How to build Buildroot for AT91

To build the binaries found in the BuildRootGet page, you will have to go through the following steps.

Prerequisites

Host build system should be a Linux system with necessary software installed.

Note You can install missing packages using yum install with Fedora or apt-get install with Ubuntu or Debian. These commands may require root privileges or being in a correct sudoers group.

Get sources

You can easily download Buildroot sources on our buildroot-at91 git repository. It is forked from the official Buildroot git repository on top of which we have applied some patches to add support for our boards.

To get the source code, you have to clone the repository:

$ git clone git://github.com/linux4sam/buildroot-at91.git
Cloning into 'buildroot-at91'...
remote: Counting objects: 92162, done.
remote: Compressing objects: 100% (28955/28955), done.
remote: Total 92162 (delta 62800), reused 92139 (delta 62778)
Receiving objects: 100% (92162/92162), 29.82 MiB | 2.09 MiB/s, done.
Resolving deltas: 100% (62800/62800), done.
$ cd buildroot-at91/
$ ls
CHANGES  COPYING  Config.in  Config.in.legacy  Makefile  Makefile.legacy  arch  board  boot  configs  docs  fs  linux  package  support  system  toolchain

The source code has been taken from the master branch which is pointing on the latest branch we use. If you want to use an older branch, you can list them and use one of them by doing this:

$ git branch -r
  origin/HEAD -> origin/master
  origin/buildroot-2012.11.1-at91
  origin/master
$ git checkout origin/buildroot-2012.11.1-at91 -b buildroot-2012.11.1-at91
Branch buildroot-2012.11.1-at91 set up to track remote branch buildroot-2012.11.1-at91 from origin.
Switched to a new branch 'buildroot-2012.11.1-at91'

Build rootfs image

Assuming you are at the Buildroot root directory, you'll find a configs folder containing several default configurations. If you are familiar with kernel configuration, you'll see that it works in the same way.

If you want to build the rootfs image we provide for sama5d3, you'll have to do:

$ make sama5d3ekdemo_defconfig

Then you can build the rootfs to obtain the binary found in BuildRootGet page.

$ make

Once compilation is done, have a look to output/images to see what has been generated:

$ ls output/images/
rootfs.jffs2  rootfs.tar  rootfs.ubi  rootfs.ubifs

  • for JFFS2 filesystem, you can flash the rootfs.jffs2 generated image
  • for UFIFS filesystem, the image to flash is the file named rootfs.ubi

Cross toolchain

While creating the rootfs, Buildroot will build a cross toolchain (or will download or use one present on your machine). You can find it under output/host/usr:

$ ls output/host/usr/bin
aclocal                                       arm-buildroot-linux-uclibcgnueabi-gcov      arm-linux-as          arm-linux-ldconfig  autoscan              gobject-query   ncurses5-config
aclocal-1.11                                  arm-buildroot-linux-uclibcgnueabi-gprof     arm-linux-c++         arm-linux-ldd       autoupdate            gperf           pkg-config
arm-buildroot-linux-uclibcgnueabi-addr2line   arm-buildroot-linux-uclibcgnueabi-ld        arm-linux-c++filt     arm-linux-nm        captoinfo             gsettings       pkgconf
arm-buildroot-linux-uclibcgnueabi-ar          arm-buildroot-linux-uclibcgnueabi-ld.bfd    arm-linux-cc          arm-linux-objcopy   ccache                gtester         reset
arm-buildroot-linux-uclibcgnueabi-as          arm-buildroot-linux-uclibcgnueabi-ldconfig  arm-linux-cpp         arm-linux-objdump   chattr                gtester-report  tabs
arm-buildroot-linux-uclibcgnueabi-c++         arm-buildroot-linux-uclibcgnueabi-ldd       arm-linux-elfedit     arm-linux-ranlib    clear                 ifnames         tic
arm-buildroot-linux-uclibcgnueabi-c++filt     arm-buildroot-linux-uclibcgnueabi-nm        arm-linux-g++         arm-linux-readelf   compile_et            infocmp         toe
arm-buildroot-linux-uclibcgnueabi-cc          arm-buildroot-linux-uclibcgnueabi-objcopy   arm-linux-gcc         arm-linux-size      faked                 infotocap       tput
arm-buildroot-linux-uclibcgnueabi-cpp         arm-buildroot-linux-uclibcgnueabi-objdump   arm-linux-gcc-4.7.2   arm-linux-strings   fakeroot              ldconfig        tset
arm-buildroot-linux-uclibcgnueabi-elfedit     arm-buildroot-linux-uclibcgnueabi-ranlib    arm-linux-gcc-ar      arm-linux-strip     gdbus                 ldd             uuidgen
arm-buildroot-linux-uclibcgnueabi-g++         arm-buildroot-linux-uclibcgnueabi-readelf   arm-linux-gcc-nm      autoconf            gdbus-codegen         libtool
arm-buildroot-linux-uclibcgnueabi-gcc         arm-buildroot-linux-uclibcgnueabi-size      arm-linux-gcc-ranlib  autoheader          gio-querymodules      libtoolize
arm-buildroot-linux-uclibcgnueabi-gcc-4.7.2   arm-buildroot-linux-uclibcgnueabi-strings   arm-linux-gcov        autom4te            glib-compile-schemas  lsattr
arm-buildroot-linux-uclibcgnueabi-gcc-ar      arm-buildroot-linux-uclibcgnueabi-strip     arm-linux-gprof       automake            glib-genmarshal       m4
arm-buildroot-linux-uclibcgnueabi-gcc-nm      arm-linux-addr2line                         arm-linux-ld          automake-1.11       glib-gettextize       makedevs
arm-buildroot-linux-uclibcgnueabi-gcc-ranlib  arm-linux-ar                                arm-linux-ld.bfd      autoreconf          glib-mkenums          mk_cmds

