Build BuildRoot for AT91SAM9N12-EK

Introduction

Buildroot is used to build the cross tool chain, a small root filesystem image of different types (jffs2, tar, ubi) and the Atmel 2.6.39 kernel image.

Included applications into the root filesystem

The root filesystem images contain the following applications:

  • Busybox
  • Audio
    • alsa-utils
    • madplay
  • Compressors and decompressors
    • bzip2
  • Hardware handling
    • i2c-tools
    • udev
  • Networking
    • bridge-utils
    • can-utils
    • dropbear
    • ethtool
    • iperf
    • iproute2
    • iptables
    • lrzsz
    • mii-diag
    • portmap
    • wireless tools
    • wpa_supplicant
  • Shell and utilities
    • file
    • which

Get Buildroot

This version is based on the latest Buildroot release: 2011.05. First of all, you have to get Buildroot sources.

You can download the Buildroot archive:

$ wget http://buildroot.uclibc.org/downloads/buildroot-2011.05.tar.bz2
$ tar xvjf buildroot-2011.05.tar.bz2
$ cd buildroot-2011.05
Or you can use git:
 
$ git clone http://git.buildroot.net/git/buildroot.git
$ cd buildroot
$ git checkout 2011.05 -b mybranch
Then you have to apply the 2011.05-at91_9n12_m2.patch patch file:
 
$ wget ftp://ftp.linux4sam.org/pub/buildroot/2011.05-at91_9n12_m2.patch
$ patch -p1 < 2011.05-at91_9n12_m2.patch
$ chmod +x board/atmel/at91sam9n12ek/post-build.sh
$ chmod +x board/atmel/at91sam9n12ek/alsa/post-build_alsa.sh

Build Buildroot

The patch provides a default configuration, to use it you only have to do:

$ make at91sam9n12ek_defconfig

Then begin the building process with:

$ make
The build process is quite long and sources will be downloaded from Internet. Once it is done, you will have the following files:
$ ls output/images/
rootfs.jffs2  rootfs.tar.bz2  rootfs.ubi  rootfs.ubifs  uImage

rootfs.* files are the root filesystem images and uImage is the kernel image for U-Boot.

The toolchain is located into output/host/usr/bin/.

Customizing Buildroot

Customizing the target filesystem

To setup the filesytem image:

$ make menuconfig

You can add or remove packages into the Package Selection for the target section.

You may want to customize the root filesystem by adding configuration file. You can do this by using a post build script called before creating filesystem images. It's what we do for alsa configuration file. You only have to fill the Custom script to run before creating filesystem images field into the System configuration section. Another way is to use a custom Root FS skeleton by selecting custom target skeleton in System Configuration -> Root FS skeleton.

You can also customize ownership/permissions and device files by editing System Configuration -> Path to the device tables.

Customizing the Busybox configuration

You can configure the Busybox but you will need to have done a first compilation of Buildroot without customizing it. Then invoke make busybox-menuconfig. The .config file will be put into the output/build/busybox directory. Run the compilation of Buildroot again.

For more information, you can have a look on BuildRoot documentation

Customizing the uClibc configuration

In the same way that Busybox, you can configure the uClibc. Make a first compilation of Buildroot without customizing it, invoke make uclibc-config. The .config file will be put into the output/toolchain/uClibc directory. Run the compilation of Buildroot again.

For more information, you can have a look on BuildRoot documentation

Add your own packages to Buildroot

If the software you want is not included into Buildroot, you can add it by yourself. There are several ways to add a package. It depends from the build system: generic makefile, autotools or cmake. You can find more information and some examples on the BuildRoot website

-- EricXu - 15 Mar 2012