Buildroot with Pigeon computers

Buildroot with Pigeon computers

This tutorial presents how to build of small custom-built Linux system for Pigeon computers using Buildroot. Buildroot is a tool that simplifies and automates the process of building a complete Linux system for an embedded system, using cross-compilation. Buildroot is able to generate a cross-compilation toolchain, a root filesystem, a Linux kernel image and a bootloader. Buildroot is designed to run on Linux systems. This text contains parts of the Buildroot user manual.

Prerequisites

Debian distribution is used on the host machine in this tutorial. At the beginning, make sure you have installed all the necessary packages:

sudo apt-get update
sudo apt-get install sed make binutils build-essential gcc g++ bash patch gzip bzip2
sudo apt-get install perl tar cpio python unzip rsync wget bc git
sudo apt-get install ncurses-base ncurses-bin ncurses-dev libncurses5-dev dialog

If you plan to use 'make xconfig':

sudo apt-get install libqt4-dev qt4-dev-tools

Getting Buildroot

At the moment of writing this tutorial, the latest stable Buildroot version is 2016.05. Buildroot releases are made every 3 months, in February, May, August and November. Release numbers are in the format YYYY.MM. Release tarballs are available at buildroot.org/downloads/. Let's start by downloading Buildroot:

mkdir buildroot
cd buildroot
wget http://buildroot.org/downloads/buildroot-2016.05.tar.bz2
tar xvjf buildroot-2016.05.tar.bz2
cd buildroot-2016.05

Configure Buildroot

The first step when using Buildroot is to create a configuration. You should build everything as a normal user. There is no need to be root to configure and use Buildroot. Download Buildroot files for Pigeon computers from our Github repository:

wget --no-check-certificate https://raw.githubusercontent.com/kristech/pigeon-rb-buildroot/master/buildroot-2016.05/buildroot-2016.05.tar.bz2
tar jxvf buildroot-2016.05.tar.bz2

then run for example for Pigeon RB100:

make pigeon_rb100_defconfig

If you want to change Buildroot configuration, run:

make menuconfig

to change the configuration of the kernel, run:

make linux-menuconfig

Build system

To start the build process, simply run:

make

It will take some time.

Write image to eMMC

Buildroot output images are stored in a directory output/images/. You can write SD card image to Pigeon computer eMMC (where X is the drive letter designation):

dd if=output/images/sdcard.img of=/dev/sdX
sync

For more detail see Operating system installation.

Boot your Pigeon

Remove cable from USB Device slot and power cycling the Pigeon. The kernel loads. It mounts the rootfs partition. Here is the banner:

Welcome to Pigeon RB100
pigeon login: root

The default login is username: root, password: kristech.

Tips

Read-only root filesystem partition

By default root filesystem partition is mounted in read-write mode. You can change it to read-only mode:

make menuconfig

then turn off:

System configuration

  • remount root filesystem read-write during boot

You can also use rw and ro script files in the Pigeon console:

# ro
[ 4742.051335] EXT4-fs (mmcblk0p2): re-mounted. Opts: errors=remount-ro,data=ordered
# echo text > test.txt
-sh: can't create test.txt: Read-only file system
# rw
[ 4765.083886] EXT4-fs (mmcblk0p2): re-mounted. Opts: errors=remount-ro,data=ordered
# echo text > test.txt
# ls
test.txt

Use initramfs

To use initramfs (force the kernel to use an in-memory root file system), run:

make menuconfig

then select:

Filesystem images

  • cpio the root filesystem (for use as an initial RAM filesystem)
  • Compression method (gzip)

Edit file board/kristech/pigeon_rb100/rpi-firmware/config.txt and uncomment line:

#initramfs rootfs.cpio.gz

Edit file board/kristech/pigeon_rb100/genimage-pigeon_rb100.cfg and uncomment line:

# "rootfs.cpio.gz"

Linux kernel will not use the rootfs from mmcblk0p2 partition. It will use the root file system from the rootfs.cpio.gz file. Any changes made in runtime will be lost on system reboot. After boot you can check if initramfs is used:

# dmesg | grep initramfs
[ 0.841264] Trying to unpack rootfs image as initramfs...
# free
total used free shared buffers cached
Mem: 408440 66760 341680 56 0 52656
-/+ buffers/cache: 14104 394336
Swap: 0 0 0
Back to Top