Welcome! Log In Create A New Profile

Advanced

Zyxel NSA325v2 - bumpy road to Debian

Posted by shiva 
Zyxel NSA325v2 - bumpy road to Debian
August 03, 2017 05:27PM
Hi all,

After much thought and some tests on the default NSA325v2 firmware I decided to flash bodhi's latest U-Boot and debian version on it. The end result should be an ownCloud instance on a Debian USB stick, having all files stored on RAID 1 SATA drives. Nothing more.

I did flash the new U-Boot but missed to flash the U-Boot env. Luckily I am not the only one screwing the U-boot env params up.

So I created an ext-3 rootfs on a 32Gb USB stick and placed the latest debian 4.12.1 on it, including uImage with the proper dbt embedded. I also added an uEnv.txt file in /boot inspired from the one in uboot.2016.05.tld-1.environment.bodhi.tar (see attached)

During boot the kernel panics:
[    6.017072] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    6.024628] Please append a correct "root=" boot option; here are the available partitions:
6.033061] 1f00            1024 mtdblock0 
[    6.033065]  (driver?)
[    6.039660] 1f01             512 mtdblock1 
[    6.039664]  (driver?)
[    6.046229] 1f02             512 mtdblock2 
[    6.046232]  (driver?)
[    6.052814] 1f03             512 mtdblock3 
[    6.052817]  (driver?)
[    6.059406] usb 1-1: new high-speed USB device number 2 using orion-ehci
[    6.066230] 1f04           10240 mtdblock4 
[    6.066234]  (driver?)
[    6.072818] 1f05           10240 mtdblock5 
[    6.072822]  (driver?)
[    6.079416] 1f06           48896 mtdblock6 
[    6.079420]  (driver?)
[    6.085984] 1f07           10240 mtdblock7 
[    6.085987]  (driver?)
[    6.092568] 1f08           48896 mtdblock8 
[    6.092571]  (driver?)
[    6.099156] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    6.107453] CPU: 0 PID: 1 Comm: swapper Not tainted 4.12.1-kirkwood-tld-1 #1

I've been changing some of the env settings but to no avail (attached is the full log of the last 3 trials). Last one was:
NSA325> run bootcmd_uenv
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

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

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            61169728        00056e13-01     83 Boot
loading envs from usb 0 ...
2781 bytes read in 301 ms (8.8 KiB/s)
importing envs ...
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
NSA325> setenv arcNumber 4495
NSA325> setenv machid
NSA325> setenv rootfstype
NSA325> setenv usb_root "LABEL=rootfs"
NSA325> setenv mtdparts "mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)"
NSA325> setenv partition "nand0,2"
NSA325> setenv bootcmd_exec "run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi"
NSA325> setenv set_bootargs "setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params"
NSA325> boot
I must mention that I have no SATA drive connected. I removed them (2 1Tb Seagates) until I will have a working debian on the device.

Now the most weirdness part: yesterday, printenv command in U-Boot displayed:
printenv
arcNumber=4495
baudrate=115200
bootcmd=run bootcmd_uenv; run bootcmd_usb; usb stop; run bootcmd_sata; reset
bootcmd_sata=run sata_init; run set_bootargs_sata; run sata_boot
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootcmd_usb=run usb_init; run set_bootargs_usb; run usb_boot
bootdelay=10
console=ttyS0,115200
device=0:1
ethact=egiga0
ethaddr=b6:d0:5e:0f:a1:17
led_error=orange blinking
led_exit=green off
led_init=green blinking
machid=118f
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x100000(uboot),0x80000(stock_uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2)
partition=nand0,2
rootdelay=10
rootfstype=ext2
sata_boot=mw 0x800000 0 1; run sata_load_uimage; if run sata_load_uinitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
sata_init=ide reset
sata_load_uimage=ext2load ide $device 0x800000 /boot/uImage
sata_load_uinitrd=ext2load ide $device 0x1100000 /boot/uInitrd
sata_root=/dev/sda1
set_bootargs_sata=setenv bootargs console=$console root=$sata_root rootdelay=$rootdelay rootfstype=$rootfstype $mtdparts
set_bootargs_usb=setenv bootargs console=$console root=$usb_root rootdelay=$rootdelay rootfstype=$rootfstype $mtdparts
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x810000
uenv_load=usb start; setenv uenv_loaded 0; for devtype in usb; do for disknum in 0; do run uenv_read_disk; done; done
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x810000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if $devtype part $disknum; then run uenv_read; fi
usb_boot=mw 0x800000 0 1; run usb_load_uimage; if run usb_load_uinitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
usb_init=usb start
usb_load_uimage=ext2load usb $device 0x800000 /boot/uImage
usb_load_uinitrd=ext2load usb $device 0x1100000 /boot/uInitrd
usb_root=/dev/sda1

but today it just prints the attached image and never stops. I have to cut power down to the NAS.

Which is another thing that rubs me the wrong way: is there any other way of forcing the device to reboot/reset when using the serial connection except for this hard power-off? Yesterday the kernel failed to boot but it also did not return to U-Boot console and I had no way of reseting it except for plugging out the cord.
Attachments:
open | download - uEnv.txt (2.7 KB)
open | download - console_log_2017.08.03.txt (55.1 KB)
open | download - Screenshot_20170804_001115.png (5.4 KB)
Re: Zyxel NSA325v2 - bumpy road to Debian
August 03, 2017 06:15PM
shiva,

There is a couple of setup problems in your system right now.

1. The rootfs has DTB embbeded inside uImage. It should not.

Quote

So I created an ext-3 rootfs on a 32Gb USB stick and placed the latest debian 4.12.1 on it, including uImage with the proper dbt embedded. I also added an uEnv.txt file in /boot inspired from the one in uboot.2016.05.tld-1.environment.bodhi.tar (see attached)

2. The envs are not quite OK.

Quote

but today it just prints the attached image and never stops. I have to cut power down to the NAS.


Solution:

1. Your rootfs should not have the DTB embbeded in uImage. So reverse that. Moun the drive on other Linux box and resore original uImage. Assuming it is mounted at /media/sdb1:

cd /media/sdb1/boot
mv uImage uImage.nsa325.with.fdt
cp -a uImage.orig uImage
sync

Now the rootfs is ready for step 2.

2. To restore the env to a good state, do this extra step.

http://forum.doozan.com/read.php?3,29362,29390#msg-29390

Afer you have run the script uboot.2016.05-tld-1.environment.scr in that post. Your envs will be reversed to the pristine default state.

And then you can run your own settings adjustment in doing this.
run bootcmd_uenv

And then you can boot.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Author:

Your Email:


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: