[SOLVED] Preparing for U-Boot serial flash in Debian 10 - recommendations?

To mount root R/W mode in "emergency mode" you may use command mount_root and correct network config. If it fail (because of jffs2 errors) you need start again from loading initramfs.bin and etc.
Typical steps fro scratch:

tftpboot 81000000 initramfs.bin
bootm 81000000

Then backup all /dev/mtd* with dd and scp to Big Brother. And flash sysupgarde.bin from openwrt web interface.
Total recovery with only serial console is possible but may vary because of vendor's modification of uboot code. Usually next sequence of command:

tftpboot 81000000 sysupgrade.bin
erase bc170000 690000
cp.b 81000000 bc170000 690000

there 0x690000 is size of sysupgrade.bin rounded up to next 64k boundary.
Flash is mapped at memory address 0xbc000000 so (as site info say):

# cat /proc/mtd 
dev:    size   erasesize  name  
mtd0: 00800000 00010000 "ALL"
mtd1: 00030000 00010000 "Bootloader"
mtd2: 00010000 00010000 "Config"
mtd3: 00010000 00010000 "Factory"
mtd4: 00010000 00010000 "5G_RF"
mtd5: 00010000 00010000 "Wolf_Config"
mtd6: 00080000 00010000 "MyDLink"
mtd7: 00080000 00010000 "Jffs2"
mtd8: 000f8ebc 00010000 "Kernel"
mtd9: 00597144 00010000 "RootFS"

openwrt firmware image start at 0xbc170000.
Some uboot modification ignore 1st parameter of tftpboot and load image at fixed memory address (8010000 as example). May check with uboot command:

md 81000000

Sometimes erase ignore all parameters and is used as "erase.linux" or "erase.uboot" for erasing firmware or uboot parts of flash. Or erase interpret parameters as flash adresses:

erase 170000 690000

I've seen variant there erasing flash is performed with command:

spi erase 170000 690000

So see carefully uboot commands help and check all steps with memory display command ("md").

1 Like