First of all, what is build root?
As described in the buildroot.uclib.org site:
"Buildroot is a set of Makefiles and patches that makes it easy to generate a complete embedded Linux system. Buildroot can generate any or all of a cross-compilation toolchain, a root filesystem, a kernel image and a bootloader image. Buildroot is useful mainly for people working with small or embedded systems, using various CPU architectures (x86, ARM, MIPS, PowerPC, etc.) : it automates the building process of your embedded system and eases the cross-compilation process."
"Buildroot is maintained by Peter Korsgaard, and licensed under the GNU GENERAL PUBLIC LICENSE V2 (Or later). Stable releases are delivered every three months."
There are several advantages using buildroot to build your linux embedded systems, two of these are the most important for me:
- You don't have to build all the scripts to startup a linux system. Buildroot will do the work for you.
- Buildroot installs a cross compilation toolchain, so you can compile your system using your desktop PC and so you can gain a lot of time. For example, the compiling process of a complete system on a Raspberry Pi can take several weeks, instead on your PC it will take few hours.
For my pourposes I'm using Bsquask. The Bsquask SDK provides a GCC 4.6.3 toolchain for building armv6 binaries with the hardfloat ABI, as well as bootloaders, kernel image, rootfs, and development sysroot for the Raspberry Pi. You can find more at the following address: https://github.com/nezticle/RaspberryPi-BuildRoot
As explained in the above page:
Getting and building the Bsquask SDK
Download the RaspberryPi-Buildroot package from https://github.com/nezticle/RaspberryPi-BuildRoot/archive/master.zip or use git clone
$ wget https://github.com/nezticle/RaspberryPi-BuildRoot/archive/master.zip
deflate the master.zip file
$ unzip master.zip
Create the directory where you want your SDK to be built:
$ export BSQUASK_DIR=/opt/bsquask
$ mkdir -p $BSQUASK_DIR
Enter the BuildRoot directory and generate a Makefile for your SDK:
$ cd BuildRoot
$ make raspberrypi_defconfig O=$BSQUASK_DIR
You may be missing some build dependancies (flex, bison, etc…) but you will be warned about what packages you need to install if this is the case.
Change to your SDK directory and and start the build (this can take a few hours the first time).
$ cd $BSQUASK_DIR
Using Generated Image on the Raspberry Pi
First you need to obtain an SD card that has the correct partitions setup. It needs to be setup as follows:
75MB fat32 partition
500MB or greater ext4 partition (ideally using the remainder of the card)
When you have this setup, mount the the two partitions (assuming /media/BOOT for the fat32 partiion, and /media/rootfs for the ext4). Then run the following commands to install the rootfs:
$ cd $BSQUASK_DIR/images
$ tar -zxvf boot.tar.gz -C /media/BOOT
$ sudo tar -zxvf rootfs.tar.gz -C /media/rootfs
Make sure you are root(sudo) when extracting rootfs.tar.gz, or you will have problems on boot
Now place the SD card in your Raspberry Pi and power on. If everything went as planned, you should get a login prompt for Bsquask (linux).