Beaglebone Black Embedded Linux Development with Buildroot : part-1

By | June 17, 2016

Let us automate beaglebone balck embedded Linux development using buildroot.

Background:

As you know, to port complete embedded Linux on a Beaglebone Black, we need following components.

  • Bootloader (MLO and U-BOOT)
  • Kernel
  • Root filesystem
  • Cross compiler

To gather all those components, you need to clone individual kernel, u-boot sources, applying respective configurations and build. This procedure may be OK for Kernel and Bootloader, but it is very difficult to create a cross compiler and Root filesystem from scratch. It requires a lot of effort.

To make our life easier, buildroot provides a set of scripts. These scripts completely automates Linux development. You just have to configure the buildroot environment with required components and packages.

It automatically fetches sources, creates a cross compiler, root filesystem,kernel and other binaries. At last, creates a deliverable packages.

Recall :

In the previous posts, we have seen the procedure to cross compile Kernel and Bootloader from the scratch using linaro cross compiler.

How to Cross compile kernel for BeagleBone Black ?

BeagleBone Black Das uboot bootloader compilation

What are you going to cover:

In this post, you will be configuring the buildroot environment with a default beaglebone configuration. You will also see the procedure to do basic customization.

The default configuration doesn’t seem to be updated. It is using older kernel, u-boot and creates a uc cross compiler. In the upcoming posts, you will configure buildroot environment to build latest kernel, u-boot source. You will also learn root filesystem customization.

Development Environment :

Nothing much required for setup.

  • Software
    • Ubuntu 14.04
  • Others
    • Internet to download buildroot and packages

Required Ubuntu tools :

Install below tools. Few are required for build system. Other tools can be used in the upcoming development.

$ sudo apt-get install minicom git ncurses-dev gedit flex bison 
$ sudo apt-get install texinfo g++ gettext u-boot-tools autoconf

Buildroot and Beaglebone Black (BBBB) – Lets gets started:

Below steps are quite straight forward.

1. Open new terminal

ctrl + alt + t

2. Run below command to fetch latest mainline buildroot source.

$ git clone git://git.buildroot.net/buildroot

3. Change directory to buildroot

$ cd buildroot/

4. Checkout require branch or tag. Try latest tags.

$ git checkout 2016.02 -b 2016.02

5. Cross verify your branch.

$ git branch

You will get a terminal log as shown below

minion@ubuntu:~/minion/bbb/buildroot$ git branch
* 2016.02
  master

6. Now, you need to find the configuration files. In buidroot, all configuration files are available in ‘./configs’ folder.

$ ls configs/

7. For beaglebone black, configuration file is beaglebone_defconfig

$ ls configs/beaglebone_defconfig

8. Apply beaglebone black specific configuration to the buildsystem

$ make beaglebone_defconfig

9. Start build process

$ make -j4

Take a break. A fresh build takes several hours, based on your INTERNET speed and host computer performance. Sometimes, you may end up with build errors because of dependency issues. So, try to monitor the build process.

10. Once done with build process, final images will be available in the below folder.

$ ls output/images/

After a successful build, you will get below components in the images folder.

minion@ubuntu:~/minion/bbb/buildroot$ ls output/images/
am335x-boneblack.dtb  am335x-bone.dtb  MLO  rootfs.ext2  u-boot.img  uEnv.txt  zImage

zImage               - Kernel image
uEnv.txt             - MMC u-boot environment variables
u-boot.img           - uboot bootloader
rootfs.ext2          - Filesystem
MLO                  - Second stage bootloader
am335x-boneblack.dtb - Devicetree

Basic buildroot customization:

Lets do a basic customization and create a tar root filesystem.

Default configuration generates a rootfs.ext2. For SD card, NFS booting, we need a tar ball. So, lets make changes in default configuration.

1. Open buildroot menuconfig

$ make menuconfig

You will be presented with a menu as shown in the below image.

Beaglebone Black buildroot menuconfig

2. Now navigate to below path and select “tar the root filesystem”

       -> Filesystem images  
         -> tar the root filesystem (BR2_TARGET_ROOTFS_TAR [=y])      
[*] tar the root filesystem

3. Compile buildroot again. Build process completes with in a minute, as it is not a fresh build.

$ make -j4

4. Tar root filesystem available in the output folder

$ ls output/images/rootfs.tar

In the upcoming post, you will learn the procedure to boot these images till Linux prompt.

Embedded Rocks

One thought on “Beaglebone Black Embedded Linux Development with Buildroot : part-1

  1. Pablo

    Hi:
    i’ve been working with beaglebone black and build root for a while now, but i cannot get hdmi output working… Do you know how to achieve this?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *