Welcome! Log In Create A New Profile

Advanced

Can't fully boot U-Boot on Zyxel NSA320S

Posted by stalker 
Can't fully boot U-Boot on Zyxel NSA320S
November 22, 2025 08:13AM
I am trying to flash Zyxel NSA320S, but I am having trouble understanding the procedure. I am working on Ubuntu 25.10. What I have achieved so far:

1. I connected the console to the motherboard (UART USB converter) and using picocom I can see the messages sent by the board during the startup of the built-in factory firmware.

2. I downloaded the files uboot.2023.04-tld-1.nsa325.bodhi.tar and uboot.2017.07-tld-1.nsa320.mtd0.kwb (both versions, just in case).

3. Using kwboot (version 2025.01, installed from system repositories), I load either version 2017 or 2023 onto the board using a UART connection.4. I see the loading percentage increasing, ending like this:

 94 % [......................................................................]
 96 % [......................................................................]
 98 % [......................................................................]
 99 % [..                                                                    ]
Done
Finishing transfer
[Type Ctrl-\ + c to quit]

And nothing else happens. After pressing Ctrl+\ and then c, I exit to the Ubuntu command line.

I also tried the USB key method. In fdisk, I created a partition, formatted it to Ext4, named it rootfs, copied the Debian-5.6.7-kirkwood-tld-1-rootfs-bodhi. tar.bz2 file there, decompressed it with sudo tar xjf, changed ext3 to ext4 in /etc/fstab. I inserted the key first into the front USB port, then into the rear one. I connected via picocom, booted the disc, and the system loaded with the factory firmware.

I don't know what to do next. I'm out of ideas. I'm probably missing some important step. Can you help me?

EDIT: after long reading other threads, I found that I shouldn't use uboot with nsa325 or nsa320 in name but nsa310s. Then uboot started as expected and I was able to flash NAND from USB.

Now board starts with new uboot - but only if USB with Debian is plugged in. How can I make it work in such way that USB dongle is unnecessary? In other words, how do I transfer Debian from USB to NAND?



Edited 1 time(s). Last edit at 11/22/2025 12:21PM by stalker.
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 22, 2025 02:55PM
stalker,

> that I shouldn't use uboot with nsa325 or nsa320
> in name but nsa310s. Then uboot started as
> expected and I was able to flash NAND from USB.

Cool!

> Now board starts with new uboot - but only if USB
> with Debian is plugged in. How can I make it work
> in such way that USB dongle is unnecessary? In
> other words, how do I transfer Debian from USB to
> NAND?

The NAND flash in these boxes are too small to host the Debian rootfs. You could use HDD rootfs instead of USB. Create a small partition such as 32GB on the HDD (should be the 1st partition). And then create a new rootfs using Debian-6.5.7-kirkwood-tld-1-rootfs-bodhi.tar.bz2, like you did for the USB. Or you also clone the USB rootfs to the HDD.

Shutdown, remove the USB drive, power up, and it should boot into HDD rootfs. And you should keep this USB rootfs in case you want to rescue the system if the HDD rootfs is corrupted.

====

Some likes to use the HDDs for RAID. In that case, booting with USB rootfs is a good set up. It keeps thing simple and easier to backup and recovery. If you use USB rootfs, see this post to prolong the life of USB flash drive.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 23, 2025 04:51AM
Thank you for the clarification. I currently have an HDD with data inserted to NAS, formatted with stock firmware. One partition is swap, the other contains backup data. I'm afraid to tinker with this drive (change partition size, etc.) in case I lose data. I think I'll buy a small SSD and use it as a boot/system drive.
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 23, 2025 03:26PM
stalker,

> Thank you for the clarification. I currently have
> an HDD with data inserted to NAS, formatted with
> stock firmware. One partition is swap, the other
> contains backup data. I'm afraid to tinker with
> this drive (change partition size, etc.) in case I
> lose data.

Good idea.

> I think I'll buy a small SSD and use it
> as a boot/system drive.

That would be best.

Also it's worth noting that the new u-boot most likely does not boot the stock FW. But Debian problably can mount the stock HDD partition so you can see the data. However, I have not tried this (I never used stock FW so don't have any data worth saving). IIRC, some users have done this OK because Zyxel NAS use a standard RAID implementation.

So, back up your mtds before flashing new u-boot. In case you cannot access the stock rootfs on the HDD while in Debian. You can kwboot the mtd0 to boot back to stock.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 24, 2025 01:34AM
I managed to access the data partition after uploading new firmware (uboot 2017). There were some issues with this because the partition was marked as RAID, but after reading the guides, I “disarmed” the RAID and changed the partition type to regular Ext4. Debian handled it perfectly :)

Now I'm waiting for the SSD drive to be delivered, and I'll try to transfer the system from the flash drive to the SSD drive.

If you have any questions, I'll be back :)
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 24, 2025 02:45PM
stalker,

> I managed to access the data partition after
> uploading new firmware (uboot 2017). There were
> some issues with this because the partition was
> marked as RAID, but after reading the guides, I
> “disarmed” the RAID and changed the partition
> type to regular Ext4. Debian handled it perfectly
> :)

Do keep the log of what you did above? please post it here. It would be useful for people with ZyXEL NAS!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 26, 2025 08:26AM
@bodhi According to your question about RAID, I'll try to find the website(s) I got the tips from.

Now I have another problem. I am trying to force my Zyxel NSA320S to boot from an SSD drive. I formatted it to Ext3 and copied the system from a USB flash drive to the drive using this thread https://forum.doozan.com/read.php?2,133372

My disks (sda - SSD, sdb - USB):

root@debian:/# lsblk -f
NAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                         
└─sda1
     ext3   1.0   rootfs
                        c09ca0a8-368e-41d1-b0dd-763e54e64dd6  219,2G     1% /media/sda1
sdb                                                                         
└─sdb1
     ext4   1.0   rootfs
                        3c11bd21-44f3-4aae-b370-6f822c588354    4,8G    32% /


I think I did everything correctly. The command

e2label /dev/sda1

shows

rootfs

The contents of /media/sda1/boot:

root@debian:/boot# ls -lart
razem 57108
-rw-r--r--  1 root root 5791271 2000-01-01  uInitrd.ORIG
drwxr-xr-x  2 root root    4096 2000-01-01  dts
-rw-r--r--  1 root root 5763896 2000-01-01  uImage
-rw-r--r--  1 root root 5790479 2000-01-01  uInitrd
-rwxr-xr-x  1 root root 6223880 2023-10-19  zImage.fdt.ORIG
-rw-r--r--  1 root root 6223944 2023-10-31  uImage.ORIG
-rwxr-xr-x  1 root root 5763832 11-03 23:17 vmlinuz-6.17.7-kirkwood-tld-1
-rw-r--r--  1 root root 4375614 11-03 23:17 System.map-6.17.7-kirkwood-tld-1
-rw-r--r--  1 root root  199199 11-03 23:17 config-6.17.7-kirkwood-tld-1
-rwxr-xr-x  1 root root 5763832 11-04 01:41 zImage.fdt
-rwxr-xr-x  1 root root 5763832 11-04 01:41 zImage-6.17.7-kirkwood-tld-1
-rw-r--r--  1 root root  187155 11-06 22:50 linux-6.17.7-kirkwood-tld-1.patch
-rw-r--r--  1 root root 6593244 11-23 17:08 initrd.img-6.17.7-kirkwood-tld-1
drwxr-xr-x  3 root root    4096 11-23 17:08 .
drwxr-xr-x 18 root root    4096 11-26 13:15 ..


And U-Boot log after disconnecting USB and powering on says:

U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:50:06 -0700)
ZyXEL NSA310S/320S 1/2-Bay Power Media Server

SoC:   Kirkwood 88F6702_A1
DRAM:  256 MiB
WARNING: Caches not enabled
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot:  0 
Initializing devices...
resetting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
resetting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Unknown command 'sata' - try 'help'
Loading envs from usb 0...
** Bad device usb 0 **
Loading envs from usb 1...
** Bad device usb 1 **
Loading envs from usb 2...
** Bad device usb 2 **
Loading envs from usb 3...
** Bad device usb 3 **
Loading envs from sata 0...
** Bad device sata 0 **
Loading envs from sata 1...
** Bad device sata 1 **
Loading envs from sata 2...
** Bad device sata 2 **
Loading envs from sata 3...
** Bad device sata 3 **
running scan_disk ...
Scan device usb
resetting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
resetting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
device usb 0:1
** Bad device usb 0 **
device usb 1:1
** Bad device usb 1 **
device usb 2:1
** Bad device usb 2 **
device usb 3:1
** Bad device usb 3 **
Scan device sata
Unknown command 'sata' - try 'help'
device sata 0:1
** Bad device sata 0 **
device sata 1:1
** Bad device sata 1 **
device sata 2:1
** Bad device sata 2 **
device sata 3:1
** Bad device sata 3 **
loading uImage ...
** Bad device usb 0 **
resetting ...

U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:50:06 -0700)
ZyXEL NSA310S/320S 1/2-Bay Power Media Server

SoC:   Kirkwood 88F6702_A1
DRAM:  256 MiB
WARNING: Caches not enabled
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot:  0 
NSA3x0S>
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 26, 2025 03:15PM
stalker,

> Hit any key to stop autoboot: 0
> NSA3x0S>

Do these commands

List your envs
printenv

Bring up both HDD/SDD in the slots
ide reset
ide info
ide part

See if both disks are spun up (if you have both HDD and SDD in the slot). And then swap the disks to the other slots, and repeat the commands

ide reset
ide info
ide part

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 29, 2025 03:30AM
After some delay I had a time to check the commands. I connected only SSD drive.

NSA3x0S> printenv 
baudrate=115200
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_exec=if run load_uimage; then; 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; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=5
bootdev=usb
console=ttyS0,115200
device=0:1
devices=usb sata
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-nsa320s.dtb
ethact=egiga0
ethaddr=5C:F4:AB:47:8D:32
if_netconsole=ping $serverip
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x2c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x01100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
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)
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3; 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 reset; sleep 1; usb reset";  setenv scan_sata "sata init";  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
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 serial,nc; setenv stdout serial,nc; setenv stderr serial,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=echo Initializing devices...; setenv init_usb "usb reset; sleep 1; usb reset"; setenv init_sata sata init;  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 $disks; do if test $uenv_loaded -eq 0; then setenv device_type $devtype; setenv disk_number $disknum; run uenv_read; fi; done; done;
uenv_read=echo Loading envs from $device_type $disk_number...; if load $device_type  $disk_number:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; echo ... envs loaded; fi

Environment size: 2997/131068 bytes

NSA3x0S> ide reset

Reset IDE: Bus 0: OK Bus 1: not available  
  Device 0: Model: Crucial_CT256MX100SSD1 Firm: MU01 Ser#: 14450DBA4097
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)

NSA3x0S> ide info
Device 0: Model: Crucial_CT256MX100SSD1 Firm: MU01 Ser#: 14450DBA4097
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)

NSA3x0S> ide info
evice 0: Model: Crucial_CT256MX100SSD1 Firm: MU01 Ser#: 14450DBA4097
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)

NSA3x0S> ide part

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

Part	Start Sector	Num Sectors	UUID		Type
  1	2048      	500116144 	86dd736f-01	83

And I found also bdinfo command - I don't know what is this for but I paste it here also:

NSA3x0S> bdinfo
arch_number = 0x00001343
boot_params = 0x00000100
DRAM bank   = 0x00000000
-> start    = 0x00000000
-> size     = 0x10000000
eth0name    = egiga0
ethaddr     = 5C:F4:AB:47:8D:32
current eth = egiga0
ip_addr     = <NULL>
baudrate    = 115200 bps
TLB addr    = 0x0FFF0000
relocaddr   = 0x0FF2D000
reloc off   = 0x0F92D000
irq_sp      = 0x0FB0CEF0
sp start    = 0x0FB0CEE0
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 29, 2025 03:41AM
I am wondering about messages below:

Scan device sata
Unknown command 'sata' - try 'help'
device sata 0:1
** Bad device sata 0 **
device sata 1:1
** Bad device sata 1 **
device sata 2:1
** Bad device sata 2 **
device sata 3:1
** Bad device sata 3 **
loading uImage ...
** Bad device usb 0 **

Specifically, I refer to Unknown command 'sata' - try 'help' - and indeed, help does not list sata in the list of commands - only ide. Could this be the problem?
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 29, 2025 12:36PM
stalker Wrote:
-------------------------------------------------------
> I am wondering about messages below:
>
> Specifically, I refer to Unknown command 'sata'
> - try 'help'
- and indeed, help does
> not list sata in the list of commands -
> only ide. Could this be the problem?

This is definitely the problem. It is never trying to boot from the ide device. You can try the following (not tested) to see if it will boot.

set bootdev=ide
ide reset
run set_bootargs;
run bootcmd_exec;

If this is successful, then we can modify your environment variables.
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 29, 2025 01:09PM
set bootdev=ide
doesn't work. But
setenv bootdev ide
does.

Then printenv shows bootdev=ide - so far so good.

ide reset
run set_bootargs;
run bootcmd_exec;

And system boots from SSD. But only until reboot. It's expected for me but what should I do to make this change permanent?
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 29, 2025 01:45PM
I suspect this fragment of the list of variables:

scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb reset; sleep 1; usb reset";  setenv scan_sata "sata init";  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

Specifically this:

setenv scan_sata "sata init"

help (list of commands) doesn't show scan_sata or scan_mmc. I think I should use something like setenv resetdisk "ide reset" instead of setenv scan_sata "sata init" but how to set and save such long line in NAND to make it permanent?
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 29, 2025 03:07PM
stalker,

Your envs are for the 2023.04 version. You must have flashed this while installing the wrong u-boot.

The easiest way to fix this this to use the default envs from the 2017.07 tarball. Let me look at the tarball and post the instruction.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 11/29/2025 03:18PM by bodhi.
Re: Can't fully boot U-Boot on Zyxel NSA320S
November 29, 2025 03:17PM
Here is the Wiki thread.

Booting with uEnv.txt (to fix messed up U-Boot envs or corrupted NAND envs area)
https://forum.doozan.com/read.php?3,116134,116139#msg-116139

You don't need a USB rootfs, just a regular USB data drive. But if you're booting with USB rootfs then the /boot folder is already there.

At top folder create a /boot/ folder and copy the file

cd /media/sdb1/boot
cp -a uboot.2016.05-tld-1.environment uEnv.txt


And then edit the uEnv.txt to have
dtb_file=/boot/dts/kirkwood-nsa320s.dtb
Sync and remove USB, bring it to the NSA320S. kwboot again. Interrupt countdown and

setenv devices usb
run bootcmd_uenv
It should load the envs and populate then correcttly
printenv
Now it does not matter where the rootfs is, boot
boot

After booted into Debian, you can reflash the envs image using uboot.2016.05-tld-1.environment.img. Or you can manually adjust the envs with fw_setenv.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 11/29/2025 03:20PM by bodhi.
[SOLVED] Re: Can't fully boot U-Boot on Zyxel NSA320S
November 30, 2025 01:30AM
Thank you very much!

After some playing with files and commands I managed to achieve the goal :) Zyxel starts now from SSD drive.

I have now the question about swap but I'll start new thread.
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: