Welcome! Log In Create A New Profile

Advanced

NSA325v2 Debian rootfs

Posted by archon 
NSA325v2 Debian rootfs
October 26, 2019 12:36PM
So I've decided to dust off this NAS after 5 years and try this again, but I'm a dummy and got overwhelmed by the instructions.

I have a working serial connection and can successfully log in from Ubuntu using
kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2017.07-tld-1.nsa325.mtd0.kwb -p
and run commands, but I'm not sure where to go from there to flash latest uboot and get Debian on it.

I started at the 25 Aug 2019 section in this guide but I don't understand step 5. How do I boot into Debian with the prepared USB stick? Just plugging it to one of the USB2 ports and powering up doesn't seem to do anything different.

printenv:
U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:42:03 -0700)
ZyXEL NSA325 2-Bay Power Media Server

SoC:   Kirkwood 88F6282_A1
DRAM:  512 MiB
WARNING: Caches not enabled
NAND:  128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   egiga0
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot:  0
NSA325> printenv
arcNumber=4495
baudrate=115200
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
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
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
console=console=ttyS0,115200
device=0:1
devices=usb ide
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-nsa325.dtb
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
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
preboot_nc=run if_netconsole start_netconsole
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 $load_uimage_addr /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
serverip=192.168.0.220
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_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $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=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
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
usb_ready_retry=15

Environment size: 3016/131068 bytes



Edited 1 time(s). Last edit at 10/26/2019 12:40PM by archon.
Re: NSA325v2 Debian rootfs
October 26, 2019 05:12PM
archon,

> So I've decided to dust off this NAS after 5 years
> and try this again, but I'm a dummy and got
> overwhelmed by the instructions.

Not really :) you are very close to booting the box.

> I have a working serial connection and can
> successfully log in from Ubuntu using
kwboot
> -t -B 115200 /dev/ttyUSB0 -b
> uboot.2017.07-tld-1.nsa325.mtd0.kwb -p
and
> run commands, but I'm not sure where to go from
> there to flash latest uboot and get Debian on it.

At this point, you are ready to boot the Debian rootfs on USB. So do the following:

- Plug in the USB rootfs to the USB 2.0 port in the back.
- Start kwboot from Ubuntu like you did. It will wait for the box.
- Power on the box

Watch the serial boot log, the first device it will try to find the kernel is the USB.

See how far it boots. And please post the entire log here.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: NSA325v2 Debian rootfs
October 27, 2019 05:53PM
Well bodhi, unsurprisingly you were right. Log attached.

After completing the 25 aug section and then the uboot flashing guide, I'm pleased to report I got it all up and running without errors. I only hit one snag here:

Quote

e.2 Box specific envs:

Then for all boxes, restore these 2 envs using the saved envs text in step c (replace xxx with the real saved values)

fw_setenv mtdparts 'xxxxxxxxx'
fw_setenv ethaddr 'xx:xx:xx:xx:xx:xx'

There was no mtdparts line in the previously saved values, so impatiently I left it as is and proceeded.

Thanks and have a good one.
Attachments:
open | download - MobaXterm_192.168.253.129a_20191027_164100.txt (25.7 KB)
Re: NSA325v2 Debian rootfs
October 27, 2019 11:56PM
archon,

> After completing the 25 aug section and then the
> uboot flashing guide, I'm pleased to report I got
> it all up and running without errors.

Cool!

> I only hit
> one snag here:
>
>
Quote

e.2 Box specific envs:
>
> Then for all boxes, restore these 2 envs using the
> saved envs text in step c (replace xxx with the
> real saved values)
>
> fw_setenv mtdparts 'xxxxxxxxx'
> fw_setenv ethaddr 'xx:xx:xx:xx:xx:xx'
>
> There was no mtdparts line in the previously saved
> values, so impatiently I left it as is and
> proceeded.

Yes, that was because you only flashed u-boot image but not its default envs image. Basically that is step 8 to 11.

The default envs from the new u-boot internals is already very close to be done.

So go ahead and flash envs image as described in step 8.

And then set these 2 envs:
fw_setenv mtdparts 'mtdparts=orion_nand:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2)'
fw_setenv ethaddr 'xx:xx:xx:xx:xx:xx'
and then list the envs to see everything is OK:
fw_printenv


Note: The ethaddr is this box MAC address. Look at the bottom of the case for the sticker label, it should have the MAC address. Currently, it is set to 52:3b:20:9c:11:51, which came from u-boot internals (a randomly generated local MAC that I used so that the network will be up in case there is no ethaddr defined).

And reboot.

-bodhi
===========================
Forum Wiki
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: