Exactly. This looks to be easily recoverable at this point, but if you don't know what you're doing it's bound to get worse.
kwboot sends a copy of u-boot over serial to the device's RAM, so it can boot up (once) even if there is nothing in the internal flash.
This process completes successfully.
U-boot starts up with the typical u-boot message of processor type, RAM and flash sizes.
It starts up the network and tries to ping a server at 10.10.10.5 but there is no response.
It finds your Kingston USB flash drive and apparently loads /boot/uEnv.txt from it, then checks for two files to potentially load and boot.
/boot/zImage
/boot/initramfs-linux.img
Those files are not found.
So, as the last resort, it boots from internal flash.
There is a kernel in internal flash but it doesn't match the machine ID. System halts.
Those all FF numbers suggest they were read from corrupted / erased flash.
Right. There is a very small ROM in the SoC which runs before anything in flash. It's function is mostly to get the RAM controller and RAM chips initialized and usable to store data. Then (in normal operation) it will load the bootloader from flash to RAM and jump to it.
A few SoC have an additional feature to load from serial to RAM, to recover in case there is not a usable bootloader in the flash.
The problem seems to have started when I followed some instructions for installing OpenWrt on this unit, in particular the command:-
nand erase 0x0 0x100000
From the section
Install u-boot and OpenWrt 18.06.1 into NAND via serial cable and tftp-server
in
This seems to have zapped the existing uBoot, but I suspect the environment remains and that is interfering in the boot. Not exactly sure where that lives...
Here is my environment:-
GoFlexHome> printenv
baudrate=115200
bootcmd=run startboot; run bootubi
bootdelay=3
bootdir=/boot
bootfilem=uImage
bootfilez=zImage
bootm=run load_debian; echo Booting from ${type} ${disk}:1 ...; bootm ${uimage_addr} ${initrd_addr} ${fdt_addr}
bootpart=1:1
bootubi=echo Trying to boot from NAND ...; if run mountubi; then ubifsload ${loadaddr} /boot/zImage;ubifsload ${fdtaddr} /boot/dtbs/${fdtfile}; ubifsumount; setenv boota
rgs console=${console} ubi.mtd=1 root=ubi0:rootfs ro rootfstype=ubifs rootwait ${mtdparts}; bootz ${loadaddr} - ${fdtaddr}; fi
console=ttyS0,115200
devnum=2
ethact=egiga0
ethaddr=00:10:75:28:cc:00
fdt_addr=0x1c00000
fdt_file=/boot/dts/kirkwood-goflexhome.dtb
fdtaddr=0x800000
fdtdir=/boot/dts
fdtfile=kirkwood-goflexhome.dtb
fileaddr=810000
filesize=2eb
initrd=/boot/uInitrd
initrd_addr=0x1100000
ipaddr=192.168.1.23
load_debian=setenv type usb; setenv disk 0; run set_bootargs; echo Running loadfdt ...;run loadfdt; echo Running loaduinitrd ...;run loaduinitrd; echo Running loaduimage
...; run loaduimage
loadaddr=0x810000
loadfdt=ext2load ${type} ${disk}:1 ${fdt_addr} ${fdt_file}
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfilez} || load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfilem}
loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/${rdfile}
loaduimage=ext2load ${type} ${disk}:1 ${uimage_addr} ${uimage}
loaduinitrd=ext2load ${type} ${disk}:1 ${initrd_addr} ${initrd}
mainargs=setenv bootargs console=${console} ${mtdparts} root=${root} rw rootwait ${optargs} ${ncargs}
mountubi=ubi part rootfs; ubifsmount ubi0:rootfs
mtddevname=u-boot
mtddevnum=0
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),-(rootfs)
ncip=10.10.10.5
ncipk=10.10.10.4
netconsole=on
partition=nand0,0
preboot=if env exists netconsole && test ${netconsole} = on; then if ping ${ncip}; then setenv stdin nc; setenv stdout nc; setenv stderr nc; version; if env exists ncarg
susr; then echo ncargs has been defined by user; setenv ncargs ${ncargsusr}; else setenv ncargs ignore_loglevel netconsole=6665@${ipaddr}/eth0,6666@${ncipk}/; fi; fi; el
se echo Netconsole has been turned off.; echo To turn it on, set netconsole variable to on.; setenv stdin; setenv stdout; setenv stderr; setenv ncargs; fi
rdaddr=0x1100000
rdfile=initramfs-linux.img
serverip=192.168.1.2
set_bootargs=setenv bootargs console=$console root=LABEL=rootfs rootdelay=10 $mtdparts
startboot=usb start; ide reset; for devtype in usb ide; do setenv devnum 0; while ${devtype} dev ${devnum}; do echo ${devtype} found on device ${devnum}; setenv bootpart
${devnum}:1; echo Checking for: ${bootdir}/uEnv.txt ...; if test -e ${devtype} ${bootpart} ${bootdir}/uEnv.txt; then load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/
uEnv.txt; env import -t ${loadaddr} ${filesize}; echo Loaded environment from ${bootdir}/uEnv.txt; echo Checking if uenvcmd is set ...; if test -n ${uenvcmd}; then echo
Running uenvcmd ...; run uenvcmd; fi; fi; if run loadimage; then if env exists root; then echo root has been defined by user; else part uuid ${devtype} ${bootpart} uuid;
setenv root PARTUUID=${uuid}; fi; run mainargs; if run loadfdt; then if run loadrd; then bootz ${loadaddr} ${rdaddr}:${filesize} ${fdtaddr}; else bootz ${loadaddr} - ${
fdtaddr}; fi; else if run loadrd; then bootm ${loadaddr} ${rdaddr}:${filesize}; else bootm ${loadaddr}; fi; fi; else echo No kernel found; fi; setexpr devnum ${devnum} +
1; done; done;
uimage=/boot/uImage
uimage_addr=0x800000
Environment size: 3560/131068 bytes
GoFlexHome> .]0;root@archlinux:~/projects/u-boot.[root@archlinux u-boot]# exit
logout
Not sure if kwboot needs any of this to boot.... Can I zap it all and incrementally add any variables I need via /boot/uEnv.txt ?
This is going to be the easiest path for you to learn more about the process without creating more issues for your self. So invest some time in understanding this.
First you need to complete the process of writing the bootloader to the mtd0 flash partition that you erased (which as the other post painstakingly explained, was simply a failure to round up the file size to the next 1 kB increment). This should allow it to boot (at least into u-boot) out of flash each time the power is turned on without needing kwboot serial download. The bootloader you're loading with kwboot likely has its own environment built in and changes you make to it will not be persistent.
U-Boot typically saves its environment on a partition on flash.
Inexpert or panicked changes to that partition or U-Boot environment can easily render the unit unbootable.
Temporary changes to the U-Boot environment can generally be made through the U-Boot console. This is the recommended approach, rather than altering the saved environment.
1 - So booting from kwboot I can only use compiled uboot env into my uboot.bin ? Or not?
Then I can flash a new uboot.bin compiled with the CONFIG_ENV_SIZE variable and then I can flash next to it the u-boot env.bin (blob ?) compiled from uboot mkenvimage using a text file and setting the blob size same as CONFIG_ENV_SIZE ?
2- I dumped my ar150 uboot env on a file ? How can I read its content ? Meaning using a hex reader isn’t quite informative to my eyes ?
With the warning that I'm not very familiar with kwboot!!!
Assuming that kwboot loads its own bootloader over serial, I would guess that:
Compiled-in parameters of the flash-resident U-Boot are not present
The flash-resident U-Boot environment might be read by the bootloader downloaded and started by kwboot
The AR150 is a very different device. From what I understand, kwboot is specific to a different SoC family. If you want to "see" what is stored there, hexdump -C <path-to-partition-dump> generally reveals key=value pair data.
is not in flash. If you read carefully above you will find references to downloading and booting from RAM. Understanding the difference between the two is very important to your success.
Yes, an expert user likely could. However, any mistake made may, or may not be recoverable.