Reflashing the OpenWrt 1.5.3 on Yun Rev.1 (the old one)

Hello,
today I rebooted my old arduino Yun, which I haven't used for over 3 years, and I wanted to update the programs.
No success. :slightly_frowning_face:
The links for opkg downloads were no longer valid and the ones I found didn't work anyway.

So I decided to put the latest version of OpenWRT indicated on the Arduino site,
http://arduino.cc/download_handler.php?f=/openwrtyun/1/YunImage_v1.5.3.zip
but following the site procedure on
https://www.arduino.cc/en/Tutorial/YunSysupgrade
using the web-based method first, my poor Yun died. :sob:

So I have performed the TFTP method, always from the Arduino site
https://www.arduino.cc/en/Tutorial/YunUBootReflash
and I stopped from the fact that, even entering Linino, my Yun doesn't see the ethernet cable.

From PC Windows the ping to Yun says that it is unreachable.

If I restart Yun without entering Linino, the ping on Yun says that it is reachable.

Is there another way to transfer U-Boot, Kernel and OpenWRT to work again in my Yun rev.1?

I attach you some info, hoping they are useful:

This is the serial monitor when I enter in Linino and do the procedure... infinite loop not copied...

U-Boot 1.1.5-linino-g223d5a8c-dirty (Jun 2 2016 - 12:11:12)

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>

linino> setenv serverip 192.168.1.64;

linino> setenv ipaddr 192.168.1.67;

linino> tftp 0x80060000 openwrt-ar71xx-generic-linino-u-boot.bin;

dup 1 speed 100
Using eth0 device
TFTP from server 192.168.1.64; our IP address is 192.168.1.67
Filename 'openwrt-ar71xx-generic-linino-u-boot.bin'.
Load address: 0x80060000
Loading: *T T T T T T T T T T
Retry count exceeded; starting again
eth1 link down
FAIL

This is my ping to my Yun in this situation:

PS C:\WINDOWS\system32> ping 192.168.1.67

Esecuzione di Ping 192.168.1.67 con 32 byte di dati:
Risposta da 192.168.1.64: Host di destinazione non raggiungibile.
Risposta da 192.168.1.64: Host di destinazione non raggiungibile.
Risposta da 192.168.1.64: Host di destinazione non raggiungibile.
Risposta da 192.168.1.64: Host di destinazione non raggiungibile.

Statistiche Ping per 192.168.1.67:
Pacchetti: Trasmessi = 4, Ricevuti = 4,
Persi = 0 (0% persi),
PS C:\WINDOWS\system32>

This is the serial monitor data if I don't press any button:

U-Boot 1.1.5-linino-g223d5a8c-dirty (Jun 2 2016 - 12:11:12)

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')...

Booting image at 9fea0000 ...

Image Name: MIPS OpenWrt Linux-3.3.8
Created: 2014-11-14 8:00:46 UTC
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 1185448 Bytes = 1.1 MB
Load Address: 80060000
Entry Point: 80060000
Verifying Checksum at 0x9fea0040 ...OK
Uncompressing Kernel Image ... OK
No initrd

Transferring control to Linux (at address 80060000) ...

Giving linux memsize in bytes, 67108864

Starting kernel ...

[ 0.000000] Linux version 3.3.8 (jenkins@jenkins) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Fri Nov 14 08:57:34 CET 2014
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[ 0.000000] SoC: Atheros AR9330 rev 1
[ 0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 04000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Zone PFN ranges:
[ 0.000000] Normal 0x00000000 -> 0x00004000
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] Early memory PFN ranges
[ 0.000000] 0: 0x00000000 -> 0x00004000
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: board=Yun console=ttyATH0,250000 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) rootfstype=squashfs,jffs2 noinitrd
.
.
. omissis
.
.
[ 39.750000] loop: module loaded
[ 39.890000] PPP generic driver version 2.4.2
[ 39.940000] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 40.060000] NET: Registered protocol family 24
[ 40.100000] nf_conntrack version 0.5.0 (954 buckets, 3816 max)
[ 40.550000] i2c /dev entries driver
[ 40.580000] Linux video capture interface: v2.00
[ 40.700000] fuse init (API version 7.18)

here it end to work, but the ethernet cable is working:

PS C:\WINDOWS\system32> ping 192.168.1.67

Esecuzione di Ping 192.168.1.67 con 32 byte di dati:
Risposta da 192.168.1.67: byte=32 durata=1ms TTL=64
Risposta da 192.168.1.67: byte=32 durata=1ms TTL=64
Risposta da 192.168.1.67: byte=32 durata=3ms TTL=64
Risposta da 192.168.1.67: byte=32 durata=1ms TTL=64

Statistiche Ping per 192.168.1.67:
Pacchetti: Trasmessi = 4, Ricevuti = 4,
Persi = 0 (0% persi),
Tempo approssimativo percorsi andata/ritorno in millisecondi:
Minimo = 1ms, Massimo = 3ms, Medio = 1ms

Any ideas?

Ok, I messed up a few things and did various tests.

I found and executed a function in

root @ Arduino: / usr / bin # ./reset-to-factory-anyway

and then I ran:

root @ Arduino: / usr / bin # reboot

(I got the terminal window by pressing Enter when indicated in the Arduino IDE serial monitor).

Then I checked that NL / CR was set in the serial monitor windowof Arduino IDE, I checked the ip addresses with a scanner (NetSetMan) and checked that in the TFTPUtilGui settings, by clicking on the gear icon, the IP address of the PC was written and that the UDP port was 69.
I pressed the reset button as indicated in https://www.arduino.cc/en/Tutorial/YunUBootReflash and wrote lin + enter when it appears to be done in the serial monitor and then I followed step by step the next instructions with enter after every end of line:

setenv serverip 192.168.X.X;
setenv ipaddr 192.168.Y.Y;
tftp 0x80060000 openwrt-ar71xx-generic-linino-u-boot.bin;
erase 0x9f000000 + 0x40000;
cp.b $ fileaddr 0x9f000000 $ filesize;
erase 0x9f040000 + 0x10000
tftp 0x80060000 openwrt-ar71xx-generic-yun-16M-kernel.bin;
erase 0x9fEa0000 + 0x140000;
cp.b $ fileaddr 0x9fea0000 $ filesize;
tftp 0x80060000 openwrt-ar71xx-generic-yun-16M-rootfs-squashfs.bin;
erase 0x9f050000 + 0xE50000;
cp.b $ fileaddr 0x9f050000 $ filesize;
bootm 0x9fea0000
reboot

I waited for the necessary time (10 minutes) for the restart.
I went to the wired Yun IP address 192.168.Y.Y and found the new login page and everything was updated.

I've done it! :slight_smile:

I hope I was helpful to someone and thank you for reading up to this point.
Thank you all!

One day I will understand why it has worked now ...

I see only now that the LEDs on the board behave in a strange way:

the green and white LEDs are always lit.
The white one is much brighter than the green one and it bothers.

I think is the USB white LED. How can I turn off? Or blink on USB activity?

The revision 1 Yun comes with uboot 1.1.4
By the time you made your first post, you had already upgraded the bootloader to 1.1.5
You did some things even quicker than you thought :slight_smile:

openwrt-ar71xx-generic-linino-u-boot.bin is the bootloader file.

Once you have uboot 1.1.5 on the old Yun, and you want to flash some other software (a newer LEDE/OpenWRT), you would not have to flash the bootloader again. Flashing only the kernel+rootfs would suffice (erasing the uboot environment space is optional).

Always take extra care when writing to that bootloader memory (starting at 0x9f000000, 256 KB, running to 0x9f040000). If you write the wrong software in that space, your device has no more way to boot properly. And if it can't boot, you can not put in those commands anymore to flash the device.

This reads the bootloader file via tftp:

tftp 0x80060000 openwrt-ar71xx-generic-linino-u-boot.bin;

This erases the memory occupied by the bootloader:

erase 0x9f000000 +0x40000;

And this line flashes the file-content to the bootloader space:

cp.b $fileaddr 0x9f000000 $filesize;

This command erases the uboot environment:

erase 0x9f040000 +0x10000

The uboot-env memory is used to store variables/settings.
In uboot 1.1.5 there are a lot more commands to use (from the uboot prompt), like saveenv. Uboot 1.1.4 was able to set values, but it was not able to save those values to the uboot-env.
In your case, you set a few vars yourself, you can execute the saveenv command, so you wouldn't have to enter those values again:

setenv serverip 192.168.X.X;
setenv ipaddr 192.168.Y.Y;
saveenv

If you would ever want to upgrade to a bigger kernel (than the 1280KB original Yun's kernel size), you would need to edit some of the variables stored in the uboot-env, and save those values, so the Yun can read the values after it reboots. The original rev 1 Yun, with uboot 1.1.4, can not do that.