Welcome! Log In Create A New Profile

Advanced

Bricked NSA320S during 2017.07 flash

Posted by zc5 
zc5
Bricked NSA320S during 2017.07 flash
February 24, 2018 12:06PM
Hello,

my power plug stopped working while I was trying to flash Kirkwood on my NSA320S. Now all that is lighting up are the blue power-LED and the yellow/green LED next to it and there is nothing on the serial console. I guess it's bricked. Is there still a chance to get it working again?

Thanks
Re: Bricked NSA320S during 2017.07 flash
February 24, 2018 04:32PM
zc5,

> I guess it's bricked. Is
> there still a chance to get it working again?

Yes. You will need to connect serial console first. Do you have another Linux box and can connect serial console to the NSA320S?

-bodhi
===========================
Forum Wiki
bodhi's corner
zc5
Re: Bricked NSA320S during 2017.07 flash
February 24, 2018 04:52PM
Hi bodhi,

thank you for the fast reply.

The 320S is my only NAS. I have a USB to RS232 converter since my laptop don't have a dedicated serial port.

zc5
Re: Bricked NSA320S during 2017.07 flash
February 24, 2018 06:12PM
zc5,

> The 320S is my only NAS. I have a USB to RS232
> converter since my laptop don't have a dedicated
> serial port.

1. You will need a separate Linux box. So that laptop must be able to run a Linux distro such as Ubuntu, Mint,... If not, you can use a Live Linux DVD/USB disk.


2. USB to RS232 is not appropriate to use. See here for USB TTL serial module adapter:
https://forum.doozan.com/read.php?8,13263,13264#msg-13264

Or you can buy a low cost rPi Zero to use for this purpose (it is easy to connect just the wires to the Pi and the NSA320S).

The NSA320S aready has a serial header. So you can use jumper wires to connect to those header pins. The Cp2102 on eBay that I mentioned in the link, most of them packaged with 3 jumper wires already.

-bodhi
===========================
Forum Wiki
bodhi's corner
zc5
Re: Bricked NSA320S during 2017.07 flash
February 25, 2018 03:59AM
bodhi,

I have a laptop running Linux and a RPi3. I connected TX and RX according to (1) to the pins 8 and 10 on the Pi. For TX and RX i tried the second and the third pin on the 320S, as seen in the second image on (2). According to dmesg ttyAMA0 is connected, but screen /dev/ttyAMA0 does not show any output.

1 https://docs.microsoft.com/en-us/windows/iot-core/learn-about-hardware/pinmappings/pinmappingsrpi
2 http://mud-slide.blogspot.de/2013/12/installing-linux-on-zyxel-nsa-320-part_722.html
Re: Bricked NSA320S during 2017.07 flash
February 25, 2018 04:52AM
zc5,

First some background. The NSA320S is a different box from the NSA320 (in the 2nd link you posted).

I believe the NSA320S serial header is the same as all these other Zyxel NAS boxes (NSA310S, NSA320, NSA310, NSA325, and NAS326). It looks like this:


+----+----+           
          |    |    |
+----+----+----+----+----+
|3.3V| TX | RX |    | GND|
+----+----+----+    +----+


Now, it is not surprising if you did not see any output, regardless of whether the connection is correct. If power went out during flashing u-boot, or a wrong file was flashed to the box mtd0, then u-boot cannot start when you power up (the image was corrupted), hence nothing will come out of the serial console.

To recover from a bad u-boot flashing, we need 1) serial console connection like you already did. 2) The next step is to use kwboot to load the good uboot image using serial console. As I mentioned in the u-boot release thread:

Quote
https://forum.doozan.com/read.php?3,12381

UART Booting: If possible, try to test this boot image with UART booting before flashing to NAND. See davygravy's UART booting using kwboot instruction here in this thread. The latest u-boot image released here should be used for UART booting, if your box is the type that supports it (these do not: Dockstar, Pogo E02, iConnect).

Basically, you would download the latest u-boot for NSA310S/320S:

Quote
https://forum.doozan.com/read.php?3,12381


uboot.2017.07-tld-1.nsa310s.bodhi.tar
md5
4af9c6f16e1705e7a4345e6f7cc01fa7
sha256
724cb6ac5baf2053e63dc44489693c6772264ca326f4bdb2506c81f654ea84dc

And then from the rPi, instead of running picom/minicom/screen, you would run kwboot binary that was downloaded, as I mentioned in the u-boot release thread:

Quote
https://forum.doozan.com/read.php?3,12381
To download ARM kwboot binary for UART booting at Dropbox

kwboot-2016.05.tar
md5:
76977c5a61544a5707dfa17ae832a3ad
sha256:
25ee4fa8a94372d2d398cac4704e9ee3ca87585c29e72e18323209b7f163209d

kwboot (this is an older version)
md5:
0efd011bdb244436e432a8de33e639a1

The command to run kwboot in rPi is:

kwboot  -t -B 115200 /dev/ttyAMA0 -b uboot.2017.07-tld-1.nsa310s.mtd0.kwb -p

Note: from other Linux rootfs the device would be USB0, so the command can also be:

kwboot  -t -B 115200 /dev/ttyUSB0 -b uboot.2017.07-tld-1.nsa310s.mtd0.kwb  -p



When you see u-boot outputs its banner and the rest of the booting activities, you've unbricked your box!

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 2 time(s). Last edit at 02/25/2018 05:00AM by bodhi.
zc5
Re: Bricked NSA320S during 2017.07 flash
February 25, 2018 07:16AM
bodhi,

that was a very easy to follow walkthrough, thank you. I tried it on my RPi first, since my laptop wouldn't run the precompiled kwboot binary. It stopped as soon as the NAS got turned on.

My next attempt was using it from within a docker container and that kind of worked:

./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2017.07-tld-1.nsa310s.mtd0.kwb -p
Sending boot message. Please reboot the target...\
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]
  3 % [......................................................................]
  5 % [......................................................................]
  6 % [......................................................................]
  8 % [......................................................................]
 10 % [......................................................................]
 11 % [......................................................................]
 13 % [......................................................................]
 15 % [......................................................................]
 17 % [......................................................................]
 18 % [......................................................................]
 20 % [......................................................................]
 22 % [......................................................................]
 23 % [......................................................................]
 25 % [......................................................................]
 27 % [......................................................................]
 29 % [......................................................................]
 30 % [......................................................................]
 32 % [......................................................................]
 34 % [......................................................................]
 35 % [......................................................................]
 37 % [......................................................................]
 39 % [......................................................................]
 41 % [......................................................................]
 42 % [......................................................................]
 44 % [......................................................................]
 46 % [......................................................................]
 47 % [......................................................................]
 49 % [......................................................................]
 51 % [......................................................................]
 53 % [......................................................................]
 54 % [......................................................................]
 56 % [......................................................................]
 58 % [......................................................................]
 59 % [......................................................................]
 61 % [......................................................................]
 63 % [......................................................................]
 64 % [......................................................................]
 66 % [......................................................................]
 68 % [......................................................................]
 70 % [......................................................................]
 71 % [......................................................................]
 73 % [......................................................................]
 75 % [......................................................................]
 76 % [......................................................................]
 78 % [......................................................................]
 80 % [......................................................................]
 82 % [......................................................................]
 83 % [......................................................................]
 85 % [......................................................................]
 87 % [......................................................................]
 88 % [......................................................................]
 90 % [......................................................................]
 92 % [......................................................................]
 94 % [......................................................................]
 95 % [......................................................................]
 97 % [......................................................................]
 99 % [....................................]
[Type Ctrl-\ + c to quit]


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 
starting 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

Reset IDE: ide_preinit failed
Unknown command 'mmc' - try 'help'
## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0
loading envs from usb 0 ...
** Bad device usb 0 **

no IDE devices available
Unknown command 'mmc' - try 'help'
running scan_disk ...
Scan device usb
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 ide

Reset IDE: ide_preinit failed
device ide 0:1
** Bad device ide 0 **
device ide 1:1
** Bad device ide 1 **
device ide 2:1
** Bad device ide 2 **
device ide 3:1
** Bad device ide 3 **
Scan device mmc
Unknown command 'mmc' - try 'help'
device mmc 0:1
** Bad device mmc 0 **
device mmc 1:1
** Bad device mmc 1 **
device mmc 2:1
** Bad device mmc 2 **
device mmc 3:1
** Bad device mmc 3 **
loading uImage ...
** Bad device usb 0 **
loading uInitrd ...
** Bad device usb 0 **
loading DTB /boot/dts/kirkwood-pogo_e02.dtb ...
** Bad device usb 0 **
Wrong Image Format for bootm command
Error occured, error code = 112
ERROR: can't get kernel image!
NSA3x0S>

As you see, it tried to boot from kirkwood-pogo_e02.dtb which I don't understand. Maybe I used a wrong image last time?

When trying to boot with a USB stick containing a rootfs (as described in Linux Kernel 4.15.2 Kirkwood package and Debian rootfs) connected it succeeds to enter BusyBox!

I didn't get to see the u-boot bunner, but it booted!
zc5
Re: Bricked NSA320S during 2017.07 flash
February 25, 2018 07:21AM
I meant "When trying to run kwboot while a USB is connected to the NAS".
zc5
Re: Bricked NSA320S during 2017.07 flash
February 25, 2018 10:28AM
Sorry for posting three times in a row (should have created an account). Using kwboot it now runs Debian. I just misspelled the partition label.
zc5
Re: Bricked NSA320S during 2017.07 flash
February 25, 2018 12:35PM
bodhi,

thank you for your great help! After using kwboot to get to Debian, I went through the flash instructions again and this time everything went right. The 320S now boots directly to Debian on the USB drive.

Thank you again!
Re: Bricked NSA320S during 2017.07 flash
February 25, 2018 03:48PM
zc5 Wrote:
-------------------------------------------------------
> bodhi,
>
> thank you for your great help! After using kwboot
> to get to Debian, I went through the flash
> instructions again and this time everything went
> right. The 320S now boots directly to Debian on
> the USB drive.
>
> Thank you again!

Cool! glad you unbricked it so quickly!

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