Upgrade the u-boot for Windows users

U-boot upgrade for Windows user


If you are a Windows user then follow this guide:

- First be sure that: 
1) the board is plugged to PC via USB cable; 
2) the board is connected via Ethernet; 
Arduino Yun 
3) the YunSerialTerminal sketch is been uploaded into the board from File>Examples>Bridge menu, use the Arduino IDE 1.7.8 or later, you can download it here
YunSerialTerminal sketch

 - Second download the u-boot latest version, you can use these links: 
1) if you have an Arduino Yun, click here
2) if you have an Arduino Yun Mini, click here.

- Third install a TFTP server: 
1) you can use Windows TFTP Utility, download it here
2) Install the tool as administrator. 
TFTPUtil GUI license 
TFTPUtil GUI: Installation Options 
TFTPUtil GUI: Installation Folder 
TFTPUtil GUI: Setup completed 
3) Open Windows TFTP Utility and set it: 
TFTPUtil GUI: Windows application 
TFTPUtil GUI 
select the path of your u-boot file; 
TFTPUtil GUI: root folder 
TFTPUtil GUI: Option 
set the ip address. 
TFTPUtil GUI: setting  
click OK when you finish the setting; 
TFTPUtil GUI actived 
4)Check that the Server is working.

 - Enter in u-boot console: 
1) open a Serial monitor; 
2) push the Yun RST and insert the command lin, when it is requested; and click on Send button; 
u-boot console 
3) now it will appear the u-boot prompt:

 
 
ar7240>
 
 

  
 - Now pay attention and follow these steps: 
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›;
 
 

 In this example the setting is:

 
 
ar7240>setenv serverip 192.168.60.124;
ar7240> setenv ipaddr 192.168.60.182;
 
 

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

 
 
ar7240> ping 192.168.60.124
 
 

Ping server 
If the ping is successful, then you continue the guide, else check the network and the tftp server or click here to follow this other guide to realize a connection point to point.   
- For Arduin Yun:

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

 - For Arduin Yun Mini:

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

Below it is shown an example for Arduino Yun:

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

Transfer the u-boot file   
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 old file 
After follow this command to copy the new u-boot:

 
 
ar7240> cp.b $fileaddr 0x9f000000 $filesize;
 
 

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

 
 
ar7240> reset
 
 

By default the new boots use the 250k baudrate. Please change the baudrate using the key combination ~1 (ASCII code: ALT 126, 1), ~2 (ASCII code: ALT 126, 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 u-boot is upgraded.