Note If you do a make clean, you will delete the rootfs but also the cross toolchain. You can save the cross toolchain in another place. Moreover you can tell Buildroot to use it to save time for next compilations. To do it run make menuconfig then go to the Toolchain menu. Then select External toolchain as Toolchain type, Custom toolchain as Toolchain, Pre-installed toolchain as Toolchain origin. Finally set Toolchain path and Toolchain prefix.

Customizing Buildroot

Before building the rootfs image, you may want to customize it: adding/removing packages, modifying component configurations such as busybox and uclibc, generate the kernel, etc.

Customizing the Busybox configuration

All the explanations are available in the Buildroot manual 'Customizing the Busybox configuration' section.

Customizing the uClibc configuration

All the explanations are available in the Buildroot manual 'Customizing the uClibc configuration' section.

Adding/removing packages from the rootfs

You can easily add or remove packages from the rootfs. You simply have to do:

make menuconfig

and to go to the Package Selection for the target menu. Packages are sorted by categories:

buildroot_package_selection.png

You simply have to go in the desired category and to select or deselect the packages you want. Once done, you can build your rootfs.

Note If you have already done a build and you want to remove packages, you may have to do make clean and to rebuild the whole rootfs to be sure that the packages will be removed.

Updating the rootfs for another nand flash device

The rootfs are configured to run on the nand flash device present on atmel boards. If you use another one you may have to update some parameters. To do it, run make menuconfig and go to Filesystem images:

buildroot_nand_conf.png

For a jffs2 root filesystem, you may have to update the page and erase size from Flash Type.

For a ubifs root filesystem, you may have to update the UBI logical erase block size, the UBI minimum I/O size, the Maximum LEB count, the UBI physical erase block size and the UBI sub-page size. You can find more information about these parameters in the ubi documentation.

Build linux-at91

You can use Buildroot to generate the kernel at the same time that the rootfs. We'll compile linux-at91:

Enter configuration menu with make menuconfig, go to Kernel and select Linux Kernel.

buildroot_kernel_linux-at91.png

In kernel version select Custom Git tree. Set URL of custom git repository to git://github.com/linux4sam/linux-at91.git, set Custom Git version to HEAD or to a branch/tag of your choice.

Set Kernel configuration to Using a defconfig and set Defconfig name to sama5d3. Buildroot can also build the device tree binary so select Device tree support and set Device Tree Source file name to sama5d34ek.

Then run make.

Add your own software to Buildroot

Builroot is basically a big set of makefiles so you will have to follow some steps to insert your own application to the cross-building system. You should have a look at the official documentation since the procedure depends on the build system used.

Topic attachments
I Attachment Action Size Date Who Comment
PNGpng buildroot_kernel_linux-at91.png manage 62.0 K 2013-02-01 - 10:23 UnknownUser buildroot kernel build screenshot
PNGpng buildroot_nand_conf.png manage 92.6 K 2013-02-01 - 10:06 UnknownUser buildroot nand configuration screenshot
PNGpng buildroot_package_selection.png manage 79.1 K 2013-02-01 - 09:59 UnknownUser buildroot package selection screenshot
r16 - 15 Feb 2013 - 15:36:03 - NicolasFerre
 
Linux & Open Source related information for AT91 Smart ARM Microcontrollers

Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Atmel® and others, are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. This site is powered by the TWiki collaboration platform

ARM® and others are registered trademarks or trademarks of ARM Ltd. Other terms and product names may be trademarks of others.

Ideas, requests, contributions ? Connect to LinksToCommunities page.

Syndicate this siteRSS ATOM