BeagleBoardAndOpenEmbeddedGit

This guide briefly describes the steps that need to be taken in order to create an OpenEmbedded (OE) based image for the BeagleBoard. It was created while performing an install on ubuntu804jeos (a minimal console only vmware appliance). This guide differs in that the official GettingStarted uses monotone while we will be using git. The second difference is that this guide only focuses on running on Ubuntu and developing for beagle.

The first step is to get a working Open Embedded installation. This can seam a daunting task at first but the rewards are great so here we go. This guide tries to be self containing. We therefore will not push you to use Google or read the other manuals.

Prerequisites
OE tries to be as self supporting as possible. OE will both compile the cross compiler and the tools needed to compile a whole system. Still some dependencies are to be met using the "host" system. During the install we will be able to run almost all the commands as normal user but right now we will install the basic set of packages that are required to make OE to be happy.

Host tools to install: sudo apt-get install ccache sed wget cvs subversion git-core coreutils unzip texi2html texinfo libsdl1.2-dev docbook-utils gawk help2man diffstat gtk-doc-tools file

OE and many tools and scripts that are used contain bashisms. We therefore want to change the default "/bin/sh" to point to bash. ln -s /bin/sh sudo dpkg-reconfigure dash ln -s /bin/sh
 * 1) and select no

An other change need need to perform as root is to change some default settings of the kernel. sudo vi /etc/sysctl.conf vm.vdso_enabled = 0 vm.mmap_min_addr = 0

Run sudo sysctl -p

The effective install
We are going install the OpenEmbedded system under the user's home directory in a directory called "oe". We will need about 10 gig of free disk space. Under that we will be putting the different components of the OE system. Those components are Bitbake, the OpenEmbedded meta-data and the beagle configuration. The Bitbake task executor will be put under "opt". The OpenEmbedded meta-data ( Bitbake recipes ), classes ( Bitbake extentions) and configuration (machine and arch setup) will be located under the "org.openembedded.dev" directory. The BeagleBoard configuration will be placed under "org.beagleboard.dev" directory.

OpenEmbedded and Bitbake install
This part really is not that difficult after all.

Set the dir where everything will be done export OE_HOME=$HOME/oe

Install Bitbake mkdir -p $OE_HOME/opt cd $OE_HOME/opt svn co svn://svn.berlios.de/bitbake/branches/bitbake-1.8/ bitbake

Install the OpenEmbedded meta-data using git cd $OE_HOME git clone git://git.openembedded.net/org.openembedded.dev/

Creating the BeagleBoard configuration and profile
We now need to tweak OpenEmbedded to fit our Beagle needs. We create a profile script that we can run whenever we feel like playing with beagle. This script will perform a few tasks. It will add bitbake to our PATH so we can run the bitbake command from anywhere. It will then export the BBPATH and BBFILES. This tells bitbake where to find it's meta-data. BBPATH will booth point to our own org.beagleboard.dev files and org.openembedded.dev.

But first we create a local.conf containing the most important choices we need to make. Change at least the MACHINE to beagleboard. Comment the BBFILES variable as we will defines then in our profile script do select angstrom-2008.1 as distro. Remove the last line after that

mkdir -p $OE_HOME/org.beagleboard.dev/beagleboard/conf cat > $OE_HOME/org.beagleboard.dev/beagleboard/conf/local.conf <<_EOF DISTRO = "angstrom-2008.1" BBFILES = "$OE_HOME/org.openembedded.dev/packages/*/*.bb" MACHINE = "beagleboard" ENABLE_BINARY_LOCALE_GENERATION = "0" _EOF

Now we create our profile

