Welcome! Log In Create A New Profile

Advanced

Help with broken NSA325v2

Posted by jimbob88 
Help with broken NSA325v2
December 24, 2022 06:18AM
Hi there, a total u-boot noob here (have got experience in Linux),

I hope you are all doing well. I am hoping to get some help with my NSA325v2.

I had a NAS which wasn't booting, so I followed the guide on installing the new u-boot firmware, and managed to get a Debian usb to boot and work.

My problem seems to be that there is nothing on the NAND other than u-boot. I can't even flash to UBI!

When I got it, it seems like there is no partition table on the NAND (I am not sure if this is correct or not, it is an assumption). I assume this, because when I tried to follow the OpenWRT installation guide (https://openwrt.org/toh/zyxel/nsa310b). I skipped the step about flashing their u-boot, because I want to keep my u-boot (which I managed to flash by following (https://forum.doozan.com/read.php?3,12381).

So, some details:
- I got a debian USB up and running (the base version from September)
- I have U-boot 2017.07-tld-1 (Sep 05 2017 - 00:42:03 - 0700) installed
- I am currently connected via Serial using an RPI

When I follow the OpenWRT guide, I do the following, but get some undefined ubi error:

NSA325> nand erase.part ubi

NAND erase.part: incorrect device type in UBI

See attached all the debug information I thought might be useful:

NSA325> printenv
arcNumber=2097
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then boo
tm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_a
ddr $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
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-nsa325.dtb
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
fileaddr=2000000
filesize=2fdc2aa
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 $d
tb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /b
oot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /bo
ot/uImage
load_uimage_addr=0x800000
machid=0x831
mainlineLinux=yes
mtddevname=key_store
mtddevnum=2
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x100000(uboot),0x80000(stock_uboot_env),0x80000(ke
y_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00
000(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 di
sknum 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; se
tenv 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";  se
tenv 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 $disknu
m: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_re
ad;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15

Environment size: 3055/131068 bytes

NSA325> version

U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:42:03 -0700)
ZyXEL NSA325 2-Bay Power Media Server
gcc (Debian 6.3.0-18) 6.3.0 20170516
GNU ld (GNU Binutils for Debian) 2.28

NSA325> mtdparts

device nand0 <orion_nand>, # parts = 9
 #: name		size		offset		mask_flags
 0: uboot               0x00100000	0x00000000	0
 1: stock_uboot_env     0x00080000	0x00100000	0
 2: key_store           0x00080000	0x00180000	0
 3: info                0x00080000	0x00200000	0
 4: etc                 0x00a00000	0x00280000	0
 5: kernel_1            0x00a00000	0x00c80000	0
 6: rootfs1             0x02fc0000	0x01680000	0
 7: kernel_2            0x00a00000	0x04640000	0
 8: rootfs2             0x02fc0000	0x05040000	0

active partition: nand0,2 - (key_store) 0x00080000 @ 0x00180000

defaults:
mtdids  : none
mtdparts: none

NSA325> ubi part ubi
incorrect device type in ubi
Partition ubi not found!


If you need anything else, I'll happily provide anything you need.

I hope this is the correct place to write this!
Re: Help with broken NSA325v2
December 24, 2022 04:02PM
jimbob88,

> When I follow the OpenWRT guide, I do the
> following, but get some undefined ubi error

That's the reason. When you are running my u-boot, the u-boot envs are different. The stock NAND partitions contain stock kernel and OS,... so they are not useful at all. When you run Debian on USB, the only thing you need on flash is u-boot (and its envs in partition mtd0). What you saw in mtdparts are the stock FW layout.

NSA325> mtdparts

device nand0 <orion_nand>, # parts = 9
 #: name		size		offset		mask_flags
 0: uboot               0x00100000	0x00000000	0
 1: stock_uboot_env     0x00080000	0x00100000	0
 2: key_store           0x00080000	0x00180000	0
 3: info                0x00080000	0x00200000	0
 4: etc                 0x00a00000	0x00280000	0
 5: kernel_1            0x00a00000	0x00c80000	0
 6: rootfs1             0x02fc0000	0x01680000	0
 7: kernel_2            0x00a00000	0x04640000	0
 8: rootfs2             0x02fc0000	0x05040000	0


From here, it is best that you follow this instruction in the Wiki thread to install OpenWrt:

Quote

Rescue Systems

Rescue System V2 (Original)
MacPlug & SMBPLug
Rescue System Pogo V3
Rescue System V4, using a custom LEDE firmware (BETA)
Rescue System for Pogo E02 using LEDE/OpenWrt (Install with Serial Console)

Rescue System for Pogo V4/Mobile using OpenWrt (Install with NetConsole)

Rescue System using OpenWrt on Kirkwood boxes
Rescue System using OpenWrt on OXNAS (Pogoplug V3 Classic and Pro)

Either of the 2 bolded tutorials are fine to use.

The tutorial "Rescue System for Pogo V4/Mobile using OpenWrt (Install with NetConsole)" is a bit long, but it is also fine to use if you have the Pogo V4.

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



Edited 1 time(s). Last edit at 12/24/2022 04:43PM by bodhi.
Re: Help with broken NSA325v2
December 25, 2022 07:15AM
Thank you so very much!

You are an absolute legend, you really made my Christmas!!!

Thanks again for taking the time to help me out.

Please keep up with this amazing project,

It has saved me so much hassle!

~ James
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: