#Building BuildRoot 2016.02

<p class="text-success lead">
BuildRoot is a set of makefiles and patches that makes it easy to generate a complete 
and very small Embedded Linux System. It can generate any or all of a cross-compilation toolchain, 
a root filesystem, a kernel image and a bootloader image. 
</p>

<a href="http://buildroot.uclibc.org/about.html">
<img src="./buildroot.jpg"/>
</a>



## Notes

* This procedure was tested on a Linux PC with Ubuntu 15.10
* It is advisable to have a [Debug Port Interface](/DPI) 
* This article explains how to create only the rootfs contents. To generate the bootloader (at91bootstrap) 
and the Linux kernel image (zImage), please refer to the specific [tutorials](/tutorials).

##Building procedure

Download BuildRoot version 2016.02 from its repository:

<ul>
<li>
<a href="http://buildroot.uclibc.org/downloads/buildroot-2016.02.tar.bz2">
Download buildroot-2016.02.tar.bz2
</a>
</li>
</ul>

Decompress the .bz2 file in your home directory and move inside the new directory:

<pre class="terminal">
~$ <b>tar xjvf buildroot-2016.02.tar.bz2</b>
~$ <b>cd buildroot-2016.02</b>
~/buildroot-2016.02$ 
</pre>

At this point I suggest to create a your own personal branch
of Buildroot sources with [git](https://git-scm.com/) to keep a trace of any changes from the
mainline. Use these commands:

<pre class="terminal">
~/buildroot-2016.02$ <b>git init; git add .; git commit -m "buildroot vanilla"; git branch acme; git checkout acme</b>
</pre>

Download this patch file from GitHub:

* [buildroot-2016.02.patch](https://raw.githubusercontent.com/AcmeSystems/acmepatches/master/buildroot-2016.02.patch)

and apply it by typing:

<pre class="terminal">
~/buildroot-2016.02$ <b>patch -p1 < buildroot-2016.02.patch</b>
</pre>

Select the configuration of your board:

###Arietta G25 basic configuration

<pre class="terminal">
~/buildroot-2016.02$ <b>make acme-arietta_defconfig</b>
...
</pre>

###Aria G25 basic configuration

<pre class="terminal">
~/buildroot-2016.02$ <b>make acme-aria_defconfig</b>
...
</pre>

###Acqua A5 basic configuration

<pre class="terminal">
~/buildroot-2016.02$ <b>make acme-acqua_defconfig</b>
...
</pre>

###FOX Board G20 basic configuration

<pre class="terminal">
~/buildroot-2016.02$ <b>make acme-foxg20_defconfig</b>
...
</pre>


##Create your own rootfs configuration:

Probably you will need to customize the Buildroot configuration to install, for example, a different
set of packages to meet your needs. If you want to do that or if you want just to take a look 
around the Buildroot configuration type:

<pre class="terminal">
~/buildroot-2016.02$ <b>make menuconfig</b>
...
</pre>

and navigate inside the Buildroot configuration using the arrow keys and following the help 
provided by the menuconfig interface

Save and exit from the configuration menu and get start to run the BuildRoot compilation.

##Buildroot compilation

Install __liblz4-tool__ (sudo apt-get install liblz4-tool) on your Ubuntu Linux to generate the Linux Kernel zImage

If you're running an Ubuntu distribution at 64 bit, install the <b>libc6-i386</b> (sudo apt-get install libc6-i386)

Run the Buildroot compilation by typing:
 
<pre class="terminal">
~/buildroot-2016.02$ <b>make</b>
...
</pre>

This operation will take about 1 hour to download and compile any 
source of any part of your Linux distribution. 

If everything goes well you will obtain these binary files in __output/images__ directory:

* The whole root file system contents: __rootfs.tar__ 

Uncompress the rootfs content inside the second partition of the microSD:

<pre class="terminal">
<b>sudo tar xvf output/images/rootfs.tar -C /media/$USER/rootfs</b>
</pre>

Unmount the microSD and boot.

At login:

* login: __root__
* password: __acmesystems__

##Related links

* [The BuildRoot user manual](http://buildroot.uclibc.org/downloads/manual/manual.html)
* [BuildRoot web page](http://www.buildroot.net/)
* [BuildRoot G+ page](https://plus.google.com/100084591154899263420/posts)
* [Browseable BuildRoot repository](http://git.buildroot.net/buildroot)

