ECE497 Lab02 Installing The Angstrom Distribution Old
Use EBC Exercise 00 Installing Angstrom on SD instead.
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.
Instructions for building Ångström are given here; however I'm going to present a Beagle-tuned version of those instructions on this page.
Contents
- 1 Step 1 - get Open Embedded metadata
- 2 Step 2 - Installing bitbake and friends
- 3 Step 3 - Setting up for the BeagleBoard
- 4 Step 4 - Start building
- 5 Step 5 - Building a complete image
- 6 Step 6 - Loading your SD card
- 7 Step 7 - Building a complete Beagle demo image (Optional)
- 8 Step 7.5 Building a complete unstable Beagle demo image
Step 1 - get Open Embedded metadata
First install git
by running the following on your host computer.
$ sudo apt-get install git-core
Here is a nice git tutorial. Take a look at it if you want to understand the commands that follow.
Then run the following to load the meta data.
$ export OETREE="${HOME}/oe" $ mkdir -p ${OETREE} && cd ${OETREE} $ git clone git://git.openembedded.org/openembedded.git openembedded $ cd openembedded $ git checkout origin/stable/2009 -b stable/2009
If git://git.openembedded.org/openembedded.git
does not work, you can also try:
The first git transfers some 336,000 object and takes about 18 minutes with the network running at 600 some KiB/s. Keep an eye on it, mine stopped about 23% in and I had to restart it. The second git takes almost no time.
Now run the following to update the metadata:
$ cd ${OETREE}/openembedded $ git pull
You've created a directory called oe
. Go explore around it to see what is there. Be sure to look in oe/openembedded/recipes
. These folders contain instructions on where to get and how to build various things. Look in recipes/linux
. Here are instructions for building various Linux kernels. We'll be using linux-omap-2.6.*
. What's the highest version you can find?
Step 2 - Installing bitbake and friends
bitbake is the workhorse that knows where to get everything and how to compile it. The following will install bitbake and additional programs that bitbake needs. This may take 5 minutes.
$ sudo apt-get install bitbake $ sudo apt-get install g++ $ sudo apt-get install help2man diffstat texi2html cvs texinfo subversion gawk $ sudo apt-get autoremove
If you are running Ubuntu you will have to also do the following:
$ cd /bin $ sudo mv sh sh.old $ sudo ln -s bash sh $ sudo sh -c "echo 0 > /proc/sys/vm/mmap_min_addr"
Finally edit the file /etc/sysctl.conf
using:
$ sudo gedit /etc/sysctl.conf
Add the following at the end and save.
# This is for bitbake vm.mmap_min_addr = 0
Now you should be ready to run bitbake.
The Psyco Python JIT compiler should help speed up compilation times at the expense of memory use . It only works on 32-bit systems. To install, use
$ sudo apt-get install python-psyco
Step 3 - Setting up for the BeagleBoard
Now let's setup local.conf
for our needs:
$ mkdir -p ${OETREE}/build/conf $ cp ${OETREE}/openembedded/contrib/angstrom/local.conf ${OETREE}/build/conf/
Open ${OETREE}/build/conf/local.conf
in your favourite editor and add the following to the end of the file.
MACHINE ?= "beagleboard"
Find the line near the top that says INHERIT += " rm_work "
and comment it out. This will save the source code.
# INHERIT += " rm_work "
Also, look at this block of lines:
# Make use of SMP and fast disks PARALLEL_MAKE = "-j4" BB_NUMBER_THREADS = "4"
Here you can tell it how many parallel threads to run. If you have several cores on your machine, make this number big. If you have only one core, you might be better performance setting it to 1. If you have no clue which value to pick, Gentoo users suggest 1 more than the number of cores in your computer. For Rose laptops, this is 3. More details are here.
- PARALLEL_MAKE sets the number "gcc" threads (same as make -j4 at compile time
- BB_NUMBER_THREADS sets the number of bitbake threads, (one thread can be downloading, while another compiles)
To save you a lot of time, it is useful to disable locale generation for all but the one you need. Add this to local.conf
GLIBC_GENERATE_LOCALES = "en_US.UTF-8 en_GB.UTF-8 de_DE.UTF-8 fr_FR.UTF-8 pt_BR.UTF-8 es_ES.UTF-8 kn_IN.UTF-8 ml_IN.UTF-8 ta_IN.UTF-8"
Step 4 - Start building
We need to create a small script to setup the environment
$ cd ${OETREE} $ wget -c http://www.angstrom-distribution.org/files/source-me.txt
- Take a second to read the script, and notice that it configures a download directory, a build directory, and a staging directory. Can you explain why ${PATH} is modified in this script?
Now we are almost ready for compiling
#Go to the OpenEmbedded folder $ cd ${OETREE}/openembedded #Make sure it's up to date $ git pull --rebase #Set environment variables $ cd ${OETREE} $ source source-me.txt #Start building $ bitbake nano
This will take a while. bitbake is installing everything that is needed to compile the system. This includes cross compilers, assemblers, source, everything. I started at 10am and ended around 5:30pm. It was running on just one of the two cores on my laptop. How long did it take on your machine? I notice that an additional 600M of disk space is being used.
![]() |
Give to the community: Keep track of you running times and configurations. We'll use this data to see what the best settings are. |
Processor | Settings | Run Time |
---|---|---|
Dell E521 with AMD Athlon 64 dual-core | PARALLEL_MAKE = "-j4" BB_NUMBER_THREADS = "4" Psyco? Yes. |
1.5 hours |
Intel Core 2 Duo T7800, 2.60 GHz | PARALLEL_MAKE = "-j1" BB_NUMBER_THREADS = "1" Psyco? No. |
1:46 |
Intel Core 2 Duo T7800, 2.60 GHz | PARALLEL_MAKE = "-j4" BB_NUMBER_THREADS = "3" Psyco? Yes. Ubuntu 10.04 Running in VMWare Workstation 7.1.3 Under Windows 7 32-bit |
1:42 |
Processor | Settings | Run Time |
---|---|---|
Intel Pentium-M@2.0Ghz | PARALLEL_MAKE = "-j1" BB_NUMBER_THREADS = "1" Psyco? Yes. |
4.9 hours |
Intel Atom N330@1.6Ghz | PARALLEL_MAKE = "-j4" BB_NUMBER_THREADS = "4" Psyco? No. |
3.15 hours |
Intel Core2Quad Q9300@2.5Ghz | PARALLEL_MAKE = "-j5" BB_NUMBER_THREADS = "4" Psyco? No. |
44 minutes |
Intel Core2Quad Q9300@2.5Ghz | PARALLEL_MAKE = "-j8" BB_NUMBER_THREADS = "8" Psyco? No. |
17 minutes |
T2600@2.16 GHz | PARALLEL_MAKE = "-j4" BB_NUMBER_THREADS = "2" Psyco? Yes. All Locals |
2.5 hours |
T2600@2.16 GHz | PARALLEL_MAKE = "-j4" BB_NUMBER_THREADS = "4" Psyco? Yes. US Only |
73 minutes |
E8400@3.00 GHz | PARALLEL_MAKE = "-j4" BB_NUMBER_THREADS = "4" Psyco? No. |
All Locals 1.4 hours US only 43 Minutes |
E5410@2.33 GHz (×2) | PARALLEL_MAKE = "-j4" BB_NUMBER_THREADS = "4" Psyco? No. |
56.08 minutes |
E5410@2.33 GHz (×2) | PARALLEL_MAKE = "-j8" BB_NUMBER_THREADS = "8" Psyco? No. |
57.83 minutes |
E5410@2.33 GHz (×2) | PARALLEL_MAKE = "-j4" BB_NUMBER_THREADS = "8" Psyco? No. |
53.86 minutes |
E5410@2.33 GHz (×2) | PARALLEL_MAKE = "-j7" BB_NUMBER_THREADS = "7" Psyco? No. |
61.75 minutes |
Core 2 Duo T7600@2.33GHz |
PARALLEL_MAKE = "-j1" BB_NUMBER_THREADS = "1" Psyco? No (64-bit). |
2:10:04 |
Step 5 - Building a complete image
Up to this point all we have done is load all the infrastructure needed and compiled the simple nano text editor. We don't even have the kernel yet. Do the following to build a basic console image.
$ bitbake console-image
This bitbake took 7 hours and 15 minutes. There are now some 7,700 directories with 67,000 files in the oe
directory. An additional 1.5G of disk space is in use.
How did I know to use console-image? I ran the following to find what images were out there:
$ locate image | grep /oe/
This found every file with image in the name it that also had /oe/ in the path. From this I see that oe/openembedded/recipes/images has a bunch of files ending in -image. Take a look at console-image.bb and see what you can figure out.
It is possible that even if you are using the most up to date bitbake recipes, they will still have references to sources that have since disappeared or moved. In this case, it will be necessary to go and manually find other copies of the files you need. The most likely errors you will see due to this are hash check errors and untar errors. If your build fails with a message like this:
NOTE: The MD5Sums did not match. Wanted: 'a377c0c67ab43fd96eeec29ce19e8382' and Got: '01c3b779c06e532aac84347634e7faed'
Or like this:
gzip: stdin: unexpected end of file tar: Unexpected EOF in archive tar: Unexpected EOF in archive tar: Error is not recoverable: exiting now
It is likely that the source files bitbake tried to download have been removed. In this case, you need to find an alternate location for the file you need, and download it to the OE/Downloads directory, then run bitbake again. Recipes that I have had issues with, along with alternate locations for the files, are below:
-
Recipe: $OE_HOME/openembedded/recipes/perl/perl-native_5.8.8.bb
File Needed: perl-5.8.8.tar.gz
Alternate Location: http://www.cpan.org/src/5.0/perl-5.8.8.tar.gz -
Recipe: $OE_HOME/openembedded/recipes/gnome/gconf-dbus_svn.bb
File Needed: trunk_developer.imendio.com_.svn.gconf-dbus_641_.tar.gz
Alternate Location: http://0xlab.org/~tick/s3c/sources/GPL/trunk_developer.imendio.com_.svn.gconf-dbus_641_.tar.gz
Step 6 - Loading your SD card
The output of the bitbake command will ultimately be found under the $OE_HOME/angstrom-dev/deploy/glibc/images/beagleboard
. In there you can find at least two interesting files:
console-image-beagleboard.tar.bz2 uImage-beagleboard.bin
The console image represents a full and self-contained file system, *including* a kernel. The uImage-beagleboard.bin is a Linux kernel image suitable for loading by the U-boot bootloader.
- Rename uImage-beagleboard.bin as uImage and load on your SD as before (ECE497 Installing Angstrom on Your Beagle (precompiled)).
- Also load console-image-beagleboard.tar.bz2 on the 2nd partition like you did before. Did you notice it untar's very quickly? Why?
- Boot and explore. What's there? What's missing?
Congratulations you've just build Linux from source. Try this:
beagleboard login: root root@beagleboard:~# cd /sys/class root@beagleboard:/sys/class# ls -F bdi/ hwmon/ misc/ scsi_generic/ usb_device/ block/ i2c-adapter/ mmc_host/ scsi_host/ usb_endpoint/ bluetooth/ i2c-dev/ mtd/ sound/ usb_host/ bmi/ ieee80211/ net/ spi_master/ usbmon/ display/ input/ regulator/ spidev/ vc/ firmware/ leds/ rtc/ thermal/ vtconsole/ gpio/ mdio_bus/ scsi_device/ tty/ graphics/ mem/ scsi_disk/ ubi/
This is a list of low-level devices on the Beagle that you can access as files. Try:
root@beagleboard:/sys/class# cd leds/ root@beagleboard:/sys/class/leds# ls -F beagleboard::usr0@ beagleboard::usr1@ root@beagleboard:/sys/class/leds# cd beagleboard\:\:usr0 root@beagleboard:/sys/devices/platform/leds-gpio/leds/beagleboard::usr0# cat trigger none nand-disk mmc0 mmc1 [heartbeat]
This is a list of values you can assign to trigger. Notice LED0 is blinking on and off right now. Try:
root@beagleboard:/sys/devices/platform/leds-gpio/leds/beagleboard::usr0# echo none > trigger root@beagleboard:/sys/devices/platform/leds-gpio/leds/beagleboard::usr0# echo 1 > brightness
What happens? Play around. Here are instructions on reading the USER switch. Try it. Can you make the LEDs blink in response to the button being pressed?
Step 7 - Building a complete Beagle demo image (Optional)
If you are really brave you can build the whole demo we were running before. Do this via bitbake, but argument do we give it? Try looking in oe/openembedded/recipes/images
, do you see a recipe that might work? Hint: It has beagle in the name. Here's what I tried.
$ time bitbake beagle????-image
Replace ???? with the recipe name you found. I added the time command so I could see how long it takes to run. My run took some 7.5 hours.
If you're having trouble with Gimp and/or gnumeric, consult ECE597 OpenEmbedded Issues and Problem_Solving.
Step 7.5 Building a complete unstable Beagle demo image
I did not have as much luck getting Ångström working in the stable OE branch, but I was able to make dev work. You should see that there are two branches available to to choose from.
$ git branch org.openembedded.dev * stable/2009
So switch to the .dev branch by saying
$ git checkout org.openembedded.dev $ git pull # may not be needed
The OE dev branch does not ship with its own version of bitbake, so you will need to obtain bitbake from another source. Compiling from the OE dev branch seems to require an up-to-date version of bitbake. Install this by running
$ cd ${OETREE} $ wget http://download.berlios.de/bitbake/bitbake-1.8.18.tar.gz $ tar -xvf bitbake-1.8.18.tar.gz
This will download and unpack version 1.8.18 of bitbake. Currently, this version seems to work well with the OE dev branch. You must now edit the path that points to bitbake in the source-me.txt file so that it will point to the directory containing this version of bitbake. You should change the line containing
PATH=${OETREE}/openembedded/bitbake/bin:${ORG_PATH}
to the following:
PATH=${OETREE}/bitbake-1.8.18/bin:${ORG_PATH}
NOTE: If you have modified the GLIBC_GENERATE_LOCALES
setting in ${OETREE}/build/conf/local.conf
to contain only en_US.UTF-8
, your build may fail due to missing required locales. You should have this set to GLIBC_GENERATE_LOCALES = "en_US.UTF-8 en_GB.UTF-8 de_DE.UTF-8 fr_FR.UTF-8 pt_BR.UTF-8 es_ES.UTF-8 kn_IN.UTF-8 ml_IN.UTF-8 ta_IN.UTF-8"
for the build to be successful. If you local.conf file does not have a line containing GLIBC_GENERATE_LOCALES
, your build still should be successful as it will, by default, include all available locales, including those mentioned above. Can you figure out where this list of locals came from?
We must now wipe out our stable build directory, as the two branches are not compatible. (Feel free to make a backup if you feel inclined).
$ rm -rf ${OETREE}/angstrom-dev/
Now you may follow the directions above by running
$ time bitbake beagle????-image
This will take a VERY long time, as it must recompile everything that was done previously. On my E8400 it took 10.4 hours to run with all locales, and 9.3 hours with only the ones I needed. It also used 17gb of space.
Once it has finished take a look in
$ ls ${OETREE}/angstrom-dev/deploy/glibc/images/beagleboard
You should recognize the files from when you previously installed Angstrom, if not re-read ECE597_Getting_your_Beagle_running_(precompiled)
The first boot of my beagle took a very long time...a few minutes (subsequent boots are faster), the beagle will hang on the below screen for a while, just let it go and it will continue.
INIT: version 2.86 booting Error. Cannot create canvas. Abort.
I also saw a lot of these errors, again you can probably ignore them. (if you can figure out how to fix, post fix here)
Cannot find fifo at /mnt/.splash/exquisite.
To fix it just do:
opkg remove exquisite
It will some speed up boot (it will not hung for a few min after INIT: version 2.86 booting).