EBC Exercise 08a Cross-Compiling
This class is about developing software for embedded Linux. The eLinux site is a good source for embedded Linux in general. There are many ongoing embedded efforts going on many platforms. Poke around the site a while to get a feel for what's happening.
We are going to use the Ångström Distribution. It's available many platforms. Look around the site, you may recognize some of them.
Finding the Kernel to copy it
Once your compile has finished, where is uImage? One way to find it is
$ cd ~/BeagleBoard/oe $ find . -name "*uImage*"
You'll find several files with uImage in the name. The one you want is
$ cd ~/BeagleBoard/oe/build/tmp-angstrom_2008 $ ls
Here you'll see several directories here. If you
cd work you will find the source code. We are going to go this way.
$ cd deploy/glibc
Here you will find some more directories worth exploring. What do you find in
$ cd images/beagleboard
Now you have found uImage. Load away.
Compile via make
When you use bitbake it sets up all the paths to use the correct cross compilers. You can also build the kernel or u-boot by using make if you set the paths yourself. Here's what you need to do. Put the following in a file, call it ~/BeagleBoard/oe/crossCompileEnv.sh. Make sure the path is correct for your system.
PATH=~/BeagleBoard/oe/build/tmp-angstrom_2008_1/sysroots/i686-linux/usr/armv7a/bin:$PATH # add cross tools to your path export ARCH=arm export CROSS_COMPILE=arm-angstrom-linux-gnueabi-
Note from Brian: On my machine I had to add ~/BeagleBoard/oe/build/tmp-angstrom_2008_1/sysroots/x86_64-linux/usr/armv7a/bin to $PATH
Then source the file and cd to the kernel directory and try a make.
$ source ~/BeagleBoard/oe/crossCompileEnv.sh $ cd ~/BeagleBoard/oe/build/tmp-angstrom_2008_1/work/beagleboard-angstrom-linux-gnueabi/linux-omap-psp-2.6.32-r88+gitra6bad4464f985fdd3bed72e1b82dcbfc004d7869/git $ make xconfig
To make the kernel and u-boot run
$ make uImage $ make u-boot
Where do these put the new uImage? It's not where bitbake puts them. Here's how I found them.
$ find . -name uImage
If you would prefer to maintain your own kernel source tree outside of OE, see these directions: BeagleBoardLinuxKernel Alternatively it is possible to run the official omap branch of the linux kernel. Take a peek at this page: BeagleBoard#Linux_kernel.
Here's what I did to create the files above
You don't have to do the following. This is what I have already done.
Instructions for building Ångström are given here; however there are a few changes you have to make. Here's what I did.
Get the setup scripts
I have everything in a
~/BeagleBoard, so here is how I setup things:
$ cd $ mkdir -p BeagleBoard $ cd BeagleBoard $ git clone git://git.angstrom-distribution.org/setup-scripts oe $ cd oe
This creates a directory for open embedded (
oe) and gets the script to download Ångström. What files do you see?
oebb.sh and replace every place you find
INHERIT += "rm_work"
# INHERIT += "rm_work"
Save the file and then run
MACHINE=beagleboard ./oebb.sh update
This will bring in all the tools you need. It took about 30 minutes on my machine in the afternoon or 3 minutes at 6:15am.
Point to the git snapshot that was used to create the image
Line 564 shows an additional git repository was used.
$ cd sources/openembedded $ git remote add myrepo git://gitorious.org/~Jadon/angstrom/jadon-openembedded.git $ git remote update
Run this git command to get access to this repository. (It took about 2 minutes at 6:20am.) Line 21 shows the hash tag for the build.
If we pull from this tag we will have the same files as were used to generate the SD image. So do the following
$ git checkout 24805033b1205acc35f8b4d75cc42f8b9c2a1b38
This takes about 10 seconds.
Compile the Kernel
Now if you do
$ source ~/.oe/environment-2008 $ cd ~/BeagleBoard/oe $ ./oebb.sh config beagleboard $ bitbake linux-omap-psp-2.6.32
you should get a kernel that will work.
To ensure you keep the kernel source, check your .../oe/build/conf/local.conf and comment out the line that says
INHERIT += "rm_work"
If you accidentally run bitbake without commenting out the above line, after it runs you can comment out the INHERIT line and then run
$ bitbake -c clean linux-omap-psp-2.6.32 $ bitbake -f -c compile linux-omap-psp-2.6.32
This second run should take less time (one timing: first run took 3.5 hours; the recompiling took 25 minutes).