world leader in high performance signal processing
Trace: » build-system

buildroot Build System

The buildroot distribution Blackfin is based on the buildroot mainline 2012.08 release. This repository can be cloned from git://blackfin.uclinux.org/git/buildroot open Internet or ssh://anonymous@firewall-sources.blackfin.uclinux.org/git/buildroot behind a firewall.

The buildroot distribution is made up of many configure scripts, make files and directories. No software source code is included directly. They are all downloaded from Internet when user starts building. Here we will explain necessary pieces that you may wish to customize.

Tree Overview

The view from the top level:

  • board/ — board specific configuration files and rootfs skeleton
  • board/AnalogDevices — configuration files and rootfs skeleton for ADI evaluation boards
  • board/AnalogDevices/blackfin/patches/linux-3.5 — Patches to apply to the proper version of Linux kernel source
  • boot/ — boot loader config scripts and make files; not used for blackfin
  • config/ — the buildroot default configuration for different boards
  • dl/ — the source tarballs that are downloaded during building process
  • docs/ — how to configure and customize buildroot
  • fs/ — config scripts and make files to build different kinds of root file system image.
  • linux/ — config scripts, make files to build Linux kernel
  • linux/linux-kernel/ — the Linux kernel source
  • output/ — All building output files are put under this folder
  • output/build/ — Contain binaries of all software packages
  • output/images/ — Contain file system images and kernel booting up images.
  • output/staging/ — locally installed (“staged”) target libraries; they may be linked with target applications later
  • packages/ — config scripts and make files to download and build libraries and applications
  • scripts/ — misc buildroot compile helper scripts
  • target/ — architecture specific configuration files and makefiles
  • toolchain/GNU toolchain and GDB config scripts and make files

Buildroot configuration system Overview

The buildroot build system is based on kernel kconfig configuration system, and GNU make. It allows you to easily add configuration options, documentation, dependencies, and integrate into Makefiles. There are 8 sets of configuration files:

  • Target arch selection
  • Target binary format selection
  • Target processor selection
  • Target processor revision
  • Top level build options
  • Toolchain options
  • Target board system configuration
  • Buildroot package options
  • File system image options
  • Linux kernel options
  • Boot loader options (not used for blackfin)

Top level build options

  • .config
  • auto.conf
  • autoconf.h
  • Makefile
  • Config.in
  • package/config/
  • package/config/lxdialog/

The top level Makefile builds the Linux kernel kconfig system under package/config at first. It then runs output/build/buildroot-config/mconf to parse GNU configuration scripts defined in Config.in under root directory. All sub level configuration options are sourced in the root Config.in file, which allows the user to select libraries, applications, targets, toolchains, boot loaders and rootfs file systems. After it parses all configuration sources, it prompts the option menu to the user. When done, the selected options will be stored into to .config. The configs/xxxx_defconfig files are minimal defconfig describing a particular configuration, that one can use as a sample to start a new configuration.

Target arch/processor/board selection

  • target/Config.in.arch
  • target/Makefile.in
  • target/generic/
  • board/AnalogDevices/
  • board/AnalogDevices/blackfin/
  • board/AnalogDevices/blackfin/target_skeleton/

Arch and target general configure options are sourced in root Config.in. Arch and binary format options are defined in target/Config.in.arch, while system console settings are in target/generic/Config.in.

In Analog Devices case:

  1. All ADI Blackfin evaluation boards have the same default rootfs skeleton and busybox configuration under the AnalogDevices board folder. Their paths can be set up in buildroot system configuration menu.
  2. Compiler prefix for different binary format can be set up in buildroot Toolchain menu.
  3. Kernel patch path and default config file name for each boards can be set up in buildroot Kernel menu.
  4. All above configure parameters are defined in the buildroot default config files for each Blackfin evaluation board under subfolder configs.

Toolchain options

  • toolchain/Config.in
  • toolchain/toolchain-external/Config.in
  • toolchain/gdb/Config.in

Because blackfin buildroot distribution always use external customer binary toolchain other than build internal toolchain from source, Only 3 toolchain option scripts are relative. External toolchain option is always selected in toolchain/Config.in.

A customer external toolchain option is defined in toolchain/toolchain-external/Config.in, which allows to use pre-installed binaries other than downloading at building time. Toolchain name prefix defined in vendor options can be overridden here, but customer usually should use the vendor's name. C library type should be set to the same as that provided by the external toolchain. So do some C library prebuilt options, such as IPv6, WChar, Locale, Threads, etc.

The options to enable GDB server support for target boards is defined in toolchain/gdb/Config.in rather than in buldroot package.

Linux Kernel options

  • linux/
  • linux/Config.in
  • linux/linux.mk
  • linux/linux-kernel/
  • board/AnalogDevices/blackfin/patches/linux-3.5
  • output/build/linux-custom/.config

The buildroot for blackfin always use customer unpacked kernel tree under linux/linux-kernel/. So, no building time download is necessary. kernel version specific customer patches can be put into board/AnalogDevices/blackfin/patches/linux-3.5, which is applied automatically before building the kernel source and removed after user runs make clean. Default kernel configuration under linux/linux-kernel/arch/blackfin/configs/ are used by default. But, customer can set other path to their own kernel configuration. Only uImage is supported to pack Blackfin kernel, don't set customer kernel image name.

User can run make linux-menuconfig to customize the kernel option and the results are stored in output/build/linux-custom/.config. Kernel object files and temporary files are put into output/build/linux-custom. All kernel modules are installed into output/target/lib/modules/ after building.

Buildroot package options

  • package/Config.in
  • package/busybox/Config.in
  • package/customize/Config.in
  • package/multimedia/Config.in

User space libraries, utilities, tools and applications are all defined in package/Config.in and its sub options. All multimedia libraries and applications are put together under package/multimedia/. Busybox options can be customized by run make busybox-menuconfig. The result is stored in busybox's object output folder. In blackfin case, the default busybox configuration path is defined by vendor's Makefile. Customer can still override this path by their own configuration.

If customer wants to add their own packages, they are free to put everything under package/customize/ and customize package/customize/Config.in. Although this is preferred, they can put anywhere under package/. Refer to Buildroot Howto about how to add Config.in and Makefile for different software packages.

File system image options

  • fs/Config.in
  • fs/ext2/Config.in
  • fs/jffs2/Config.in
  • fs/ubifs/Config.in
  • fs/initramfs/Config.in

Kernel uImage and rootfs image types are selected in file system image options. If initramfs is selected, initramfs rootfs is packed into the uImage by kernel. And kernel won't mount any other rootfs defined in boot command line when this uImage is booting. In order to generate a pure kernel uImage and mount individual rootfs image, user should disable “Initial RAM filesystem and RAM disk (initramfs/initrd) support” option in kernel configuration. In the bf609 buildroot release, only ext2, jffs2 and ubifs are tested. But, other file system types are also supported.

Build Overview

The top level Makefile will copy the target file system skeleton from board's default skeleton, copy external toolchain libraries to target and staging, build up the GDB, libraries, applications, kernel and file system images as selected by the user. Each package will be compiled in its own sub-directory under output/build/. Compiled libraries will be locally installed into the output/staging/ directory so that other packages can easily find and link against them. Files that are meant to be used on the board at run time will be copied into the output/target/ directory. This is the rootfs directory. Booting up images are created in output/images/.

For information on make targets, visit the build_a_target page.