Buildroot gains better support for external toolchains

Buildroot logoBuildroot is a tool that I’ve already covered in a previous blog post. To me, its main purpose is to build the root filesystem for an embedded Linux system, with all the necessary applications and libraries. It automates the tedious process of cross-compiling and integrating all the free software components in an embedded system.

In addition to root filesystem generation, Buildroot is also known for its ability to generate a uClibc-based cross-compilation toolchain. Buildroot used to be for quite some time the only way to generate a toolchain based on this size-effective C library, but it is no longer the case with Crosstool-NG supporting glibc, uClibc and eglibc.

However, I’ve personaly never been really satisfied with uClibc generation of cross-compiling toolchains:

  • It mixes the process of the cross-compilingn toolchain generation with the process of root filesystem generation, which are, in my opinion, two very different processes. Once your toolchain is generated, you generally don’t touch it, but regenerate your root filesystem dozens or hundred of times until all your components are here and properly integrated.
  • The attention paid to toolchain generation in the Buildroot project itself is relatively small, while other projects like Crosstool-NG or vendors like Codesourcery, are specifically dedicated to providing toolchains. The fact that, for example, uClibc is the only C library supported is one example of this.
  • It might necessary, for various reasons, make sense to use an already existing toolchain.

Support for the usage of external toolchains has already been present in Buildroot for a long time, but wasn’t developed enough to be easily usable. Months ago, I’ve started to improve the situation (here, here, here and here), and last week, two other patches have been integrated.

  • The first patch, visible here removes the ugly configuration option that allows to configure the set of libraries that must be copied to the target filesystem, and replaces it with a nice selection of the C libary type: uClibc or glibc. It makes it clear that generating Linux system with the glibc library is possible with Buildroot, even if Buildroot has often been advertised as a uClibc only tool.
  • The second patch, visible here adds checks for the conformity of Buildroot configuration versus the C library configuration. There are configuration options in Buildroot that must tell whether the C library supports IPv6, supports RPC, supports locale, supports large file, etc. These options must be set in the configuration interface according to the C library configuration, because some userspace packages depend on them. The added checks verify that the value set to these options match the configuration of your C library

So, now, external toolchains are a little bit easier to use with Buildroot, and your own vendor toolchain, Codesourcery toolchains or any other toolchain can be used with Buildroot. The only requirement is that the toolchain supports the sysroot feature, which is very common in most toolchains.

Building Android on Beagle

Note: these instructions are now out of date and refer to URLs which no longer exist. See the wiki for more recent instructions.

These instructions are derived from’s Android Porting Guide to Beagle Board (the corresponding web page no longer exists), based on their work to port Android on the Beagle board. They correct multiple inaccuracies in this guide, and also add many useful details.

These instructions were tested on xubuntu 9.04. There shouldn’t be many differences if you use other recent Ubuntu or Debian versions.

Install needed software packages

At the time of this writing, note that Android requires Sun’s Java5 JDK, and doesn’t support the Java6 one.

apt-get update
apt-get dist-upgrade
apt-get install git-core bison sun-java5-jdk flex g++ zlib1g-dev
apt-get install  libx11-dev libncurses5-dev gperf uboot-mkimage

Android also uses its own repo script as a git front-end:

mkdir -p ~/bin
cd ~/bin
curl > repo
chmod +x repo

We are also going to need a 2007q3 toolchain from Code Sourcery

cd /opt
sudo tar jxf arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

You could also get this toolchain from our website:

wget /pub/demos/beagleboard/android/arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.lzma
cd /opt
sudo tar --lzma -xf ~/arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.lzma

Download sources

Our instructions create a directory in your home directory, but of course, it can be placed anywhere!

 mkdir ~/beagledroid
 cd ~/beagledroid
 repo init -u git://
 repo sync

Caution: this can take a lot of time, as this downloads and extracts 2.4 GB of data. On a fast workstation with a 500KB/s Internet connection, it took about 90 minutes.

Building Android


If your workstation has multiple CPUs, you could save a lot of time by running multiple jobs in parallel:

make -j 4

On our machine, this took about 4 hours!

