4. Support Engineering Group : McStar BeagleBoard Prep This page last changed on Apr 13, 2010 by tm. #### BeagleBoard and USB Harddisk Preparation Instructions ###### ##### Summary 1. Prepare Host 2. Create Bootable SD Card 3. Using Bootable SD card, update the BeagleBoard NAND flash ###### Prepare the Host Recommended: use VMWare Player v3.01 to host Ubuntu Linux. (30G, one big file for easy backup) Install Ubuntu 9.04 (Jaunty Jackal) sudo apt-get install gparted libasound2 uboot-mkimage Make sure libasound2 is installed on the host Install Eclipse for c/c++ (Galileo) Copy McStar files to the Ubuntu desktop ###### Create Bootable SD Card Format SD into 128 MB FAT 32 partition and the remainder as EXT3 using "sudo gparted" Remove and re-insert SD card sudo chown $USER /media/disk sudo chown $USER /media/disk-1
   | Important Note Copy the files below in exactly the order given, no exceptions Install first boot loader, U-Boot, kernel image and U-Boot scripts
11. Copy MLO from ~/Common to FAT32 partition Copy u-boot.bin from either ~/C3 or ~/C4 to the FAT32 partition Copy uImage.bin from ~/Common to the FAT32 partition Copy xload-bin-ift from ~/Common to the FAT32 partition Copy boot.scr from ~/Common to the FAT32 partition Unmount the FAT32 partition cd to the EXT3 partition
    | SD Card Copy the root file system to the SD card
14. 12 (13). Copy ~/common/mcstar-rootfs*.tar.bz2 to /home/root on the EXT3 partition 13 (12). Enter "sudo tar xvjf mcstar-rootfs*.tar.bz2" Unmount EXT3 partition
    | SD Boot Force a boot the Beagleboard from the SD card
21. Power off the Beagleboard, attach serial port cable Start hyperterm or picocom on host "picocom -b 115200 /dev/ttyS0 or /dev/ttyUSB0" Insert Card into Beagleboard and connect power to Beagleboard Stop autoboot by pressing return within 10 seconds Press and hold user button on Beagleboard Press and release the reset button while pressing the user button Stop autoboot by pressing return within 10 seconds
    | Install Root Filesys Install the root file system as a JFFS2 partition on the NAND Flash
29. At the Linux prompt, type "root" with no password Enter "halt" Power off the Beagbleboard when there is no response to "enter" Attach the USB to Ethernet dongle to the EHCI port, connect to network Stop autoboot by pressing return within 10 seconds Press and hold user button on Beagleboard Press and release the reset button while pressing the user button AT the Linux prompt, type "root" with no password
    | JFFS2 Setup Get the necessary libraries and utilities for JFFS2
37. opkg update opkg upgrade opkg install mtd-utils bzip2 # Make sure mtd-utils works# cat /proc/mtd # You should see the following: # dev: size erasesize name # mtd0: 00080000 00020000 "X-Loader" # mtd1: 001e0000 00020000 "U-Boot" # mtd2: 00020000 00020000 "U-Boot Env" # mtd3: 00400000 00020000 "Kernel" # mtd4: 0f980000 00020000 "File System" # Erase and remove bad block from the mtd partition (root file system) Enter "flash_eraseall -j /dev/mtd4" # Mount the mtd partition and format it as JFFS2# Enter "cd /mnt" Enter "mkdir nand" Enter "mount -t jffs2 /dev/mtdblock4 /mnt/nand"
    | Extract root filesys Extract the root file system from the SD card into the JFFS2 partition
38. Enter "cd nand"
    | Extracting tar Extracting the root file system takes about 5 minutes
42. Enter "tar xvjf /home/root/mcstar-rootfs*.tar.bz2" Enter "cd .." Enter "sync" Enter "umount nand"
    | Reboot board
60. Enter "shutdown now" and wait at least 45 seconds Remove the SD card Apply power to the beagleboard Enter "root" at the Linux prompt # Install sound libraries and utilities need to build the McStar application on the root file system opkg update opkg upgrade opkg install task-native-sdk cpp gccmakedep gdb opkg install nano opkg install lrzsz opkg install task-base-alsa task-base-alsa-dev opkg install alsa-conf alsa-conf-base alsa-dev alsa-lib-dev opkg install alsa-utils alsa-utils-aplay set the date for the software clock date -s "<Today's Date> <Today's Time>" # Set the RTC, only if a battery has been installed on the Beagleboard# set the battery backed RTC, "hwclock -w" # Build the McStar Natively# Enter "shutdown now". Power off Beagleboard Remove Ethernet Dongle from the Beagleboard
    | Copy McStar app from host to harddrive
Attach a freshly EXT3 formatted USB drive to the host Enter "cp -R ~/McStar/app /media/sda1/." Unmount USB drive Remove the USB host from the host and connect it to the Beagleboard Power up the Beagleboard Enter "root" at the Linux prompt Enter "cd /media/sda1/app/src" Enter "touch Makefile *.h *.cpp" Enter "make clean" Enter "make" # Test the McStar App for 10 minutes, writing a new file every minute Enter "mkdir /media/sda1/data" Enter "cd /media/sda1/app/scripts" Enter "./test_mcstar.sh" ### Notes on Beagel Board and SD Card Copy # Copy Linux filesystem on bootable SD card This tutorial is part of our Tutorials section. It shows how to flash an image onto an SD/SDHC card. This guide assumes that the card is correctly partitioned, as described in the Create a bootable SD/SDHC card in Ubuntu tutorial. #### Steps in this tutorial Mount the SD/SDHC card (if not already mounted) Write bootloader if necessary Write Linux kernel image Write Linux root file system Unmount # Quick Solution: Copy an already existing card If you have already one working SD image and an (absolutely similar) formatted second card, you can just copy them. WARNING Please be aware that the filesystem names (/dev/sdb1, etc.) can differ from system to system, make sure to select the right one. Copy one SD card to another: sudo dd if=/dev/sdb of=/dev/sdcThe safer alternative: Copy the SD card to harddisk and then onto another sudo dd if=/dev/sdb of=/sd-card-copy.binNow back on the second SD card: sudo dd if=/sd-card-copy.bin of=/dev/sdb # Mount SD/SDHC card Check where linux mounted the card. One way is to check this via mount . Call mount to see where the card has been mounted. Two partitions should have been mounted, one named '/media/BOOT' and the other one '/media/LINUX'. Note the device name, e.g. '/dev/sdb'. mountIf the card has not been mounted, you have two choices: ### Automatic Just unplug and re-plug the cardreader. It will be detected and mounted automatically. ### Manually If the check with mount didn't work out, use dmesg: dmesg | tailWatch out for a line like this: sdc Attached SCSI removable diskWhere sdc could also be sdc or sdd. If it was sdb, the device name of the memory card is /dev/sdc. sudo mkdir -p /media/BOOT sudo mount /dev/sdc1 /media/BOOT sudo mkdir -p /media/LINUX sudo mount /dev/sdc2 /media/LINUX # Copy files on the BOOT partition (MLO, u-boot.bin and uImage) Please note that the bootloader files don't have to be rewritten every time. This applies especially when a new custom Linux system is created with BitBake and OpenEmbedded_. However if you work close to the hardware, e.g. on drivers, this is different._ #### Overo Download MLO and uBoot from this link (commands for shell below): PIXHAWK OpenEmbedded Images Download (OpenCV and libdc1394 ready) IMPORTANT: Copy MLO FIRST!. The commands below download the two files and copy them in the right order on the boot partition. You may have to adjust the filenames for future revisions. cd $HOME wget http://pixhawk.ethz.ch/wiki/_media/symlink/images/overo/mlo-overo wget http://pixhawk.ethz.ch/wiki/_media/symlink/images/overo/u-boot.bin-overoAnd now copy the two files onto the boot partition (MLO first because of a bug in the X-loader which causes problems if MLO is not the first file written onto the boot partition). cp MLO-overo* /media/BOOT/MLO cp u-boot.bin-overo* /media/BOOT/u-boot.bin The Linux kernel (uImage) resides also on the BOOT partition of the SD-card. If you compile a new version of the kernel you have to copy the new uImage on the BOOT partition. See the instructions below. #### BeagleBoard Download MLO and uBoot from this link (commands for shell below): http://www.angstrom-distribution.org/demo/beagleboard/ Only for PIXHAWK Team (will be made public in october) IMPORTANT: Copy MLO FIRST!. The commands below download the two files and copy them in the right order on the boot partition. You may have to adjust the filenames for future revisions. cd $HOME wget http://www.angstrom-distribution.org/demo/beagleboard/MLO wget http://www.angstrom-distribution.org/demo/beagleboard/u-boot.binAnd now copy the two files onto the boot partition (MLO first because of a bug in the X-loader which causes problems if MLO is not the first file written onto the boot partition). cp MLO /media/BOOT/MLO cp u-boot.bin /media/BOOT/u-boot.bin The Linux kernel (uImage) resides also on the BOOT partition of the SD-card. If you compile a new version of the kernel you have to copy the new uImage on the BOOT partition. See the instructions below. # Copy Linux The next step is to copy the Linux kernel and the Linux root filesystem on the BOOT and LINUX partitions. You can use precompiled binaries for both or compile an OpenEmbedded image yourself. Instructions for both options are provided below. ## Copy the precompiled Ångström Image The precompiled Ångström image consists (besided MLO and u-boot.bin from the bootloader section) of two files: The Linux kernel image (uImage) and the root file system. ### Copy uImage Download and copy the kernel image into the root directory of the boot partition. #### Gumstix Overo cd $HOME wget http://pixhawk.ethz.ch/wiki/_media/symlink/images/overo/uimage.bin-overo cp uimage.bin-overo* /media/BOOT/uImage #### BeagleBoard cd $HOME wget http://www.angstrom-distribution.org/demo/beagleboard/uImage cp uImage /media/BOOT/uImage ### Copy the Linux root file system The file is named rootfs.tar.bz2 for the Beagle link and omap3-desktop-image-overo-.tar.bz2 for the Overo link below. Check the main folder for the current name. Gumstix Overo: PIXHAWK OpenEmbedded Images Download (OpenCV and libdc1394 ready) BeagleBoard: http://www.angstrom-distribution.org/demo/beagleboard/ Download the files to a temporary directory, e.g. the Desktop or your user folder. The next step is to extract these files into the LINUX partition (NOT the boot partition). This can only be done by using Linux. If you're using Windows or MacOS, read this. #### Gumstix Overo If you have downloaded the console image: wget http://pixhawk.ethz.ch/wiki/_media/symlink/images/overo/pixhawk-console-image-overo.tar.bz2 sudo tar xjf pixhawk-console-image-overo-*.tar.bz2 -C /media/LINUXOr the desktop image: wget http://pixhawk.ethz.ch/wiki/_media/symlink/images/overo/pixhawk-desktop-image-overo.tar.bz2 sudo tar xjf pixhawk-desktop-image-overo-.tar.bz2 C /media/LINUXpossibly, "pixhawk-desktop-image-overo.tar.bz2" has to be changed into "pixhawk-console-image-overo.tar.bz2" (just adept file name) #### BeagleBoard sudo tar xjf *rootfs.tar.bz2 -C /media/LINUX ## Copy custom OpenEmbedded Linux Image ### Linux Kernel Image and u-boot bootloader Copy the kernel image and u-boot. #### Gumstix Overo sudo cp $OE_HOME/tmp/deploy/glibc/images/overo/uImage-overo.bin /media/BOOT/uImage cp $OE_HOME/tmp/deploy/glibc/images/overo/u-boot-overo.bin /media/BOOT/u-boot.bin #### BeagleBoard sudo cp $OE_HOME/tmp/deploy/glibc/images/beagleboard/uImage-beagleboard.bin /media/BOOT/uImage cp $OE_HOME/tmp/deploy/glibc/images/beagleboard/u-boot-beagleboard.bin /media/BOOT/u-boot.bin ### Linux root filesystem After the kernel, the root filesystem has to be copied as well. If you are overwriting an existing installation and you don't need a 100% clean system, you can just delete all files. The command below will delete all files in /media/LINUX except the lost+found directory of the EXT3 file system. sudo rm -rf /media/LINUX/* && sudo mkdir /media/LINUX/lost+foundHowever if you want a really clean disk, you should format it, but this will take considerably longer. sudo mkfs.ext3 -L LINUX /dev/sdc2And now copy the new files. #### Gumstix Overo The console image: sudo tar xjf $OE_HOME/tmp/deploy/glibc/images/overo/omap3-console-image-overo.tar.bz2 -C /media/LINUXThe pixhawk console image: sudo tar xjf $OE_HOME/tmp/deploy/glibc/images/overo/pixhawk-console-image-overo.tar.bz2 -C /media/LINUXOr the desktop image: sudo tar xjf $OE_HOME/tmp/deploy/glibc/images/overo/omap3-desktop-image-overo.tar.bz2 -C /media/LINUX #### BeagleBoard The console image: sudo tar xjf $OE_HOME/tmp/deploy/glibc/images/beagleboard/omap3-console-image-beagleboard.tar.bz2 -C /media/LINUXOr the desktop image: sudo tar xjf $OE_HOME/tmp/deploy/glibc/images/beagleboard/omap3-desktop-image-overo.beagleboard.bz2 -C /media/LINUX # Unmount the SD/SDHC card Now unmount the drive either manually (by clicking the unmount icon on the desktop) or by shell command: sync sudo umount /media/BOOT sudo umount /media/LINUX sudo rm -r /media/BOOT sudo rm -r /media/LINUX # Copy bytewise from one SDHC card to another If you have modified your installation and want to clone the content of the SD card, you can do this with dd. Make sure to plug in the source card first, then the destination card. Check the file names with: dmesg | tailAnd unmount the card (with the GUI or with umount /dev/sdb). Then use dd to copy the first gigabyte from one card to the other (including partition table, etc.): sudo dd if=/dev/sdb of=/dev/sdc bs=1073741824

Document generated by Confluence on Feb 03, 2026 16:22