Buildroot

Overview

Name: Buildroot
Picture:
Active Yes
Purpose Embedded Linux distribution
Ignition install No
Compatibility All a38x MicroSoms
More information Build system for embedded Linux based on cross compilation
Maintained by Community (dormant)
Forum na
Website buildroot.uclibc.org

Description

Buildroot is a simple, efficient and easy-to-use tool to generate embedded Linux systems through cross-compilation.

This wiki page describes how to cross compile a complete u-boot, kernel and about 300MByte of root filesystem that has lots of different applications that are useful when developing on Clearfog board and A38x MicroSOM.

You can start with the attached config file that has all the URLs for u-boot and the kernel, and then add / remove packages.

Build Instructions

The build instructions below are based on release 2015.08.1 of buildroot. But the modifications are easily portable into different releases -

Download the following two files buildroot-clearfog.txt.gz uboot-mk.diff.gz

Get the release and untar -

gunzip buildroot-clearfog.txt.gz
gunzip uboot-mk.diff.gz
wget http://buildroot.uclibc.org/downloads/buildroot-2015.08.1.tar.bz2
tar jxf buildroot-2015.08.1.tar.bz2
cd buildroot-2015.08.1

Patch Buildroot uboot build script, and add .config file that describes what to build

mv ../buildroot-clearfog.txt .config
patch -p0 < ../uboot-mk.diff

Start a build. Notice that this will take few hours to build, depending on your build machine and internet connection speed.

make

Deploying an image on a micro SD card

With the attached buildroot configuration, zImage, uboot, device tree and ext4 partition is created. The following commands can be used as a post script to buildroot to create an output.img image file that can be written as-is to a micro SD and then booting from it -

dd if=/dev/zero of=output/images/output.img bs=512 count=2048
dd if=output/images/u-boot.mmc of=output/images/output.img bs=512 seek=1
dd if=output/images/rootfs.ext4 of=output/images/output.img bs=512 seek=2048
echo -e "n\np\n1\n2048\n\nw\n" | fdisk output/images/output.img

The above instructions creates a 1MByte empty output.img file, then applies u-boot to it, writes the ext4 partition and then creates a partition starting from 1MByte to the end of the volume (end of ext4 partition).

The user can resize that partition afterwards if needed.

When booting the first time then the u-boot environment variables won't be set; so the need to be set manually in order to correctly boot -

setenv bootargs 'console=ttyS0,115200 root=/dev/mmcblk0p1 rootwait'
setenv bootcmd 'ext2load mmc 0:1 0x02000000 /boot/zImage; ext2load mmc 0:1 0x01800000 /boot/armada-388-clearfog.dtb; bootz 0x02000000 - 0x01800000'
saveenv
boot

Clearly the above manual settings of the environment variables can be set automatically on the build machine and then using the build machine uboot tools to create the u-boot environment variables block.