Arduino Yun pairs a commonly found wifi router chipset, the Atheros AR9331, with a classical AVR microcontroller.
The Yún’s Bridge library enables communication between the two processors, connecting the hardware serial port of the AR9331 to Serial1 on the 32U4 (digital pins 0 & 1). Another post will describe the library in greater depth. The serial port of the AR9331 exposes the Linux console (aka, the command line interface, or CLI) for communication with the 32U4. The console is a means for the Linux kernel and other processes to output messages to the user and receive input from the user. File and system management tools are installed by default. It’s also possible to install and run your own applications using Bridge.
The ATmega32U4 can be programmed from the AR9331 by uploading a sketch through the Yún’s WiFi interface. When connected to the same WiFi network as your computer, the board will appear under the "Port" menu of the Arduino IDE. The sketch will be transferred to the AR9331, and the Linux distribution will program the ATmega32U4 through the SPI bus, emulating an AVR ISP programmer.
Below steps from Building a custom image for Arduino YUN, via Fiore Basile:
As soon as I got my hands on the YUN I found the selection of packages lacks many interesting pieces of software that could help building interesting appliances. I think Arduino people selected those packages that would easily fit in the minimal 64MB flash.
So first of all I formatted a 4GB mini-sd as ext3 and plugged it in to the mini, it was recognized as /dev/sda1, so I quickly added an /opt folder and mounted in there instead. Now I have plenty of space to add my custom packages, and some "secure" disk space just in case I have to wipe my YUN loosing all flash content.
Resetting the YUN flash is done by holding the reset button for 30 seconds. Holding it for 5 just resets the WiFi config.
Then I spent some time to collect all the information needed to setup our own buildroot for the YUN, here you can find a few tips to do it yourself.
First of all you should clone the Arduino YUN buildroot sources, available from github.
git clone https://github.com/arduino/linino.git lininoThis will checkout the OpenWRT buildroot with specific Arduino YUN modifications
In order to successfully compile the builroot you'll need a few packages installed: for Debian Stable you can easily get them by running as root (or with sudo)
apt-get install subversion build-essential git-core libncurses5-dev zlib1g-dev gawk asciidoc \ bash bc binutils bzip2 fastjar flex g++ gcc util-linux zlib1g-dev libncurses5-dev \ libssl-dev perl-modules python2.6-dev rsync ruby sdcc unzip wget gettext xsltproc \ zlib1g-dev libxml-parser-perlI've included a few you might already have installed, just in case someone had removed them, it won't hurt anyway to put them on the command line.
Once you're done with prerequisites go on to configure the kernel:
cd linino/trunk ./scripts/feeds update -a ./scripts/feeds install -a make menuconfigIf all the steps above have been done correctly you will be presented with a familiar menu, similar to the standard Linux kernel build. Go on and select the kernel modules, and packages you want to build.
Once you exit you can compare with diff the generated config with the one available on the Arduino YUN package repository, this should be located at http://download.linino.org/dogstick/all-in-one/latest/build-config.txt.
EDIT: If you want to keep the same config and packages getting built by Yun developers, also do:
./scripts/feeds uninstall -a rm -rf feeds ./scripts/feeds update -a ./scripts/feeds install -a rm -f .config git checkout .config make oldconfigBuild it Now you can just run make to start the build process, get a cup of coffee, or several considering it needs to fetch many packages i.e. the Linux kernel and build lots of stuff.
make V=sPlease note that using the V=s param switches on verbose output. If you like you can add -j4 or -j8 depending on how many cores you configured on your machine or VM to speed things up a little.
At the end of the process you should have images ready to be uploaded via TFTP (I'm currently investigating how), and a complete cross-compiling toolchain to test out new packages, and eventually package and contribute them to the offical repository.