Building the kernel

export CC_PATH=/opt/arm-2007q3/bin/arm-none-linux-gnueabi-
cd ~/beagledroid/kernel

Copying the Android root filesystem

Android’s root file system is generated in ~/beagledroid/out/target/product/generic

cd ~/beagledroid/out/target/product/generic
mkdir ~/beagledroid/rootfs
cp -a root/* ~/beagledroid/rootfs/
cp -a system/* ~/beagledroid/rootfs/system/
cd ~/beagledroid/rootfs
sudo chown -R root.root .
sudo chmod -R a+rwX data system 

Formatting an MMC/SD card

First connect your card reader to your workstation, with the MMC/SD card inside. Type the dmesg command to see which device is used by your workstation. Let’s assume that this device is /dev/sdb

Type the mount command to check your currently mounted partitions. If MMC/SD partitions are mounted, unmount them.

In a terminal edit partitions with fdisk:

sudo fdisk /dev/sdb

Delete any existing partition with the d command.

Now, create the boot partition:

Command (m for help): n 
Command action 
   e   extended 
   p   primary partition (1-4) 
Partition number (1-4): 1 
First cylinder (1-239, default 1): 1 
Last cylinder, +cylinders or +size{K,M,G} (1-239, default 239): +64M

Change its type to FAT32:

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Using the n command again, create a second partition filling up the rest of your card (just accept default values).

Now, format the partitions in your card:

sudo mkfs.vfat -n beagleboot -F 32 /dev/sdb1
sudo mkfs.ext3 /dev/sdb2

Remove and insert your card again. Your new partitions should be mounted automatically.

Copying data to the MMC/SD card

Start by copying the X-loader and U-boot on the first partition.

cd /media/beagleboot
wget /pub/demos/beagleboard/android/MLO
cp ~/beagledroid/kernel/arch/arm/boot/uImage .

Now copy the Android root filesystem to the second partition (assuming it is mounted on /media/disk:

sudo rsync -a ~/beagledroid/rootfs/ /media/disk/

Finish by unmounting your MMC/SD partitions:

sudo umount /media/beagleboot
sudo umount /media/disk

Boot setup

The last thing left to do is to specify how the board boots Linux.

Plug the Beagle board on your computer, and also connect it to a DVI-D monitor. Start minicom (corresponding to Hyperterminal in Windows) on /dev/ttyS0, or on /dev/ttyUSB0 if you are using a serial to USB adapter. Power up the board.

First, stop Minicom from truncating long lines by typing [Ctrl] [a] followed by z and w.

In the U-boot prompt, make the board boot automatically on the MMC/SD card:

setenv bootcmd 'mmc init;fatload mmc 0 80000000 uImage;bootm 80000000'

Now set the kernel command line arguments:

setenv bootargs console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2 video=omapfb.mode=dvi:1280x720MR-24@50 init=/init rootfstype=ext3 rw rootdelay=1 nohz=off androidboot.console=ttyS2

You may need to adapt the video settings to the capabilities of your DVI display. You should now see Android boot!

Beagle board MMC boot myths?

Booting a Beagle board from an MMC/SD should be easier than what people tell you

Beagle boardAt the time of this writing, most documentation that you can find on the web about the Beagle board will tell you that you need to take special preparation steps if you wish to boot your board on an MMC/SD card:

  • The card requires a special geometry: 255 heads and 63 sectors per track
  • The first partition on the card, with a FAT type, must be marked as bootable
  • The X-loader (MLO file), must be copied to the first sectors of the first partition. As a consequence, you should copy this file first.

As my colleague Florent Peyraud and TI engineers started to suspect, all this is not always required. I’ve just made tests with my Rev C2 Beagle board:

  • I took a brand new MMC/SD card. fdisk showed that it had 57 heads and 56 sectors per track.
  • I created the partitions again, and didn’t flag the first one as bootable.
  • After formatting the first partition in FAT32 format, I first copied the u-boot.bin and uImage files, and then the MLO one.

After all this, I had no problem booting my Beagle board on the MMC/SD card. At least with my Rev C2 board, what TI engineers expected was true: the board romcode understood the FAT format, and therefore just needed a file with the MLO name, whatever its physical location on the card.

Does anyone know whether the requirements used to be true with earlier Beagle board romcode releases, or in special cases?

ELC Europe in Grenoble


Just a quick note after the announcement that has just been made at the Embedded Linux Conference (ELC) in San Francisco…

Tim Bird has just announced that the next European edition of ELC will be in Grenoble, France, on October 15-16. As the new conference home page says, it will be colocated with ESWEEK.

We are very excited about this news, as Grenoble is a not only a beautiful place, but also a very dynamic city full of universities and high-tech companies. We will do our best to incite people to attend the conference, and of course to speak about their projects and propose demos.

Free Electrons at ELC

My colleague Thomas Petazzoni and I will participate to the Embedded Linux Conference on April 6-8 in San Francisco.

This is an exciting conference with a very interesting program, and we are proud to be part of it:Golden Gate Bridge

If participate to this conference too, and if you are interested in the above topics, or in topics we covered in this blog, don’t hesitate to come and chat with us. We will both arrive on Saturday afternoon, so we could even meet before the conference starts.

If you can’t make it to this conference, we will also shoot and share videos as usual, so at least you won’t miss the technical contents. You will just miss the beer together…

Linux kernel 2.6.29 – New features for embedded users

Tuz Linux logoThe 2.6.29 version of the Linux kernel has just been released by Linus Torvalds. Like all kernel releases, this new version offers a number of interesting new features.

For embedded users, the most important new feature is certainly the inclusion of Squashfs, a read-only compressed filesystem. This filesystem is very well-suited to store the immutable parts of an embedded system (applications, libraries, static data, etc.), and replaces the old cramfs filesystem which had some strong limitations (file size, filesystem size and limited compression).

Squashfs is a block filesystem, but since it is read-only, you can also use it on flash partitions, through the mtdblock driver. It’s fine as you just write the filesystem image once. Don’t hesitate to try it to get the best performance out of your flash partitions. Ideally, you should even use it on top of UBI, which would transparently allow the read-only parts of your filesystem to participate to wear-leveling. See sections about filesystems in our embedded Linux training materials for details.

This new release also adds Fastboot support, at least for scsi probes and libata port scan. This is a step forward to reducing boot time, which is often critical in embedded systems.

2.6.29 also allows stripping of generated symbols under CONFIG_KALLSYMS_ALL, saving up to 200 KB for kernels built with this feature. This is nice for embedded systems with very little RAM, which still need this feature during development.

Another new feature of this kernel is the support for the Samsung S3C64XX CPUs. Of course, a lot of new boards and devices are supported, such as the framebuffer of the i.MX 31 CPU, or the SMSC LAN911x and LAN912x Ethernet controllers.

The other major features of this new kernel, not necessarily interesting for embedded systems are the inclusion of the btrfs filesystem, the inclusion of the kernel modesetting code, support for WiMAX, scalability improvements (support of 4096 CPUs!), filesystem freezing capability, filesystem improvements and many new drivers.

For more details on the 2.6.29 improvements, the best resource is certainly the human-readable changelog written by the community.

The Buildroot project begins a new life

The Buildroot project has been around for a quite a while. For those just discovering Buildroot, it is a set of Makefiles that ease and automate the process of building a cross-compilation toolchain (based on the uClibc C library, since Buildroot has been initiated by uClibc developers) and a full embedded Linux system. Buildroot can compile over 600 packages : graphical libraries (Qt Embedded, Gtk,, DirectFB), network servers (the Dropbear SSH server, several HTTP servers), and more), core components such as Busybox, DBUS, Avahi and many other free software packages that make sense on embedded systems. Of course, more packages can easily be added. Buildroot is very similar to PTXdist.

I remember using to this project and contributing to it back in 2004 when I still was an intern during my studies. One of my contributions was the writing of documentation for the project, which is still the official documentation. Since 2004, the project has evolved, but there was no clear maintainer and no stable releases. The developer community around Buildroot was not completely satisfied since no one was merging the proposed fixes and improvements, since there was no official maintainer. And Buildroot was difficult to use for users because it didn’t offer any kind of stable releas : users had to pick a random SVN checkout and cross fingers to get a reasonably-working version.

In January 2009, as part of the traditionnal new year’s resolution, Peter Korsgaard, one of the most active Buildroot developers, volunteered to step up as the official maintainer and to deliver releases. And indeed, he integrated many patches that were floating around, released several release candidates before releasing Buildroot 2009.02 on February, 12th. Since then he continues to make very interesting improvements to Buildroot, replies on the mailing list, review and merge the proposed patches. A new bug tracker has been set up, and the source code will soon be moved over the Git distributed version control system.

Definitely, it’s a new life starting for the Buildroot project. As a long-time user and occasional contributor of the project, I’m glad to see such evolution.

FOSDEM 2009 videos

As previously announced, I had the chance to attend the FOSDEM conference again this year. And once again, the famous Free Electrons video camera was with me, and I could record a few talks. I’m pleased to make them available today.

FOSDEM, the Free and Open Source Software Developers' European Meeting

Here are the available videos, with my personal comments. Of course, except the talk about CMake, all of them come from the embedded devroom. Thanks to the speakers for sharing their knowledge and presenting their projects !

  • video captureWt, a C++ web toolkit, for rich web interfaces to embedded systems, by Pieter Libin (Noesis Solutions)
    Video (44 minutes, 124M)
    Presentation of a Web application generator, which generates a Web application including a web server from a C++ description. The C++ design is based on many ideas coming from Qt, which eases the creation of the graphical application. Certainly a very interesting tool for embedded systems.
  • Hacking with modular hardware: the BUG, by Ken Gilmer (Bug Labs)
    Video (43 minutes, 129M)
    The BUG is a set of hardware modules that can be combined together. A base module contains the CPU, memory and other basic components, while additional modules can provide GPS, Wifi, webcam, I/O lines and many others. Of course, it comes with a completely free software SDK. Can be an interesting starting point for prototyping or hobbyist embedded hacking, even though the hardware is quite expensive.
  • Building Embedded Linux Systems with PTXdist, by Robert Schwebel (Pengutronix)
    Video (68 minutes, 151M)
    A very good presentation on why system building tools are needed for Embedded Linux systems (cross-compiling issues, etc.), and how PTXdist fits this need. Even though I’m personally quite fan of Buildroot, PTXdist’s competitor, the presentation was very interesting.
  • video captureDevelopment on the OpenMoko with hackable:1, by Pierre Pronchery (Bearstech)
    Video (55 minutes, 189M)
    A hands-on lab on the OpenMoko, which unfortunately was too short to be really interesting, and restricted to only the 10-12 people at the front of the room. Interesting for the people who did it, probably not so interesting to watch afterwards.
  • Development and Certification of Linux-Based Fire Safety & Security Systems, by Baurzhan Ismagulov (Siemens)
    Video (47 minutes, 124M)
    The topic of the talk was really appealing, because the use of free software in environments where human life is in danger has always caused many debates and discussions. Unfortunately, the talk completely misses the point : the speaker spent the whole talk discussing Germany-specific rules and laws for the certification of fire safety and security systems, almost without saying a word on how Linux can match these rules.
  • Maemo on BeagleBoard, by Juha Kallionen (Nokia)
    Video (20 minutes, 51M)
    Good talk, but not a lot of content, outside of « Hey, we run Maemo on BeagleBoard, try it !». A kind of announcement talk, I would say.
  • video captureAdvanced power management for OMAP3, by Peter De Schrijver (Nokia)
    Video (49 minutes, 169M)
    A very interesting, in-depth, technical talk about the power management features of the OMAP3 CPU and how these features can be used by the Linux kernel.
  • Emdebian 1.0 release – small and super small Debian, by Neil Williams (Debian)
    Video (86 minutes, 257M)
    video captureAgain, another interesting talk about the status of Emdebian, which has just reached 1.0. Neil described both Emdebian Crush and Emdebian Grip, that are two different approaches for making Debian more suitable for embedded systems. Very good progress has been made, and Emdebian is certainly something that should now be considered as a distribution for embedded systems.
  • CMake – what can it do for your project, by Alexander Neundorf
    Video (45 minutes, 167M)
    A general introduction to CMake, with lots of examples and demonstrations. Very nice for those who never had the opportunity to look at CMake.

USB-Ethernet device for Linux

Useful device when you work with an embedded development board

For our Embedded Linux training sessions, I was looking for a USB to Ethernet device. Since Linux supported devices are often difficult to find, I’m glad to share my investigations here.

When you use an embedded development board, you must connect it to your computer with an Ethernet cable, for example to transfer a new kernel image to U-boot through tftp, or to make your board boot on a directory on your workstation, exported with NFS.

You could connect both the board and computer to your local network, which would still allow your computer to connect to the Internet while you work with the board. However, you may create conflicts on your local network if you don’t use DHCP to assign an IP address to your board (if your DHCP server even accepts this new device on the network). In a training environment, you are also likely to run out of Ethernet outlets in the training room if you have to connect 8 such boards. Hence, a direct connection between the board and your workstation’s Ethernet port is often the most convenient solution.

If you can’t use WIFI to keep your computer connected to the outside world, a good solution is to add an extra Ethernet port to your computer by using an USB-to-Ethernet device.

My colleague Thomas and I started looking for such devices that would be supported by Linux. Here are a few that we found:

  • D-Link DUB-E100. Supported by the USB_NET_AX8817X driver. However, this product is bulky and quite heavy (at least 100 grams).
  • TRENDnet TU2-E100. Supported by the same driver, but still bulk (August 2015 update: now replaced by a more recent version, now almost as small as the Apple one, and supported out of the box in Linux. See the comment about this device.)
  • Linksys USB 200m. Supported by the same Linux driver and has a much more acceptable size, but customer reviews complain that its connector can break easily.
  • Apple USB Ethernet Adapter. This should be working out of the box in Linux. At least the MB442Z/A or MC704ZM/A references did, but Apple now sells a new reference that might have a different chipset. It is beautiful, small and light. Support for this device (at least the references I mentioned) was added to Linux 2.6.26 through the same driver. You should be able to use it in recent distros.

Apple USB to EthernetSo, I recommend the Apple device. I event posted a comment on the Apple Store, titled “Perfect for Linux”! I hope the Apple droids won’t censor it. Don’t hesitate to buy it, so that we can confirm that the latest reference is supported too.

I can’t tell whether this could happen with Apple. This was the first Apple device I ever bought…

Program for Embedded Linux Conference 2009 announced

CELF penguinThe program for the Embedded Linux Conference 2009 has been announced a few days ago, and the registration is now open. For the record, the Embedded Linux Conference is probably the largest technical conference specifically dedicated to the use of Linux on embedded systems. Organized by the CE Linux Forum every year, this conference gathers a large audience and a wide range of very interesting talks.

The 2009 edition of ELC will take place from April 6th to April 8th, in downtown San Francisco, in the United States.

The program features :

  • Almost 50 talks, tutorials and keynotes. The topics go from multimedia, flash filesystems, system initialization, memory management, instrumentation and debugging tools, real-time, embedded distributions, system building,
  • An opening keynote by Dirk Hohndel from Intel
  • A keynote by David Woodhouse, one of the two embedded Linux maintainers
  • Other famous speakers such as Paul Mundt (maintainer of the Linux port to the SuperH architecture), Kate Alhola (from Maemo/Nokia), Dan Malek (from Embedded Alley), Mike Anderson (the PTR group, famous for his JTAG tutorial), Jake Edge (from LWN), Klaas van Gend (from Montavista), Frank Rowand (from Sony, famous for his real-time adventures talk), Jim Ready, Denis Oliver Kropp (DirectFB main developer)
  • A panel on The Linux Kernel, what’s next with Jonathan Corbet, Greg KH, Andrew Morton, Keith Packard and Ted Ts’o
  • And last but not least, a talk from Michael Opdenacker, Free Electrons, on flash filesystems.

Of course, both Michael and I will attend the conference. Hope to meet you there!
Golden Gate Bridge