OE and many tools and scripts that are used contain bashisms. We therefore want to change the default "/bin/sh" to point to bash.

OE and many tools and scripts that are used contain bashisms. We therefore want to change the default "/bin/sh" to point to bash.

Revision as of 05:23, 20 April 2009

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 from the official guide in that we focus on the BeagleBoard as target and Ubuntu as host platform.

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.

So the minimum free disk space is about 15 GB (no desktop images), standard would be 35 GB and a safe size is 45 GB.

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.

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 "openembedded" directory. The BeagleBoard configuration will be placed under "beagleboard" directory.

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 both point to our own beagleboard files and openembedded.

But first we create a local.conf containing the most important choices we need to make. Change at least the MACHINE to beagleboard. Select angstrom-2008.1 as distro.

NOTE: In the recented version BitBake, it will remove all of the environment variables, unless they are trustly declared in BitBake whitelist(BB_ENV_EXTRAWHITE), therefore, you should list the env vars you need in the BitBake whitelist and export it. This is already done when creating the profile bellow using the BB_ENV_EXTRAWHITE environment variable.

CHOICE 1) If you are going to operate directly connected to the internet (i.e. NO Proxy Firewall), then do:

Running

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

source $OE_HOME/beagleboard/beagleboard/profile.sh

Pull down any changes in the git tree.

cd $OE_HOME/openembedded
git pull
git checkout

Now build the console image.

cd $OE_HOME
bitbake console-image

If this goes well your computer will be compiling for a long time. A long time can be several hours. Once this works try using the x11-image target (bitbake x11-image) this will give you a more complete distribution

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/tmp/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 both a fat and an 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.

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.

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

One very important note:

It's important to have an X-Loader on your Beagleboard that uses the uBoot on the SD Card that goes with the Angstrom uImage. The B5 Beagleboards do not appear to come with such an X-Loader / U-Boot combination (i.e. the B5 standard uBoot will lead to problems with the sound driver and other things, but will not tell you that it's creating a problem).

The fix is to load a new X-Loader which will in turn automatically load the uBoot from the SD card, which again in turn will load the uImage properly.

This will update the X-Loader to a newer version that will automatically load uBoot from the SD card, and then load uImage from the SD card, rather than always using the uBoot in the Beagleboard NAND.

Setting the video resolution:

The Angstrom kernels since 2.6.27 have used "DSS2", which is a candidate for replacing the OMAP framebuffer driver in the mainline Linux kernel. It provides greater flexibility for support of the S-Video port on the BeagleBoard and more monitor resolutions than previous mainline kernels. Documentation for the driver is in the kernel source at [Documentation/arm/OMAP/DSS http://groups.google.com/group/beagleboard/msg/4c64b2c614622053].

Using the OpenEmbedded Environment

If you have not used bitbake / OpenEmbedded before, a helpful example for creating packages that can be installed on a beagle linux install (such as the one created above) can be found at Hello World Tutorial for Gumstix.

See also Open Embedded User's Manual (these links point to nightly builds of the documentation and so should always be up to date):