Welcome! Log In Create A New Profile

Advanced

Debian cannot boot on KD20 after flashing u-boot

Posted by hacksome 
Debian cannot boot on KD20 after flashing u-boot
June 26, 2020 03:37PM
I was trying to get a KD20 OMNINAS to boot from USB.

At first I managed to use tftp upload of uImage with kd20.dtb appended and uInitrd
I could mostly reproduce the events as described in: https://forum.doozan.com/read.php?3,16469,page=2 until

I could boot from sata and from USB when uImage and UInitrd were loaded with tftp.

To flash U-boot I booted from USB, downloaded the uboot.2015.10-tld-2.ox820.bodhi.tar and continued following your advise to ´Bastler´ as described in the 3rd last message dated: November 15, 2018 05:26PM to continue with flashing in Debian as described in: https://forum.doozan.com/read.php?3,16017

So I did.
I followed the description and everything looked OK. There was only a different output then expected from the flash_erase command:

root@debian:/tmp# /usr/sbin/flash_erase /dev/mtd0 0x0 6
Erasing 128 Kibyte @ 7f5f1f5c00000064 --  6 % complete 
root@debian:/tmp# /usr/sbin/nandwrite /dev/mtd0 uboot.spl.2013.10.ox820.850mhz.mtd0.img
Writing data to block 0 at offset 0x0
root@debian:/tmp# /usr/sbin/nandwrite -s 262144 /dev/mtd0 uboot.2015.10-tld-2.ox820.mtd0.img
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000
Writing data to block 4 at offset 0x80000
Writing data to block 5 at offset 0xa0000
root@debian:/tmp# /usr/sbin/flash_erase /dev/mtd0 0x00100000 1
Erasing 128 Kibyte @ 7f621f5c00000064 --  9 % complete 
root@debian:/tmp# /usr/sbin/nandwrite -s 1048576 /dev/mtd0 uboot.2015.10-tld-2.ox820.environment.img
Writing data to block 8 at offset 0x100000

I thought I had encountered similar erroneous output before when flashing my Pogoplug, so I ignored this anomaly.

fw_printenv showed:
root@debian:/tmp# fw_printenv
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x60500000 0x60e00000 0x62c00000; else bootm 0x60500000 0x60e00000; fi; else if run load_dtb; then bootm 0x60500000 - 0x62c00000; else bootm 0x60500000; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
usb_custom_params=zswap.enabled=1
device=0:1
devices=usb ide
disks=0 1 2 3
ethaddr=52:3b:20:9c:11:51
ethact=mii0
if_netconsole=ping $serverip
ipaddr=192.168.0.222
serverip=192.168.0.220
dtb_file=/boot/dts/ox820-pogoplug-pro.dtb
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device 0x62c00000 $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device 0x60e00000 /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device 0x60500000 /boot/uImage
mainlineLinux=yes
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 0x60500000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60510000  $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15

That seemed OK to me, but i noticed that the dtb_file was for a pogoplug so I changed it to a ox820-kd20.dtb
with:

fw_setenv dtb_file '/boot/dts/ox820-kd20.dtb'

output from fw_printenv showed it was indeed modified in the environment:
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x60500000 0x60e00000 0x62c00000; else bootm 0x60500000 0x60e00000; fi; else if run load_dtb; then bootm 0x60500000 - 0x62c00000; else bootm 0x60500000; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
usb_custom_params=zswap.enabled=1
device=0:1
devices=usb ide
disks=0 1 2 3
ethaddr=52:3b:20:9c:11:51
ethact=mii0
if_netconsole=ping $serverip
ipaddr=192.168.0.222
serverip=192.168.0.220
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device 0x62c00000 $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device 0x60e00000 /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device 0x60500000 /boot/uImage
mainlineLinux=yes
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 0x60500000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60510000  $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15
root@debian:/tmp# fw_setenv dtb_file=/boot/dts/ox820-kd20.dtb^C
root@debian:/tmp# fw_setenv dtb_file '/boot/dts/ox820-kd20.dtb'
root@debian:/tmp# fw_printenv
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x60500000 0x60e00000 0x62c00000; else bootm 0x60500000 0x60e00000; fi; else if run load_dtb; then bootm 0x60500000 - 0x62c00000; else bootm 0x60500000; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
usb_custom_params=zswap.enabled=1
device=0:1
devices=usb ide
disks=0 1 2 3
ethaddr=52:3b:20:9c:11:51
ethact=mii0
if_netconsole=ping $serverip
ipaddr=192.168.0.222
serverip=192.168.0.220
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device 0x62c00000 $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device 0x60e00000 /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device 0x60500000 /boot/uImage
mainlineLinux=yes
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 0x60500000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60510000  $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15
dtb_file=/boot/dts/ox820-kd20.dtb

so fingers crossed and reboot.....
the serial console showed:

U-Boot SPL 2013.10-tld-4 (Sep 07 2014 - 14:10:12)
  Boot device: NAND
Attempting to set PLLA to 850 MHz ...
  plla_ctrl0 : 0000020a
  plla_ctrl1 : 00330000
  plla_ctrl2 : 0065008b
  plla_ctrl3 : 000000f1

PLLA Set


U-Boot 2015.10-tld-2 (Oct 21 2017 - 22:00:02 -0700)
OXNAS OX820

DRAM:  128 MiB
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   dwmac.40400000
Hit any key to stop autoboot: 10  9  8  7  6  5  4  3  2  1  0 
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

Reset IDE: SATA PHY not ready for device 0
ide_preinit failed

Partition Map for USB device 0  --   Partition Type: DOS

Part	Start Sector	Num Sectors	UUID		Type
  1	2048      	10293248  	b82c45ce-01	83
  2	10295296  	49850368  	b82c45ce-02	83
  3	60145664  	1122304   	b82c45ce-03	82
loading envs from usb 0 ...
** File not found /boot/uEnv.txt **

no IDE devices available
running scan_disk ...
Scan device usb
device usb 0:1
1 bytes read in 177 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...
4629915 bytes read in 367 ms (12 MiB/s)
loading uInitrd ...
4594376 bytes read in 333 ms (13.2 MiB/s)
loading DTB /boot/dts/ox820-kd20.dtb ...
8091 bytes read in 151 ms (51.8 KiB/s)
## Booting kernel from Legacy Image at 60500000 ...
   Image Name:   Linux-4.4.54-oxnas-tld-1
   Created:      2020-06-26  17:23:32 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4629851 Bytes = 4.4 MiB
   Load Address: 60008000
   Entry Point:  60008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 60e00000 ...
   Image Name:   initramfs-4.4.54-oxnas-tld-1
   Created:      2020-06-26  17:25:01 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    4594312 Bytes = 4.4 MiB
   Load Address: 60000000
   Entry Point:  60000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 62c00000
   Booting using the fdt blob at 0x62c00000
   Loading Kernel Image ... OK
   Loading Ramdisk to 679c5000, end 67e26a88 ... OK
   Loading Device Tree to 679c0000, end 679c4f9a ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.54-oxnas-tld-1 (root@tldDebian) (gcc version 4.9.2 (Debian 4.9.2-10) ) #2 SMP PREEMPT Sat Mar 18 23:09:58 PDT 2017
[    0.000000] CPU: ARMv6-compatible processor [410fb025] revision 5 (ARMv7), cr=00c5787d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Shuttle KD20
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Kernel panic - not syncing: ERROR: Failed to allocate 0x2000 bytes below 0x0.
[    0.000000] 
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.54-oxnas-tld-1 #2
[    0.000000] Hardware name: PLXTECH NAS782X SoC (Flattened Device Tree)
[    0.000000] [<c0010c6c>] (unwind_backtrace) from [<c000cf8c>] (show_stack+0x10/0x14)
[    0.000000] [<c000cf8c>] (show_stack) from [<c02cf840>] (dump_stack+0x84/0xa0)
[    0.000000] [<c02cf840>] (dump_stack) from [<c0091c78>] (panic+0x8c/0x1ec)
[    0.000000] [<c0091c78>] (panic) from [<c0835b7c>] (memblock_alloc_base+0x34/0x40)
[    0.000000] [<c0835b7c>] (memblock_alloc_base) from [<c082cf44>] (early_alloc_aligned+0xc/0x2c)
[    0.000000] [<c082cf44>] (early_alloc_aligned) from [<c082dfe0>] (paging_init+0x764/0xa1c)
[    0.000000] [<c082dfe0>] (paging_init) from [<c082ae54>] (setup_arch+0x508/0x8f8)
[    0.000000] [<c082ae54>] (setup_arch) from [<c0828940>] (start_kernel+0x80/0x3ac)
[    0.000000] [<c0828940>] (start_kernel) from [<60008074>] (0x60008074)
[    0.000000] ---[ end Kernel panic - not syncing: ERROR: Failed to allocate 0x2000 bytes below 0x0.
[    0.000000]

This was quite a disappointment, I have no idea where things went wrong........
Maybe I should not have ignored these outputs:
Erasing 128 Kibyte @ 7f5f1f5c00000064 -- 6 % complete
and
Erasing 128 Kibyte @ 7f621f5c00000064 -- 9 % complete

Another thing I can think of is this message: ** File not found /boot/uEnv.txt **
I have not created an uEnv.txt yet, but did not expect that a missing uEnv.txt would end up in not booting at all.....

And an error about ide_preinit failing from u-boot.

I used Linux version 4.4.54-oxnas-tld-1 (stretch) because Debian Buster was not stable. I had similar problems as I have encountered with Buster with a fresh install on USB for a PogoplugPro.

Any idea´s ?
Re: Debian cannot boot on KD20 after flashing u-boot
June 26, 2020 05:07PM
hacksome,

> This was quite a disappointment, I have no idea
> where things went wrong........
> Maybe I should not have ignored these outputs:
> Erasing 128 Kibyte @ 7f5f1f5c00000064 -- 6 %
> complete
> and
> Erasing 128 Kibyte @ 7f621f5c00000064 -- 9 %
> complete
>

The "flashing errors" were benign. That was a misleading output from flash_erase (known problem). But things went OK.

> Another thing I can think of is this message: **
> File not found /boot/uEnv.txt **
> I have not created an uEnv.txt yet, but did not
> expect that a missing uEnv.txt would end up in not
> booting at all.....

That's was also not important. The u-boot script simply did not find uEnv.txt. And uEnv.txt is optional.

> And an error about ide_preinit failing from
> u-boot.

Meaning there is no SATA drive plugged in. If the SATA drive was pluggeg in, it has no power.

All and all, the u-boot flashing was successful, since you can load and start the kernel:

Quote

[ 0.000000] Linux version 4.4.54-oxnas-tld-1 (root@tldDebian) (gcc version 4.9.2 (Debian 4.9.2-10) ) #2 SMP PREEMPT Sat Mar 18 23:09:58 PDT 2017
[ 0.000000] CPU: ARMv6-compatible processor [410fb025] revision 5 (ARMv7), cr=00c5787d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: Shuttle KD20


However, I don't recall anybody has installed the OXNAS u-boot on NAND for this box. People have run this box with a much older u-boot (built from my GitHub source) on SATA, in a direct SATA booting (with WarheadsSE 's magic dust in the HDD sector).

It looks like a memory location issue.

Some users have run the later kernels (linux-4.4.201-oxnas-tld-1, and linux-4.14.180-oxnas-tld-1) on this box, IIRC. You could keep it at Debian Stretch, but install these later kernels on it.

You can use your Pogo V3 to do this, or run chroot into the drive to install. If you have not done chroot to install kernel before, let me know, I meant to write a new tutorial post to upload my shell script, but never got around to do this (no urgency).

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
June 27, 2020 03:27AM
Bohdi,

I am impressed with your swift response!

I also see that most of my assumptions were OK.

What I missed completely is that the OXNAS U-boot is actually not used at all on this box.
I guess I completely misinterpreted your advice to ´Bastler´ and specifically this part at:https://forum.doozan.com/read.php?3,16469,page=2
3rd last message where I read this:

> Remember, this box is the same SoC OX820 as the Pogo Pro V3.
quote to flashing U-boot procedure
and
>In your case, you would use your KD20 files:

stage1.wrapped-nand --- instead of uboot.spl.2013.10.ox820.850mhz.mtd0.img
u-boot.wrapped-nand  --- instead of uboot.2015.10-tld-2.ox820.mtd0.img

I assumed that you advised 'Bastler' to flash ¨stage1.wrapped-nand¨ because 'Bastler' previously had decided he did not want to use the Pogoplug u-boot after all but wanted to go back to the original U-boot.

I do have a kd20.zip files with both ¨wrapped-nand¨ files, but thought one of them would be the same as the mtd0 backup I made with:
nanddump --noecc --omitoob -f mtd0  /dev/mtd0

So I assumed that you actually advised him to just restore stock images.

I was also a bit puzzled because within the new U-boot the ox820-pogoplug-pro.dtb is used and not the ox820-kd20.dtb and was wondering if that might limit it´s required functionality somehow.

Anyway, I decided to flash the OXNAS U-boot to the kd20.

What happened after that you know now;)

I am a bit lost about steps to revert the U-boot flashing because I cannot boot into Debian anymore.
In the whole process I have tried to make a bootable sata disk(with WarheadsSE 's magic dust in the HDD sector). But that did work properly. But that was probably caused by missing of working images on it.
Because I could ftpboot I did not explore that route.

At the moment I have no clear view with light at the end of the tunnel how to re-establish a stable situation.

My goal would be: a U-boot version that can boot from USB or SATA when the requirement are fullfilled just like I have now with the PogoPro. (e.g. LABEL:rootfs)

In fact it just worked like that with the tftpboot. Both USB boot and sataboot worked when I added:
 setenv bootargs root=LABEL=rootfs initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00 mem=256M poweroutage=yes

I would like to know how to use my PogoPro for this steps, or how to use chrooting for this.
I have used chroot in the past, but that was not more than copy/paste command, because then I had no real idea what was happening.

I have gained a lot more Linux knowledge since than but chrooting is not one of the topics I have explored yet.
Basically I am an old school programmer and have written programs in assembly language and later on used Pascal and C. So low level programming is not much of a problem when needed.
But now the complexity and interaction between existing modules, there functionality, structures etc. are the elements that make it difficult to figure out things.


At the moment the KD20 is completely inoperable. I see the new U-boot message on the TTY but then it gets stuck and no commands are accepted. So at the moment the only way out is sataboot I expect. And that just did not function. I tried to create a new sata boot disk with the schnee script. The script executed, but for some reason it could not mount one of the partition it created a while ago to write the rootfs files. So I manually completed the steps of the procedure. However then at booting it could not find the DTB files.... Those were from the Pogo Classic for some reason and they are on rootfs disc in the correct location, but the boot process could not find them.
I will try to figure out if I missed things. I was hoping to be able to ftp boot with the U-boot from the sataboot, but that did not work out either. It looks as if no ethernet interface is available.

So I am pretty stuck now.

Thanks anyway for all your assistance so far!

hacksome



Edited 1 time(s). Last edit at 06/27/2020 10:40AM by hacksome.
Re: Debian cannot boot on KD20 after flashing u-boot
June 27, 2020 04:28PM
hacksome,

Turbo Pascal? depending on your asnwer, I would be able to guess how far back you started proramming :)

At this point, there are 3 alternative paths:

1. Try to fix the current booting problem. I have not looked closely what is the different between this KD20 and the Pogo V3. So that's why I suggest you update the kernels to latest to see if that will be resolved, without us spending time reinventing wheel.

2. (Recommended) Get Direct SATA booting working now. And flash stock u-boot in Debian. This is always a good thing to have so you have a rescue mechanism for your box.

3. Flash stock SPL and u-boot in serial console. Since you can run u-boot to the prompt, you don't need to have the Direct SATA booting working. You can start at Step 7

Quote


https://forum.doozan.com/read.php?3,42599,44024#msg-44024

7. Installation steps


But you need to post the size of the "wrapped_nand" images, so I can see if the instruction need to be revised.

stage1.wrapped-nand --- instead of uboot.spl.2013.10.ox820.850mhz.mtd0.img
u-boot.wrapped-nand  --- instead of uboot.2015.10-tld-2.ox820.mtd0.img

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
June 28, 2020 04:55PM
Bodhi,

I would like to roll back what I did and option 3 seems the most easy option to me, however for some reason I cannot establish a tftp connection with the U-boot available with direct boot from SATA. It looks as if no Ethernet device is detected.
When I set various addresses: serverip, ipaddr, gatewayip etc. Only the ipaddr is retained when saved and rebooted. Both serverip and other changes are lost. There are dhcp and ping commands available, but dhcp receives no response and the ping command does not get a response either. Maybe this is due to the U-boot using a pogo classic.dtb. I don't know.

I will try to re-create a SATA boot disk or create one with another U-boot/kernel too see if one of them will provide access to a working linux shell or to have re-enabled tftp boot capabilities. I still have a USB image that booted successfully after using tftp commands to load a uImage and uInitrd built with KD20 DTB appended.

Your question:

> But you need to post the size of the "wrapped_nand" images, so I can see if the instruction need to be revised.

stage1.wrapped-nand --- instead of uboot.spl.2013.10.ox820.850mhz.mtd0.img
u-boot.wrapped-nand  --- instead of uboot.2015.10-tld-2.ox820.mtd0.img

This is exactly where I went wrong in the steps to continue with. I though that your advise was: the KD20 is also an OXNAS system so you can flash the Pogopro U-boot and it will work. I found out this is not so the hard way....

I had poked aroundt a bit with a Hex editor in the images to see if its contents did make any sense.

The uboot.spl.2013.10.ox820.850mhz.mtd0.img did not show any human recognizable information. The only thing I could make of it that it contained a pattern of hex codes 0xAA and 0x55. I know this is not random because 0x55 is 01010101 and 0xAA is 10101010. So I assumed this images presented a bit pattern matrix. But how it is used? I have no idea.

In the uboot.2015.10-tld-2.ox820.mtd0.img I recognized various areas. ASCII strings with text kernel version, labels, U-boot commands and variables. Most of the image contents looked as machine code to me and I recognized one thing that made me hesitate a little: the image uboot.2015.10-tld-2.ox820.mtd0.img tries to load the ¨boot/dts/ox820-pogoplug-pro.dtb¨. But I gambled that some misconfiguration would not screw up the machine completely.

So I went on and flashed the PogoPro U-boot...........

I also discovered why a /tmp directory has this name. When you download files into this directory and store data in it you lose all of it with the next boot. I did execute all flashing commands from within the /tmp directory.
So I have no mtd0 backup. I now just hope that I do not need that backup when I have somehow installed another working U-boot.

I have a KD20.zip file that contains both 'stage1.wrapped-nand' size 56.0 kb and 'u-boot.wrapped-nand' files size 1.3MB. But being more cautious this time I checked those with a hex editor and I found out that both files only contain 0x55 and 0xAA patterns. I suppose those are not the ones to use.....

I have a KD20_sata_boot.tar.gz files that contains one directory with 3 files in it. Those files are not 'wrapped-nand' images but 'stage1.wrapped' and 'u-boot.wrapped' files and a disk create script that writes the magic dust in de HDD sector and copies the images to absolute disk aereas.

I assume these are the images I could or should use?

This is the script: disk_create
#!/bin/sh

# uncomment line below and set to the correct disk
#disk=/dev/sdX

if [ -z "${disk}" ] ; then
   echo "You must uncomment/set the 'disk' variable"
   exit -1
fi

workarea="."

stage1File=$workarea/stage1.wrapped
ubootFile=$workarea/u-boot.wrapped
kernelFile=$workarea/uImage

perl <<EOF | dd of="$disk" bs=512
    print "\x00" x 0x1a4;
    print "\x00\x5f\x01\x00";
    print "\x00\xdf\x00\x00";
    print "\x00\x80\x00\x00";
    print "\x00" x (0x1b0 -0x1a4 -12 );
    print "\x22\x80\x00\x00";
    print "\x22\x00\x00\x00";
    print "\x00\x80\x00\x00";
EOF

if [ -f $stage1File ];then
	echo "Writing stage 1"
	dd if=$stage1File    of="$disk" bs=512 seek=34
fi

if [ -f $ubootFile ];then
	echo "Writing uboot"
	dd if=$ubootFile     of="$disk" bs=512 seek=154
fi

if [ -f $kernelFile ];then
	echo "Writing kernel to "
	dd if=$kernelFile of="$disk"1 bs=512 
fi

There is no kernel file (uImage) provided. I guess I have to provide one myself. I assume I already have one, because I have a uImage with KD20.dtb created for tftp boot.

One thing I wonder is if you use 'dd' to just write blocks of data to disk there is no partition or filesystem information created. Will this work? I assume that will only work when those data-blocks are 'device' images that contain all required partition information within the written image?

Within the stage1.wrapper file, size 8.2 kb I see a name 'BOOTP' Maybe meaning BOOTPartition?
Within the u-boot.wrapper file, size 154.0 kb I see no label but the output of the ¨strings¨ command shows various familiar u-boot variables and also intriguing options that look like command to manage and test a lot of things using u-boot commands. If it is as I assume this looks like some kind of enhanced U-boot.

`p@-
`0@-
`0@-
`p@-
`8@-
`s@-
`8@-
`s@-
`0@-
`p@-
`p@-
`8@-
`8@-
`7@-
`8@-
`p@-
`p@-
`p@-
`p@-
`8@-
`p@-
TSIL
`8@-
`s@-
`p@-
`p@-
`USBC
USBS
`8@-
`c P
`0@-
`p@-
`8@-
`p@-
`8@-
`8@-
`0@-
0l0,0
0l0,0
 l0,
0l0,0
0l0,0
D8@-
`8@-
D0@-
B8@-
`8@-
`8@-
`8@-
`8@-
`8@-
BTV7
`8@-
`p@-
`8@-
`U-Boot 1.1.2 (Jan 24 2015 - 13:54:11)
nand
e03f<ij??ji<f30ef30e?ji<<ij?e03f
i<?j0ef33fe0j?<i
j?<i3fe00ef3i<?jj?<i3fe00ef3i<?j
i<?j0ef33fe0j?<i
f30e?ji<<ij?e03fe03f<ij??ji<f30e
 n;^
Qkkbal
i]Wb
9a&g
MGiI
wn>Jj
#.zf
+o*7
System is Shoutdown Now
clear environment in disk
hide
Disk read is error!!! 
Disk write is error!!! 
finished 
rebuild 
down 
reveal
enable_interrupts
disable_interrupts
OUTPUT
INPUT
HIGHT
LED_HDDA_B is %s %s 
Timer is 0x%04X 
qazwsx
part	- clear MBR
[h/r] 
c:>fdisk /mbr_ 
clrenv
clrenv	- clear environment
N/A 
Walker's Clear environment Function 
beep
beep	- make beep sound
N/A 
Walker's beep Function 
poweroff
poweroff- Power-OFF
N/A 
Walker's Power-OFF Function 
led	- LED Switch
[1/0] = LED ON/OFF 
[a/z] = Interrupts ON/OFF 
Walker's LED switch 
Resetting CPU ...
pc : [<%08lx>]    lr : [<%08lx>]
sp : %08lx  ip : %08lx  fp : %08lx
r10: %08lx  r9 : %08lx  r8 : %08lx
r7 : %08lx  r6 : %08lx  r5 : %08lx  r4 : %08lx
r3 : %08lx  r2 : %08lx  r1 : %08lx  r0 : %08lx
Flags: %c%c%c%c
  IRQs %s  FIQs %s  Mode %s%s
undefined instruction
software interrupt
prefetch abort
data abort
not used
interrupt request
USER_26
FIQ_26
IRQ_26
SVC_26
UK4_26
UK5_26
UK6_26
UK7_26
UK8_26
UK9_26
UK10_26
UK11_26
UK12_26
UK13_26
UK14_26
UK15_26
USER_32
FIQ_32
IRQ_32
SVC_32
UK4_32
UK5_32
UK6_32
ABT_32
UK8_32
UK9_32
UK10_32
UND_32
UK12_32
UK13_32
UK14_32
SYS_32
     _           _   _   _       
    | |         | | | | | |      
 ___| |__  _   _| |_| |_| | ___  
/ __| '_ \| | | | __| __| |/ _ \ 
\__ \ | | | |_| | |_| |_| |  __/ 
|___/_| |_|\__,_|\__|\__|_|\___| 
          _   _     ____              _
         | | | |   | __ )  ___   ___ | |_ 
         | | | |___|  _ \ / _ \ / _ \| __| 
         | |_| |___| |_) | (_) | (_) | |_ 
          \___/    |____/ \___/ \___/ \__| 
U-Boot code: %08lX -> %08lX  BSS: -> %08lX
IRQ Stack: %08lx
FIQ Stack: %08lx
	Bank #%d: %08lx 
SRAM Configuration:
	%dKB at 0x%08x
baudrate
### ERROR ### Please RESET the board ###
NAND:
ipaddr
ethaddr
loadaddr
bootfile
netretry
once
## Warning: gatewayip needed but not set
ARP Retry count exceeded; starting again
ARP Resend request
%d.%d.%d.%d
none
bad length %d < %d
invalid RARP header
len bad %d < %d
checksum bad
 ICMP Host Redirect to 
gatewayip
netmask
nvlan
serverip
*** ERROR: ping address not given
*** ERROR: `serverip' not set
*** ERROR: `ipaddr' not set
*** ERROR: `ethaddr' not set
Abort
Bytes transferred = %ld (%lx hex)
filesize
fileaddr
octet
timeout
File too large
File has bad magic
	 %lu MB reveived
TFTP error: First block is not block 1 (%ld)
Starting again
done
TFTP error: '%s' (%d)
Retry count exceeded; starting again
%02lX%02lX%02lX%02lX.img
*** Warning: no boot file name; using '%s'
TFTP from server 
; our IP address is 
; sending through gateway 
Filename '%s'.
 Size is 0x%x Bytes = 
Load address: 0x%lx
Loading: *
*** WARNING: %s is too long (%d - max: %d) - truncated
Host Name
Root Path
*** Unhandled DHCP Option in OFFER/ACK: %d
DHCP client bound to address 
autoload
DHCP: INVALID STATE
BOOTP broadcast %d
RARP broadcast %d
bootargs
Setting Linux mem= boot arg value
mem=
 mem=64M
 mem=128M
 mem=256M
Unsupported memory size, defaulting to 64M
adminmode=
timeINC=
poweroutage=
powermode=
 poweroutage=yes
bootdelay
bootcmd
Hit any key to stop autoboot: %2d 
%2d 
## Command too long!
** Too many args (max. %d) **
Unknown command '%s' - try 'help'
Usage:
## Error: "%s" not defined
%-12s= 0x%08lX
arch_number
env_t
boot_params
DRAM bank
-> start
-> size
ethaddr     =
%c%02X
ip_addr     = 
baudrate    = %d bps
bdinfo
bdinfo  - print Board Info structure
## Starting application at 0x%08lX ...
## Application terminated, rc = 0x%lX
reset   - Perform RESET of the CPU
go      - start application at address 'addr'
addr [arg ...]
    - start application at address 'addr'
      passing 'arg' as arguments
Unknown OS
Unknown Architecture
Unknown Image
unknown compression
   Image Name:   %.*s
   Image Type:   
%s %s %s (%s)
   Data Size:    %d Bytes = 
   Load Address: %08x
   Entry Point:  %08x
   Contents:
   Image %d: %8ld Bytes = 
## Checking Image at %08lx ...
   Bad Magic Number
   Bad Header Checksum
   Verifying Checksum ... 
   Bad Data CRC
Error: Bad gzipped data
Error: gunzip out of data in header
Error: inflateInit2() returned %d
Error: inflate() returned %d
Standalone Application
Kernel Image
Multi-File Image
verify
## Booting image at %08lx ...
Unsupported Architecture 0x%x
Wrong Image Type for %s command
   XIP %s ... 
   Uncompressing %s ... 
GUNZIP ERROR - must RESET board to recover
Unimplemented compression type %d
autostart
Can't boot image type %d
## Transferring control to NetBSD stage-2 loader (at address %08lx) ...
## Transferring control to RTEMS (at address %08lx) ...
uncompressed
gzip compressed
bzip2 compressed
Invalid Image
Standalone Program
RAMDisk Image
Firmware
Script
Invalid CPU
Alpha
Intel x86
IA64
MIPS
MIPS 64 Bit
PowerPC
IBM S390
SuperH
SPARC
SPARC 64 Bit
M68K
Microblaze
Invalid OS
NetBSD
Linux
VxWorks
U-Boot
RTEMS
iminfo
iminfo  - print header information for application image
addr [addr ...]
    - print header information for application image starting at
      address 'addr' in memory; this includes verification of the
      image contents (magic number, header and payload checksums)
bootm
bootm   - boot application image from memory
[addr [arg ...]]
    - boot application image stored in memory
	passing arguments 'arg ...'; when booting a Linux kernel,
	'arg' can be the address of an initrd image
** No boot file defined **
** Block device %s %d not supported
** Invalid boot device, use `dev[:part]' **
** Bad partition %d **
** Invalid partition type "%.32s" (expect "U-Boot")
** Bad partition - %s %d:%d **
** Bad ext2 partition or disk - %s %d:%d **
** Unable to read "%s" from %s %d:%d **
%ld bytes read
** Error ext2fs_ls() **
ext2load
ext2load- load binary file from a Ext2 filesystem
<interface> <dev[:part]> [addr] [filename] [bytes]
    - load binary file 'filename' from 'dev' on 'interface'
      to address 'addr' from ext2 filesystem
ext2ls
ext2ls  - list files in a directory (default /)
<interface> <dev[:part]> [directory]
    - list files from 'dev' on 'interface' in a 'directory'
IDE read: device %d not ready
No Powersaving mode %X
Error (no IRQ) dev %d blk %ld: status 0x%02x
bootdevice
** No boot device **
** Device %d not available
PPCBoot
Loading from IDE device %d, partition %d: Name: %.32s  Type: %.32s
** Bad Magic Number **
Automatic boot of image at addr 0x%08lX ...
Detecting SATA busses:
Bus %d: 
No devices found
Found second device OK
Found first device OK
ERROR
Reset IDE: 
no IDE devices available
IDE device %d: 
part
unknown device
... is now current device
IDE device %d not available
read
disk is not present!
IDE read: device %d block # %ld, count %ld ... 
%ld blocks read: %s
write
IDE write: device %d block # %ld, count %ld ... 
%ld blocks written: %s
diskboot
diskboot- boot from IDE device
loadAddr dev:part
ide     - IDE sub-system
reset - reset IDE controller
ide info  - show available IDE devices
ide device [dev] - show or set current device
ide part [dev] - print partition table of one or all IDE devices
ide read  addr blk# cnt
ide write addr blk# cnt - read/write `cnt' blocks starting at block `blk#'
    to/from memory address `addr'
Base Address: 0x%08lx
Pattern %08lX  Writing...%12s
Reading...
Mem error @ 0x%08X: found %08lX, expected %08lX
CRC32 for %08lx ... %08lx ==> %08lx
%08lx:
 %08x
 %04x
 %02x
byte
halfword
word at 0x%08lx (0x%08lx) != word at 0x%08lx (0x%08lx)
halfword at 0x%08lx (0x%04x) != halfword at 0x%08lx (0x%04x)
byte at 0x%08lx (0x%02x) != byte at 0x%08lx (0x%02x)
Total of %ld %s%s were the same
Zero length ???
mtest
mtest   - simple RAM test
[start [end [pattern]]]
    - simple RAM read/write test
loop
loop    - infinite loop on address range
[.b, .w, .l] address number_of_objects
    - loop on a set of addresses
base
base    - print or set address offset
    - print address offset for memory commands
base off
    - set address offset for memory commands to 'off'
crc32
crc32   - checksum calculation
address count [addr]
    - compute CRC32 checksum [save at addr]
cmp     - memory compare
[.b, .w, .l] addr1 addr2 count
    - compare memory
cp      - memory copy
[.b, .w, .l] source target count
    - copy memory
mw      - memory write (fill)
[.b, .w, .l] address value [count]
    - write memory
nm      - memory modify (constant address)
[.b, .w, .l] address
    - memory modify, read and keep address
mm      - memory modify (auto-incrementing)
[.b, .w, .l] address
    - memory modify, auto increment address
md      - memory display
[.b, .w, .l] address [# of objects]
    - memory display
'%s' is not a number
device %d 
whole chip
offset 0x%x, size 0x%x
scrub
erase
written
NOT 
TIGHT 
UNLOCK 
quiet
Device %d: %s, sector size %lu KB
no devices available
Device %d: %s
No such device
Device %d: %s
dump
markbad
biterr
unlock
Device %d bad blocks:
clean
NAND %s: 
Warning: scrub option will erase all factory set bad blocks!
         There is no reliable way to recover them.
         Use this command only for testing purposes if you
         are sure of what you are doing!
Really scrub this NAND flash? <y/N>
scrub aborted
.oob
No memory for page buffer
Error (%d) reading page %08x
Page %08x dump:
	%02x %02x %02x %02x %02x %02x %02x %02x  %02x %02x %02x %02x %02x %02x %02x %02x
OOB:
	%02x %02x %02x %02x %02x %02x %02x %02x
.jffs2
 %d bytes %s: %s
block 0x%08lx successfully marked as bad
block 0x%08lx NOT marked as bad! ERROR %d
tight
status
device is %swrite protected
%08x - %08x: %8d pages %s%s%s
NAND flash successfully locked
Error locking NAND flash
NAND flash successfully unlocked
Error unlocking NAND flash, write and erase will probably fail
Loading from %s, offset 0x%lx
** Read error
** Bad Magic Number 0x%x **
Automatic boot of image at addr 0x%08lx ...
nboot
nboot   - boot from NAND device
[partition] | [[[loadAddr] dev] offset]
nand
nand	- NAND sub-system
info                   - show available NAND devices
nand device [dev]      - show or set current device
nand read[.jffs2/.e]   - addr off|partition size (Using the .e option skips bad blocks)
nand write[.jffs2/.e]  - addr off|partiton size (Using the .e option skips bad blocks)
    at offset `off' to/from memory address `addr'
nand erase [clean] [off size] - erase `size' bytes from
    offset `off' (entire device if not specified)
nand bad - show bad blocks
nand dump[.oob] off - dump page
nand scrub - really clean NAND erasing bad blocks (UNSAFE)
nand markbad off - mark bad block at offset (UNSAFE)
nand biterr off - make a bit error at offset (UNSAFE)
nand lock [tight] [status] - bring nand to lock state or display locked pages
nand unlock [offset] [size] - unlock section
hostname
rootpath
dnsip
domain
ping failed; host %s is not alive
host %s is alive
ping
ping	- send ICMP ECHO_REQUEST to network host
pingAddress
dhcp
dhcp	- invoke DHCP client to obtain IP/boot params
rarpboot
rarpboot- boot image via network using RARP/TFTP protocol
[loadAddress] [bootfilename]
tftpboot
tftpboot- boot image via network using TFTP protocol
bootp
bootp	- boot image via network using BootP/TFTP protocol
 ** Abort
Environment size: %d/%d bytes
Saving Environment to %s...
mac_adr=
first macadr sync!
secned macadr sync!
stdout
stderr
Can't delete "%s"
## Baudrate %d bps not supported
## Error: environment overflow, "%s" deleted
stdin
## Switch baudrate to %d bps and press ENTER ...
setenv
run     - run commands in an environment variable
var [...]
    - run the commands in the environment variable(s) 'var'
saveenv
saveenv - save environment variables to persistent storage
setenv  - set environment variables
name value ...
    - set environment variable 'name' to 'value ...'
setenv name
    - delete environment variable 'name'
printenv
printenv- print environment variables
    - print values of all environment variables
printenv name ...
    - print value of environment variable 'name'
storage device not initialized. Use usb scan
error reading partinfo...try to boot raw
Loading from USB device %d, partition %d: Name: %.32s  Type: %.32s
** Bad Header Checksum **
** Read error on %d:%d
See Interface
Audio
Communication
Human Interface
Printer
Mass Storage
CDC Data
Vendor specific
Human Interface, Subclass: 
None
Boot 
Keyboard
Mouse
reserved
Mass Storage, 
RBC 
SFF-8020i (ATAPI)
QIC-157 (Tape)
SFF-8070
Transp. SCSI
Command/Bulk
Command/Bulk/Int
Bulk only
String: "%s"
%d: %s,  USB Revision %x.%x
 - %s %s %s
 - Class: 
 - Class: (from Interface) %s
 - PacketSize: %d  Configurations: %d
 - Vendor: 0x%04x  Product 0x%04x Version %d.%d
Self Powered 
Bus Powered 
Remote Wakeup 
   Configuration: %d
   - Interfaces: %d %s%s%dmA
     Interface: %d
     - Alternate Settings %d, Endpoints: %d
     - Class 
     - 
     - Endpoint %d %s 
Control
Isochronous
Interrupt
 MaxPacket %d
 Interval %dms
480MBit/s
1.5MBit/s
12MBit/s
 %s (%s, %dmA)
 %s  %s %s %s
(Re)start USB...
Waiting for storage device(s) to settle before scanning...
stop
stopping USB..
Device Tree:
config for device %d
*** NO Device avaiable ***
scan
  NOTE: this command is obsolete and will be phased out
  please use 'usb storage' for USB storage devices information
stor
print_part of %x
no USB devices available
no current device selected
USB read: device %d block # %ld, count %ld ... 
USB device %d: 
    Device %d: 
usbboot
usbboot - boot from USB device
usb     - USB sub-system
usb start - start the usb interface, including scan of the bus. Must be
       executed prior to using the USB, and should be executed only once.
usb tree  - show USB device tree
usb info [dev] - show available USB devices
usb storage  - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'
       to memory address `addr'
Extinguish LED
Light LED
ledfail
ledfail - Extinguish (0) or light (1) failure LED
- No help available.
Unknown command '%s' - try 'help' without arguments for list of all known commands
Usage:
%s - %s
?       - alias for 'help'
help
help    - print online help
[command ...]
    - show help information (for 'command')
'help' prints online help for the monitor commands.
Without arguments, it prints a short usage message for all commands.
To get detailed help information for specific commands you can type
'help' with one or more command names as arguments.
exit
exit    - exit script
    - exit functionality
test    - minimal test like /bin/sh
[args..]
    - test functionality
echo
echo    - echo args to console
[args..]
    - echo args to console; \c suppresses newline
version
version - print monitor version
In:    
No input devices available!
Out:   
No output devices available!
Err:   
No error devices available!
Cannot initialize the list of devices!
serial
*** Warning - bad CRC, using default environment
Saving environment to disk %d primary image failed
Saving environment to disk %d secondary image failed
Environment successfully read from disk %d primary image
Environment successfully read from disk %d secondary image
Failed to read valid environment from disk, using built-in default
ERROR : memory not allocated
syntax error
OXNAS> 
ERROR: There is a global environment variable with the same name.
%s: readonly variable
*?[\
\$'"
;&|#
Unknown command '%s' - try 'help' or use 'run' command
;$&|
exit not allowed from main input shell.
<INTERRUPT>
HUSH_VERSION
0.01
then
elif
else
while
until
done
 ERROR: NOT USB_CONFIG_DESC %x
unable to get descriptor, error %lX
config descriptor too short (expected %i, got %i)
selecting invalid interface %d
ERROR, too many USB Devices, max=%d
ERROR: USB_MAX_HUB (%d) reached
     Couldn't reset port %i
      USB device not responding, giving up (status=%lX)
XXX bMaxPacketSize0 unsupported (%u)
      USB device not accepting new address (error=%lX)
unable to get device descriptor (error=%d)
USB device descriptor short read (expected %i, got %i)
failed to set default configuration len %d, status %lX
%d USB Device(s) found
USB:   
scanning bus for devices... 
Error, couldn't init Lowlevel part
cannot reset port %i!?
Device NOT ready
   Request Sense returned %02X %02X %02X
No storage devices, perhaps not 'usb start'ed..?
	Did not get interrupt on CBI
cmd 0x%02X returned 0x%02X 0x%02X 0x%02X 0x%02X (NOT READY)
cmd 0x%02X returned 0x%02X 0x%02X 0x%02X 0x%02X
USB Storage Transport unknown / not yet implemented
Sorry, protocol %d not yet supported.
error in inquiry
READ_CAP ERROR
max USB Storage Device reached: %d stopping
%d Storage Device(s) found
%u MiB
Reading data from NAND FLASH without ECC is not recommended
Timeout!
nand_write_ecc: Not page aligned data
nand_write_ecc: Device is write protected
Writing data without ECC not recommended
U-Boot BUG at %s:%d!
nand_base.c
Offset not a multiple of erasesize size (%d)
Too many bad blocks
Too many bad pages
%d bad pages, %d bad blocks
Write to flash with page replication of %d and block replication of %d
Offset not a multiple of erase size (%x)
Block is bad
Bad page for copy %lx of block %lx
nand_erase: attempt to erase a bad block at page 0x%08x
NAND device: Manufacturer ID: 0x%02x, Chip ID: 0x%02x (%s %s)
NAND bus width %d instead %d bit
No NAND device found!!!
%d NAND chips detected
nand_scan(): Cannot allocate oob_buf
nand_scan(): Cannot allocate data_buf
No oob scheme defined for oobsize %d
2048 byte HW ECC not possible on %d byte page size, fallback to SW ECC
512 byte HW ECC not possible on 256 Byte pagesize, fallback to SW ECC 
NAND_ECC_NONE: Not recommended !!
Invalid NAND_ECC_MODE %d
No ECC functions supplied, Hardware ECC not possible
Toshiba
Samsung
Fujitsu
National
Renesas
ST Micro
Micron
Unknown
128MiB 1,8V 8-bit
128MiB 3,3V 8-bit
128MiB 1,8V 16-bit
128MiB 3,3V 16-bit
256MiB 1,8V 8-bit
256MiB 3,3V 8-bit
256MiB 1,8V 16-bit
256MiB 3,3V 16-bit
512MiB 1,8V 8-bit
512MiB 3,3V 8-bit
512MiB 1,8V 16-bit
512MiB 3,3V 16-bit
1GiB 1,8V 8-bit
1GiB 3,3V 8-bit
1GiB 1,8V 16-bit
1GiB 3,3V 16-bit
2GiB 1,8V 8-bit
2GiB 3,3V 8-bit
2GiB 1,8V 16-bit
2GiB 3,3V 16-bit
create_bbt(): chipnr (%d) > available chips (%d)
Bad block table not found for chip %d
Bad block table found at page %d, version 0x%02X
nand_update_bbt: Out of memory
nand_scan_bbt: Out of memory
nand_bbt: Out of memory
 Eeep. Autoplacement selected and no empty space in oob
Warning: Erase size 0x%08lx smaller than one erase block 0x%08x
         Erasing 0x%08x instead
Skipping bad block at  0x%08x                                            
%s: MTD get bad block failed: %d
%s: MTD Erase failure: %d
%s: MTD writeoob failure: %d
%s: this erase routine only supports NAND devices!
Erasing at 0x%x -- %3d%% complete.
 Cleanmarker written at 0x%x.
Can't pad when oob data is present.
Unknown flash (not normal NAND)
YAFSS cannot operate on 256 Byte page size
Input block length is not page aligned
Image %d bytes, NAND page %d bytes, OOB area %u bytes, device size %u bytes
Input block does not fit into device
Bad block check failed
Bad block at 0x%lx in erase block from 0x%x will be skipped
MTD writeoob failure: %d
writing NAND page at offset 0x%lx failed
Writing data at 0x%lx -- %3d%% complete.
Data did not fit into device, due to bad blocks
Input block is larger than device
reading NAND page at offset 0x%lx failed
MTD readoob failure: %d
Reading data from 0x%lx -- %3d%% complete.
Could not read entire image due to bad blocks
nand_get_lock_status: Start address must be beginning of nand page!
nand_unlock: start: %08x, length: %d!
nand_unlock: Device is write protected!
nand_unlock: Start address must be beginning of nand page!
nand_unlock: Length must be a multiple of nand page size!
Boot Menu
%c: 
=> Select: 
============================== 
LED  test			  
Is Blue LED Blinking ? (Y/N)
Is Red LED Blinking ? (Y/N)
Is 'Bee' sound on and Fan turn on ? (Y/N)
Please press RESET button during 10 seconds...
Timeout!
Please press POWER button during 10 seconds...
Please press HDDA button during 10 seconds...
Please press HDDB button during 10 seconds...
======================================
                XX       XX   
                 XX     XX    
                  XX   XX     
                   XX XX      
                    XXX       
======================================
        OKOK        OK      OK 
      OK    OK	    OK     OK 
    OK        OK    OK    OK 
   OK          OK   OK   OK	
  OK            OK  OK  OK 
  OK            OK  OK OK 
  OK            OK  OKOK 
  OK            OK  OK	OK 
  OK            OK  OK   OK 
   OK          OK   OK    OK 
    OK        OK    OK     OK 
      OK    OK      OK      OK 
        OKOK        OK       OK 
Enter Command Line Interface
Reboot
Start the Kernel Code
GPIO Test Function
%2ld
.%ld
 %cB%s
0123456789abcdefghijklmnopqrstuvwxyz
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
<NULL>
unknown compression method
invalid window size
invalid reserved bit
incorrect header check
invalid block type
invalid stored block lengths
too many length or distance symbols
oversubscribed dynamic bit lengths tree
incomplete dynamic bit lengths tree
invalid bit length repeat
oversubscribed literal/length tree
incomplete literal/length tree
invalid distance code
invalid literal/length code
incorrect data check
stream end
file error
stream error
data error
insufficient memory
buffer error
0.95P
HW reset~~
Resetting...
PHY is Vitesse VSC8201XVZ
PHY is Realtek RTL8211BGR
PHY is Realtek RTL8211D
PHY is LSI ET1011C
PHY is IC+ IP1001LF
Ethernet Phy not recognised!
Wait GMAC to reset
No PHY found
Wait for PHY reset
Wait for link to come up
Link up
Wait for auto-negotiation to complete
Failed to detect link speed
Link is 1000M
Link is 100M
Link is 10M
Unknown link speed!
eth_init(): Failed to allocate memory for DMA descriptors
eth_init(): No memory for socket buffer
eth_init(): Error, no RX descriptor available
eth_rx() Received packet has bad desc_status = 0x%08x
eth_rx(): Failed to set RX descriptor
wait_sata_command_not_busy() Timed out of wait for SATA command to finish
scr_write() Timed out of wait for write completion
wait_dma_not_busy() Timed out of wait for DMA not busy
scr_read() Timed out of wait for read completion
ide_inb() Unknown port = %d
wait_no_error() SATA core flagged error
wait_no_error() Timed out of wait for SATA no-error condition
ide_outb() Unknown port = %d
oxnas_sata_outb() Wait for ATA no-error timed-out
Timed out of wait for DMA channel for SATA device %d to have in-progress clear
Timed out of wait for SATA device %d to have BUSY clear
oxnas_sata_output_data() Wait for ATA no-error timed-out
SATA read fixup port %d cannot deal with %d quads remaining
No FIS received from device %d
No SATA device %d found, PHY status = 0x%08x
SATA PHY not ready for device %d
## Loading Ramdisk Image at %08lx ...
No Linux ARM Ramdisk Image
Starting kernel ...
** ext2fs read block (indir 1) malloc failed. **
** ext2fs read block (indir 1) failed. **
** ext2fs read block (indir 2 1) malloc failed. **
** ext2fs read block (indir 2 1) failed. **
** ext2fs read block (indir 2 2) malloc failed. **
** ext2fs read block (indir 2 2) failed. **
** ext2fs doesn't support tripple indirect blocks. **
<DIR> 
<SYM> 
      
< ? > 
%10d %s
** Can not find directory. **
Failed to mount ext2 filesystem...
 ** ext2fs_devread() read outside partition sector %d
** Invalid Block Device Descriptor (NULL)
 ** ext2fs_devread() read error **
 ** ext2fs_devread() read error - block
 ** ext2fs_devread() read error - last part
(%d:%d) 
Model: %s Firm: %s Ser#: %s
Vendor: %s Prod.: %s Rev: %s
            Type: 
Removable 
Hard Disk
CD ROM
Optical Device
Tape
# %02X #
            Supports 48-bit addressing
            Capacity: %ld.%ld MB = %ld.%ld GB (%ld x %ld)
            Capacity: not available
Partition Map for 
ATAPI
UNKNOWN
 device %d  --   Partition Type: %s
## Unknown partition table
 Extd
** Can't read partition table on %d:%d **
    1		         0	%10ld	%2x
%5d		%10d	%10d	%2x%s
bad MBR sector signature 0x%02x%02x
hd%c%d
sd%c%d
usbd%c%d
docd%c%d
xx%c%d
Partition     Start Sector     Num Sectors     Type
        
bootargs=root=/dev/sda2 initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00
bootcmd=run beep select0 load loadr sysled boot || run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot || run sysretry load loadr sysled boot || run errled select2 load3 loadr3 ramboot boot 
bootdelay=2
baudrate=115200
ethaddr=00:25:b1:ff:ff:00
ipaddr=192.168.0.128
serverip=192.168.0.1
autoload=n
netmask=255.255.0.0
bootfile="uImage"
select0=ide dev 0
select1=ide dev 1
select2=dhcp 
loadr=ide read 0x62000000 2122 1644
load=ide read 0x60500000 50a 1800
loadr3=tftp 0x62000000 rdimg.gz
load2=ide read 0x60500000 e3e8 1800
load3=tftp 0x60500000 uImage
sysretry=led a;ide res
sysled=led 1
errled=led r
beep=beep
ramboot=setenv bootargs root=/dev/ram0 console=ttyS0,115200 initrd=0x61000000 mem=256M
boot=bootm 60500000 62000000
`1tbBBbt0
(((((
AAAAAA
BBBBBB

And about the missing uImage kernel file. I suppose that just writing only the stage1 and u-boot wrappers to a sata disk, than boot it will give me a U-boot prompt that I can use to tftp-load my existing KD20 Uimage and uInitrd and then boot my Debian stretch (KD20) USB and flash these new stage1 and u-boot wrappers from this KD20_sata_boot.tar.gz archive to the KD20 NAND instead of the uboot.spl.2013.10.ox820.850mhz.mtd0.img and the uboot.2015.10-tld-2.ox820.mtd0.img.

All in all not very plug and play, but if the results will be that I can continue from there to modify the KD20 (U-boot) if needed so that it can have it boot from 'rootfs' labeled USB or SATA drives then I am the last one to complain about it.

As I realize now: for the direct SATA boot disk I created I used the PogoSata.tar.gz archive that contained a complete system that should be created with just running the script.(created by schnee) This didn´t work as expected. The script missed a drive it could not mount, so most files were not copied at all. But also the environment used is not based on a KD20, but on a Pogoplug classic. I now see that a different, much larger stage1.wrapper file is used. It has a u-boot.env file that contains a reference to the pogo-classic.dtb and there is a u-boot.img size 513.5kb that is much larger then the u-boot.wrapped file from the KD20_sata_boot.tar.gz archive which is only 154.0 kb.

I hope you can confirm one thing or another, confirm the steps I think I should take or tell where to use other options.

Thanks again for all your assistance on this.

hacksome
Re: Debian cannot boot on KD20 after flashing u-boot
June 28, 2020 06:47PM
hacksome,


> The uboot.spl.2013.10.ox820.850mhz.mtd0.img did
> not show any human recognizable information. The
> only thing I could make of it that it contained a
> pattern of hex codes 0xAA and 0x55. I know this is
> not random because 0x55 is 01010101 and 0xAA is
> 10101010. So I assumed this images presented a bit
> pattern matrix. But how it is used? I have no
> idea.


> In the uboot.2015.10-tld-2.ox820.mtd0.img I
> recognized various areas. ASCII strings with text
> kernel version, labels, U-boot commands and
> variables. Most of the image contents looked as
> machine code to me and I recognized one thing that
> made me hesitate a little: the image
> uboot.2015.10-tld-2.ox820.mtd0.img tries to load
> the ¨boot/dts/ox820-pogoplug-pro.dtb¨. But I
> gambled that some misconfiguration would not screw
> up the machine completely.
>

Really it does not matter much about the internals of these images. I would not worry or try to understand it.

> I have a KD20.zip file that contains both
> 'stage1.wrapped-nand' size 56.0 kb and
> 'u-boot.wrapped-nand' files size 1.3MB. But being
> more cautious this time I checked those with a hex
> editor and I found out that both files only
> contain 0x55 and 0xAA patterns. I suppose those
> are not the ones to use.....
>

If u-boot.wrapped-nand doesn't have u-boot version string and the envs in there, then it is not good. hexedit should show on the right hand column these data in readable text.


> I have a KD20_sata_boot.tar.gz files that contains
> one directory with 3 files in it. Those files are
> not 'wrapped-nand' images but 'stage1.wrapped' and
> 'u-boot.wrapped' files and a disk create script
> that writes the magic dust in de HDD sector and
> copies the images to absolute disk aereas.

This is used to create the dirrect SATA drive booting partition.

>
> I assume these are the images I could or should
> use?

Yes, use it to create the HDD.

> There is no kernel file (uImage) provided.

It is OK. Trying booting first. Once you get to the u-boot prompt, then power down. Bring the HDD to another Linux box, and populate it with the rootfs Debian-4.14.180-oxnas-tld-1-rootfs-bodhi.tar.bz2 (Buster) or Debian-4.4.54-oxnas-tld-1-rootfs-bodhi.tar.bz2 (Stretch).


> One thing I wonder is if you use 'dd' to just
> write blocks of data to disk there is no partition
> or filesystem information created. Will this work?
> I assume that will only work when those
> data-blocks are 'device' images that contain all
> required partition information within the written
> image?

dd should only be used in this procedure to write to a raw unused sector. That's where the magic dust is written to. Don't use it casually in anything related to writing to HDD. You will see dd used a lot in other scenarios, but mostly it is to deal with file as device (i.e. /dev/xxx) , or device as file, at a binary level.

> Within the stage1.wrapper file, size 8.2 kb I see
> a name 'BOOTP'

Ignore this. It is not usable.

> As I realize now: for the direct SATA boot disk I
> created I used the PogoSata.tar.gz archive that
> contained a complete system that should be created
> with just running the script.(created by schnee)
> This didn´t work as expected. The script missed a
> drive it could not mount, so most files were not
> copied at all.

You don't need to run schnee script automatically. Just run each of the steps from his script. And when it get to the drive that you cannot mount, post the question here.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
June 28, 2020 07:14PM
bodhi Wrote:
-------------------------------------------------------
> dd should only be used in this
>procedure to write to a raw unused
>sector. That's where the magic dust
>is written to. Don't use it casually in
>anything related to writing to HDD.

LOL in remembering DD's nickname is "disk destroyer". Looking down in shame having proven it a few times.



Edited 2 time(s). Last edit at 06/28/2020 07:16PM by LeggoMyEggo.
Re: Debian cannot boot on KD20 after flashing u-boot
June 28, 2020 09:52PM
> LOL in remembering DD's nickname is "disk
> destroyer". Looking down in shame having proven
> it a few times.

That will make you remember for sure :))

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
June 29, 2020 04:51PM
Bodhi,

I created the direct SATA boot with the KD20 'stage1.wrapped' and 'u-boot.wrapped' dd´ d those to the disk and i got a working U-boot.
I populated a rootfs with Debian-4.4.54-oxnas-tld-1-rootfs-bodhi.tar.bz2 (Stretch). With KD20.dtb appended to uImage.

However, I could not figure out what u-boot environment changes were needed to actually boot from the disk.
printenv output from u-boot console:
Stage-1 Bootloader 2015-01.21-21:48:56
Attempting to set PLLA to 800MHz ...
  plla_ctrl0 : 0x0000030A
  plla_ctrl1 : 0x00400000
  plla_ctrl2 : 0x007F0068
  plla_ctrl3 : 0x00000193
PLLA Set

Setup memory, testing
Reading disk 00
  Sector : 0x0000009A
  Hdr len: 0x00025978
  Hdr CRC: 0x1CCE0DF0
 OK
Detecting SATA busses:
Bus 0: No devices found
Failed to read valid environment from disk, using built-in default

     _           _   _   _       
    | |         | | | | | |      
 ___| |__  _   _| |_| |_| | ___  
/ __| '_ \| | | | __| __| |/ _ \ 
\__ \ | | | |_| | |_| |_| |  __/ 
|___/_| |_|\__,_|\__|\__|_|\___| 
          _   _     ____              _
         | | | |   | __ )  ___   ___ | |_ 
         | | | |___|  _ \ / _ \ / _ \| __| 
         | |_| |___| |_) | (_) | (_) | |_ 
          \___/    |____/ \___/ \___/ \__| 

U-Boot 1.1.2 (Jan 24 2015 - 13:54:11)

U-Boot code: 60D00000 -> 60D25978  BSS: -> 60D3A680
IRQ Stack: 60cddf7c
FIQ Stack: 60cdcf7c
RAM Configuration:
	Bank #0: 60000000 256 MB
SRAM Configuration:
	64KB at 0x50000000
NAND:128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Setting Linux mem= boot arg value
Hit any key to stop autoboot:  2  1  0 

IDE device 0: not available
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
Wait GMAC to reset
Wait for PHY reset
PHY is IC+ IP1001LF
Wait for link to come up.............Link up
Wait for auto-negotiation to complete
Link is 1000M
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 2
*** Unhandled DHCP Option in OFFER/ACK: 23
*** Unhandled DHCP Option in OFFER/ACK: 2
*** Unhandled DHCP Option in OFFER/ACK: 23
DHCP client bound to address 192.168.178.19
Wait GMAC to reset
Wait for PHY reset
PHY is IC+ IP1001LF
Wait for link to come up.............Link up
Wait for auto-negotiation to complete
Link is 1000M
TFTP from server 192.168.178.1; our IP address is 192.168.178.19
Filename 'uImage'.
Load address: 0x60500000
Loading: *
Abort

                              Boot Menu
==============================================================================
0: Enter Command Line Interface             1: Reboot
2: Start the Kernel Code                    T: GPIO Test Function

=> Select: 
OXNAS> help


?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
beep	- make beep sound
bootm   - boot application image from memory
bootp	- boot image via network using BootP/TFTP protocol
clrenv	- clear environment
cmp     - memory compare
cp      - memory copy
crc32   - checksum calculation
dhcp	- invoke DHCP client to obtain IP/boot params
diskboot- boot from IDE device
echo    - echo args to console
exit    - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
go      - start application at address 'addr'
help    - print online help
ide     - IDE sub-system
iminfo  - print header information for application image
led	- LED Switch
ledfail - Extinguish (0) or light (1) failure LED
loop    - infinite loop on address range
md      - memory display
mm      - memory modify (auto-incrementing)
mtest   - simple RAM test
mw      - memory write (fill)
nand	- NAND sub-system
nboot   - boot from NAND device
nm      - memory modify (constant address)
ping	- send ICMP ECHO_REQUEST to network host
poweroff- Power-OFF
printenv- print environment variables
part	- clear MBR
rarpboot- boot image via network using RARP/TFTP protocol
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv  - set environment variables
test    - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor version
OXNAS>


=> Select: 
OXNAS> printenv

bootcmd=run beep select0 load loadr sysled boot || run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot || run sysretry load loadr sysled boot || run errled select2 load3 loadr3 ramboot boot 
bootdelay=2
baudrate=115200
ethaddr=00:25:b1:ff:ff:00
autoload=n
select0=ide dev 0
select1=ide dev 1
select2=dhcp 
loadr=ide read 0x62000000 2122 1644
load=ide read 0x60500000 50a 1800
loadr3=tftp 0x62000000 rdimg.gz
load2=ide read 0x60500000 e3e8 1800
load3=tftp 0x60500000 uImage
sysretry=led a;ide res
sysled=led 1
errled=led r
beep=beep
ramboot=setenv bootargs root=/dev/ram0 console=ttyS0,115200 initrd=0x61000000 mem=256M
boot=bootm 60500000 62000000
stdin=serial
stdout=serial
stderr=serial
bootargs=root=/dev/sda2 initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00 mem=256M poweroutage=yes
bootfile=uImage
gatewayip=192.168.178.1
netmask=255.255.255.0
ipaddr=192.168.178.19
serverip=192.168.178.1
dnsip=192.168.178.33

Environment size: 1206/8188 bytes


I noticed that environment settings were quite different from the ones 'Bastler' had on his box.
Saving the environment changes give this output:
I modified the serverip address and tried to save it:

 OXNAS> saveenv
Saving Environment to Disk...

But after the reset command changes were vanished.


So I used the the follwing tftp procedure to boot Debian stretch.
tftp 0x60000000 uImage ; tftp 0x61000000 uInitrd
bootm 0x60000000 0x61000000

After that I can ssh into Debian stretch.

dmesg output:
root@debian:~# dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.54-oxnas-tld-1 (root@tldDebian) (gcc version 4.9.2 (Debian 4.9.2-10) ) #2 SMP PREEMPT Sat Mar 18 23:09:58 PDT 2017
[    0.000000] CPU: ARMv6-compatible processor [410fb025] revision 5 (ARMv7), cr=00c5787d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Shuttle KD20
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 65536
[    0.000000] free_area_init_node: node 0, pgdat c08a69c0, node_mem_map cfdf9000
[    0.000000]   Normal zone: 512 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 65536 pages, LIFO batch:15
[    0.000000] DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map
[    0.000000] PERCPU: Embedded 12 pages/cpu @cfdd9000 s17696 r8192 d23264 u49152
[    0.000000] pcpu-alloc: s17696 r8192 d23264 u49152 alloc=12*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: root=/dev/sda2 initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00 mem=256M poweroutage=yes
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 246144K/262144K available (6410K kernel code, 288K rwdata, 1908K rodata, 224K init, 247K bss, 16000K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
                   vector  : 0xffff0000 - 0xffff1000   (   4 kB)
                   fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
                   vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
                   lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
                   modules : 0xbf000000 - 0xc0000000   (  16 MB)
                     .text : 0xc0008000 - 0xc0827e14   (8320 kB)
                     .init : 0xc0828000 - 0xc0860000   ( 224 kB)
                     .data : 0xc0860000 - 0xc08a8378   ( 289 kB)
                      .bss : 0xc08a8378 - 0xc08e6350   ( 248 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:160
[    0.000000] clocksource: rps_clocksource_timer: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 19112603332 ns
[    0.000010] sched_clock: 24 bits at 390kHz, resolution 2560ns, wraps every 21474835200ns
[    0.000202] Console: colour dummy device 80x30
[    0.000238] Calibrating delay loop... 319.48 BogoMIPS (lpj=1597440)
[    0.050030] pid_max: default: 32768 minimum: 301
[    0.050222] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.050240] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.051123] Initializing cgroup subsys net_cls
[    0.051212] CPU: Testing write buffer coherency: ok
[    0.051663] Setting up static identity map for 0x60008220 - 0x60008258
[    0.190156] Brought up 2 CPUs
[    0.190179] SMP: Total of 2 processors activated (638.97 BogoMIPS).
[    0.191027] devtmpfs: initialized
[    0.197242] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.197294] futex hash table entries: 512 (order: 2, 16384 bytes)
[    0.197649] prandom: seed boundary self test passed
[    0.202344] prandom: 100 self tests passed
[    0.202375] pinctrl core: initialized pinctrl subsystem
[    0.203279] NET: Registered protocol family 16
[    0.203942] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.230018] cpuidle: using governor ladder
[    0.260011] cpuidle: using governor menu
[    0.266419] gpio-oxnas 44000000.gpio: at address d0848000
[    0.266851] gpio-oxnas 44100000.gpio: at address d084a000
[    0.267471] pinctrl-oxnas pinctrl: initialized OX820 pinctrl driver
[    0.392066] oxnas-pcie 47c00000.pcie-controller: PCIe version/deviceID 0x82510b5
[    0.402178] oxnas-pcie 47c00000.pcie-controller: link up
[    0.402554] oxnas-pcie 47c00000.pcie-controller: PCI host bridge to bus 0000:00
[    0.402583] pci_bus 0000:00: root bus resource [mem 0x48000000-0x49ffffff]
[    0.402606] pci_bus 0000:00: root bus resource [mem 0x4a000000-0x4bdfffff pref]
[    0.402626] pci_bus 0000:00: root bus resource [io  0x0000-0xfffff]
[    0.402649] pci_bus 0000:00: root bus resource [bus 00-7f]
[    0.402711] pci 0000:00:00.0: [1b6f:7023] type 00 class 0x0c0330
[    0.402787] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x00007fff 64bit]
[    0.402936] pci 0000:00:00.0: supports D1 D2
[    0.402954] pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
[    0.403294] PCI: bus0: Fast back to back transfers disabled
[    0.403392] pci 0000:00:00.0: BAR 0: assigned [mem 0x48000000-0x48007fff 64bit]
[    0.403927] vgaarb: loaded
[    0.404446] SCSI subsystem initialized
[    0.404830] libata version 3.00 loaded.
[    0.405393] usbcore: registered new interface driver usbfs
[    0.405516] usbcore: registered new interface driver hub
[    0.405685] usbcore: registered new device driver usb
[    0.405893] pps_core: LinuxPPS API ver. 1 registered
[    0.405905] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.405957] PTP clock support registered
[    0.408360] clocksource: Switched to clocksource rps_clocksource_timer
[    0.428300] NET: Registered protocol family 2
[    0.429263] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.429324] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.429381] TCP: Hash tables configured (established 2048 bind 2048)
[    0.429488] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.429534] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.429821] NET: Registered protocol family 1
[    0.430499] RPC: Registered named UNIX socket transport module.
[    0.430522] RPC: Registered udp transport module.
[    0.430535] RPC: Registered tcp transport module.
[    0.430545] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.430609] pci 0000:00:00.0: enabling device (0140 -> 0142)
[    0.430676] PCI: CLS 32 bytes, default 32
[    0.431068] Unpacking initramfs...
[    0.940326] Freeing initrd memory: 4492K (c1000000 - c1463000)
[    0.951313] Initialise system trusted keyring
[    0.984407] zbud: loaded
[    1.001505] NFS: Registering the id_resolver key type
[    1.001566] Key type id_resolver registered
[    1.001582] Key type id_legacy registered
[    1.001628] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    1.001653] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    1.002641] fuse init (API version 7.23)
[    1.004856] Key type big_key registered
[    1.088627] Key type asymmetric registered
[    1.088665] Asymmetric key parser 'x509' registered
[    1.088808] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.088837] io scheduler noop registered
[    1.088857] io scheduler deadline registered
[    1.088926] io scheduler cfq registered (default)
[    1.089582] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    1.091284] console [ttyS0] disabled
[    1.091389] 44200000.uart: ttyS0 at MMIO 0x44200000 (irq = 6, base_baud = 390625) is a 16550A
[    1.683834] console [ttyS0] enabled
[    1.699650] loop: module loaded
[    1.705809] scsi host0: sata_oxnas
[    1.710049] scsi host1: sata_oxnas
[    1.713896] ata1: SATA max UDMA/133 irq 7
[    1.717895] ata2: SATA max UDMA/133 irq 7
[    1.722032] sata_oxnas: resetting SATA core
[    1.723184] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xf1
[    1.723192] nand: Hynix H27U1G8F2BTR-BC
[    1.723200] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.723230] Scanning device for bad blocks
[    1.736878] Bad eraseblock 167 at 0x0000014e0000
[    1.806896] 2 ofpart partitions found on MTD device 41000000.nand
[    1.812989] Creating 2 MTD partitions on "41000000.nand":
[    1.818388] 0x000000000000-0x000000e00000 : "boot"
[    1.825144] 0x000000e00000-0x000008000000 : "ubi"
[    1.832499] oxnas-gmac 40400000.ethernet: snps,phy-addr property is deprecated
[    1.839790] oxnas-gmac 40400000.ethernet: no reset control found
[    1.845813] stmmac - user ID: 0x12, Synopsys ID: 0x35
[    1.850856]  Ring mode enabled
[    1.853898]  DMA HW capability register supported
[    1.858403]  Enhanced/Alternate descriptors
[    1.862748] 	Enabled extended descriptors
[    1.866736]  RX Checksum Offload Engine supported (type 2)
[    1.872207]  TX Checksum insertion supported
[    1.876454]  Wake-Up On Lan supported
[    1.880110]  Enable RX Mitigation via HW Watchdog Timer
[    1.908572] libphy: stmmac: probed
[    1.912015] eth%d: PHY ID 02430d91 at 1 IRQ POLL (stmmac-0:01) active
[    1.919360] PPP generic driver version 2.4.2
[    1.924328] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.930887] ehci-pci: EHCI PCI platform driver
[    1.935708] oxnas-ehci 40200100.ehci: EHCI Host Controller
[    1.941273] oxnas-ehci 40200100.ehci: new USB bus registered, assigned bus number 1
[    1.949084] oxnas-ehci 40200100.ehci: irq 10, io mem 0x40200100
[    1.970158] oxnas-ehci 40200100.ehci: USB 2.0 started, EHCI 1.00
[    1.976501] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.983303] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.990512] usb usb1: Product: EHCI Host Controller
[    1.995368] usb usb1: Manufacturer: Linux 4.4.54-oxnas-tld-1 ehci_hcd
[    2.001799] usb usb1: SerialNumber: 40200100.ehci
[    2.007564] hub 1-0:1.0: USB hub found
[    2.011535] hub 1-0:1.0: 2 ports detected
[    2.016691] xhci_hcd 0000:00:00.0: xHCI Host Controller
[    2.021985] xhci_hcd 0000:00:00.0: new USB bus registered, assigned bus number 2
[    2.029762] xhci_hcd 0000:00:00.0: hcc params 0x040040a5 hci version 0x100 quirks 0x00080490
[    2.038679] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    2.045486] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.052712] usb usb2: Product: xHCI Host Controller
[    2.057569] usb usb2: Manufacturer: Linux 4.4.54-oxnas-tld-1 xhci-hcd
[    2.064002] usb usb2: SerialNumber: 0000:00:00.0
[    2.069662] hub 2-0:1.0: USB hub found
[    2.073543] hub 2-0:1.0: 2 ports detected
[    2.078435] xhci_hcd 0000:00:00.0: xHCI Host Controller
[    2.083706] xhci_hcd 0000:00:00.0: new USB bus registered, assigned bus number 3
[    2.091302] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.099632] usb usb3: New USB device found, idVendor=1d6b, idProduct=0003
[    2.106449] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.113948] usb usb3: Product: xHCI Host Controller
[    2.118809] usb usb3: Manufacturer: Linux 4.4.54-oxnas-tld-1 xhci-hcd
[    2.125255] usb usb3: SerialNumber: 0000:00:00.0
[    2.130954] hub 3-0:1.0: USB hub found
[    2.134778] hub 3-0:1.0: 2 ports detected
[    2.139950] usbcore: registered new interface driver cdc_acm
[    2.145646] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    2.153779] usbcore: registered new interface driver cdc_wdm
[    2.159649] usbcore: registered new interface driver usb-storage
[    2.165913] usbcore: registered new interface driver usbserial
[    2.172116] usbcore: registered new interface driver usbserial_generic
[    2.178685] usbserial: USB Serial support registered for generic
[    2.185162] mousedev: PS/2 mouse device common for all mice
[    2.190968] i2c /dev entries driver
[    2.196641] hidraw: raw HID events driver (C) Jiri Kosina
[    2.202327] usbcore: registered new interface driver usbhid
[    2.207872] usbhid: USB HID core driver
[    2.213818] NET: Registered protocol family 10
[    2.219694] sit: IPv6 over IPv4 tunneling driver
[    2.225392] NET: Registered protocol family 17
[    2.230021] Key type dns_resolver registered
[    2.236206] registered taskstats version 1
[    2.240373] Loading compiled-in X.509 certificates
[    2.245278] zswap: loaded using pool lzo/zbud
[    2.265697] Key type encrypted registered
[    2.270146] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[    2.276825] ata1.00: ATA-10: KINGSTON SA400S37480G, SBFKB1C2, max UDMA/133
[    2.283806] ata1.00: 937703088 sectors, multi 1: LBA48 NCQ (depth 0/32)
[    2.290905] ata1.00: configured for UDMA/133
[    2.330534] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SA400S3 B1C2 PQ: 0 ANSI: 5
[    2.340052] sd 0:0:0:0: [sda] 937703088 512-byte logical blocks: (480 GB/447 GiB)
[    2.348672] sata_oxnas: resetting SATA core
[    2.349132] sd 0:0:0:0: [sda] Write Protect is off
[    2.349150] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    2.349373] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.390190] usb 2-1: new high-speed USB device number 2 using xhci_hcd
[    2.396874] sata_oxnas: resetting SATA core
[    2.544814] usb 2-1: New USB device found, idVendor=05e3, idProduct=0723
[    2.551528] usb 2-1: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[    2.558632] usb 2-1: Product: USB Storage
[    2.562644] usb 2-1: Manufacturer: Generic 
[    2.568655] usb-storage 2-1:1.0: USB Mass Storage device detected
[    2.590376] scsi host2: usb-storage 2-1:1.0
[    3.070146] ata2: SATA link down (SStatus 0 SControl 300)
[    3.160051] ata1: exception Emask 0x10 SAct 0x0 SErr 0x0 action 0xe frozen
[    3.166917] ata1: hard resetting link
[    3.611079] scsi 2:0:0:0: Direct-Access     Generic  STORAGE DEVICE   9454 PQ: 0 ANSI: 0
[    3.622581] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[    4.080035] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[    4.086707] ata1.00: configured for UDMA/133
[    4.091084] ata1: EH complete
[    4.094499]  sda: sda1 sda2 sda3
[    4.101762] sd 0:0:0:0: [sda] Attached SCSI disk
[    4.106718] Freeing unused kernel memory: 224K (c0828000 - c0860000)
[    4.307412] random: systemd-udevd: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.318794] random: systemd-udevd: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.320381] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.322823] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.323023] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.324321] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.325521] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.326668] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.327892] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.329213] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.756664] usbcore: registered new interface driver uas
[    4.817111] i2c-gpio i2c-gpio: using pins 41 (SDA) and 42 (SCL)
[   22.029713] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
[   24.401031] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0
[   25.947276] EXT4-fs (sda2): re-mounted. Opts: errors=remount-ro
[   29.640501] eth0: device MAC address 0e:ab:62:e2:15:a6
[   33.720184] oxnas-gmac 40400000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

root@debian:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00e00000 00020000 "boot"
mtd1: 07200000 00020000 "ubi"

root@debian:~# cat /etc/fw_env.config
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
# pogoplug pro
  /dev/mtd0               0x00100000      0x20000         0x20000

root@debian:~# fw_printenv
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x60500000 0x60e00000 0x62c00000; else bootm 0x60500000 0x60e00000; fi; else if run load_dtb; then bootm 0x60500000 - 0x62c00000; else bootm 0x60500000; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
usb_custom_params=zswap.enabled=1
device=0:1
devices=usb ide
disks=0 1 2 3
ethaddr=52:3b:20:9c:11:51
ethact=mii0
if_netconsole=ping $serverip
ipaddr=192.168.0.222
serverip=192.168.0.220
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device 0x62c00000 $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device 0x60e00000 /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device 0x60500000 /boot/uImage
mainlineLinux=yes
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 0x60500000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60510000  $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15
dtb_file=/boot/dts/ox820-kd20.dtb

From there I flashed the 'stage1.wrapped' and 'u-boot.wrapped'

However I get this outputs:
root@debian:/kd20# /usr/sbin/flash_erase /dev/mtd0 0x0 6
Erasing 128 Kibyte @ 7f578f5c00000064 --  6 % complete 
root@debian:/kd20# /usr/sbin/nandwrite /dev/mtd0 stage1.wrapped
Input file is not page-aligned. Use the padding option.
nandwrite: error!: Data was only partially written due to error
           error 0 (Success)
root@debian:/kd20# /usr/sbin/nandwrite /dev/mtd0 u-boot.wrapped
Input file is not page-aligned. Use the padding option.
nandwrite: error!: Data was only partially written due to error
           error 0 (Success)

And I have no environment to write.....
When booting without disk, nothing happens on the TTY.
I have also removed the magic dust on the sata disk so it would not use it´s own u-boot, but that did not work either.

I reflashed using the padding option:
root@debian:/kd20# /usr/sbin/flash_erase /dev/mtd0 0x0 6
Erasing 128 Kibyte @ 7f569f5c00000064 --  6 % complete 
root@debian:/kd20# /usr/sbin/nandwrite -p /dev/mtd0 stage1.wrapped
Writing data to block 0 at offset 0x0
root@debian:/kd20# /usr/sbin/nandwrite -p -s 262144 /dev/mtd0 u-boot.wrapped
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000
root@debian:/kd20#

No error message, but still no sign of life anywhere....

hacksome
Re: Debian cannot boot on KD20 after flashing u-boot
June 29, 2020 05:04PM
hacksome,

> From there I flashed the 'stage1.wrapped' and
> 'u-boot.wrapped'
>
> However I get this outputs:
>
> root@debian:/kd20# /usr/sbin/flash_erase /dev/mtd0
> 0x0 6
> Erasing 128 Kibyte @ 7f578f5c00000064 --  6 %
> complete 
> root@debian:/kd20# /usr/sbin/nandwrite /dev/mtd0
> stage1.wrapped
> Input file is not page-aligned. Use the padding
> option.
> nandwrite: error!: Data was only partially written
> due to error
>            error 0 (Success)
> root@debian:/kd20# /usr/sbin/nandwrite /dev/mtd0
> u-boot.wrapped
> Input file is not page-aligned. Use the padding
> option.
> nandwrite: error!: Data was only partially written
> due to error
>            error 0 (Success)
> 
>
>
> And I have no environment to write.....
> When booting without disk, nothing happens on the
> TTY.

You should not reboot when there is error in flashing. Because there is no valid u-boot in NAND at this point.

And remember that you flashed stock u-boot, so anything related to the new u-boot will not apply.

Let's get back to booting with direct SATA again. Populate the HDD with the new rootfs. And I will come back to suggest the next step.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
June 30, 2020 05:20AM
Bodhi,

maybe I was not specific enough. I have no problem creating a direct sata boot disk and populate the rootfs with a debian version. For now I use Debian Stretch 4.4.54. When I start this sata boot disk I get this U-boot screen on the serial TTY.
Stage-1 Bootloader 2015-01.21-21:48:56
Attempting to set PLLA to 800MHz ...
  plla_ctrl0 : 0x0000030A
  plla_ctrl1 : 0x00400000
  plla_ctrl2 : 0x007F0068
  plla_ctrl3 : 0x00000193
PLLA Set

Setup memory, testing
Reading disk 00
  Sector : 0x0000009A
  Hdr len: 0x00025978
  Hdr CRC: 0x1CCE0DF0
 OK
Detecting SATA busses:
Bus 0: No devices found
Failed to read valid environment from disk, using built-in default

     _           _   _   _       
    | |         | | | | | |      
 ___| |__  _   _| |_| |_| | ___  
/ __| '_ \| | | | __| __| |/ _ \ 
\__ \ | | | |_| | |_| |_| |  __/ 
|___/_| |_|\__,_|\__|\__|_|\___| 
          _   _     ____              _
         | | | |   | __ )  ___   ___ | |_ 
         | | | |___|  _ \ / _ \ / _ \| __| 
         | |_| |___| |_) | (_) | (_) | |_ 
          \___/    |____/ \___/ \___/ \__| 

U-Boot 1.1.2 (Jan 24 2015 - 13:54:11)

U-Boot code: 60D00000 -> 60D25978  BSS: -> 60D3A680
IRQ Stack: 60cddf7c
FIQ Stack: 60cdcf7c
RAM Configuration:
	Bank #0: 60000000 256 MB
SRAM Configuration:
	64KB at 0x50000000
NAND:128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Setting Linux mem= boot arg value
Hit any key to stop autoboot:  0 

IDE device 0: not available
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
enable_interrupts

Reset IDE: Detecting SATA busses:
Bus 0: No devices found
disk is not present!
Wait GMAC to reset
Wait for PHY reset
PHY is IC+ IP1001LF
Wait for link to come up.............Link up
Wait for auto-negotiation to complete
Link is 1000M
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 2
*** Unhandled DHCP Option in OFFER/ACK: 23
*** Unhandled DHCP Option in OFFER/ACK: 2
*** Unhandled DHCP Option in OFFER/ACK: 23
DHCP client bound to address 192.168.178.19
Wait GMAC to reset
Wait for PHY reset
PHY is IC+ IP1001LF
Wait for link to come up.............Link up
Wait for auto-negotiation to complete
Link is 1000M
TFTP from server 192.168.178.1; our IP address is 192.168.178.19
Filename 'uImage'.
Load address: 0x60500000
Loading: T T T T T T T T T T T T T

This is all that happens when I let the Uboot on the sata disk do it´s thing. It does not boot the disk, I assume because the environment is not properly configured to do that.
The uboot does not boot via tftp either because the serverip is not configured. If I interrupt the uboot, set the serverip and start tftpboot then it only downloads the uImage and returns to the uBoot prompt.

OXNAS> setenv serverip 192.168.178.15
OXNAS> tftpboot
Wait GMAC to reset
Wait for PHY reset
PHY is IC+ IP1001LF
Wait for link to come up.............Link up
Wait for auto-negotiation to complete
Link is 1000M
TFTP from server 192.168.178.15; our IP address is 192.168.178.19
Filename 'uImage'.
Load address: 0x60500000
Loading: #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 ############################################################
done
Bytes transferred = 4629915 (46a59b hex)
OXNAS>

these are the env settings:
OXNAS> printenv
bootcmd=run beep select0 load loadr sysled boot || run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot || run sysretry load loadr sysled boot || run errled select2 load3 loadr3 ramboot boot 
bootdelay=2
baudrate=115200
ethaddr=00:25:b1:ff:ff:00
autoload=n
select0=ide dev 0
select1=ide dev 1
select2=dhcp 
loadr=ide read 0x62000000 2122 1644
load=ide read 0x60500000 50a 1800
loadr3=tftp 0x62000000 rdimg.gz
load2=ide read 0x60500000 e3e8 1800
load3=tftp 0x60500000 uImage
sysretry=led a;ide res
sysled=led 1
errled=led r
beep=beep
ramboot=setenv bootargs root=/dev/ram0 console=ttyS0,115200 initrd=0x61000000 mem=256M
boot=bootm 60500000 62000000
stdin=serial
stdout=serial
stderr=serial
bootargs=root=/dev/sda2 initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00 mem=256M poweroutage=yes
bootfile=uImage
filesize=46a59b
fileaddr=60500000
gatewayip=192.168.178.1
netmask=255.255.255.0
ipaddr=192.168.178.19
serverip=192.168.178.15
dnsip=192.168.178.33

Environment size: 1241/8188 bytes
OXNAS>

when I enter:
bootm 0x60500000
It boots without problems into Debian Stretch this is wat I get on the TTY console:
## Booting image at 60500000 ...
   Image Name:   Linux-4.4.54-oxnas-tld-1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4629851 Bytes =  4.4 MB
   Load Address: 60008000
   Entry Point:  60008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.54-oxnas-tld-1 (root@tldDebian) (gcc version 4.9.2 (Debian 4.9.2-10) ) #2 SMP PREEMPT Sat Mar 18 23:09:58 PDT 2017
[    0.000000] CPU: ARMv6-compatible processor [410fb025] revision 5 (ARMv7), cr=00c5787d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Shuttle KD20
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map
[    0.000000] PERCPU: Embedded 12 pages/cpu @cfdd9000 s17696 r8192 d23264 u49152
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: root=/dev/sda2 initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00 mem=256M poweroutage=yes
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 250636K/262144K available (6410K kernel code, 288K rwdata, 1908K rodata, 224K init, 247K bss, 11508K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0827e14   (8320 kB)
[    0.000000]       .init : 0xc0828000 - 0xc0860000   ( 224 kB)
[    0.000000]       .data : 0xc0860000 - 0xc08a8378   ( 289 kB)
[    0.000000]        .bss : 0xc08a8378 - 0xc08e6350   ( 248 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:160
[    0.000000] clocksource: rps_clocksource_timer: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 19112603332 ns
[    0.000010] sched_clock: 24 bits at 390kHz, resolution 2560ns, wraps every 21474835200ns
[    0.000199] Console: colour dummy device 80x30
[    0.000235] Calibrating delay loop... 319.48 BogoMIPS (lpj=1597440)
[    0.050030] pid_max: default: 32768 minimum: 301
[    0.050216] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.050237] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.051123] Initializing cgroup subsys net_cls
[    0.051210] CPU: Testing write buffer coherency: ok
[    0.051665] Setting up static identity map for 0x60008220 - 0x60008258
[    0.190151] Brought up 2 CPUs
[    0.190177] SMP: Total of 2 processors activated (638.97 BogoMIPS).
[    0.191014] devtmpfs: initialized
[    0.197800] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.197852] futex hash table entries: 512 (order: 2, 16384 bytes)
[    0.198195] prandom: seed boundary self test passed
[    0.202892] prandom: 100 self tests passed
[    0.202923] pinctrl core: initialized pinctrl subsystem
[    0.203829] NET: Registered protocol family 16
[    0.204492] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.230021] cpuidle: using governor ladder
[    0.260011] cpuidle: using governor menu
[    0.266411] gpio-oxnas 44000000.gpio: at address d0848000
[    0.266826] gpio-oxnas 44100000.gpio: at address d084a000
[    0.267430] pinctrl-oxnas pinctrl: initialized OX820 pinctrl driver
[    0.392002] oxnas-pcie 47c00000.pcie-controller: PCIe version/deviceID 0x82510b5
[    0.402106] oxnas-pcie 47c00000.pcie-controller: link up
[    0.402483] oxnas-pcie 47c00000.pcie-controller: PCI host bridge to bus 0000:00
[    0.402513] pci_bus 0000:00: root bus resource [mem 0x48000000-0x49ffffff]
[    0.402534] pci_bus 0000:00: root bus resource [mem 0x4a000000-0x4bdfffff pref]
[    0.402552] pci_bus 0000:00: root bus resource [io  0x0000-0xfffff]
[    0.402575] pci_bus 0000:00: root bus resource [bus 00-7f]
[    0.403217] PCI: bus0: Fast back to back transfers disabled
[    0.403317] pci 0000:00:00.0: BAR 0: assigned [mem 0x48000000-0x48007fff 64bit]
[    0.403850] vgaarb: loaded
[    0.404380] SCSI subsystem initialized
[    0.405322] usbcore: registered new interface driver usbfs
[    0.405440] usbcore: registered new interface driver hub
[    0.405614] usbcore: registered new device driver usb
[    0.405818] pps_core: LinuxPPS API ver. 1 registered
[    0.405839] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.405888] PTP clock support registered
[    0.408307] clocksource: Switched to clocksource rps_clocksource_timer
[    0.428513] NET: Registered protocol family 2
[    0.429480] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.429544] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.429606] TCP: Hash tables configured (established 2048 bind 2048)
[    0.429716] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.429765] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.430146] NET: Registered protocol family 1
[    0.430732] RPC: Registered named UNIX socket transport module.
[    0.430755] RPC: Registered udp transport module.
[    0.430766] RPC: Registered tcp transport module.
[    0.430776] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.430840] pci 0000:00:00.0: enabling device (0140 -> 0142)
[    0.432942] Initialise system trusted keyring
[    0.446720] zbud: loaded
[    0.452643] NFS: Registering the id_resolver key type
[    0.452705] Key type id_resolver registered
[    0.452723] Key type id_legacy registered
[    0.452771] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.452797] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.453821] fuse init (API version 7.23)
[    0.456069] Key type big_key registered
[    0.524907] Key type asymmetric registered
[    0.524943] Asymmetric key parser 'x509' registered
[    0.525081] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.525109] io scheduler noop registered
[    0.525130] io scheduler deadline registered
[    0.525194] io scheduler cfq registered (default)
[    0.525926] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.527528] console [ttyS0] disabled
[    0.527633] 44200000.uart: ttyS0 at MMIO 0x44200000 (irq = 6, base_baud = 390625) is a 16550A
[    1.111408] console [ttyS0] enabled
[    1.127308] loop: module loaded
[    1.133452] scsi host0: sata_oxnas
[    1.137607] scsi host1: sata_oxnas
[    1.141463] ata1: SATA max UDMA/133 irq 7
[    1.145459] ata2: SATA max UDMA/133 irq 7
[    1.149570] sata_oxnas: resetting SATA core
[    1.150627] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xf1
[    1.150635] nand: Hynix H27U1G8F2BTR-BC
[    1.150643] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.150661] Scanning device for bad blocks
[    1.164416] Bad eraseblock 167 at 0x0000014e0000
[    1.234560] 2 ofpart partitions found on MTD device 41000000.nand
[    1.240660] Creating 2 MTD partitions on "41000000.nand":
[    1.246041] 0x000000000000-0x000000e00000 : "boot"
[    1.271070] 0x000000e00000-0x000008000000 : "ubi"
[    1.278479] oxnas-gmac 40400000.ethernet: snps,phy-addr property is deprecated
[    1.285824] oxnas-gmac 40400000.ethernet: no reset control found
[    1.291850] stmmac - user ID: 0x12, Synopsys ID: 0x35
[    1.296872]  Ring mode enabled
[    1.299906]  DMA HW capability register supported
[    1.304435]  Enhanced/Alternate descriptors
[    1.308766] 	Enabled extended descriptors
[    1.312775]  RX Checksum Offload Engine supported (type 2)
[    1.318231]  TX Checksum insertion supported
[    1.322496]  Wake-Up On Lan supported
[    1.326136]  Enable RX Mitigation via HW Watchdog Timer
[    1.351925] libphy: stmmac: probed
[    1.355322] eth%d: PHY ID 02430d91 at 1 IRQ POLL (stmmac-0:01) active
[    1.362833] PPP generic driver version 2.4.2
[    1.367772] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.374410] ehci-pci: EHCI PCI platform driver
[    1.379264] oxnas-ehci 40200100.ehci: EHCI Host Controller
[    1.384901] oxnas-ehci 40200100.ehci: new USB bus registered, assigned bus number 1
[    1.392811] oxnas-ehci 40200100.ehci: irq 10, io mem 0x40200100
[    1.410001] oxnas-ehci 40200100.ehci: USB 2.0 started, EHCI 1.00
[    1.416360] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.423175] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.430397] usb usb1: Product: EHCI Host Controller
[    1.435253] usb usb1: Manufacturer: Linux 4.4.54-oxnas-tld-1 ehci_hcd
[    1.441689] usb usb1: SerialNumber: 40200100.ehci
[    1.447444] hub 1-0:1.0: USB hub found
[    1.451353] hub 1-0:1.0: 2 ports detected
[    1.456504] xhci_hcd 0000:00:00.0: xHCI Host Controller
[    1.461877] xhci_hcd 0000:00:00.0: new USB bus registered, assigned bus number 2
[    1.469619] xhci_hcd 0000:00:00.0: hcc params 0x040040a5 hci version 0x100 quirks 0x00080490
[    1.478617] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    1.485429] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.492646] usb usb2: Product: xHCI Host Controller
[    1.497505] usb usb2: Manufacturer: Linux 4.4.54-oxnas-tld-1 xhci-hcd
[    1.503938] usb usb2: SerialNumber: 0000:00:00.0
[    1.509685] hub 2-0:1.0: USB hub found
[    1.513605] hub 2-0:1.0: 2 ports detected
[    1.518440] xhci_hcd 0000:00:00.0: xHCI Host Controller
[    1.523788] xhci_hcd 0000:00:00.0: new USB bus registered, assigned bus number 3
[    1.531450] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.539781] usb usb3: New USB device found, idVendor=1d6b, idProduct=0003
[    1.546603] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.554176] usb usb3: Product: xHCI Host Controller
[    1.559040] usb usb3: Manufacturer: Linux 4.4.54-oxnas-tld-1 xhci-hcd
[    1.565493] usb usb3: SerialNumber: 0000:00:00.0
[    1.571182] hub 3-0:1.0: USB hub found
[    1.574999] hub 3-0:1.0: 2 ports detected
[    1.580316] usbcore: registered new interface driver cdc_acm
[    1.585958] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    1.594181] usbcore: registered new interface driver cdc_wdm
[    1.600179] usbcore: registered new interface driver usb-storage
[    1.606369] usbcore: registered new interface driver usbserial
[    1.612541] usbcore: registered new interface driver usbserial_generic
[    1.619107] usbserial: USB Serial support registered for generic
[    1.625602] mousedev: PS/2 mouse device common for all mice
[    1.631441] i2c /dev entries driver
[    1.637068] hidraw: raw HID events driver (C) Jiri Kosina
[    1.642844] usbcore: registered new interface driver usbhid
[    1.648396] usbhid: USB HID core driver
[    1.654397] NET: Registered protocol family 10
[    1.660328] sit: IPv6 over IPv4 tunneling driver
[    1.665978] NET: Registered protocol family 17
[    1.671047] Key type dns_resolver registered
[    1.676879] registered taskstats version 1
[    1.681059] Loading compiled-in X.509 certificates
[    1.685964] zswap: loaded using pool lzo/zbud
[    1.692520] Key type encrypted registered
[    1.700183] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[    1.706572] ata1.00: ATA-10: KINGSTON SA400S37480G, SBFKB1C2, max UDMA/133
[    1.713487] ata1.00: 937703088 sectors, multi 1: LBA48 NCQ (depth 0/32)
[    1.720350] ata1.00: configured for UDMA/133
[    1.725360] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SA400S3 B1C2 PQ: 0 ANSI: 5
[    1.735511] sd 0:0:0:0: [sda] 937703088 512-byte logical blocks: (480 GB/447 GiB)
[    1.735518] sata_oxnas: resetting SATA core
[    1.747988] sd 0:0:0:0: [sda] Write Protect is off
[    1.753067] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.762145] sata_oxnas: resetting SATA core
[    1.829992] usb 2-1: new high-speed USB device number 2 using xhci_hcd
[    1.984693] usb 2-1: New USB device found, idVendor=05e3, idProduct=0723
[    1.991464] usb 2-1: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[    1.998574] usb 2-1: Product: USB Storage
[    2.002595] usb 2-1: Manufacturer: Generic 
[    2.008678] usb-storage 2-1:1.0: USB Mass Storage device detected
[    2.030248] scsi host2: usb-storage 2-1:1.0
[    2.439997] ata2: SATA link down (SStatus 0 SControl 300)
[    2.520161] ata1: exception Emask 0x10 SAct 0x0 SErr 0x0 action 0xe frozen
[    2.527029] ata1: hard resetting link
[    3.031841] scsi 2:0:0:0: Direct-Access     Generic  STORAGE DEVICE   9454 PQ: 0 ANSI: 0
[    3.043233] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[    3.440151] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[    3.446796] ata1.00: configured for UDMA/133
[    3.451200] ata1: EH complete
[    3.456890]  sda: sda1 sda2 sda3
[    3.463127] sd 0:0:0:0: [sda] Attached SCSI disk
[    3.468741] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities
[    3.489228] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
[    3.497088] VFS: Mounted root (ext4 filesystem) readonly on device 8:2.
[    3.509775] devtmpfs: mounted
[    3.513244] Freeing unused kernel memory: 224K (c0828000 - c0860000)

INIT: version 2.88 booting


[info] Using makefile-style concurrent boot in runlevel S.
ERROR: could not open /proc/stat: No such file or directory
findfs: unable to resolve 'LABEL=rootfs'
[....] Starting the hotplug events dispatcher: systemd-udevdstarting version 232
[    4.740500] random: systemd-udevd: uninitialized urandom read (16 bytes read, 6 bits of entropy available)
[    4.757629] random: systemd-udevd: uninitialized urandom read (16 bytes read, 6 bits of entropy available)
[    4.768622] random: systemd-udevd: uninitialized urandom read (16 bytes read, 6 bits of entropy available)
[    4.779686] random: systemd-udevd: uninitialized urandom read (16 bytes read, 6 bits of entropy available)
[?25l[?1c7[ ok 8[?25h[?0c.
[....] Synthesizing the initial hotplug events...[    4.934282] random: udevadm: uninitialized urandom read (16 bytes read, 7 bits of entropy available)
[    4.945835] random: udevadm: uninitialized urandom read (16 bytes read, 7 bits of entropy available)
[    4.955310] random: udevadm: uninitialized urandom read (16 bytes read, 7 bits of entropy available)
[    4.965824] random: udevadm: uninitialized urandom read (16 bytes read, 7 bits of entropy available)
[    4.976245] random: udevadm: uninitialized urandom read (16 bytes read, 7 bits of entropy available)
[    4.986636] random: udevadm: uninitialized urandom read (16 bytes read, 7 bits of entropy available)
[    5.599772] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0
[    5.651522] usbcore: registered new interface driver uas
[    5.664837] i2c-gpio i2c-gpio: using pins 41 (SDA) and 42 (SCL)
[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Waiting for /dev to be fully populated...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Activating swap...[?25l[?1c7[ ok 8[?25h[?0cdone.
[    7.315118] EXT4-fs (sda2): re-mounted. Opts: (null)
[....] Checking root file system...fsck from util-linux 2.29.2
rootfs: clean, 14121/262144 files, 177542/1048576 blocks
[?25l[?1c7[ ok 8[?25h[?0cdone.
[    7.576110] EXT4-fs (sda2): re-mounted. Opts: errors=remount-ro
[....] Activating lvm and md swap...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Checking file systems...fsck from util-linux 2.29.2
[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Loading kernel modules...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Cleaning up temporary files... /tmp[?25l[?1c7[ ok 8[?25h[?0c.
[....] Mounting local filesystems...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Activating swapfile swap...[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Cleaning up temporary files...[?25l[?1c7[ ok 8[?25h[?0c.
[....] Setting kernel variables...[?25l[?1c7[ ok 8[?25h[?0cdone.
[   11.219133] eth0: device MAC address 4a:fe:af:fe:e5:2d
[....] Configuring network interfaces...Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/4a:fe:af:fe:e5:2d
Sending on   LPF/eth0/4a:fe:af:fe:e5:2d
Sending on   Socket/fallback
DHCPREQUEST of 192.168.178.25 on eth0 to 255.255.255.255 port 67
[   15.300157] oxnas-gmac 40400000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
DHCPREQUEST of 192.168.178.25 on eth0 to 255.255.255.255 port 67
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPREQUEST of 192.168.178.25 on eth0 to 255.255.255.255 port 67
DHCPOFFER of 192.168.178.25 from 192.168.178.1
DHCPACK of 192.168.178.25 from 192.168.178.1
bound to 192.168.178.25 -- renewal in 1692 seconds.
[?25l[?1c7[ ok 8[?25h[?0cdone.
[....] Starting RPC port mapper daemon: rpcbind[?25l[?1c7[ ok 8[?25h[?0c.
[....] Starting NFS common utilities: statd idmapd[?25l[?1c7[ ok 8[?25h[?0c.
[....] Cleaning up temporary files...[?25l[?1c7[ ok 8[?25h[?0c.

INIT: Entering runlevel: 2


[info] Using makefile-style concurrent boot in runlevel 2.
[....] Starting busybox' syslogd implementation : syslogdStarting /sbin/syslogd...
1179 (syslogd)
[?25l[?1c7[ ok 8[?25h[?0c.
[....] Starting NFS common utilities: statd idmapd[?25l[?1c7[ ok 8[?25h[?0c.
[....] Starting system message bus: dbus[?25l[?1c7[ ok 8[?25h[?0c.
[....] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon[?25l[?1c7[ ok 8[?25h[?0c.
[....] Not starting NFS kernel daemon: no exports. ...[?25l[?1c7[warn8[?25h[?0c (warning).
[....] Starting OpenBSD Secure Shell server: sshd[?25l[?1c7[ ok 8[?25h[?0c.
[....] Starting busybox' klogd implementation : klogdStarting /sbin/klogd...
1182 (klogd)
[?25l[?1c7[ ok 8[?25h[?0c.
[....] Starting NTP server: ntpd[?25l[?1c7[ ok 8[?25h[?0c.



Debian GNU/Linux 9 debian ttyS0

debian login: [  238.962577] random: nonblocking pool is initialized

I can log in via ssh:
output of fw_printenv:
root@debian:~# fw_printenv
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x60500000 0x60e00000 0x62c00000; else bootm 0x60500000 0x60e00000; fi; else if run load_dtb; then bootm 0x60500000 - 0x62c00000; else bootm 0x60500000; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
usb_custom_params=zswap.enabled=1
device=0:1
devices=usb ide
disks=0 1 2 3
ethaddr=52:3b:20:9c:11:51
ethact=mii0
if_netconsole=ping $serverip
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device 0x62c00000 $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device 0x60e00000 /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device 0x60500000 /boot/uImage
mainlineLinux=yes
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 0x60500000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60510000  $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15
dtb_file=/boot/dts/ox820-kd20.dtb
ipaddr=192.168.178.25
serverip=192.168.178.15

It uses the sata drive I guess:
root@debian:~# lsblk
NAME      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda         8:0    0 447.1G  0 disk 
|-sda1      8:1    0    16M  0 part 
|-sda2      8:2    0     4G  0 part /
`-sda3      8:3    0 443.1G  0 part 
mtdblock0  31:0    0    14M  0 disk 
mtdblock1  31:1    0   114M  0 disk

What steps I have to execute from here to have it autonomously boot from disk, ideally either a USB or sata disk labeled ¨rootfs¨ or whatever name is chosen, I have lost track. The only thing I now know is that I still don´t now the details of the linux booting process well enough.

Very confusing is that I have different stage1.wrapped, stage1.wrapped-nand, md0.backup, uboot.img, stage1.backup etc files that all look functionally equivalent, but only one of them or maybe even none of them is the proper image I need. Or maybe I do have a usable image, but with a different name.
That was what I was meaning with that I am an old school programmer. ( When I started MS DOS did not exist, Turbo Pascal neither).
Poking around in peripheral registers, manipulating I/O lines to control systems was daily routine. Using hexedit for patches, dowloading code with S1S9 format etc.

Times are different now, but still challenging, even more then they were way back. The challenge for me in hacking and modding these more or less declared obsolete devices is to proove that with some knowledge and tinkering one can still use those devices for even serious things. Or just use it for modest services without scrapping those still technically healthy boxes.

It would be nice to complete this process with success for this KD20 box.
Actually I have no real need for a NAS at home, but when it can be done with this unit, why buy an expensive ¨real¨ NAS box?

hacksome



Edited 1 time(s). Last edit at 06/30/2020 06:13AM by hacksome.
Re: Debian cannot boot on KD20 after flashing u-boot
June 30, 2020 04:23PM
hacksome,

Quote

Actually I have no real need for a NAS at home, but when it can be done with this unit, why buy an expensive ¨real¨ NAS box?

That's what we are here for :) I have a lot of fun supporting old plugs that people tend to throw away when that product is EOL. And also we can run the latest kernel so it is as good as a expensive NAS!

The content on the HDD is apparent not good. It was just enough so you can boot to u-boot prompt. Which is OK. And you've figured out how to boot to the Stretch rootfs.

Quote

Debian GNU/Linux 9 debian ttyS0

debian login: [ 238.962577] random: nonblocking pool is initialized

At this point, ignore the output of fw_printenv, because it shows the envs from the new u-boot that you have flashed before. Not the one you have on HDD, which you used for booting into Debian in this session.


=======================

3 paths to choose:

1. Find a real stock u-boot backup from someone who has the KD20. Before doing that, you can flash the stage1.wrapped and u-boot.wrapped hoping these are correct stock images.

2. Try to get pass the problem in booting new u-boot as you saw in this post:

https://forum.doozan.com/read.php?2,105494,105494#msg-105494

Quote

[ 0.000000] Kernel panic - not syncing: ERROR: Failed to allocate 0x2000 bytes below 0x0.

3. Continue using the HDD for everything. Meaning the current rootfs on this HDD. Right now it is Stretch, but you can upgrade it to the latest Buster.

To do this, we need to boot from the uImage on the HDD, not from tftp. And a few envs changes are needed to do that.

And then later, the envs in the HDD needed to be updated to make it automatically executed and boot the kernel uImage from HDD, and the rootfs from HDD.

=======================

For number 1. I need you to show the listing of the sizes of these 2 images so I can confirm:

ls -larth stage1.wrapped
ls -larth  u-boot.wrapped

When you flash the images and use -p, you would have to do it a little bit differently from what I showed in installing new u-boot (with the new u-boot images, I already round them up to 128k blocks so no padding is needed).

/usr/sbin/flash_erase /dev/mtd0 0x0 6
/usr/sbin/nandwrite -p /dev/mtd0 stage1.wrapped

At this point, erase again, 4 blocks starting at 0x40000 (262144 decimal).
/usr/sbin/flash_erase /dev/mtd0 0x40000 4

and then flash
nandwrite -p -s 262144 /dev/mtd0 u-boot.wrapped

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 2 time(s). Last edit at 06/30/2020 04:31PM by bodhi.
Re: Debian cannot boot on KD20 after flashing u-boot
July 01, 2020 06:03AM
Bodhi,

I have used this archive: https://www.dropbox.com/s/82t5pfnybvacr3b/KD20_sata_boot.tar.gz?dl=0
from this thread: https://forum.doozan.com/read.php?2,17649,page=4
In this archive there is a only one folder: oxnas_sata_boot.
In that folder are 3 files:

disk_create
stage1.wrapped
u-boot.wrapped

sizes:

ls -larth *.wrapped:
-rwxr-xr-x 1 john john 8,1K jan 21  2015 stage1.wrapped
-rwxr--r-- 1 john john 151K jan 24  2015 u-boot.wrapped
or

ls -l *.wrapped
-rwxr-xr-x 1 john john   8224 jan 21  2015 stage1.wrapped
-rwxr--r-- 1 john john 153984 jan 24  2015 u-boot.wrapped

If I flash those files with a tftp booted Debian Stretch according to your description I have nothing on the TTY when booting without disk. So that is not working.

One peculiar thing I noticed. Using the command tftpboot first try it downloaded the uImage to 0x6000000.
I entered bootm 0x6050000 and got a ¨bad magic number¨. Only then I noticed the actual load address value.
So I used bootm 0x6000000. Debian booted and I flashed both images.
Result: No life on TTY, so again sata boot, u-boot prompt, tftpboot.
But the 2nd try exactly the same tftpboot command loads the uImage at 0x06500000.
As expected that made no difference.
But when system responses are different with the same commands I get suspicious. Especially when computers are involved;)

So that leaves only option 2 and 3 left. I assume I do not have the correct stage1 and u-boot.wrapped files.

Option 2 seemed challenging, but why not. However when I tried to recreate the situation that started all this mess: https://forum.doozan.com/read.php?2,105494,105494#msg-105494

I found out I could not recreate this situation anymore.

The result of flashing the PogoPro u-boot, tried it a few times, with and without -p option, does not provide a usable U-boot console prompt anymore.
Only the inital U-boot banner screen:

U-Boot SPL 2013.10-tld-4 (Sep 07 2014 - 14:10:12)
  Boot device: NAND
Attempting to set PLLA to 850 MHz ...
  plla_ctrl0 : 0000020a
  plla_ctrl1 : 00330000
  plla_ctrl2 : 0065008b
  plla_ctrl3 : 000000f1

PLLA Set


U-Boot 2015.10-tld-2 (Oct 21 2017 - 22:00:02 -0700)
OXNAS OX820

DRAM:  128 MiB
NAND:

Then it stops and does not respond to anything.

So that leaves only option 3:

I have no idea how to tackle this now, besides just trial and error. I am really lost in the boot process sequences, spl´s variables, chain loaders, images etc. I have read many hours and much information is ambiguous, even incorrect, different references are used for the same or different names. Command that have bugs show errors, but you must know that and ignore it, or output is generated showing variables that are not the ones you think what they are. Different u-boot´s need different syntax etc.

It need not be easy, but the effort needed to get things running again are growing to a level that trying to distill the right steps out of this heap of chaotic information is becoming almost impossible. Or maybe it is even impossible, because from what I have read about the KD20 there are still a lot of things not known, not fully functional or not possible because nobody has sufficient information of the hardware details and how it is reliably managed using the appropriate drivers etc.

All this is becoming quite frustrating because there is not much progress made until now.

On the other hand it also makes it easy: no options to try out anymore so I have to accept SATA only boot. And your help in finding the correct env setting to get that functional would be very welcome.

hacksome



Edited 2 time(s). Last edit at 07/01/2020 08:55AM by hacksome.
Re: Debian cannot boot on KD20 after flashing u-boot
July 01, 2020 04:13PM
hacksome ,

> I have used this archive:
> https://www.dropbox.com/s/82t5pfnybvacr3b/KD20_sata_boot.tar.gz?dl=0
> from this thread:
> https://forum.doozan.com/read.php?2,17649,page=4
> In this archive there is a only one folder:
> oxnas_sata_boot.
> In that folder are 3 files:
>
>
disk_create
> stage1.wrapped
> u-boot.wrapped
>

OK. Now it is clear. That's not stock u-boot. It is a version specially built to run from HDD. So what's in NAND right now is not usable.

> So that leaves only option 3:

> there is not much progress made until now.

Sorry you've picked this box to play with! the OXNAS box is not an ideal box to start learning embedded Linux ARM. Not very friendly, becasue of all the idiosyncracies come with it. I've been supporting the Pogo V3 Pro mainly, and don't pay much attention about its cousisns such as this KD20 box.

If you had one of the Kirkwood boxes, then I am sure in no time, you will understand the boot process and how the envs work. I have been supporting Kirkwood boxes for quite a while, so we know most everything about them (no stone unturned).

Debian: https://forum.doozan.com/read.php?2,12096
U-Boot: https://forum.doozan.com/read.php?3,12381

==============

Ok so I will look at HDD booting envs and make some modification. In the mean time, let's get some info in 1 post so it is easier to work on. Please post the entire serial console log (starting from the u-boot banner.)

While at the u-boot prompt,

printenv

And do the setenv commands that allow you to continue booting.

While log in Debian,
uname -a
e2label /dev/sda1
e2label /dev/sda2
mount
ls -lart /boot

And there are 2 partition on this HDD, the first one is where u-boot and other boot files are. If it is not mounted, then mount the /dev/sda1. Assuming it is mounted at /media/sda1.

ls -laRt /media/sda1

=========

Here is the ARM box boot process description in the Wiki. I summarized it at a high level, but it will be hepful to have a mental image of the process.

Quote

How to set up U-Boot for booting in multiple drives configuration:

https://forum.doozan.com/read.php?3,19093

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
July 02, 2020 08:17AM
Bohdi,

I got to know I did no pick the most easy device. I have a PogoplugPro and that´s running fine, although i still have to resolve the systemd issue in combination with upgrading a fresh Buster install;)

But this complexity is just one of the things that drive me because I am convinced that what I want to do can be done. Although it might not be easy.

Because all the frustrating events filled with unexpected behavior and other explainable things, I tried to analyze what has happened so far. I have logged many TTY sessions, so I could go back to the situation when stock U-Boot was operational.

Then looking more close to what was put on the TTY console: It seems that the box does not detect a SATA (or other) drive at all, however it is using images that can only be found on the disk: stage1.wrapper and u-boot.wrapper

When no bootable drive is installed I get the initial messages from (PogoPro) U-boot SPL:
U-Boot SPL 2013.10-tld-4 (Sep 07 2014 - 14:10:12)
And this one tries to set PLLA to 850Mhz.
and then the U-Boot version follows:
U-Boot 2015.10-tld-2 (Oct 21 2017 - 22:00:02 -0700)
OXNAS OX820

This process stops after showing:

NAND:


When I install a disk configured for direct sata booting I get the same initial messages, but instead of stalling after the
NAND:

message the boot sequence continues with:

Stage-1 Bootloader 2015-01.21-21:48:56
Attempting to set PLLA to 800MHz ...
  plla_ctrl0 : 0x0000030A
  plla_ctrl1 : 0x00400000
  plla_ctrl2 : 0x007F0068
  plla_ctrl3 : 0x00000193
PLLA Set

Setup memory, testing
Reading disk 00
  Sector : 0x0000009A
  Hdr len: 0x00025978
  Hdr CRC: 0x1CCE0DF0
 OK
Detecting SATA busses:
Bus 0: No devices found
Failed to read valid environment from disk, using built-in default

I do not know what is meant with the default environment, but it can only come from the stage1.wrapped and u-boot.wrapped images I had written to the sata disk.


     _           _   _   _       
    | |         | | | | | |      
 ___| |__  _   _| |_| |_| | ___  
/ __| '_ \| | | | __| __| |/ _ \ 
\__ \ | | | |_| | |_| |_| |  __/ 
|___/_| |_|\__,_|\__|\__|_|\___| 
          _   _     ____              _
         | | | |   | __ )  ___   ___ | |_ 
         | | | |___|  _ \ / _ \ / _ \| __| 
         | |_| |___| |_) | (_) | (_) | |_ 
          \___/    |____/ \___/ \___/ \__| 

U-Boot 1.1.2 (Jan 24 2015 - 13:54:11)

U-Boot code: 60D00000 -> 60D25978  BSS: -> 60D3A680
IRQ Stack: 60cddf7c
FIQ Stack: 60cdcf7c
RAM Configuration:
	Bank #0: 60000000 256 MB
SRAM Configuration:
	64KB at 0x50000000
NAND:128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Setting Linux mem= boot arg value
Hit any key to stop autoboot:  0 

IDE device 0: not available
enable_interrupts

This U-Boot code does not detect a disk, it times out, request for an IP address and receives one and with this environment tftpbooting is possible when some envs are modified.

I don´t know if the initial PLLA setting from U-Boot SPL 2013.10-tld-4 (Sep 07 2014 - 14:10:12) of 850Mhz is to high or not.

The stock U-Boot image runs at 750Mhz. I do not know the influence of higher speed, but it might explain some of the unexpected events. (tftp sometimes runs fluently, sometimes not)

When a disk is inserted the boot sequence seems to be diverted to booting from disk with the modified Shuttle stage1.wrapper and u-boot.wrapper. The PLLA speed is set to 800Mhz and things seem to run OK. Although nothing is shown about detecting a disk or not.
Maybe there are U-boot command available for that, it seems so, but I have not found the correct syntax for it.

After having found out that not all things were what I thought they were I re-created the direct sata boot disk.

Initially I had a sata boot disk with a FAT ¨BOOT¨ partition populated with an u-boot.img and an u-boot.env.
I do not remember it, but my logs show no evidence that, these images and environment have ever been actually used when booting from sata.

Although many things did not work out well, most of the time I still could boot using tftp with some additional changing of envs.

The new sata boot disk I created has only one 6G ext3 formatted partition labeled ¨rootfs¨. So no more /dev/sda2...

And I wrote the magic code, the modified KD20 stage1.wrapped and u-boot.wrapped to the disk in the area before that first partition.
The rootfs (/dev/sda1) is occupied with a Debian Strech 4.4.54 version with a KD20 DTB appended to the uImage file in /boot.

When the system is booted I get a U-boot prompt that does not recognize a disk and tries to ftpboot.

However I cannot permanently modify the U-boot environments but can modify them before every tftpboot.
I have to set the correct serverip and due to the altered sataboot disk (rootfs is now on /dev/sda1, not on /dev/sda2 anymore) I have to modify the kernel arguments.
After that I can tftpboot into Debian stretch.

Your questions: with some of the envs already modified to be able to tftpboot
printenv


bootcmd=run beep select0 load loadr sysled boot || run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot || run sysretry load loadr sysled boot || run errled select2 load3 loadr3 ramboot boot 
bootdelay=2
baudrate=115200
ethaddr=00:25:b1:ff:ff:00
autoload=n
select0=ide dev 0
select1=ide dev 1
select2=dhcp 
loadr=ide read 0x62000000 2122 1644
load=ide read 0x60500000 50a 1800
loadr3=tftp 0x62000000 rdimg.gz
load2=ide read 0x60500000 e3e8 1800
load3=tftp 0x60500000 uImage
sysretry=led a;ide res
sysled=led 1
errled=led r
beep=beep
ramboot=setenv bootargs root=/dev/ram0 console=ttyS0,115200 initrd=0x61000000 mem=256M
boot=bootm 60500000 62000000
stdin=serial
stdout=serial
stderr=serial
bootfile=uImage
gatewayip=192.168.178.1
netmask=255.255.255.0
ipaddr=192.168.178.19
dnsip=192.168.178.33
serverip=192.168.178.15
bootargs=root=/dev/sda1 initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00 mem=256M poweroutage=yes

Environment size: 1207/8188 bytes


uname -a                   
Linux debian 4.4.54-oxnas-tld-1 #2 SMP PREEMPT Sat Mar 18 23:09:58 PDT 2017 armv6l GNU/Linux

root@debian:~# e2label /dev/sda1
rootfs

I did create another disk without FAT so no /dev/sda2 anymore

e2label /dev/sda2
e2label: No such file or directory while trying to open /dev/sda2
Couldn't find valid filesystem superblock.

root@debian:~# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=123072k,nr_inodes=30768,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=25088k,mode=755)
/dev/sda1 on / type ext3 (rw,noatime,errors=remount-ro,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=50160k)
tmpfs on /tmp type tmpfs (rw,relatime)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)

root@debian:~# ls -lart /boot
total 45228
drwxr-xr-x  2 root root    4096 Dec 11  2016 dts
-rw-r--r--  1 root root  111194 Mar 18  2017 config-4.4.54-oxnas-tld-1
-rwxr-xr-x  1 root root 4621760 Mar 18  2017 zImage-4.4.54-oxnas-tld-1
-rw-------  1 root root 4621760 Mar 18  2017 vmlinuz-4.4.54-oxnas-tld-1
-rw-------  1 root root 1712926 Mar 18  2017 System.map-4.4.54-oxnas-tld-1
-rw-r--r--  1 root root 7378702 Mar 18  2017 linux-headers-4.4.54-oxnas-tld-1_1.0_armel.deb
-rw-r--r--  1 root root 4621824 Jul 31  2017 uImage.orig
-rw-r--r--  1 root root 4629915 Jun 29 07:52 uImage.orig2
-rw-r--r--  1 root root 4597215 Jun 29 12:51 initrd.img-4.4.54-oxnas-tld-1
drwxr-xr-x  3 root root    4096 Jun 29 12:53 .
-rwxr-xr-x  1 root root 4629851 Jun 29 12:54 zImage.fdt
-rw-r--r--  1 root root 4629915 Jun 29 12:55 uImage
-rw-r--r--  1 root root 4597279 Jun 29 12:55 uInitrd
drwxr-xr-x 22 root root    4096 Jul  2 03:20 ..

Because nowhere during the boot process is indicated if any disk can be allocated I only have the proof of Dmesg that the sata disk is used to run Debian stretch.

root@debian:~# dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.54-oxnas-tld-1 (root@tldDebian) (gcc version 4.9.2 (Debian 4.9.2-10) ) #2 SMP PREEMPT Sat Mar 18 23:09:58 PDT 2017
[    0.000000] CPU: ARMv6-compatible processor [410fb025] revision 5 (ARMv7), cr=00c5787d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Shuttle KD20
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 65536
[    0.000000] free_area_init_node: node 0, pgdat c08a69c0, node_mem_map cfdf9000
[    0.000000]   Normal zone: 512 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 65536 pages, LIFO batch:15
[    0.000000] DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map
[    0.000000] PERCPU: Embedded 12 pages/cpu @cfdd9000 s17696 r8192 d23264 u49152
[    0.000000] pcpu-alloc: s17696 r8192 d23264 u49152 alloc=12*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: root=/dev/sda1 initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00 mem=256M poweroutage=yes
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 246144K/262144K available (6410K kernel code, 288K rwdata, 1908K rodata, 224K init, 247K bss, 16000K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
                   vector  : 0xffff0000 - 0xffff1000   (   4 kB)
                   fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
                   vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
                   lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
                   modules : 0xbf000000 - 0xc0000000   (  16 MB)
                     .text : 0xc0008000 - 0xc0827e14   (8320 kB)
                     .init : 0xc0828000 - 0xc0860000   ( 224 kB)
                     .data : 0xc0860000 - 0xc08a8378   ( 289 kB)
                      .bss : 0xc08a8378 - 0xc08e6350   ( 248 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:160
[    0.000000] clocksource: rps_clocksource_timer: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 19112603332 ns
[    0.000010] sched_clock: 24 bits at 390kHz, resolution 2560ns, wraps every 21474835200ns
[    0.000199] Console: colour dummy device 80x30
[    0.000235] Calibrating delay loop... 319.48 BogoMIPS (lpj=1597440)
[    0.050030] pid_max: default: 32768 minimum: 301
[    0.050222] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.050240] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.051123] Initializing cgroup subsys net_cls
[    0.051212] CPU: Testing write buffer coherency: ok
[    0.051665] Setting up static identity map for 0x60008220 - 0x60008258
[    0.190154] Brought up 2 CPUs
[    0.190177] SMP: Total of 2 processors activated (638.97 BogoMIPS).
[    0.191027] devtmpfs: initialized
[    0.197181] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.197230] futex hash table entries: 512 (order: 2, 16384 bytes)
[    0.197585] prandom: seed boundary self test passed
[    0.202278] prandom: 100 self tests passed
[    0.202309] pinctrl core: initialized pinctrl subsystem
[    0.203194] NET: Registered protocol family 16
[    0.203857] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.230018] cpuidle: using governor ladder
[    0.260008] cpuidle: using governor menu
[    0.266529] gpio-oxnas 44000000.gpio: at address d0848000
[    0.266951] gpio-oxnas 44100000.gpio: at address d084a000
[    0.267566] pinctrl-oxnas pinctrl: initialized OX820 pinctrl driver
[    0.391943] oxnas-pcie 47c00000.pcie-controller: PCIe version/deviceID 0x82510b5
[    0.402969] oxnas-pcie 47c00000.pcie-controller: link up
[    0.403348] oxnas-pcie 47c00000.pcie-controller: PCI host bridge to bus 0000:00
[    0.403376] pci_bus 0000:00: root bus resource [mem 0x48000000-0x49ffffff]
[    0.403397] pci_bus 0000:00: root bus resource [mem 0x4a000000-0x4bdfffff pref]
[    0.403415] pci_bus 0000:00: root bus resource [io  0x0000-0xfffff]
[    0.403438] pci_bus 0000:00: root bus resource [bus 00-7f]
[    0.403496] pci 0000:00:00.0: [1b6f:7023] type 00 class 0x0c0330
[    0.403573] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x00007fff 64bit]
[    0.403722] pci 0000:00:00.0: supports D1 D2
[    0.403742] pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
[    0.404093] PCI: bus0: Fast back to back transfers disabled
[    0.404190] pci 0000:00:00.0: BAR 0: assigned [mem 0x48000000-0x48007fff 64bit]
[    0.404715] vgaarb: loaded
[    0.405242] SCSI subsystem initialized
[    0.405634] libata version 3.00 loaded.
[    0.406190] usbcore: registered new interface driver usbfs
[    0.406307] usbcore: registered new interface driver hub
[    0.406476] usbcore: registered new device driver usb
[    0.406681] pps_core: LinuxPPS API ver. 1 registered
[    0.406696] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.406745] PTP clock support registered
[    0.409172] clocksource: Switched to clocksource rps_clocksource_timer
[    0.429245] NET: Registered protocol family 2
[    0.430287] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.430351] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.430407] TCP: Hash tables configured (established 2048 bind 2048)
[    0.430512] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.430556] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.430840] NET: Registered protocol family 1
[    0.431429] RPC: Registered named UNIX socket transport module.
[    0.431449] RPC: Registered udp transport module.
[    0.431459] RPC: Registered tcp transport module.
[    0.431470] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.431534] pci 0000:00:00.0: enabling device (0140 -> 0142)
[    0.431600] PCI: CLS 32 bytes, default 32
[    0.431979] Unpacking initramfs...
[    0.942456] Freeing initrd memory: 4492K (c1000000 - c1463000)
[    0.953157] Initialise system trusted keyring
[    0.966935] zbud: loaded
[    0.972769] NFS: Registering the id_resolver key type
[    0.972848] Key type id_resolver registered
[    0.972864] Key type id_legacy registered
[    0.972912] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.972940] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.973967] fuse init (API version 7.23)
[    0.976168] Key type big_key registered
[    1.058301] Key type asymmetric registered
[    1.058332] Asymmetric key parser 'x509' registered
[    1.058475] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.058506] io scheduler noop registered
[    1.058526] io scheduler deadline registered
[    1.058590] io scheduler cfq registered (default)
[    1.059381] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    1.061150] console [ttyS0] disabled
[    1.061255] 44200000.uart: ttyS0 at MMIO 0x44200000 (irq = 6, base_baud = 390625) is a 16550A
[    1.654059] console [ttyS0] enabled
[    1.716920] loop: module loaded
[    1.723143] scsi host0: sata_oxnas
[    1.727298] scsi host1: sata_oxnas
[    1.731141] ata1: SATA max UDMA/133 irq 7
[    1.735139] ata2: SATA max UDMA/133 irq 7
[    1.739243] sata_oxnas: resetting SATA core
[    1.740318] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xf1
[    1.740326] nand: Hynix H27U1G8F2BTR-BC
[    1.740336] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.740354] Scanning device for bad blocks
[    1.754076] Bad eraseblock 167 at 0x0000014e0000
[    1.824115] 2 ofpart partitions found on MTD device 41000000.nand
[    1.830233] Creating 2 MTD partitions on "41000000.nand":
[    1.835614] 0x000000000000-0x000000e00000 : "boot"
[    1.842398] 0x000000e00000-0x000008000000 : "ubi"
[    1.849756] oxnas-gmac 40400000.ethernet: snps,phy-addr property is deprecated
[    1.857103] oxnas-gmac 40400000.ethernet: no reset control found
[    1.863127] stmmac - user ID: 0x12, Synopsys ID: 0x35
[    1.868149]  Ring mode enabled
[    1.871211]  DMA HW capability register supported
[    1.875717]  Enhanced/Alternate descriptors
[    1.880074] 	Enabled extended descriptors
[    1.884062]  RX Checksum Offload Engine supported (type 2)
[    1.889518]  TX Checksum insertion supported
[    1.893783]  Wake-Up On Lan supported
[    1.897423]  Enable RX Mitigation via HW Watchdog Timer
[    1.911948] libphy: stmmac: probed
[    1.915348] eth%d: PHY ID 02430d91 at 1 IRQ POLL (stmmac-0:01) active
[    1.922813] PPP generic driver version 2.4.2
[    1.927736] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.934330] ehci-pci: EHCI PCI platform driver
[    1.939166] oxnas-ehci 40200100.ehci: EHCI Host Controller
[    1.944732] oxnas-ehci 40200100.ehci: new USB bus registered, assigned bus number 1
[    1.952606] oxnas-ehci 40200100.ehci: irq 10, io mem 0x40200100
[    1.970004] oxnas-ehci 40200100.ehci: USB 2.0 started, EHCI 1.00
[    1.976353] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.983188] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.990415] usb usb1: Product: EHCI Host Controller
[    1.995271] usb usb1: Manufacturer: Linux 4.4.54-oxnas-tld-1 ehci_hcd
[    2.001722] usb usb1: SerialNumber: 40200100.ehci
[    2.007480] hub 1-0:1.0: USB hub found
[    2.011348] hub 1-0:1.0: 2 ports detected
[    2.016506] xhci_hcd 0000:00:00.0: xHCI Host Controller
[    2.021831] xhci_hcd 0000:00:00.0: new USB bus registered, assigned bus number 2
[    2.029598] xhci_hcd 0000:00:00.0: hcc params 0x040040a5 hci version 0x100 quirks 0x00080490
[    2.038507] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    2.045337] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.052561] usb usb2: Product: xHCI Host Controller
[    2.057420] usb usb2: Manufacturer: Linux 4.4.54-oxnas-tld-1 xhci-hcd
[    2.063856] usb usb2: SerialNumber: 0000:00:00.0
[    2.069524] hub 2-0:1.0: USB hub found
[    2.073395] hub 2-0:1.0: 2 ports detected
[    2.078300] xhci_hcd 0000:00:00.0: xHCI Host Controller
[    2.083596] xhci_hcd 0000:00:00.0: new USB bus registered, assigned bus number 3
[    2.091368] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[    2.099709] usb usb3: New USB device found, idVendor=1d6b, idProduct=0003
[    2.106547] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.114091] usb usb3: Product: xHCI Host Controller
[    2.118952] usb usb3: Manufacturer: Linux 4.4.54-oxnas-tld-1 xhci-hcd
[    2.125406] usb usb3: SerialNumber: 0000:00:00.0
[    2.131146] hub 3-0:1.0: USB hub found
[    2.134963] hub 3-0:1.0: 2 ports detected
[    2.140234] usbcore: registered new interface driver cdc_acm
[    2.145873] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    2.154019] usbcore: registered new interface driver cdc_wdm
[    2.159892] usbcore: registered new interface driver usb-storage
[    2.166146] usbcore: registered new interface driver usbserial
[    2.172316] usbcore: registered new interface driver usbserial_generic
[    2.178882] usbserial: USB Serial support registered for generic
[    2.185387] mousedev: PS/2 mouse device common for all mice
[    2.191180] i2c /dev entries driver
[    2.196812] hidraw: raw HID events driver (C) Jiri Kosina
[    2.202542] usbcore: registered new interface driver usbhid
[    2.208092] usbhid: USB HID core driver
[    2.214039] NET: Registered protocol family 10
[    2.230991] sit: IPv6 over IPv4 tunneling driver
[    2.236669] NET: Registered protocol family 17
[    2.241408] Key type dns_resolver registered
[    2.247211] registered taskstats version 1
[    2.251386] Loading compiled-in X.509 certificates
[    2.256294] zswap: loaded using pool lzo/zbud
[    2.276851] Key type encrypted registered
[    2.290170] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[    2.296560] ata1.00: ATA-10: KINGSTON SA400S37480G, SBFKB1C2, max UDMA/133
[    2.303544] ata1.00: 937703088 sectors, multi 1: LBA48 NCQ (depth 0/32)
[    2.310694] ata1.00: configured for UDMA/133
[    2.315719] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SA400S3 B1C2 PQ: 0 ANSI: 5
[    2.317335] sd 0:0:0:0: [sda] 937703088 512-byte logical blocks: (480 GB/447 GiB)
[    2.318320] sd 0:0:0:0: [sda] Write Protect is off
[    2.318338] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    2.318576] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.325969] sata_oxnas: resetting SATA core
[    2.360240] sata_oxnas: resetting SATA core
[    2.390000] usb 2-1: new high-speed USB device number 2 using xhci_hcd
[    2.544668] usb 2-1: New USB device found, idVendor=05e3, idProduct=0723
[    2.551393] usb 2-1: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[    2.558497] usb 2-1: Product: USB Storage
[    2.562526] usb 2-1: Manufacturer: Generic 
[    2.568614] usb-storage 2-1:1.0: USB Mass Storage device detected
[    2.590302] scsi host2: usb-storage 2-1:1.0
[    3.050183] ata2: SATA link down (SStatus 0 SControl 300)
[    3.120192] ata1: exception Emask 0x10 SAct 0x0 SErr 0x0 action 0xe frozen
[    3.127060] ata1: hard resetting link
[    3.591800] scsi 2:0:0:0: Direct-Access     Generic  STORAGE DEVICE   9454 PQ: 0 ANSI: 0
[    3.603645] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[    4.040186] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[    4.046842] ata1.00: configured for UDMA/133
[    4.051212] ata1: EH complete
[    4.056972]  sda: sda1
[    4.062922] sd 0:0:0:0: [sda] Attached SCSI disk
[    4.067919] Freeing unused kernel memory: 224K (c0828000 - c0860000)
[    4.265635] random: systemd-udevd: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.277248] random: systemd-udevd: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.278725] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.281239] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.281433] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.282703] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.283873] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.285012] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.286179] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.287408] random: udevadm: uninitialized urandom read (16 bytes read, 1 bits of entropy available)
[    4.703073] usbcore: registered new interface driver uas
[    4.747325] i2c-gpio i2c-gpio: using pins 41 (SDA) and 42 (SCL)
[   10.371102] EXT4-fs (sda1): mounting ext3 file system using the ext4 subsystem
[   10.391265] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[   13.025090] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0
[   14.578309] EXT4-fs (sda1): re-mounted. Opts: (null)
[   15.039052] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[   18.761420] eth0: device MAC address 42:f1:bf:23:93:3e
[   22.840312] oxnas-gmac 40400000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[  210.133690] random: nonblocking pool is initialized


to me this looks like a neat and clean boot, only one line shows:
[    3.120192] ata1: exception Emask 0x10 SAct 0x0 SErr 0x0 action 0xe frozen
[    3.127060] ata1: hard resetting link

I have no idea if this message means anything, but maybe the need for a hard reset of ata1 has somthing to to with not being able to detect the sata disk initially and use it to boot from?
On the other hand, the correct type of sata disk is already detected earlier in the boot process?


hacksome



Edited 3 time(s). Last edit at 07/02/2020 02:23PM by hacksome.
Re: Debian cannot boot on KD20 after flashing u-boot
July 02, 2020 04:36PM
hacksome,


> Stage-1 Bootloader 2015-01.21-21:48:56
> Attempting to set PLLA to 800MHz ...
> plla_ctrl0 : 0x0000030A
> plla_ctrl1 : 0x00400000
> plla_ctrl2 : 0x007F0068
> plla_ctrl3 : 0x00000193
> PLLA Set
>
> Setup memory, testing
> Reading disk 00
> Sector : 0x0000009A
> Hdr len: 0x00025978
> Hdr CRC: 0x1CCE0DF0
> OK
> Detecting SATA busses:
> Bus 0: No devices found
> Failed to read valid environment from disk, using
> built-in default
>
> I do not know what is meant with the default
> environment, but it can only come from the
> stage1.wrapped and u-boot.wrapped images I had
> written to the sata disk.

When you boot with HDD, the envs image is on the HDD, where u-boot image is. And it was not found, so u-boot uses a set of default envs defined internally. This is called the default envs. The default envs are used whenever the envs cannot be founded in its expected location, or were corrupted.

> This U-Boot code does not detect a disk, it times
> out, request for an IP address and receives one
> and with this environment tftpbooting is possible
> when some envs are modified.

Now at this point the default envs are not good enough for booting (it keeps looking for the root device at /dev/sda2).

What should be done is: interrupt serial console at count down, and adjust the envs.

> I don´t know if the initial PLLA setting from
> U-Boot SPL 2013.10-tld-4 (Sep 07 2014 - 14:10:12)
> of 850Mhz is to high or not.
>
> The stock U-Boot image runs at 750Mhz. I do not
> know the influence of higher speed, but it might
> explain some of the unexpected events. (tftp
> sometimes runs fluently, sometimes not)

It could be. As I mentoined to some users before, I probably need to rebuild the SPL to 750 MHz to see if it will play well with this box. The Pogo V3 can be run with all speeds from 700-850 Mhz.


> When a disk is inserted the boot sequence seems to
> be diverted to booting from disk with the modified
> Shuttle stage1.wrapper and u-boot.wrapper. The
> PLLA speed is set to 800Mhz and things seem to run
> OK. Although nothing is shown about detecting a
> disk or not.

It does not have to show disk detected. The BootROM has detected the SATA drive present, it skipped finding all other devices, and proceeded to load SPL from the SATA drive. When u-boot started running, the SATA drive was already initialized, so it does not need to bring it up.


> I do not remember it, but my logs show no evidence
> that, these images and environment have ever been
> actually used when booting from sata.

Yes they were. That's the only way the SPL and u-boot can be run at this moment (because the boot mode is direct SATA).

> However I cannot permanently modify the U-boot
> environments but can modify them before every
> tftpboot.

Because they are on the HDD, and that env image file was not found.


> I have to set the correct serverip and due to the
> altered sataboot disk (rootfs is now on /dev/sda1,
> not on /dev/sda2 anymore) I have to modify the
> kernel arguments.

Very good!

> [ 3.120192] ata1: exception Emask 0x10 SAct 0x0
> SErr 0x0 action 0xe frozen
> [ 3.127060] ata1: hard resetting link

> I have no idea if this message means anything, but
> maybe the need for a hard reset of ata1 has
> somthing to to with not being able to detect the
> sata disk initially and use it to boot from?

Not that reason. As I described above, it was detected OK during boot.

This box has a little bit problem with the SATA driver. So sometime we see the ATA hard reset like that. But as long as the boot probess completed, and Debian is running then it is OK.

======

OK. I forgot to ask you to list the root directory (because I thought you used 2 partitions). So the info is not complete. I need to confirm that u-boot and its envs are on /, and what else is on the same location. This is where the BootROM find u-boot.

uname -a                   
e2label /dev/sda1
mount
ls -lart /boot
ls -lart /
ls -larth /

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
July 03, 2020 07:43AM
Bohdi,

output from requested commands:

root@debian:~# uname -a
Linux debian 4.4.54-oxnas-tld-1 #2 SMP PREEMPT Sat Mar 18 23:09:58 PDT 2017 armv6l GNU/Linux

root@debian:~# e2label /dev/sda1
rootfs

root@debian:~# mount
/dev/sda1 on / type ext3 (rw,noatime,errors=remount-ro,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=125316k,nr_inodes=31329,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=25088k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=50160k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
tmpfs on /tmp type tmpfs (rw,relatime)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)


root@debian:~# ls -lart /boot
total 45228
drwxr-xr-x  2 root root    4096 Dec 11  2016 dts
-rw-r--r--  1 root root  111194 Mar 18  2017 config-4.4.54-oxnas-tld-1
-rwxr-xr-x  1 root root 4621760 Mar 18  2017 zImage-4.4.54-oxnas-tld-1
-rw-------  1 root root 4621760 Mar 18  2017 vmlinuz-4.4.54-oxnas-tld-1
-rw-------  1 root root 1712926 Mar 18  2017 System.map-4.4.54-oxnas-tld-1
-rw-r--r--  1 root root 7378702 Mar 18  2017 linux-headers-4.4.54-oxnas-tld-1_1.0_armel.deb
-rw-r--r--  1 root root 4621824 Jul 31  2017 uImage.orig
-rw-r--r--  1 root root 4629915 Jun 29 07:52 uImage.orig2
-rw-r--r--  1 root root 4597215 Jun 29 12:51 initrd.img-4.4.54-oxnas-tld-1
drwxr-xr-x  3 root root    4096 Jun 29 12:53 .
-rwxr-xr-x  1 root root 4629851 Jun 29 12:54 zImage.fdt
-rw-r--r--  1 root root 4629915 Jun 29 12:55 uImage
-rw-r--r--  1 root root 4597279 Jun 29 12:55 uInitrd
drwxr-xr-x 22 root root    4096 Jul  3 05:32 ..

root@debian:~# ls -lart /
total 4616
dr-xr-xr-x 86 root root       0 Dec 31  1969 proc
dr-xr-xr-x 12 root root       0 Dec 31  1969 sys
drwxr-xr-x 11 root root    4096 Dec 31  1969 var
drwxr-xr-x 61 root root    4096 Dec 31  1969 etc
drwxrwxrwt  2 root root      40 Dec 31  1969 tmp
drwxr-xr-x 12 root root    2620 Dec 31  1969 dev
drwxr-xr-x  2 root root    4096 Jan 22  2012 home
drwx------  2 root root   16384 Feb 24  2012 lost+found
drwxr-xr-x 10 root root    4096 Feb 24  2012 usr
drwxr-xr-x  2 root root    4096 Feb 24  2012 srv
drwxr-xr-x  2 root root    4096 Feb 24  2012 opt
drwxr-xr-x  2 root root    4096 Jul 31  2017 mnt
drwx------  5 root root    4096 Aug  1  2017 root
drwxr-xr-x 13 root root    4096 Jun 29 12:47 lib
drwxr-xr-x  2 root root    4096 Jun 29 12:48 bin
drwxr-xr-x  2 root root    4096 Jun 29 12:48 sbin
drwxr-xr-x  3 root root    4096 Jun 29 12:53 boot
drwxr-xr-x  3 root root    4096 Jul  1 04:42 kd20
drwxr-xr-x  3 root root    4096 Jul  1 14:42 media
-rw-r--r--  1 root root 4629915 Jul  2 03:20 uImage.tmp
drwxr-xr-x 22 root root    4096 Jul  3 05:32 ..
drwxr-xr-x 22 root root    4096 Jul  3 05:32 .
drwxr-xr-x 13 root root     540 Jul  3 05:38 run

root@debian:~# ls -larth /
total 4.6M
dr-xr-xr-x 86 root root    0 Dec 31  1969 proc
drwxr-xr-x 11 root root 4.0K Dec 31  1969 var
drwxr-xr-x 61 root root 4.0K Dec 31  1969 etc
drwxrwxrwt  2 root root   40 Dec 31  1969 tmp
drwxr-xr-x 12 root root 2.6K Dec 31  1969 dev
drwxr-xr-x  2 root root 4.0K Jan 22  2012 home
drwx------  2 root root  16K Feb 24  2012 lost+found
drwxr-xr-x 10 root root 4.0K Feb 24  2012 usr
drwxr-xr-x  2 root root 4.0K Feb 24  2012 srv
drwxr-xr-x  2 root root 4.0K Feb 24  2012 opt
drwxr-xr-x  2 root root 4.0K Jul 31  2017 mnt
drwx------  5 root root 4.0K Aug  1  2017 root
drwxr-xr-x 13 root root 4.0K Jun 29 12:47 lib
drwxr-xr-x  2 root root 4.0K Jun 29 12:48 bin
drwxr-xr-x  2 root root 4.0K Jun 29 12:48 sbin
drwxr-xr-x  3 root root 4.0K Jun 29 12:53 boot
drwxr-xr-x  3 root root 4.0K Jul  1 04:42 kd20
drwxr-xr-x  3 root root 4.0K Jul  1 14:42 media
-rw-r--r--  1 root root 4.5M Jul  2 03:20 uImage.tmp
drwxr-xr-x 22 root root 4.0K Jul  3 05:32 ..
drwxr-xr-x 22 root root 4.0K Jul  3 05:32 .
drwxr-xr-x 13 root root  540 Jul  3 05:38 run
dr-xr-xr-x 12 root root    0 Jul  3 05:39 sys

in my pursuit to get my fingers behind all this fuzziness I managed to compile the U-boot sources without to many difficulties.

I had an old thinkpad with ubuntu 14.04 where gcc version 4 was available. So I installed gcc-arm-linux-gnueabi.
ran:
git clone https://github.com/kref/u-boot-oxnas
And created a 750 MHZ u-boot.img with:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- ox820_fat_config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4 all u-boot.img

I did not check if that image was functional because ¨crosser¨ indicated here: https://forum.doozan.com/read.php?3,16469,16471
that he only used it for the SPL and that the U-boot had no network.
But he could use it to restore his mtd0 backup. I have none....

But because I am able to compile a u-boot myself I though maybe I could modify the 2015.10 U-Boot in a way that at least the clock frequency is set to 750MHZ and then try to figure out other modifications when needed.
So I ran:
git clone https://github.com/mibodhi/u-boot-oxnas.git

and tried to repeat the procedure.

I encountered some problems, but they look solvable....

There is a difference between the newer 2015.10 U-boot configuration information and the kref u-boot version.

So I figured out the way to set the compiler and make configuration option for this newer U-boot version:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- ox820_defconfig

and I used this command to produce a u-boot.bin.
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4 u-boot.img

I was not able to create an SPL image.
When I added ¨all¨ to the command line:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4 all u-boot.img

an error was thrown after the u-boot.bin was created:
make[1]:**There is no rule to create target ¨checkarmloc¨, needed for ¨all¨. Aborted.

I have not yet found this ¨checkarmloc¨ declaration or whatever it is. Maybe you have an idea where to look and what do do about it?

On the other hand, I understand that I need the 2013 U-boot version to create a SATA SPL, so the previous has produced a 750MHz u-boot and I will try to use the 2013 version for the SPL, or maybe the kref u-boot version is also OK and I can build one that is configured to boot from ext4.

When I can create a working system with just changing some env of the current KD20 setup that´s OK as well. However when I am able to compile my own modified U-boot I have no problem to invest some more time to try to build a standard scenario how to mod a KD20 to have it run Debian without digging for hours on fora. Although I have learned a lot from all this until now it is not something for the faint-hearted.

If you would be willing to assist me with this where you can that would be very welcome!


hacksome



Edited 1 time(s). Last edit at 07/03/2020 04:03PM by hacksome.
Re: Debian cannot boot on KD20 after flashing u-boot
July 03, 2020 04:02PM
hacksome,

Strange. Where are SPL, u-boot ,and envs images on this disk? I'd expect it to be at the top folder.

Ah. I see.


#!/bin/sh

# uncomment line below and set to the correct disk
#disk=/dev/sdX

if [ -z "${disk}" ] ; then
   echo "You must uncomment/set the 'disk' variable"
   exit -1
fi

workarea="."

stage1File=$workarea/stage1.wrapped
ubootFile=$workarea/u-boot.wrapped
kernelFile=$workarea/uImage

perl <<EOF | dd of="$disk" bs=512
    print "\x00" x 0x1a4;
    print "\x00\x5f\x01\x00";
    print "\x00\xdf\x00\x00";
    print "\x00\x80\x00\x00";
    print "\x00" x (0x1b0 -0x1a4 -12 );
    print "\x22\x80\x00\x00";
    print "\x22\x00\x00\x00";
    print "\x00\x80\x00\x00";
EOF

if [ -f $stage1File ];then
	echo "Writing stage 1"
	dd if=$stage1File    of="$disk" bs=512 seek=34
fi

if [ -f $ubootFile ];then
	echo "Writing uboot"
	dd if=$ubootFile     of="$disk" bs=512 seek=154
fi

if [ -f $kernelFile ];then
	echo "Writing kernel to "
	dd if=$kernelFile of="$disk"1 bs=512 
fi

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 07/03/2020 04:06PM by bodhi.
Re: Debian cannot boot on KD20 after flashing u-boot
July 03, 2020 04:12PM
hacksome,

Is there a reason why you did not use the original disk_create.sh ?

¨disk_create.sh¨ 

#!/bin/sh

# uncomment line below and set to the correct disk
disk=/dev/sdb
#pay attention to fit yourself.this is  my situation

if [ -z "${disk}" ] ; then
   echo "You must uncomment/set the 'disk' variable"
   exit -1
fi

workarea=.

stage1File=$workarea/boot/u-boot-spl.bin

perl <<EOF | dd of="$disk" bs=512
    print "\x00" x 0x1a4;
    print "\x00\x5f\x01\x00";
    print "\x00\xdf\x00\x00";
    print "\x00\x80\x00\x00";
    print "\x00" x (0x1b0 -0x1a4 -12 );
    print "\x22\x80\x00\x00";
    print "\x22\x00\x00\x00";
    print "\x00\x80\x00\x00";
EOF

if [ -f $stage1File ];then
        echo "Writing stage 1"
        dd if=$stage1File    of="$disk" bs=512 seek=34
fi

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
July 04, 2020 08:11AM
Quote
Bohdi
Is there a reason why you did not use the original disk_create.sh ?

Everything is relative of what one uses as a reference.

I used the images from the archive KD20_sata_boot.tar.gz with the u-boot configured for the KD20.
In this archive is also a disk_create file. Not disk_create.sh, but that´s just a name.

So in my perception I used the ¨original¨ disk_create script.

The difference between both scripts is:

The script I used writes stage1.wrapped (SPL?) and a u-boot.wrapped image to the disk.
There was no kernel file in the archive, so none was written to the disk.

Now I think about this, maybe I should also have written the uImage to /dev/sd1 that I had built myself for the KD20 with its DTB attached. I have tried this later once, but it made no difference in the booting process if I remember this well, but maybe I should check this out again to verify this.

Or else use ¨your¨ original script that only writes the stage1.wrapped file, but that seems a bit incomplete to me. But trying does not hurt.

hacksome
Re: Debian cannot boot on KD20 after flashing u-boot
July 04, 2020 04:46PM
hacksome,

> I used the images from the archive
> KD20_sata_boot.tar.gz with the u-boot configured
> for the KD20.

I see.

> Or else use ¨your¨ original script that only
> writes the stage1.wrapped file, but that seems a
> bit incomplete to me.

That's WarheadsSE's script when we started hacking the Pogo V3 box. So that is the original script.

The reason I would prefer that script is that you can see u-boot image and the envs images as regular files. Same as you're done it for the Pogo V3.

And then once we modifed the envs to boot this box, we will need to retrofit the new envs into the envs image. These files are from your Pogo V3 session.
ls -l /home/rescue/boot

-rwxr-xr-x 1 root root   16384 jan  1  1970 u-boot.env           
-rw-r--r-- 1 root root  525880 aug  3  2014 u-boot.img
-rwxr-xr-x 1 root root   32120 aug  3  2014 u-boot-spl.bin
-rw-r--r-- 1 root root 3676848 aug  3  2014 uImage                # this would be the uImage with DTB embedded from Debian-4.4.54-oxnas-tld-1-rootfs-bodhi.tar.bz2 
-rw-r--r-- 1 root root 2103272 aug  3  2014 uInitrd                  # this would be the uImage with DTB embedded from Debian-4.4.54-oxnas-tld-1-rootfs-bodhi.tar.bz2

See if you can use the files from Pogo V3 tarball.

If you can boot with serial console, adjust envs, and boot into the HDD rootfs, then you can make the envs permanent.

Do a backup,
cd -a u-boot.env u-boot.env.orig
cd -a u-boot.env u-boot.env.txt

Edit the u-boot.env.txt (strip off its header in nano), modify it to add/modify envs, and then repack it as u-boot image.
nano u-boot.env.txt
mkenvimage -s 131072 -o u-boot.env boot.env.txt

And then reboot.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
July 06, 2020 09:57AM
Bohdi,

no glory, trying the original script:

To create a new sata disk I only used
dd if=./u-boot-spl.bin    of=/dev/sdb bs=512 seek=34

to replace de existing spl image to the disk. (replaced stage1.wrapper with u-boot-spl.bin)

I did not modify the existing rootfs because all the files needed were already present in the proper location.

Exept the following files that I added to the /rootfs/boot directory of the sata drive:

u-boot.env
u-boot.img
u-boot-spl.bin (why this file is needed I do not know, it is already written on the disk before the /dev/sdx1 partition as far as I understand it all and is only used once during the initial boot process?)

A uImage an uInitrd with KD20DTB embedded were already present in the /rootfs/boot directory. To be sure I checked this again.

Booting this drive did not provide a console I could use:

output of TTY console:

U-Boot SPL 2013.10-g3a0f380-dirty (Jul 26 2014 - 14:31:34)
  Boot device: SATA
Attempting to set PLLA to 850 MHz ...
  plla_ctrl0 : 0000020a
  plla_ctrl1 : 00330000
  plla_ctrl2 : 0065008b
  plla_ctrl3 : 000000f1

PLLA Set
Bus 0: OK 
  Device 0: 
** File not found /boot/bootargs.bin **


U-Boot 2013.10-g3a0f380-dirty (Jul 26 2014 - 10:18:57) for OXNAS

DRAM:  128 MiB
IDE:   Bus 0: OK 
  Device 0: Model: KINGSTON SA400S37480G  Firm: SBFKB1C2 Ser#: 50026B77825D65D5
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 457862.8 MB = 447.1 GB (937703088 x 512)
NAND:  128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   
Led:	GREEN
mii0
Main Loop
switch to net console


The first message comes from the u-boot-spl.bin code that cannot find the file /boot/bootargs.bin.

I am a quite surprised that this file is nowhere to be foud in the Pogo V3 tarball as well.
However it finds the /boot/u-boot.img file en executes it.

Then a little success: the sata disk is recognized correctly.
Unfortunately the system information used is incorrect, only 128MB RAM instead of 256MB. Who knows what other information will be incorrect as well?

NAND content is bad, so default env used,

Then it switches to netconsole. I never got netconsole to work on my ubuntu box and because I have a TTY console there was never a need for that. I am not inclined to waste more time to try that again because I do not think that the KD20 box has a reachable IP address with the current environment setting used.
Besides that I have have learned that many messages written to screens and consoles are not very accurate or even plain false.

A slightly different output is produced when feeding the TTY console with input from hitting some keyboard keys during the boot process:

 Device 0: Model: KINGSTON SA400S37480G  Firm: SBFKB1C2 Ser#: 50026B77825D65D5
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 457862.8 MB = 447.1 GB (937703088 x 512)
NAND:  128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   
Led:	GREEN
mii0
Main Loop
Hit any key to stop autoboot:  3

Then I get a: ¨Hit any key¨ message. That´s all. After that no response anymore.

Then I edited the u-boot.env file

Mind: cd is a typo I guess, should be cp

Editing a file that contains partially binary info with nano seems to work, but it did not alter the console response in any way.
What I see in nano is some binary characters preceding one single long line with ascii strings that is ending with many more binary characters.
I deleted the preceding binary characters and changed various envs: modified the DTB file to the proper one, changes Memory value from 128 to 256 changed nc output to serial. Adjusted /dev/sda2 to /dev/sda1 etc, anyway I tried various modifications I though would be more appropriate for this box and this configuration, but nothing changed on the console output.
So I assume the u-boot.env file is not used at all for some reason.
One small positive result might be that a 850Mhz PLLA setting does not seem to hamper the following part of the failing boot process.

hacksome
Re: Debian cannot boot on KD20 after flashing u-boot
July 06, 2020 05:08PM
hacksome,

> u-boot-spl.bin (why this file is needed I do not
> know, it is already written on the disk before the
> /dev/sdx1 partition as far as I understand it all
> and is only used once during the initial boot
> process?)

Yes. That's correct. It was the SPL file written to the unused disk sector. It is not needed to be present.

> A uImage an uInitrd with KD20DTB embedded were
> already present in the /rootfs/boot directory. To
> be sure I checked this again.
>

> I am a quite surprised that this file is nowhere
> to be foud in the Pogo V3 tarball as well.
> However it finds the /boot/u-boot.img file en
> executes it.

That would be expected, it seems shv compiled this u-boot in a differently way (I am guessing). u-boot.img is the predefined name in the original OXNAS u-boot sourceso it works in all OXNAS boxes.


> Unfortunately the system information used is
> incorrect, only 128MB RAM instead of 256MB. Who
> knows what other information will be incorrect as
> well?

Yes, the Pogo V3 has only 128MB.

>
> NAND content is bad, so default env used,
>

It is OK.

> Then it switches to netconsole. I never got
> netconsole to work on my ubuntu box and because I
> have a TTY console there was never a need for
> that. I am not inclined to waste more time to try
> that again because I do not think that the KD20
> box has a reachable IP address with the current
> environment setting used.

Right, ignore netconsole. This old version do not have a good netconsole.


> A slightly different output is produced when
> feeding the TTY console with input from hitting
> some keyboard keys during the boot process:
>
>
>  Device 0: Model: KINGSTON SA400S37480G  Firm:
> SBFKB1C2 Ser#: 50026B77825D65D5
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 457862.8 MB = 447.1 GB
> (937703088 x 512)
> NAND:  128 MiB
> *** Warning - bad CRC, using default environment
> 
> In:    serial
> Out:   serial
> Err:   serial
> Net:   
> Led:	GREEN
> mii0
> Main Loop
> Hit any key to stop autoboot:  3
>
>
> Then I get a: ¨Hit any key¨ message. That´s
> all. After that no response anymore.

That was because netconsole is activated.


> Editing a file that contains partially binary info
> with nano seems to work, but it did not alter the
> console response in any way.

This env file seems to be ignored because this u-boot was not built properly.

=======

OK. So to avoid trying to reinvent some wheel here. What we should do is to go back to booting this KD20 from the HDD. Using your tarball.

- And then trying to set envs in serial console, and save them in serial console. It might work.

The worst case is you have to recreate the HDD (if the saveenv messes up the disk). So make sure this HDD is a test HDD (nothing worth saving).

Boot up the box after you recreate the KD20 files as before:

Stage-1 Bootloader 2015-01.21-21:48:56
Attempting to set PLLA to 800MHz ...
  plla_ctrl0 : 0x0000030A
  plla_ctrl1 : 0x00400000
  plla_ctrl2 : 0x007F0068
  plla_ctrl3 : 0x00000193
PLLA Set

Setup memory, testing
Reading disk 00
  Sector : 0x0000009A
  Hdr len: 0x00025978
  Hdr CRC: 0x1CCE0DF0
 OK
Detecting SATA busses:
Bus 0: No devices found
Failed to read valid environment from disk, using built-in default

     _           _   _   _       
    | |         | | | | | |      
 ___| |__  _   _| |_| |_| | ___  
/ __| '_ \| | | | __| __| |/ _ \ 
\__ \ | | | |_| | |_| |_| |  __/ 
|___/_| |_|\__,_|\__|\__|_|\___| 
          _   _     ____              _
         | | | |   | __ )  ___   ___ | |_ 
         | | | |___|  _ \ / _ \ / _ \| __| 
         | |_| |___| |_) | (_) | (_) | |_ 
          \___/    |____/ \___/ \___/ \__| 

U-Boot 1.1.2 (Jan 24 2015 - 13:54:11)

U-Boot code: 60D00000 -> 60D25978  BSS: -> 60D3A680
IRQ Stack: 60cddf7c
FIQ Stack: 60cdcf7c
RAM Configuration:
	Bank #0: 60000000 256 MB
SRAM Configuration:
	64KB at 0x50000000
NAND:128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Setting Linux mem= boot arg value
Hit any key to stop autoboot:  0

printenv
saveenv
printenv
See if everything goes well in the 3 commands above. And then
reset
See if the envs are now read properly by u-boot, no bad CRC.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
July 07, 2020 06:07AM
Bodhi,

Quote
Bodhi
OK. So to avoid trying to reinvent some wheel here. What we should do is to go back to booting this KD20 from the HDD. Using your tarball.

- And then trying to set envs in serial console, and save them in serial console. It might work.


That is the problem I already ran into earlier. I am able to modify the envs that are used by the KD20 uboot. You can see those in the end of the strings dump from that u-boot: https://forum.doozan.com/read.php?2,105494,105594#msg-105594
Using the:
saveenv
command this message is shown on the console:
Saving Environment to Disk...

and using
printenv
then shows the modified envs (e.g. serverip) properly.

However after a reset command still the old envs are used. I assume because the location where it is written to is not found or is not valid or maybe it is not written anywhere at all;).

I can only run a clean tftpboot when I have modified some of the envs. Then the box boots and the Debian version runs without any problem.

Maybe it is possible to modify some more of the other envs in such a way that I am able to use an other boot sequence instead of the tftpboot. E.g. a disk, I have both Sata and USB with a working /rootfs on it

hacksome
Re: Debian cannot boot on KD20 after flashing u-boot
July 07, 2020 05:00PM
hacksome,

Quote

U-Boot 2013.10-g3a0f380-dirty (Jul 26 2014 - 10:18:57) for OXNAS

This looks like this u-boot image was built from my GitHub. But it was most definitely forked and modified.

However after a reset command still the old envs are used. I assume because the location where it is written to is not found or is not valid or maybe it is not written anywhere at all;).

It probably did not write to disk at all.

=====

So the recap:

- Using my Pogo V3 U-Boot 2015.10-tld-2 on NAND, you cannot boot because of the memory location map seems wrong.
- Using HDD built by shv for Pogo V3, you can not boot far either.
- Using this KD20 built HDD u-boot, you cannot save envs.


================

So the last resorts:

1. Try to fit your rootfs to the way the current KD20 u-boot envs to allow booting without changing envs.

OXNAS> printenv

bootcmd=run beep select0 load loadr sysled boot || run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot|| run sysretry load loadr sysled boot || run sysretry load loadr sysled boot || run errled select2 load3 loadr3 ramboot boot 
bootdelay=2
baudrate=115200
ethaddr=00:25:b1:ff:ff:00
autoload=n
select0=ide dev 0
select1=ide dev 1
select2=dhcp 
loadr=ide read 0x62000000 2122 1644
load=ide read 0x60500000 50a 1800
loadr3=tftp 0x62000000 rdimg.gz
load2=ide read 0x60500000 e3e8 1800
load3=tftp 0x60500000 uImage
sysretry=led a;ide res
sysled=led 1
errled=led r
beep=beep
ramboot=setenv bootargs root=/dev/ram0 console=ttyS0,115200 initrd=0x61000000 mem=256M
boot=bootm 60500000 62000000
stdin=serial
stdout=serial
stderr=serial
bootargs=root=/dev/sda2 initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00 mem=256M poweroutage=yes
bootfile=uImage
gatewayip=192.168.178.1
netmask=255.255.255.0
ipaddr=192.168.178.19
serverip=192.168.178.1
dnsip=192.168.178.33

Environment size: 1206/8188 bytes

Is the above the correct printout for the envs at serial console when you boot with HDD?

2. Figure out the memory problem with running U-Boot 2015.10-tld-2

Let see if we can take one issue at the time. So for now just concentrate on 1. I think this memory problem could be firgured out if I have sometime to spend looking at the source code again. I will not have a lot of free time in the next 2, 3 weeks.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
July 10, 2020 03:48PM
Bodhi,

I finally found a way to revert to stock u-boot.
It took me quite some time to figure out the steps and most of all: to verify as much as possible to prevent messing up things more then they already were.

The biggest hurdle was that I could not find anything about images being encoded (some seem to call it wrapped) to be able to use error correcting features of NAND memory or to be better protected against bit errors in the image due to failing bits in NAND.
By accident I found in some older uboot source the code for this encoding, that was actually quite simple. Every bit is written out as 0x55 and every zero 0xAA. I found out that the Pogo uboot stage1 is also encoded like that.
However I still could not verify that the encoded images I had for stage1 and the uboot (the kd20 u-boot is also encoded) were actually images I could use. So I wrote an image decode program to revert the coding so I could see that these images were actually images built to be used in a Shuttle kd20.

Another problem could have been flashing to the wrong area of the NAND.
To solve that problem I used the kernel and Initrd images that I also had in the KD20.zip archive.
I used them to boot the kd20 via tftp and I got a working kernel and could mount a disk.
From there I could flash the images with ¨native¨ Shuttle kd20 nand tools. That solved the non functional u-boot problem.

All can be explained in a few minutes, but it took me many hours to figure it all out.
I had to revive my programming skills and had to adapt to the differences between C an Python, but that was not to difficult.
And I have learned a lot about the U-boot mechanism. Unfortunately it is not as modular and generic as I thought this mechanism was before I started with all this.
I had the idea it would be similar to replacing the Pogoplug stock u-boot with the newer one with more functionality, so booting options would be more flexible.

So now I am back to square one.

I have a KD20 wit stock u-boot and would like to be able to have it boot automatically from either a USB disk or a SATA disk. Similar as what is possible with a pogoplug.
A less desired option would be to have it only boot from a SATA disk using it´s own Stage1 and Uboot, however I have already found out that booting from sata is not the problem, but I am not able to save the modified environment to have it boot automatically.

From both options you suggested option 1 would be fine if it will enable automatic booting of a USB or SATA disk. The flexibility to auto-detect whether the USB or STA disk should be used would be nice but is not a requirement. If I have to make changes manually in the u-boot environment to switch between the disk type to boot from that´s is something I can live with.

these are the stock envs of the kd20:
bootcmd=run beep select0 load loadr sysled boot || run errled select2 load3 loadr3 ramboot boot
bootdelay=2
baudrate=115200
ethaddr=00:25:b1:ff:ff:00
ipaddr=192.168.0.128
serverip=192.168.0.1
autoload=n
netmask=255.255.0.0
bootfile="uImage"
select0=nand  info
select1=ide dev 0
select2=dhcp 
loadr=nand  read.e 0x62000000 240000 280000
loadr2=ide read 0x62000000 2122 1800
loadr3=tftp 0x62000000 rdimg.gz
load=nand  read.e 0x60500000 840000 300000
load2=ide read 0x60500000 50a 1800
load3=tftp 0x60500000 uImage
sysled=led 1
errled=led r
beep=beep
ramboot=setenv bootargs root=/dev/ram0 console=ttyS0,115200 initrd=0x61000000 mem=256M mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00
boot=bootm 60500000 62000000
ft=n
stdin=serial
stdout=serial
stderr=serial
bootargs=root=ubi0:rootfs ubi.mtd=5,512 rootfstype=ubifs initrd=0x61000000 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x25,0xb1,0xff,0xff,0x00 mem=256M poweroutage=yes

These are the commands available at the u-boot prompt:
?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
beep	- make beep sound
bootm   - boot application image from memory
bootp	- boot image via network using BootP/TFTP protocol
bubt	- Burn an image on the Boot Nand Flash.
clrenv	- clear environment
cmp     - memory compare
cp      - memory copy
crc32   - checksum calculation
dhcp	- invoke DHCP client to obtain IP/boot params
diskboot- boot from IDE device
echo    - echo args to console
exit    - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
go      - start application at address 'addr'
help    - print online help
ide     - IDE sub-system
iminfo  - print header information for application image
led	- LED Switch
ledfail - Extinguish (0) or light (1) failure LED
loop    - infinite loop on address range
md      - memory display
mm      - memory modify (auto-incrementing)
mtest   - simple RAM test
mw      - memory write (fill)
nand	- NAND sub-system
nboot   - boot from NAND device
nm      - memory modify (constant address)
ping	- send ICMP ECHO_REQUEST to network host
poweroff- Power-OFF
printenv- print environment variables
part	- clear MBR
rarpboot- boot image via network using RARP/TFTP protocol
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv  - set environment variables
test    - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor version


With the stock u-boot I am able to modify the environment so I guess there is more room to play with

Any suggestion would be welcome.

hacksome
Re: Debian cannot boot on KD20 after flashing u-boot
July 10, 2020 04:34PM
hacksome,

Congrats! go back to stock u-boot on this box would give you a lot of room.

Quote

With the stock u-boot I am able to modify the environment so I guess there is more room to play with

So now we can create a new set of envs to boot the box, and save them. Let me see I post some example, and you can retrofit it (you have more fun that way).

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
July 10, 2020 05:02PM
hacksome,

The example to boot Kirkwood boxes with USB rootfs, this is generic enough that it will be applicable to any u-boot.
setenv usb_set_bootargs 'setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 earlyprintk=serial'
setenv load_uimage 'ext2load usb 0:1 0x800000 /boot/uImage'
setenv load_uinitrd 'ext2load usb 0:1 0x2100000 /boot/uInitrd'
setenv usb_boot 'run load_uimage; if run load_uinitrd; then bootm 0x800000 0x2100000; else bootm 0x800000; fi'
setenv usb_bootcmd 'run usb_set_bootargs; run usb_boot'
setenv bootcmd 'usb start; run usb_bootcmd; usb stop; reset'
boot

You need to replace the load addresses of uImage and uInitrd with ones for this OXNAS box (use the Pogo V3 envs as a guide).

Pogo V3:
load_initrd=echo loading uInitrd ...; ext2load $bootdev $device 0x60e00000 /boot/uInitrd
load_uimage=echo loading uImage ...; ext2load $bootdev $device 0x60500000 /boot/uImage

Note that you are booting with stock u-boot, so the uInitrd load address might need to be further such as 0x60f00000 (I forgot what was the exact address, I have posted it somewhere in this forum).

As long as you don't do saveenv, nothing is sticky, mistakes are OK. Once you booted into Debian successfully, you can come back to serial console and save them.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian cannot boot on KD20 after flashing u-boot
July 11, 2020 09:08AM
Bodhi,

SATA boot is working!
I did find the env changes to boot from a standard SATA disk automatically!

The disk of course must be properly populated with a rootfs configured for this box. But that´s not difficult to do. I used Debian Stretch. (4.4.54-oxnas-tld-1) this time. But using Debian Buster instead should be similar I guess.

These are the environment changes I made:

setenv sata_set_bootargs 'setenv bootargs root=/dev/sda1 initrd=0x61000000 console=ttyS0,115200 elevator=cfq mem=256M poweroutage=yes'
setenv load_uimage 'ext2load ide 0:1 0x60500000 /boot/uImage'
setenv load_uinitrd 'ext2load ide 0:1 0x61000000 /boot/uInitrd'
setenv sata_boot 'run load_uimage; if run load_uinitrd; then bootm 0x60500000 0x61000000; else bootm 0x60500000; fi'
setenv sata_bootcmd 'run sata_set_bootargs; run sata_boot'
setenv bootcmd 'run sata_bootcmd boot || bootcmd=run beep select0 load loadr sysled boot || run errled select2 load3 loadr3 ramboot boot'

using the phrase
root=LABEL=rootfs
instead of
root=/dev/sda1
in the bootargs environment did not work. Probably this u-boot is not capable to use the declared LABEL variable.

The other env modifications were derived from your examples and adapted for proper load addresses.

To have the box automatically boot from the SATA disk I added the
run sata_bootcmd boot ||
to the default bootcmd declaration , so its first action now is to try to boot from the SATA disk.

About booting from USB: I could not figure out how the have the USB drive initialized properly from within the u-boot console, so I focused on the SATA Boot. However it would be nice if booting from USB could be added as well. Maybe you know some u-boot commands that I can try to find out how to initialize a USB drive by using u-boot commands.
When that is functioning I guess booting from it should not be to difficult.

hacksome



Edited 1 time(s). Last edit at 07/11/2020 09:41AM by hacksome.
Re: Debian cannot boot on KD20 after flashing u-boot
July 11, 2020 04:41PM
hacksome.

> SATA boot is working!
> I did find the env changes to boot from a standard
> SATA disk automatically!

Cool!

> using the phrase
root=LABEL=rootfs
> instead of
root=/dev/sda1
> in the bootargs environment did not work. Probably
> this u-boot is not capable to use the declared
> LABEL variable.

That because of uInitrd. If you don't load uInitrd, then you cannot use label. And the bootargs must be root=LABEL=rootfs. And the rootfs partition must be labeled as rootfs.

U-Boot does have anything to do with the root device. It passes the the bootargs to the kernel, whatever you have in the env, it treats it as a string. Once the the kernel has comlete booting, it will use the bootargs to find the rootfs and mount it. At this time the root=LABEL=rootfs bootarg is used by the kernel to tell initrd where the root device is (see bottom of this post).


> About booting from USB: I could not figure out how
> the have the USB drive initialized properly from
> within the u-boot console, so I focused on the
> SATA Boot. However it would be nice if booting
> from USB could be added as well. Maybe you know
> some u-boot commands that I can try to find out
> how to initialize a USB drive by using u-boot
> commands.

Plug in a USB thumb drive, and at serial console prompt,

usb reset
ext2ls usb 0:1 /

If you can see the USB drive top directory listing from these commands, then it is OK to use USB rootfs. And that is my example above for:

setenv usb_set_bootargs 'setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 earlyprintk=serial'
setenv load_uimage 'ext2load usb 0:1 0x800000 /boot/uImage'
setenv load_uinitrd 'ext2load usb 0:1 0x2100000 /boot/uInitrd'
setenv usb_boot 'run load_uimage; if run load_uinitrd; then bootm 0x800000 0x2100000; else bootm 0x800000; fi'
setenv usb_bootcmd 'run usb_set_bootargs; run usb_boot'
setenv bootcmd 'usb start; run usb_bootcmd; usb stop; reset'
boot


======

I've mentioned before about the ARM boot process description in the Wiki (I need to add more details and change the topic name to make it apparent):

Quote
https://forum.doozan.com/read.php?3,19093

The booting process has 2 phases:

1. Boot loader:

- Power up, bootROM is running, u-boot image is loaded and run.
- u-boot uses the envs to find uImage and uInitrd.
- u-boot loads uImage and uInitrd from partition that has /boot folder, and start kernel. If multiple drives exist, only one drive and partition should have /boot.

2. Kernel

- Kernel starts using bootargs.
- Kernel search for rootfs to mount. This is when root device with label or UUID is used. If none specified, drive letter is used (e.g. /dev/sda1). If multiple drives exist, rootfs label or UUID will pinpoint to the exact rootfs partition.

-bodhi
===========================
Forum Wiki
bodhi's corner
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: