#OpenWRT 15.05
<img src="./fox_openwrt.jpg">
<abstract>
This article illustrate how to compile and install OpenWRT on the FOX Board G20
</abstract>
##About OpenWRT
"<i>OpenWrt is a highly extensible GNU/Linux distribution for embedded devices (typically wireless routers).
Unlike many other distributions for these routers, OpenWrt is built from the ground up to be a
full-featured, easily modifiable operating system for your router. In practice, this means that
you can have all the features you need with none of the bloat, powered by a Linux kernel that's more
recent than most other distributions</i>" [Read more...](https://wiki.openwrt.org/about/start)
## Requirements
* This procedure was tested on a Linux PC with <b>Ubuntu 15.10</b>
* It is advisable to have a [Debug Port Interface](/DPI) or similar during the kernel bootstrap
##Requested packages:
Install these packages on your Linux PC
<pre class="terminal">
~$ <b>sudo apt-get update</b>
~$ <b>sudo apt-get -y install git openssl unzip</b>
~$ <b>sudo apt-get -y install binutils flex bison autoconf gettext texinfo</b>
~$ <b>sudo apt-get -y install sharutils subversion libncurses5-dev ncurses-term zlib1g-dev gawk</b>
~$ <b>sudo apt-get -y install build-essential</b>
~$ <b>sudo apt-get -y install libssl-dev</b>
</pre>
##Step-by-step procedure
Clone the OpenWRT git repository:
<pre class="terminal">
~$ <b>git clone git://git.openwrt.org/15.05/openwrt.git</b>
~$ <b>cd openwrt</b>
</pre>
Update the software packages (feed)
<pre class="terminal">
~/openwrt$ <b>./scripts/feeds update –a</b>
~/openwrt$ <b>./scripts/feeds install -a</b>
</pre>
Save this file in the openwrt directory and rename it <b>.config</b>:
* [acme-foxg20_defconfig](./acme-foxg20_defconfig)
Select your configuration
<pre class="terminal">
~/openwrt$ <b>make menuconfig</b>
~/openwrt$ <b>make defconfig</b>
~/openwrt$ <b>make prereq</b>
</pre>
Configure the Linux Kernel
<pre class="terminal">
~/openwrt$ <b>make kernel_menuconfig</b>
</pre>
Launch the compilation
<pre class="terminal">
~/openwrt$ <b>make V=s</b>
</pre>
Copy the kernel image and the device tree blob
<pre class="terminal">
~/openwrt$ <b>cd bin/at91</b>
~/openwrt/bin/at91$ <b>cat openwrt-at91-legacy-zImage openwrt-at91-legacy-9g20ek-oftree.dtb > /media/$USER/boot/uImage</b>
</pre>
Copy the rootfs contents
<pre class="terminal">
~/openwrt/bin/at91$ <b>sudo tar -xvzpSf openwrt-at91-legacy-AT91SAM9G20EK-rootfs.tar.gz -C /media/$USER/rootfs</b>
</pre>
Unmount the microSD, insert the [debug port](/DPI) and try. Press a key on your serial terminal to
get the access to the system prompt:
<pre class="terminal">
BusyBox v1.23.2 (2016-03-31 20:47:06 CEST) built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
CHAOS CALMER (Chaos Calmer, r49097)
-----------------------------------------------------
* 1 1/2 oz Gin Shake with a glassful
* 1/4 oz Triple Sec of broken ice and pour
* 3/4 oz Lime Juice [ 45.000000] random: nonblocking pool is initialized
unstrained into a goblet.
* 1 1/2 oz Orange Juice
* 1 tsp. Grenadine Syrup
-----------------------------------------------------
root@OpenWrt:/#
</pre>
##Procedura rapida partendo dai file compilati
Tempo richiesto: <b>Circa 10 minuti</b>
Per seguire questa pocedura occorre:
* Una microSD da almeno 1GB
* Una macchina Linux Ubuntu con Gparted installato
Formattare la microSD con due partizzioni fat32 e ext4 come descritto in questo articolo:
* [Formattazione microSD](http://www.acmesystems.it/microsd_format)
Creare una directory nella vostra home directory e copiarci detro i seguenti files:
* [boot.tar.bz2](./boot.tar.bz2) Contenuto della prima partizione
* [rootfs.tar.bz2](./rootfs.tar.bz2) Contenuto della seconda partizione
Montare la microSD quindi dare i i seguenti comandi all'interno della directory appena creata:
<pre class="terminal">
tar -xvjpSf boot.tar.bz2 -C /media/$USER/boot
sudo tar -xvjpSf rootfs.tar.bz2 -C /media/$USER/rootfs
</pre>
Smontare la microSD e provare a fare il boot sulla FOX
##Links
* [OpenWrt web page](https://openwrt.org/)
* [OpenWrt doc](https://wiki.openwrt.org/doc/start)
* [OpenWrt build system – Installation](https://wiki.openwrt.org/doc/howto/buildroot.exigence)
* [Network configuration](https://wiki.openwrt.org/doc/uci/network)
* [Installing LuCI on uHTTPd](https://wiki.openwrt.org/doc/howto/luci.essentials)
##Credits
Many thanks to <b>Leo Guainella</b> for his effort to find and provide this info
2018 Ⓒ TanzoLab