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

#BuildRoot 2015.08.1 + Linux 4.2.2 on Arietta G25

<p class="text-success">
BuildRoot is a set of makefiles and patches that makes it easy to generate a complete 
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>

This article explains how to create a bootable microSD for [Arietta G25](/arietta) SoM using the latest
BuildRoot version and the latest stable Kernel version available now (Oct 2, 2015).

##Building procedure

Download BuildRoot version 2015.08.1 from its repository:

<a class="btn btn-primary" href="http://buildroot.uclibc.org/downloads/buildroot-2015.08.1.tar.bz2">
<span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>  Download buildroot-2015.08.1.tar.bz2
</a>

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

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

Download our patch file to add the file requested by Arietta G25:

<a class="btn btn-primary" href="./acme.patch">
<span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> Download acme.patch
</a>

and apply it by typing:

<pre class="minicom">
~/buildroot-2015.08.1$ <b>patch -p1 < acme.patch</b>
</pre>

Select the Arietta G25 defconfig:

<pre class="minicom">
~/buildroot-2015.08.1$ <b>make arietta_defconfig</b>
</pre>

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

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

Save and exit from the configuration menu and launch the BuildRoot compilation.
 
This operation will take about 1 hour to download and compile any 
source of any part of your Linux distribution. 

<pre class="minicom">
~/buildroot-2015.08.1$ <b>make</b>
...
</pre>

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

* The Linux Kernel image: __zImage__
* The device tree blob file: __acme-arietta.dtb__  
* The whole root file system contents: __rootfs.tar__ 

Insert a microSD formated in this way using gparted:

* a first fat16 or fat32 partition (>6 MB) labeled __boot__
* a second ext4 partition (>32 MB) labeled __rootfs__

Copy the files generated renaming some of them in this way:

<pre class="minicom">
<b>cp output/images/at91-ariettag25.dtb /media/$USER/boot/acme-arietta.dtb</b>
<b>cp output/images/zImage /media/$USER/boot</b>
<b>sudo tar xvf output/images/rootfs.tar -C /media/$USER/rootfs</b>
</pre>

Unmount the microSD and boot on your Aria. It will take about 2 minutes the first time 
to calculate the openssh keys. The next boots it will take just 5 secs.

At login:

* login: __root__
* password: __acmesystems__

### Changing Linux Kernel configuration

If you want to change something of the basic BuildRoot configuration 
(like adding packages) type:

<pre class="minicom">
~/buildroot-2015.08.1$ <b>make menuconfig</b>
</pre>

If you want to change something in the Linux Kernel configuration
(like adding some drivers) type:

<pre class="minicom">
~/buildroot-2015.08.1$ <b>make linux-menuconfig</b>
</pre>


##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)
* [Appfruits GitHub Project - Buildroot on Acqua A5](https://github.com/appfruits/buildroot-boards)

