About buildroot

buildboot is a tool for creating an embedded Linux embedded Linux. It constitutes of Makefile and other patch files. This article employs the buildroot, which specifically customized for beagleboard-xm. This explains how to create the build environment and how to build an embedded Linix with buildroot. For the details of buildroot, please visit URLs listed below.

Process of Creating the Building Environment

The Host OS, which is used for creating the build environment, is Ubuntu 10.04 (64bit). Processes of adding extra packages, modifying the configuration, and creating the build environment are explained.

There are three stages in the process of creating the build environment: obtaining buildroot, obtaining toolchain, and placing the files for bc10.

To obtain the git clone of buildroot, follow the direction, which is written the web page below. Its URL is:

Adding extra packages

To create the build environment, the packages listed below are added to the default packages.

ssh vim git-core build-essential curl ia32-libs diffstat cvs subversion chrpath texi2html texinfo 
libncurses5-dev bison flex gettext

Changing from dash to bash

The default shell of Ubuntu is dash. To execute make with the default setting, it will cause error and, and make process will fail. To prevent this happening, the setting of shell is changed to bash.

$ sudo dpkg-reconfigure dash

To execute the command above, it will ask to install dash at /bin/sh? Please select NO. Then, shell will be changed to bash.

Obtaining buildroot

To use git command, obtain buildroot.

$ cd ${HOME}
$ mkdir work_router
$ cd work_router
$ git clone

Installing Toolchain

The default Toolchain, which buildroot (this is adjusted to 2011.05 base) uses, is CodeSourcery 2011.03. However, this article uses a toolchian, which is included in ti-sdk-beagleboard- This file is distributed by TI. This Toolchain is also used for bc10-router/arago-project.

Download Toolchain from TI's web site. The downloaded file can be placed at whichever directory you like.
If you do not specify any directory, the file will be downloaded at the directory of ${HOME}/ti-sdk-beagleboard-, and toolchain will be extracted at the directory of ${HOME}/ti-sdk-beagleboard-

$ wget
$ chmod +x ti-sdk-beagleboard-

To install it by console, add --mode console option to the command line. Then, execute it.

$ ./ti-sdk-beagleboard- --mode console

PATH of toolchain is added to the list on bashrc.

$ vi ${HOME}/.bashrc

$ source ${HOME}/.bashrc

Placing configuration files for bc10

There are config files for bc10. You can download these files to any directories.

However, these files are needed to be stored the specific directories. The directories are shown shown below. Please create bc10 directory under board directory.
kernel-patches are copied from the downloaded buildroot file, buildroot/board/beagleboard/xm/kernel-patches, and the copied file is stored at the directory below /buildroot/board/bc10/.
At the location where busybox-1.19.x.config is stored, a file does have the identical name has already existed. Please change the name of the existing file, and place the downloaded busybox-1.19.x.config.

   `- buildroot/
          |- board/
          |    `-bc10/
          |        |- kernel-patches/
          |        `- linux-3.2.8.config
          |- configs/
          |       `- bc10_defconfig
                 `- busybox/
                          `- busybox-1.19.x.config (the config file for busybox, which has already been edited for bc10)

Confirming the configuration of the placed files

Completing to placing these configuration files, please check the settings of these files. To execute make bc10_deconfig and make menuconfig commands, check the settings of these files. If the settings are correct, the outputs of commands are the same as the example shown below.
Especially, please check PATH of Toolchain. Its PATH has to be set as it is described above. (If its installed location differs form explained one, please adjust its PATH.) Please make sure that Custom kernel patches and Configuration file path of Kernerl specify the directory of board/bc10/.

$ cd ~/work_router/buildroot
$ make bc10_defconfig
$ make menuconfig

 Toolchain --->
   |- Toolchain type(External toolchain)
   |- Toolchain (Custom toolchain)
   |- (${HOME}/ti-sdk-beagleboard- Toolchain Path
   |- ($(ARCH)-arago-linux-gnueabi) Toolchain prefix
   |- External toolchain C library (glibc)
   |- [*] Toolchain has C++ support?
 Package Selection for the target  --->
   |- (package/busybox/busybox-1.19.x.config) BusyBox configuration file to use?
  Kernel  --->
   |- (board/bc10/kernel-patches) Custom kernel patches
   |- (board/bc10/linux-3.2.8.config) Configuration file path

Modifying and changing buildroot

Since IT's Toolchain and the Toolchain of CodeSourcery2011.03 employ the different versions of GCC, each Toolchain requires a specific GCC. If the version of GCC and a Toolchain do not match, it will cause a build error. To prevent this happening, modify and change buildroot. Version of GCC and settings of other tools are consist with the settings used at bc10-router/arago-project.

Changing the version of libtool

The default version of libtool is 2.2.10. The version 2.2.6b is used at bc10/arago-project. As changing the version of libtool from 2.2.10 to 2.2.6b, make the version of libtool consist with TI's Toolchain. If version 2.2.10 is used with TI's Toolchain, it causes an error due to version mismatch of libraries.

$ cd ${HOME}/work_router/buildroot
$ vi package/libtool/

+ # LIBTOOL_VERSION = 2.2.10
   LIBTOOL_SOURCE = libtool-$(LIBTOOL_VERSION).tar.gz   

Toolchain of CodeSourcery2011.03 causes only a build error on buildroot. It does not cause any build errors when it builds other tools.

Change the version of ncurses

The version of ncurses is changed from 5.7 to 5.9. This change prevents a build error occurring. The build error is due to version mismatch of libraries.

$ cd ${HOME}/work_router/buildroot
$ vi package/ncurses/ 

--- ncurses.mk_orig     2012-12-21 17:10:01.570116798 +0900
+++  2012-12-21 15:30:30.220956375 +0900
@@ -23,27 +23,52 @@
 # USA

+       --enable-widec \
+       --without-progs \
        --with-shared \
-       --without-cxx \
-       --without-cxx-binding \
        --without-ada \
-       --without-progs \
-       --without-tests \
+       --enable-hard-tabs \
+       --enable-xmc-glitch \
+       --enable-colorfgbg \
        --disable-big-core \
-       --without-profile \
-       --disable-rpath \
-       --enable-echo \
-       --enable-const \
-       --enable-overwrite \
-       --enable-broken_linker \
+       --disable-rpath-hack \
+       --with-ticlib \
+       --with-termlib=tinfo \
+       --enable-sigwinch \
+       --enable-pc-files \
+       --with-build-cc="${HOSTCC}" \
+       --with-build-cpp="${HOSTCPP}" \
+       --with-build-ld="${HOSTLD}" \
+       --with-build-cflags="${HOSTCFLAGS}" \
+       --with-build-cppflags='${HOSTCPPFLAGS}' \
+       --with-build-ldflags='${HOSTLDFLAGS}' \

+#      --with-shared \
+#      --without-cxx \
+#      --without-cxx-binding \
+#      --without-ada \
+#      --without-progs \
+#      --without-tests \
+#      --disable-big-core \
+#      --without-profile \
+#      --disable-rpath \
+#      --enable-echo \
+#      --enable-const \
+#      --enable-overwrite \
+#      --enable-broken_linker \
+#      --disable-static
 ifneq ($(BR2_ENABLE_DEBUG),y)
 NCURSES_CONF_OPT += --without-debug
@@ -99,7 +124,7 @@ endif

       mkdir -p $(TARGET_DIR)/usr/lib
-        cp -dpf $(NCURSES_DIR)/lib/* $(TARGET_DIR)/usr/lib/
+       cp -dpf $(NCURSES_DIR)/lib/* $(TARGET_DIR)/usr/lib/
@@ -120,6 +145,32 @@ define NCURSES_INSTALL_TARGET_CMDS

+#      mkdir -p $(TARGET_DIR)/usr/lib
+#      cp -dpf $(NCURSES_DIR)/lib/* $(TARGET_DIR)/usr/lib/
+#      ln -snf /usr/share/terminfo $(TARGET_DIR)/usr/lib/terminfo
+#      mkdir -p $(TARGET_DIR)/usr/share/terminfo/x
+#      cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm $(TARGET_DIR)/usr/share/terminfo/x
+#      cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-color $(TARGET_DIR)/usr/share/terminfo/x
+#      cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-xfree86 $(TARGET_DIR)/usr/share/terminfo/x
+#      mkdir -p $(TARGET_DIR)/usr/share/terminfo/v
+#      cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt100 $(TARGET_DIR)/usr/share/terminfo/v
+#      cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt102 $(TARGET_DIR)/usr/share/terminfo/v
+#      cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt200 $(TARGET_DIR)/usr/share/terminfo/v
+#      cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt220 $(TARGET_DIR)/usr/share/terminfo/v
+#      mkdir -p $(TARGET_DIR)/usr/share/terminfo/a
+#      cp -dpf $(STAGING_DIR)/usr/share/terminfo/a/ansi $(TARGET_DIR)/usr/share/terminfo/a
+#      mkdir -p $(TARGET_DIR)/usr/share/terminfo/l
+#      cp -dpf $(STAGING_DIR)/usr/share/terminfo/l/linux $(TARGET_DIR)/usr/share/terminfo/l

Adding a patch to udev-181

TI's Toolchain has an issue to udev-181 and causes a build error. Since u-dev for bc10-router/arago-project is 165, it does not suffer this issue. However, the download site of udev for Toolchain archives under 100 and over 170. There is no 165. To avoid an error happening, a pach is applied to udev-181. The name of patch and the location that it is placed are package/udev/udev-181-define-trigger-happy.patch. The contents of the patch are shown below.

$ vi package/udev/udev-181-define-trigger-happy.patch

diff -Naur udev-181.orig/src/udev-builtin-input_id.c udev-181/src/udev-builtin-input_id.c
--- udev-181.orig/src/udev-builtin-input_id.c   2012-03-05 11:41:10.000000000 -0500
+++ udev-181/src/udev-builtin-input_id.c        2012-03-05 11:46:31.000000000 -0500
@@ -30,6 +30,10 @@

 #include "udev.h"

+#define BTN_TRIGGER_HAPPY 0x2c0
 /* we must use this kernel-compatible implementation */
 #define BITS_PER_LONG (sizeof(unsigned long) * 8)
 #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)

Creating Images

When the preparation is completed, images are build. Please execute the command below for building the images

$ make

After the build process is completed, the image files are created at the directory: work_router/buildroot/output/images. The names of the created files are:

MLO  rootfs.tar  u-boot.img  uEnv.txt  uImage

Editing uEnv.txt

The environment configuration file for uboot has been created, but its contents are needed to be modified. The details are:

--- __uEnv.txt_orig	2012-12-18 15:20:53.344986130 +0900
+++ uEnv.txt	2012-12-18 15:21:06.901053349 +0900
@@ -1,3 +1,2 @@
-uenvcmd=mmc init; run loaduimagefat; run mmcboot
+mmcroot=/dev/mmcblk0p2 rw
+uenvcmd=run loaduimagefat; run mmcboot

Writing images to a SD card

The process of formatting a SD card is shown []. Please follow the direction, and format a SD, which is suitable to bc10. Create FAT32 and Ext3 directories and the names of these directories are /media/FAT and /media/EXT3, respectively.

Then, copy the created files to the targeted directories and extract them.

$ cp MLO /media/FAT
$ cp u-boot.img /media/FAT
$ cp uImage /media/FAT
$ sudo tar xvf rootfs.tar -C /media/EXT3

This is the end of the process of writing images to a SD card.

Configuration after booting bc10

As the images are written to a SD card, yet some modification is required using this buildroot.

About login of dropbear

This buildroot uses bash and dropbear as the default shell and ssh, respectively. To access this buildroot via ssh, it denies the login, showing the message. The message is shown below.

authpriv.warn dropbear[780]: User 'root' has invalid shell, rejected

This issue is due to that the authentication of dropbear only recognizes sh, not recognizes bash. In drop/svr-auth.c, the part of checking shell is fixed as /bin/sh. It means that it accept only sh. To fix this issue, shell of User root changes form /bin/bash to /bin/sh. Then, reboot it. The details are show below.

$ vi dropbear-2012.55/svr-auth.c

/* check that the shell is set */
usershell = ses.authstate.pw_shell;
if (usershell[0] == '\0') {
/* empty shell in /etc/passwd means /bin/sh according to passwd(5) */
     usershell = "/bin/sh";
TRACE(("no matching shell"))
dropbear_log(LOG_WARNING, "User '%s' has invalid shell, rejected",
send_msg_userauth_failure(0, 1);

[root@bc10-router ~]# vi /etc/passwd

Reading in wireless LAN modul

Under the default setting, the wireless LAN module cannot be recognized. To make this module recognized, after booting, change it as it is shown below.

# modprobe rt2800usb
[   38.027832] cfg80211: Calling CRDA to update world regulatory domain
[   38.291656] usb 1-2.4: reset high-speed USB device number 4 using ehci-omap
[   38.486846] usbcore: registered new interface driver rt2800usb
# ifconfig -a
wlan0     Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
         BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Revision History

  • 2013/07/22 This article is initially uploaded

Attach file: filebusybox-1.19.x.config 680 download [Information] filebc10_defconfig 689 download [Information] filelinux-3.2.8.config 656 download [Information]

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes
Last-modified: 2013-07-22 (Mon) 13:48:09 (1586d)