#Buildroot and Qt on Arietta G25 + XTERM-01

<div class="text-success lead">
This article illustrates how to generate from sources a BuildRoot distribution for Arietta G25 + XTERM-01 2.8 lcd
with Qt graphic libraries and Qt examples
</div>

##Features

* Fast boot: less than 6 secs
* Small: less than 50MByte
* Buidroot 2015.05, Kernel 4.0.4, Qt 4.8.6

<center>
<iframe width="560" height="380" src="https://www.youtube.com/embed/dxFgib5qrvA" frameborder="0" allowfullscreen></iframe>
</center>

##Building BuildRoot from sources

Follow this article: @article='buildroot_arietta' but instead to launch
__make acme-arietta_defconfig__ launch: 

<pre class="minicom">
~/buildroot-2015.05.acme$ <b>make acme-xterm-01_defconfig</b>
</pre>

This will add Qt and Qt examples to your Buildroot image. Before to launch 
__make__ follow this instruction to add the right driver
to manage the SPI display on your Linux Kernel.

##Install the Linux framebuffer drivers for small TFT LCD display modules

Move inside the __~/buildroot-2015.05.acme/output/build/linux-4.0.4/drivers/video__ directory:

<pre class="minicom">
tanzilli@ubuntu:~$ <b>cd ~/buildroot-2015.05.acme/output/build/linux-4.0.4/drivers/video</b>
</pre>
  
and clone the __fbtft__ repository. 

<pre class="minicom">
../video$ <b>git clone https://github.com/notro/fbtft.git</b>
</pre>
  
edit the <b>drivers/video/Kconfig</b> file by adding this line before 
the __endmenu__ line:

<pre class="minicom">
source "drivers/video/fbtft/Kconfig"
</pre>

edit the <b>drivers/video/Makefile</b> file adding this line after 
__obj-y += fbdev/__ line:  

<pre class="minicom">
obj-y += fbtft/
</pre>
  
Go back to __~/buildroot-2015.05.acme__ directory and launch:

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

To enable the frame buffer and the LCD driver:

<pre class="minicom">
---> Device Drivers
	---> Graphics support
		< * > Support for frame buffer devices  ---> 
		< * > Support for small TFT LCD display modules  ---> 
			< * > FB driver for the ILI9341 LCD Controller 
		
</pre>

To enable the touch screen:

<pre class="minicom">
---> Device Drivers
	< * > Industrial I/O support  --->
		Analog to digital converters  --->
			< * > Atmel AT91 ADC  
</pre>

exit from the configuration menu and launch:

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

after about 1 hour (on my Mac Book pro I5) the microSD files will be ready:

<pre class="minicom">
tanzilli@ubuntu:~/buildroot-2015.05.acme$ ls -al output/images/
total 43660
drwxrwxr-x 2 tanzilli tanzilli     4096 Jun  3 08:36 .
drwxrwxr-x 6 tanzilli tanzilli     4096 Jun  3 08:15 ..
-rw-rw-r-- 1 tanzilli tanzilli    24226 Jun  3 10:46 acme-arietta.dtb
-rwxrwxr-x 1 tanzilli tanzilli    14529 Jun  3 08:26 boot.bin
-rw-rw-r-- 1 tanzilli tanzilli 41666560 Jun  3 10:46 rootfs.tar
-rwxrwxr-x 1 tanzilli tanzilli  2986064 Jun  3 10:46 zImage
</pre>


Insert a [formatted microSD card](/microsd_format) and copy these files on it:

<pre class="minicom">
~/buildroot-2015.05.acme$ <b>cp output/images/boot.bin /media/$USER/kernel</b>
~/buildroot-2015.05.acme$ <b>cp output/images/acme-arietta.dtb /media/$USER/kernel</b>
~/buildroot-2015.05.acme$ <b>cp output/images/zImage /media/$USER/kernel</b>
~/buildroot-2015.05.acme$ <b>sudo tar xvf output/images/rootfs.tar -C /media/$USER/rootfs</b>
</pre>

At the first boot Arietta will be very slow (about 2 minutes) to calculate the openssh keys. 
At the next boots it will need less than 5 secs.

##Try a Qt example

Get the access to the board using the [DPI interface](/DIP) or via [SSH](/ssh).

Login with as __root__ using the password __acmesystems__

Calibrate the touchscreen by typing:

<pre class="minicom">
# <b>ts_calibrate</b>
</pre>  

then try one of the Qt example available:

<pre class="minicom">
# <b>cd /usr/share/qt/examples/widgets/sliders</b>
# <b>./sliders</b> 
</pre>  

now run this command in order to set Qt to use tslib:

<pre class="minicom">
# <b>export QWS_MOUSE_PROTO=Tslib:/dev/input/event0</b>
</pre>  

then launch the first example ([see the video](https://youtu.be/dxFgib5qrvA)):

<pre class="minicom">
# <b>/sliders -qws</b>
</pre>  

<fieldset markdown="1" >
<table markdown="1" class="noborder">
<tr>
<td valign="top">
<a href="http://terzo.acmesystems.it/download/microsd/arietta_webcam.img.zip">
<img src="/images/icon_microsd_image.jpg"/>
</a>

</td>
<td>
##Download the ready-to-use microSD binaries 

* Format a microSD using gparted in this way:
  * First partition 32MB (or more) FAT16 or FAT32
  * Second partition large as you like as EXT4  
* Copy in the first partition these files:
  * [boot.bin](https://www.acmesystems.it/download/microsd/buildroot_xterm_qt/boot.bin)
  * [zImage](https://www.acmesystems.it/download/microsd/buildroot_xterm_qt/zImage)
  * [acme-arietta.dtb](https://www.acmesystems.it/download/microsd/buildroot_xterm_qt/acme-arietta.dtb)
* Untar as root (sudo tar -xvf rootfs.tar) in the second partition this file:
  * [rootfs.tar](https://www.acmesystems.it/download/microsd/buildroot_xterm_qt/rootfs.tar)
</blockquote>
  
##Login data

* SSH, and Debug port: user <b>root</b> password <b>acmesystems</b>

##Software versions

* Kernel Linux 4.0.4
* Buildroot 2015.05

##Configuration files

* [acme-arietta.dts](https://www.acmesystems.it//download/microsd/buildroot_xterm_qt/acme-arietta.dts)
* [buildroot.defconfig](https://www.acmesystems.it//download/microsd/buildroot_xterm_qt/buildroot.defconfig)
* [linux.defconfig](https://www.acmesystems.it//download/microsd/buildroot_xterm_qt/linux.defconfig)

</td>
</tr>
</table>
</fieldset>

##Related links

* [The BuildRoot user manual](http://buildroot.uclibc.org/downloads/manual/manual.html)
* [BuildRoot web page](http://www.buildroot.net/)
* [Browseable BuildRoot repository](http://git.buildroot.net/buildroot)
* [Appfruits - Compiling Qt 4.8.5 for Arietta G25](http://www.appfruits.com/2015/01/compiling-qt-4-8-5-for-arietta-g25/)
* [Appfruits GitHub Project - Buildroot on Acqua A5](https://github.com/appfruits/buildroot-boards)


@shop='XTERM-01'
@shop='ARIETTA-G25'
@shop='ARIETTA-G25-256'
@shop='STRIP-001'
