LininoIO OS upgrade from U-boot

U-boot

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
 
 

Note: 
If you use MACOSX 10.9.4, you must use this path: /dev/tty.usbmodemXXXX .

  • 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.

Push the Linux reset button and type lin to stop the boot of the Linux cpu.

 
 
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>
 
 

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
Note: 
If you use Linux OS or Mac OS be sure that the files insert in the tftpboot folder have the execution permissions.

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:

 
 
linino> setenv serverip 192.168.0.101;
linino> setenv ipaddr 192.168.0.120;
 
 

Test the TFTP server doing a ping, in this example:

 
 
linino> ping 192.168.0.101;
 
 

Setting TFTP server

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:

 
 
linino> 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)
 
 

Warning: 
Be sure that the u-boot binary file is correctly transferred. If the tftp failed then stop and repeat the steps again.

If the file was properly downloaded, you can proceed: erase the flash and copy 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.

 
 
linino> erase 0x9f000000 +0x40000; 
Erase Flash from 0x9f000000 to 0x9f03ffff in Bank #
First 0x0 last 0x3 sector size 0x10000
  3
Erased 4 sectors
linino> cp.b $fileaddr 0x9f000000 $filesize;
Copy to Flash... write addr: 9f000000
done
 
 

Kernel

Download the kernel file: 
- If you have an Arduino Yun click here 
- If you have an Arduino Yun Mini click here
- Transfer the kernel file: 
- For Arduino Yun:

 
 
tftp 0x80060000 lininoIO-generic-linino-yun-kernel.bin;
 
 

- For Arduino Yun Mini:

 
 
tftp 0x80060000 lininoIO-generic-linino-yun-mini-kernel.bin;
 
 

In this example it is used an Arduino Yun: 
Only if the transfer is successful then continue the procedure, else check the network and the TFTP server and try again the transfer 
Transfer the kernel file 
- Delete the old file, pay attention that the command and the address are correct:

 
 
erase 0x9fEa0000 +0x140000;
 
 

Delete old file 
- Copy the new file, pay attention that the command and the address are correct

 
 
cp.b $fileaddr 0x9fea0000 $filesize;
 
 

Copy new kernel file

Rootfs

Download the Rootfs file: 
- If you have an Arduino Yun click here
- If you have an Arduino Yun Mini click here
- Transfer the Rootfs file using the below command: 
- For Arduino Yun:

 
 
tftp 0x80060000 lininoIO-generic-linino-yun-rootfs-squashfs.bin;
 
 

- For Arduino Yun Mini:

 
 
tftp 0x80060000 lininoIO-generic-linino-yun-mini-rootfs-squashfs.bin;
 
 

In this example it is used an Arduino YUN. 
Only if the transfer is successful then continue the procedure, else check the network and the TFTP server and try again the transfer 
Transfer Rootfs file 
- Delete the old file, pay attention that the command and the address are correct:

 
 
erase 0x9f050000 +0xE50000;
 
 

Erase old  Rootfs file 
- Copy the new file, pay attention that the command and the address are correct

 
 
cp.b $fileaddr 0x9f050000 $filesize;
 
 

Copy the new Rootfs file 
- Now type Reset:

 
 
linino> reset
 
 

Optional steps

If you want erased the UBoot environment partition, in order to apply the new default environment, it is possible to delete it with the command:

 
 
linino> erase 0x9f040000 +0x10000;
Erase Flash from 0x9f040000 to 0x9f04ffff in Bank # 1
First 0x4 last 0x4 sector size 0x10000
  4
Erased 1 sectors
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>
 
 

To avoid the warning message give the following command on the UBoot console

 
 
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 booargs changing the console to ttyATH0:

 
 
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
linino> reset