In addition to the capabilties provided by u-boot 2017.07-tld-1 for NSA325 , this 2023.04-tld-1 NSA325 u-boot has the following new capabilties:
- Supports for USB 3.0. You can now boot with the rootfs attached to the USB 3.0 port in front.
- Netconsole enhancement. (See Note C.1.2).
- Distro boot (see Note C.2 after the Installation Steps for usage).
============================
Update 26 May 2023
Download at Dropbox
uboot.2023.04-tld-1.nsa325.bodhi.tar
As always, please verify the hash of what you've downloaded!
This tarball includes 4 files
A. Preparation
A.1. UART booting
It is strongly recommmended that you try to run kwboot to test this boot image with UART booting before flashing to NAND. This is the rescue path when and if the flashing goes wrong for some reason. See example here. And to download latest ARM kwboot binary for UART booting see here.
A.2. Flashing tools
If you are running an OS (eg. stock FW) that does not provide mtd-utils and uboot-tools (fw_setenv, fw_printenv, flash_erase, nandwrite), you can download the NAND and U-Boot tools binaries here in this thread.
B. Flashing Instruction:
1. Setup fw_env.config
U-Boot envs config should be defined as followed in your /etc/fw_env.config
cat /etc/fw_env.config
If you don't have /etc/fw_env.config file in your system then go ahead and create this file:
- And your mtd partitions should be:
# cat /proc/mtd
2. Backup mtd0 and envs
Save your current uBoot image and envs image in mtd0, and save your current u-boot envs with fw_printenv.
2.1 Dumping NAND mtd0:
2.2. Save envs:
Copy these files to a persistent storage.
3. Check for bad blocks
Be sure there is no bad block in the first 1M of your NAND. This is very important, if there is bad block in the first 1M (blocks 0 to 7), don't flash u-boot, because you will almost certainly soft-brick your box.
Example of bad block in mtd0:
This bad eraseblock 3 is the 4th block which resides within mtd0 first 1M (block 0 to block 7). Please stop at this step and post question in this thread for a workaround.
4. Extract the archive to /tmp
5. Flash u-boot image to NAND
Be extra careful with the next 2 commands, you should see output that look like below in those steps. If there is error, then do not reboot, post your problem here so we can help.
Erase 4 blocks
Write the image
6. Flash default u-boot envs image
If you are upgrading from 2017.07-tld-1 u-boot, you can skip this step. But some envs will need to be updated before reboot. See Note section below after the installation steps. Especially if your rootfs is SATA, then you must adjust the env described in Note section "C.1.1 SATA boot envs". Or if you are using netconsole then you must adjust the env described in Note section "C.1.2 Netconsole envs".
Be extra careful with the next 2 commands, you should see output that look like below. If there is error, then do not reboot, post your problem here so we can help.
Erase 1 block
Write the image
7. Restore MAC address
Modify the following u-boot variable using fw_setenv:
Restore the MAC address using the saved envs in current_envs.txt. Or find the MAC address on the sticker outside the case. Replace xx:xx:xx:xx:xx:xx with the real values.
Don't reboot if there is error while listing U-Boot envs.
8. (Optional) Activate netconsole
Skip this step if you already have serial console connected. Netconsole can be set up anytime later.
Adjust 192.168.0.xxx and 192.168.0.yyy below to the real numbers in your network configuration. 192.168.0.xxx is this pogoplug static IP address, and 192.168.0.yyy is the IP address of the netconsole server where it will monitor the output from this pogoplug. The ipaddr can be any unique address that you want to use. serverip is IP address of the netconsole server, so usually a Linux box in your network.
9. Reboot
Upon reboot, in either serial console or netconsole, U-Boot banner should show:
DONE installation.
C. Note
C.1. Envs changes from 2017.07-tld-1 u-to 2023.04-tld-1 u-boot.
As mentioned in Step 6, if you are upgrading from 2017.07-tld-1 u-boot then this is a u-boot drop in replacement (no need to flash new default envs image). However there are changes in envs for 2023.04-tld-1 that need to be retrofitted if you have chosen not flashing the default envs in Step 6.
C.1.1 SATA boot envs
In this new u-boot, the SATA device was changed from "ide" to "sata", and also the command to start it. So if SATA is the boot drive, you must adjust these envs.
C.1.2 Netconsole envs
Both serial console and netconsole input and output are now muxed to one console.
So in this new u-boot, the stdin/stdout/stderr netconsole was change from "serial" to "serial,nc". Therefore, if netconsole is used, you must adjust the start_netconsole env.
C.2. Distro Boot
C.2.1 (Optional) Booting all distros
In this new u-boot, I've implemented the Distro Boot capability. So any distro (such as Ubuntu, Alpine, Fedora, etc.) can be booted as long as they conform to the Distro Boot standard. However, for the purpose of booting our Debian Kirkwood kernel released here for this box, it is not relevant and should be ignored.
C.2.2 Using boot.scr to recover from damaged or corrupted envs NAND block
Included in the tarball uboot.2023.04-tld-1.nsa325.bodhi.tar is the script file uboot.2023.04-tld-1.nsa325.boot.scr. This is a Distro-Boot-compliant boot script. It can be used to recover from a damaged/corrupted envs NAND block, or if the envs NAND block has never been flashed (same as corrupted).
So for whatever reason, if in serial console, U-Boot reported the CRC error while loading the envs, using the boot.scr will provide a minimalist booting envs and enable booting into Debian. And then the default envs image can be flashed.
- Mount the USB rootfs on another Linux box. Assuming it is mounted at /media/sdb1.
- Unmount and then bring it back to the NSA325. Power up and let it boot automatically. The boot.scr should come into play, and allow booting to Debian.
C.3. uEnv.txt
This capabilty is the same as in previously released u-boot-2017.07-tld-1.
Description TBD.
END of NOTE.
- Supports for USB 3.0. You can now boot with the rootfs attached to the USB 3.0 port in front.
- Netconsole enhancement. (See Note C.1.2).
- Distro boot (see Note C.2 after the Installation Steps for usage).
============================
Update 26 May 2023
Download at Dropbox
uboot.2023.04-tld-1.nsa325.bodhi.tar
md5sum bfb6b95f53e195c7e7a219b7174bd33f sha256sum ae9da01a81d0800266ddb2de2fd4660a97a45016624183085ae1355715562d68
As always, please verify the hash of what you've downloaded!
This tarball includes 4 files
uboot.2023.04-tld-1.nsa325.kwb uboot.2023.04-tld-1.nsa325.environment.img uboot.2023.04-tld-1.nsa325.environment uboot.2023.04-tld-1.nsa325.boot.scr
A. Preparation
A.1. UART booting
It is strongly recommmended that you try to run kwboot to test this boot image with UART booting before flashing to NAND. This is the rescue path when and if the flashing goes wrong for some reason. See example here. And to download latest ARM kwboot binary for UART booting see here.
A.2. Flashing tools
If you are running an OS (eg. stock FW) that does not provide mtd-utils and uboot-tools (fw_setenv, fw_printenv, flash_erase, nandwrite), you can download the NAND and U-Boot tools binaries here in this thread.
B. Flashing Instruction:
1. Setup fw_env.config
U-Boot envs config should be defined as followed in your /etc/fw_env.config
cat /etc/fw_env.config
# MTD device name Device offset Env. size Flash sector size Number of sectors /dev/mtd0 0xc0000 0x20000 0x20000
If you don't have /etc/fw_env.config file in your system then go ahead and create this file:
echo "/dev/mtd0 0xc0000 0x20000 0x20000" > /etc/fw_env.config
- And your mtd partitions should be:
# cat /proc/mtd
dev: size erasesize name mtd0: 00100000 00020000 "uboot" mtd1: 00080000 00020000 "stock_uboot_env" mtd2: 00080000 00020000 "key_store" mtd3: 00080000 00020000 "info" mtd4: 00a00000 00020000 "etc" mtd5: 00a00000 00020000 "kernel_1" mtd6: 02fc0000 00020000 "rootfs1" mtd7: 00a00000 00020000 "kernel_2" mtd8: 02fc0000 00020000 "rootfs2"
2. Backup mtd0 and envs
Save your current uBoot image and envs image in mtd0, and save your current u-boot envs with fw_printenv.
2.1 Dumping NAND mtd0:
nanddump --noecc --omitoob -l 0x80000 -f mtd0.nsa325 /dev/mtd0 nanddump --noecc --omitoob -f mtd0.nsa325.envs -s 786432 -l 131072 /dev/mtd0If installing from stock u-boot, also save stock envs
nanddump --noecc --omitoob -f mtd0.nsa325.envs.stock /dev/mtd1
2.2. Save envs:
fw_printenv > current_envs.txtFor most stock OS, there is no fw_printenv. So it's OK if this step fails.
Copy these files to a persistent storage.
3. Check for bad blocks
Be sure there is no bad block in the first 1M of your NAND. This is very important, if there is bad block in the first 1M (blocks 0 to 7), don't flash u-boot, because you will almost certainly soft-brick your box.
Example of bad block in mtd0:
dmesg | grep -i 'bad' [ 2.413231] Scanning device for bad blocks [ 2.417731] Bad eraseblock 3 at 0x000000060000
This bad eraseblock 3 is the 4th block which resides within mtd0 first 1M (block 0 to block 7). Please stop at this step and post question in this thread for a workaround.
4. Extract the archive to /tmp
cd /tmp tar xf uboot.2023.04-tld-1.nsa325.bodhi.tar
5. Flash u-boot image to NAND
Be extra careful with the next 2 commands, you should see output that look like below in those steps. If there is error, then do not reboot, post your problem here so we can help.
Erase 4 blocks
flash_erase /dev/mtd0 0 4Expected output:
Erase Total 4 Units Performing Flash Erase of length 131072 at offset 0x60000 done
Write the image
nandwrite /dev/mtd0 /tmp/uboot.2023.04-tld-1.nsa325.kwbExpected output:
Writing data to block 0 at offset 0x0 Writing data to block 1 at offset 0x20000 Writing data to block 2 at offset 0x40000 Writing data to block 3 at offset 0x60000
6. Flash default u-boot envs image
If you are upgrading from 2017.07-tld-1 u-boot, you can skip this step. But some envs will need to be updated before reboot. See Note section below after the installation steps. Especially if your rootfs is SATA, then you must adjust the env described in Note section "C.1.1 SATA boot envs". Or if you are using netconsole then you must adjust the env described in Note section "C.1.2 Netconsole envs".
Be extra careful with the next 2 commands, you should see output that look like below. If there is error, then do not reboot, post your problem here so we can help.
Erase 1 block
flash_erase /dev/mtd0 0xc0000 1Expected output:
Erase Total 1 Units Performing Flash Erase of length 131072 at offset 0xc0000 done
Write the image
nandwrite -s 786432 /dev/mtd0 /tmp/uboot.2023.04-tld-1.nsa325.environment.imgExpected output:
Writing data to block 6 at offset 0xc0000
7. Restore MAC address
Modify the following u-boot variable using fw_setenv:
Restore the MAC address using the saved envs in current_envs.txt. Or find the MAC address on the sticker outside the case. Replace xx:xx:xx:xx:xx:xx with the real values.
fw_setenv ethaddr 'xx:xx:xx:xx:xx:xx'For sanity check, list you envs again
fw_printenv
Don't reboot if there is error while listing U-Boot envs.
8. (Optional) Activate netconsole
Skip this step if you already have serial console connected. Netconsole can be set up anytime later.
Adjust 192.168.0.xxx and 192.168.0.yyy below to the real numbers in your network configuration. 192.168.0.xxx is this pogoplug static IP address, and 192.168.0.yyy is the IP address of the netconsole server where it will monitor the output from this pogoplug. The ipaddr can be any unique address that you want to use. serverip is IP address of the netconsole server, so usually a Linux box in your network.
fw_setenv preboot 'run preboot_nc' fw_setenv ipaddr '192.168.0.xxx' fw_setenv serverip '192.168.0.yyy'
9. Reboot
Upon reboot, in either serial console or netconsole, U-Boot banner should show:
U-Boot 2023.04-tld-1 (...) ZyXEL NSA325 2-Bay Power Media Server
DONE installation.
C. Note
C.1. Envs changes from 2017.07-tld-1 u-to 2023.04-tld-1 u-boot.
As mentioned in Step 6, if you are upgrading from 2017.07-tld-1 u-boot then this is a u-boot drop in replacement (no need to flash new default envs image). However there are changes in envs for 2023.04-tld-1 that need to be retrofitted if you have chosen not flashing the default envs in Step 6.
C.1.1 SATA boot envs
In this new u-boot, the SATA device was changed from "ide" to "sata", and also the command to start it. So if SATA is the boot drive, you must adjust these envs.
fw_setenv devices 'sata usb' fw_setenv init_sata 'sata init' fw_setenv scan_disk 'echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start"; 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' fw_setenv uenv_init_devices 'echo Initializing devices...; setenv init_usb "usb start"; setenv init_sata "sata init"; setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done'
C.1.2 Netconsole envs
Both serial console and netconsole input and output are now muxed to one console.
So in this new u-boot, the stdin/stdout/stderr netconsole was change from "serial" to "serial,nc". Therefore, if netconsole is used, you must adjust the start_netconsole env.
fw_setenv start_netconsole 'setenv ncip $serverip; setenv bootdelay 10; setenv stdin serial,nc; setenv stdout serial,nc; setenv stderr serial,nc; version'
C.2. Distro Boot
C.2.1 (Optional) Booting all distros
In this new u-boot, I've implemented the Distro Boot capability. So any distro (such as Ubuntu, Alpine, Fedora, etc.) can be booted as long as they conform to the Distro Boot standard. However, for the purpose of booting our Debian Kirkwood kernel released here for this box, it is not relevant and should be ignored.
C.2.2 Using boot.scr to recover from damaged or corrupted envs NAND block
Included in the tarball uboot.2023.04-tld-1.nsa325.bodhi.tar is the script file uboot.2023.04-tld-1.nsa325.boot.scr. This is a Distro-Boot-compliant boot script. It can be used to recover from a damaged/corrupted envs NAND block, or if the envs NAND block has never been flashed (same as corrupted).
So for whatever reason, if in serial console, U-Boot reported the CRC error while loading the envs, using the boot.scr will provide a minimalist booting envs and enable booting into Debian. And then the default envs image can be flashed.
- Mount the USB rootfs on another Linux box. Assuming it is mounted at /media/sdb1.
cd /media/sdb1/boot cp -a uboot.2023.04-tld-1.nsa325.boot.scr boot.scr sync
- Unmount and then bring it back to the NSA325. Power up and let it boot automatically. The boot.scr should come into play, and allow booting to Debian.
C.3. uEnv.txt
This capabilty is the same as in previously released u-boot-2017.07-tld-1.
Description TBD.
END of NOTE.