Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3247

Debian cannot boot on KD20 after flashing u-boot (1 reply)

$
0
0
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 ?

Viewing all articles
Browse latest Browse all 3247

Trending Articles