Upgrade to Linino

Introduction

What changes if you install LininoIO OS? With LininoIO OS you don't need to write your C code application for the MCU. 
It is enough to install LininoIO OS on the MCU side and all of the functionalities, like GPIO, ADC, PWM, I2C, etc. will be exported onto the LininoIO.

To install LininoIO you need:

  • 1) upgrade the LininoIO OS image
  • 2) upgrade the u-boot

following the above order.

Warning: 
Ony if your version is dated before 4 October 2015 follow this guide. 
if you have any doubts then follow the guide to check your version. 
Note: 
Before to upgrade the Linino OS, upload the YunSerialTerminal sketch from File>Examples>Bridge menu on Arduino IDE.

Upgrade your old Arduino Yun to LininoIO OS

If you alredy have an old Arduino Yun board and you want to upgrade your board to LininoIO OS, you must first upgrade your on-board OS from OpenWrt-Yun to LininoOS 
You can find the latest image here

Upgrade your Arduino Yun with sysupgrade

Login as root by means of SSH and type the following commands :

 
 
$ cd /tmp
$ wget http://download.linino.org/linino_distro/lininoIO/latest/lininoIO-generic-linino-yun-squashfs-sysupgrade.bin
$ sysupgrade -v -n lininoIO-generic-linino-yun-squashfs-sysupgrade.bin
 
 
 

after about 1 minute the board will reboot and the new image will be loaded on the board. 
Warning: 
If you have an Arduino Yun Mini use the same steps but you must only change the image name as below:

 
 
$ wget http://download.linino.org/linino_distro/lininoIO/latest/lininoIO-generic-linino-yun-mini-squashfs-sysupgrade.bin
$ sysupgrade -v -n lininoIO-generic-linino-yun-mini-squashfs-sysupgrade.bin
 
 
 

PLEASE NOTE: In this case the new root password will be “arduino" or "doghunter” without quotes.

u-boot upgrade


If you are a Windows user then you can use this other guide, else continue this procedure.

To be able to run this how to you must have an Ethernet connection. 
Once connected by means of the Arduino IDE or of a serial terminal as cu or minicom (i.e.) :

 
 
sudo cu -l /dev/ttyACM0 -s 115200
 
 

( if you use MACOSX 10.9.4, you must use this path: /dev/tty.usbmodem1411 ) push the Linux reset button and type lin to stop the boot of the Linux cpu.

  • Verify that you have a TFTP server installed on your PC. (Windows users can use Windows TFTP Utility:http://sourceforge.net/projects/tftputil/).
  • Verify that the board and the PC are connected via Ethernet on the same LAN.
  • Setup the TFTP server and TFTP client IP addresses at the u-boot prompt (Note about TFTP for MAC OS X 10.9.3):
  • Verify that your board is Connected to PC via USB cable.

Open Serial Monitor press the YUN RST button and press the Enter button a couple of times on your keyboard. It will appear U-boot promp:

 
 
ar7240>
 
 

download the latest version of u-boot from http://download.linino.org/linino_distro/lininoIO/latest/u-boot-linino-yun.bin and put the file in the TFTP server directory, generally /tftpboot or /var/lib/tftpboot. 
If you use an Arduino Yun Mini download here:http://download.linino.org/linino_distro/lininoIO/latest/u-boot-linino-yun-mini.bin.

From the prompt of the Linino U-Boot, type the following commands: (please be sure to connect your Ethernet cable)

 
 
setenv serverip ‹tftp-server-ip›; setenv ipaddr ‹linino-board-ip›;
 
 

on my setup I have:

 
 
ar7240>setenv serverip 192.168.0.101;
ar7240> setenv ipaddr 192.168.0.120;
 
 

Test the TFTP server doing a ping:

 
 
ar7240> ping 192.168.0.101
dup 1 speed 100
Using eth0 device
host 192.168.0.18 is alive
 
 

Transfer the u-boot bin file in the board:  
- For Arduin Yun Mini:

 
 
tftp 0x80060000 u-boot-linino-yun-mini.bin;
 
 

- For Arduin Yun:

 
 
tftp 0x80060000 u-boot-linino-yun.bin;
 
 

Below it is shown an example for Arduino Yun:

 
 
ar7240> tftp 0x80060000 u-boot-linino-yun.bin; 
Using eth0 device
TFTP from server 192.168.0.18; our IP address is 192.168.0.23
Filename 'u-boot-linino-yun.bin'
Load address: 0x80060000
Loading: ####################################
done
Bytes transferred = 181852 (2c65c hex)
 
 


Only if the file was properly downloaded, as shown above, you can proceed erasing the flash and copying the new u-boot.
In case of FAIL, try to understand if the Ethernet connection is present and if the file is in the right position on the TFTP server. 
DON'T type the following command if the tftp failed! 
Erase the old u-boot:

 
 
ar7240> erase 0x9f000000 +0x40000; 
Erase Flash from 0x9f000000 to 0x9f03ffff in Bank #
First 0x0 last 0x3 sector size 0x10000
  3
Erased 4 sectors
 
 

After copy the new uboot following this command:

 
 
ar7240> cp.b $fileaddr 0x9f000000 $filesize;
Copy to Flash... write addr: 9f000000
done
 
 

Congratulations! The new u-boot is ready! Please reboot and proceed to install the new kernel image where the cmdline is taken from the u-boot.

 
 
ar7240> reset
 
 

By default the new boots use the 250k baudrate. Please use the key combination ~1, ~2 to switch to 115200 or 250000 bauds. 
Note: Sometimes the first character could not be correctly recognized then in this case type ~~1 or ~~2. 
After the Reset command it will show the new u-boot prompt, please type the lin command to enter in u-boot console:

 
 
U-Boot 1.1.5-linino-g17593166-dirty (Oct  4 2015 - 02:12:32)
Linino Board (ar9331) U-boot
DRAM: 64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 218k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16777216, sector count = 256
Flash: 16 MB
In:   serial
Out:   serial
Err:   serial
Net:   eth0: b4:21:8a:00:00:00
eth1: b4:21:8a:00:00:01
eth0, eth1
autoboot in 4 seconds (stop with 'lin')...
linino>
 
 


You can check the configuration typing the following command:

 
 
linino> printenv
 
 

  
This it must be the output:

 
 
linino> printenv
bootargs=
bootcmd=run addboard; run addtty;run addparts; run addrootfs; bootm 0x9fEa0000
bootdelay=4
baudrate=250000
ethaddr=0xb4:0x21:0x8a:0x00:0x00:0x10
ipaddr=192.168.1.2
serverip=192.168.1.1
board=linino-yun
addboard=setenv bootargs board=${board}
console=spicons
addtty=setenv bootargs ${bootargs} console=${console}
mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware)
addparts=setenv bootargs ${bootargs} mtdparts=${mtdparts}
addrootfs=setenv bootargs ${bootargs} rootfstype=squashfs,jffs2 noinitrd
erase_env=erase 0x9f040000 +0x10000
dir=
lu=tftp 0x80060000 ${dir}u-boot-${board}.bin&&erase 0x9f000000 +$filesize&&cp.b $fileaddr 0x9f000000 $filesize
lf=tftp 0x80060000 ${dir}lininoIO-generic-${board}-rootfs-squashfs.bin&&erase 0x9f050000 +$filesize&&cp.b $fileaddr 0x9f050000 $filesize
lk=tftp 0x80060000 ${dir}lininoIO-generic-${board}-kernel.bin&&erase 0x9fEa0000 +$filesize&&cp.b $fileaddr 0x9fEa0000 $filesize
stdin=serial
stdout=serial
stderr=serial
ethact=eth0
Environment size: 1044/65532 bytes
linino>
 
 

  
If the UBoot environment configuration is equal at that shown above, then you can go directly to step called "Set properly the bootargs changing the console to ttyATH0", otherwise apply the new default environment following the below steps: 
 

 
 
linino> erase 0x9f040000 +0x10000;
 
 

  
Below the output on monitor: 
 

 
 
linino> erase 0x9f040000 +0x10000;
Erase Flash from 0x9f040000 to 0x9f04ffff in Bank # 1
First 0x4 last 0x4 sector size 0x10000
  4
Erased 1 sectors
 
 

  
Now reset:

 
 
linino>reset;
 
 


After the board reboot a message like *** Warning - bad CRC, using default environment will appear on the console.

 
 
U-Boot 1.1.5-linino-g17593166-dirty (Oct  4 2015 - 02:12:32)
Linino Board (ar9331) U-boot
DRAM: 64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 218k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16777216, sector count = 256
Flash: 16 MB
*** Warning - bad CRC, using default environment
In:   serial
Out:   serial
Err:   serial
Net:   eth0: b4:21:8a:00:00:00
eth1: b4:21:8a:00:00:01
eth0, eth1
autoboot in 4 seconds (stop with 'lin')...
linino>
 
 
 


Type the lin command and push the Send button. 
To avoid the warning message give the following command on the UBoot console

 
 
linino> saveenv
 
 


Below the output shown:

 
 
linino> saveenv
Saving Environment to Flash...
Protect off 9F040000 ... 9F04FFFF
Un-Protecting sectors 4..4 in bank 1
Un-Protected 1 sectors
Erasing Flash...Erase Flash from 0x9f040000 to 0x9f04ffff in Bank # 1
First 0x4 last 0x4 sector size 0x10000
  4
Erased 1 sectors
Writing to Flash... write addr: 9f040000
done
Protecting sectors 4..4 in bank 1
Protected 1 sectors
linino>
 
 

   
Set properly the bootargs changing the console to ttyATH0:

 
 
linino> setenv console ttyATH0,250000
linino> saveenv
 
 

  
This is the output:

 
 
linino> setenv console ttyATH0,250000
linino> saveenv
Saving Environment to Flash...
Protect off 9F040000 ... 9F04FFFF
Un-Protecting sectors 4..4 in bank 1
Un-Protected 1 sectors
Erasing Flash...Erase Flash from 0x9f040000 to 0x9f04ffff in Bank # 1
First 0x4 last 0x4 sector size 0x10000                                                                                                                                 4
Erased 1 sectors
Writing to Flash... write addr: 9f040000
done
Protecting sectors 4..4 in bank 1
Protected 1 sectors
 
 
 

Finally type the reset on the command line:

 
 
linino> reset
 
 

Now your board is upgraded.