cd $OE_HOME cat > $OE_HOME/org.beagleboard.dev/beagleboard/profile.sh <<_EOF export OE_HOME=\$HOME/beagle/oe export MY_OE_CONF="beagleboard" export BPATH=\$OE_HOME/org.beagleboard.dev/:\$OE_HOME/org.beagleboard.dev/\$MY_OE_CONF:\$OE_HOME/org.openembedded.dev export BBFILES="\$OE_HOME/org.openembedded.dev/packages/*/*.bb" export PATH=\$OE_HOME/opt/bitbake/bin:\$PATH if [ "\$PS1" ]; then if [ "\$BASH" ]; then export PS1="\[\033[01;32m\]OE:\$MY_OE_CONF\[\033[00m\] \${PS1}" fi fi _EOF chmod +x org.beagleboard.dev/beagleboard/profile.sh

Running
We now have finished the installation. If everything goes well we can now create images for the BeagleBoard

source org.beagleboard.dev/beagleboard/profile.sh bitbake  console-image

If this goes well your computer will be compiling for a long time. If you receive an error of the form "ERROR: Unable to open conf/bitbake.conf" check that your profile.sh created earlier has the correct BBPATH setting (copy/pasting from this page may cause a line-break between the export command and the BBPATH var).

Preparing the system for booting
The output of the bitbake command will ultimately be found under the $OE_HOME/system/angstrom/deploy/glibc/images/beagleboard/. In there you can find at least 3 interesting files, console-image-beagleboard.tar console-image-beagleboard.jffs2 and uImage-beagleboard.bin. The console images are representations of a full and self containing file system *including* a kernel. The uImage is a linux kernel image that is suitable to be loaded by the U-boot bootloader. The difference between the tar file and the jffs2 image is that the later is better suited to directly put on a raw partition. We are going to use the U-boot that is already provided in the nand flash of the beagleboard as that one already support the MMC can load kernel images from a fat file system. What we will do is to format a SD-card to hold an booth a fat and a ext2 file system. We will put the kernel in the fat file system as U-boot failed to load the image from a ext2 file system.. We will unpack the console-image under the ext2 file system.

Create partitions and format the SD-card
We usually create two partitions, the first one has a FAT partition type and the second one a Linux file system type. We then format them and put content on them. We are not going the describe the formating other then briefly because it just if to easy to format the wrong partition. There are a few reasons for having a first partition as FAT but his is not the scope of this document ( Think of U-boot, windows, mass-storage ). Instruction for formatting the SD-card correctly can be found at: Boot Disk Format

Here is the output of the fdisk -l command after creating the new partitions. Disk /dev/mmcblk0: 2032 MB, 2032664576 bytes 1 heads, 16 sectors/track, 248128 cylinders Units = cylinders of 16 * 512 = 8192 bytes Disk identifier: 0x2f3dffc4

Device Boot     Start         End      Blocks   Id  System /dev/mmcblk0p1              2       12209       97664    b  W95 FAT32 /dev/mmcblk0p2          12210      248128     1887352   83  Linux

We now format the file systems ext2 file system under /mnt. Some system will perform a automount of the newly created file system. Try to disable this automount feature if possible (it is not easy) or use gparted mkfs.vfat /dev/mmcblk0p1 mkfs.ext2 /dev/mmcblk0p2

Mount the ext2 file system and unpack the archive. Do not forget the -C option. mount /dev/mmcblk0p2 /mnt tar xvf system/angstrom/deploy/glibc/images/beagleboard/console-image-beagleboard.tar -C /mnt umount /mnt

Mount the fat file system and copy the kernel image to there. mount /dev/mmcblk0p1 /mnt cp system/angstrom/deploy/glibc/images/beagleboard/uImage-beagleboard.bin /mnt/uImage umount /mnt

Booting
We can put the SD-card in the beagleboard and wait for the U-boot prompt. The kernel we compiled only gave serial output if we first ran the coninfo command we therefore type coninfo and ask U-Boot to initialise the mmc stack. After that we set the kernel command line telling what the console is and where our root file system is located. We then load the image from the fat file system into memory and boot the kernel

coninfo mmcinit set bootargs console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1 fatload mmc 0:1 0x80000000 uImage bootm