Welcome! Log In Create A New Profile

Advanced

Debian on NSA325 V1/V2

Posted by Buttzy10169 
Debian on NSA325 V1/V2
December 08, 2013 03:47PM
I just thaught I would update the main post in this thread with the details so People could find them easier.

With Bodhi's latest rootfs from this thread:

http://forum.doozan.com/read.php?2,12096

prepare a usb or hdd with 2 partitions the first ext2, the second whatever you want your rootfs as (i use ext4 at the moment)

This assumes an ext2 partition on the disk for boot no directories files in the root
of the ext2 partition and the root partition is labeled rootfs.

download the sata-debian-uboot.tar.gz from this post
extract it to a fat 32 formated usb

in uboot type resetenv
then reset the device

after reboot type saveenv (in uboot)
reset again
let the device boot normal

after it finishes and reboot uboot variables are set for sata boot of debian


The second works for usb:

download the usb-debian-uboot.tar.gz from this post
extract it to a fat 32 formated usb

in uboot type resetenv
then reset the device

after reboot type saveenv (in uboot)
reset again
let the device boot normal

after it finishes and reboot uboot variables are set for usb boot of debian.

It only changes uboot variables to allow booting of debian on nsa325 v1 & v2.
This also works if you want your boot files on usb and your rootfs on a different drive.
If you want to name your rootfs different edit the usb_key_func.sh.2 script in the downloaded tar file.

To turn the sys led green at boot add this to the /etc/rc.local file:
if [ -d /sys/class/leds/nsa325:green:sys ]; then
   echo default-on  > /sys/class/leds/nsa325:green:sys/trigger
   echo none        > /sys/class/leds/nsa325:orange:sys/trigger
fi

These instructions let the power button shut the nsa325 down:
Install debian package "acpid"

# Setup files

1. In /etc/acpi/events/button_power put

     event=button/power
     action=/bin/sh /etc/acpi/shutdown.sh

2. In /etc/acpi/shutdown.sh put

     #!/bin/sh
     echo timer > /sys/class/leds/nsa325:green:sys
     echo none > /sys/class/leds/nsa325:orange:sys
     /sbin/shutdown -h now "Power button pressed"

3. Reload acpid configuration

     /etc/init.d/acpid reload


And the following python script lets you do something with the copy button:
from evdev import InputDevice
from select import select
from subprocess import call

dev = InputDevice('/dev/input/event0')

while True:
        r,w,x = select([dev], [], [])
        for event in dev.read():
                if event.code == 133:
                        call(["shutdown", "-r", "now", "\"this is a test\""])

If anyone know's a better or more responsive way to use the copy button let me know as to use the buttons at the moment i have to keep them pressed for a second or 2

===================
Moderator: changed title to make it easier to seach for



Edited 3 time(s). Last edit at 09/19/2019 06:34PM by bodhi.
Attachments:
open | download - sata-debian-uboot.tar.gz (1.2 KB)
open | download - usb-debian-uboot.tar.gz (1.2 KB)
Re: NSA 325 V2 Debian Possible?
December 08, 2013 04:26PM
It's newly announced, and at least to my knowledge, should be similar to the 325, but I can't say it will work until tested/proven
Re: NSA 325 V2 Debian Possible?
December 08, 2013 04:39PM
I read somewhere on the arch linux arm forum after i posted here that the hardware is the exact same only difference is the box looks different and the fan is quieter.

oops it was nas central forum:

http://forum.nas-central.org/viewtopic.php?f=249&t=11873



Edited 1 time(s). Last edit at 12/08/2013 04:41PM by Buttzy10169.
Re: NSA 325 V2 Debian Possible?
December 09, 2013 12:58PM
If the board is identical, other than casing and fan, then sure, the existing 325 should work. I can't confirm that is the case however.
shv
Re: NSA 325 V2 Debian Possible?
December 10, 2013 05:12AM
The board is identical for the previous NSA 325 model and the v2 model (see: http://www.computerbase.de/artikel/netzwerk/2013/zyxel-nsa325-v2-im-test/3/).



Edited 2 time(s). Last edit at 12/10/2013 05:13AM by shv.
Re: NSA 325 V2 Debian Possible?
December 10, 2013 09:30AM
I took the plunge and ordered the V2 NSA 325 so will see how that goes when it arrives probably next week sometime.
Re: NSA 325 V2 Debian Possible?
December 13, 2013 01:23PM
Got ms nsa325 v2 today but need a rootfs with kernel that supports the nsa325 v1 as my system is 64bit so i cannot seem to chroot into bodhi's to install the latest kernel.

oh also does anybody know where to get the uboot settings for the 325 for debian? to maker sure the ones im useing arent / don't cause any problems?

update2:

I have arch linux up and booting with the default kernel.

But i would prefer to run debian if anyone has any ideas on what i need to change from arch linux's settings.



Edited 2 time(s). Last edit at 12/13/2013 03:24PM by Buttzy10169.
Re: NSA 325 V2 Debian Possible?
December 16, 2013 04:21PM
You would need to add a loading of the uInitrd
Re: NSA 325 V2 Debian Possible?
December 16, 2013 04:53PM
Thanks WarheadsSE iv already figured it all out and have debian running. I edited the arch script and added the correct uboot settings.

edit1:

I have 2 versions of the arch script 1 for booting from first sata:
This assumes an ext2 partition on the disk for boot no directories files in the root
of the partition and the root partition is labeled rootfs
download the sata-debian-uboot.tar.gz from this post
extract it to a fat 32 formated usb

in uboot type resetenv
then reset the device

after reboot type saveenv (in uboot)
reset again
let the device boot normal

after it finishes and reboot uboot variables are set for sata boot of debian

The second hopefully works for usb:
download the usb-debian-uboot.tar.gz from this post
extract it to a fat 32 formated usb

in uboot type resetenv
then reset the device

after reboot type saveenv (in uboot)
reset again
let the device boot normal

after it finishes and reboot uboot variables are set for usb boot of debian.

It only changes uboot variables to allow booting of debian on nsa325 v1 & v2.

IT DOES NOT FLASH ANYTHING!!

edit2:
just tested on my own nsa325 v2 usb booting is persistant after reboot.

edit3:
Files moved to first post



Edited 4 time(s). Last edit at 12/17/2013 06:13AM by Buttzy10169.
Re: NSA 325 V2 Debian Possible?
December 16, 2013 08:54PM
Good works Buttzy!

Please keep NSA325 discussion in this thread.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA 325 V2 Debian Possible?
December 17, 2013 12:31AM
Buttzy10169 Wrote:
-------------------------------------------------------
> Thanks WarheadsSE iv already figured it all out
> and have debian running. I edited the arch script
> and added the correct uboot settings.
>
> edit1:
>
> I have 2 versions of the arch script 1 for booting
> from first sata:
> This assumes an ext2 partition on the disk for
> boot no directories files in the root
> of the partition and the root partition is labeled
> rootfs
>
> download the sata-debian-uboot.tar.gz from this
> post
> extract it to a fat 32 formated usb
> 
> in uboot type resetenv
> then reset the device
> 
> after reboot type saveenv (in uboot)
> reset again
> let the device boot normal
> 
> after it finishes and reboot uboot variables are
> set for sata boot of debian
>
>
> The second hopefully works for usb:
>
> download the usb-debian-uboot.tar.gz from this
> post
> extract it to a fat 32 formated usb
> 
> in uboot type resetenv
> then reset the device
> 
> after reboot type saveenv (in uboot)
> reset again
> let the device boot normal
> 
> after it finishes and reboot uboot variables are
> set for usb boot of debian.
>
>
> It only changes uboot variables to allow booting
> of debian on nsa325 v1 & v2.
>
> IT DOES NOT FLASH ANYTHING!!
>
> edit2:
> just tested on my own nsa325 v2 usb booting is
> persistant after reboot.

NICE! Thanks for all your help in getting it up and going. I now have deb7 rootfs and boot on my usb flash drive and created a raid1 using the left and right drives. where most of my data will live. Now time to organize everything again.

Thanks everyone.

~SOL
Re: NSA 325 V2 Debian Possible?
December 17, 2013 02:23AM
To answer SoL question:

Quote

Should I expect drive and panel leds to work? on the power button and led just below that are on. power = blue and system status or led just below power is orage and usb is green when I have a usb device plugged in.

See LED controls in /etc/rc.local, and /etc/rc0.d/K07halt.

For NSAxx LEDs control, see posts by pbg4 in this thread:
http://forum.doozan.com/read.php?2,12096,13642#msg-13642

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA 325 V2 Debian Possible?
December 17, 2013 12:51PM
Buttzy,

Regarding the uBoot dump (http://forum.doozan.com/read.php?2,12096,14462#msg-14462). The dump is more than what uBoot image is (should be only 512K). If Marvell padded it then it is 512K, if not then we don't really know the exact size.

Have you tried to boot UART with Davy's uBoot image?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA 325 V2 Debian Possible?
December 17, 2013 01:41PM
I gave a few uboots a try Bodhi i tried davy's and got:


sudo ./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.NAND-NSA320-IDEfixedv4-scripted.kwb -p

Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [.....................................++...............................]
  1 % [.....................................................................+xmodem: Bad message

before it stopped

and i tried your goflex image and got:


sudo ./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2013.10.goflexnet.mtd0.kwb -p

Sending boot message. Please reboot the target.../
Sending boot image...
  0 % [......................................................................]
  1 % [............................................................+.........]
  3 % [......................................................................]
  5 % [....................................+.................................]
  6 % [........+.............................................................]
  8 % [......................................................................]
 10 % [......................................................................]
 11 % [...............................................+......................]
 13 % [.................................+....................................]
 15 % [.+..............................+.....................................]
 16 % [.....+xmodem: Bad message

before it stopped.

edit1:

I just managed to get this far with davys image:

sudo ./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.NAND-NSA320-IDEfixedv4-scripted.kwb -p

Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [+...........................+................................+........]
  1 % [.......................+................................+.............]
  3 % [..................+................................+..................]
  4 % [..............+...............................+.......................]
  6 % [........+.................................+...........................]
  8 % [....+...................................+.............................]
  9 % [.+.............................+.................................+....]
 11 % [...........................+................................+.........]
 13 % [......................+.................................+.............]
 14 % [...................+...............................+..................]
 16 % [................+.............................+.......................]
 18 % [.........+...............................+............................]
 19 % [.....+.....................+xmodem: Protocol error



Edited 1 time(s). Last edit at 12/17/2013 01:49PM by Buttzy10169.
Re: NSA 325 V2 Debian Possible?
December 17, 2013 11:59PM
Buttzy,

Can you pm me the mtd0 dump, or upload it somewhere? I'd like to take a look at the binary. Thnx.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA 325 V2 Debian Possible?
December 18, 2013 03:08AM
Thanks Bodhi.

This is the uboot I dumped from my nsa325.
Attachments:
open | download - uboot.mtd0.bak.tar.gz (206.5 KB)
Re: NSA 325 V2 Debian Possible?
December 19, 2013 01:01AM
Thanks Buttzy,

I'm looking at it. I have to look for my old notes to find the format!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA 325 V2 Debian Possible?
December 19, 2013 02:59AM
Buttzy,

The numbers in the header don't make sense to me! So let's just trial and error. Dump only 4 blocks (512K).

nanddump -nof uboot.mtd0.bak -l 0x80000 /dev/mtd0

and (I doubt that the below will work, though)
nanddump -nf uboot.mtd0.bak -l 0x80000 /dev/mtd0


See which one get the UART booting working :) If neither works then we're back to the drawing board. I'll think of something else.

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



Edited 1 time(s). Last edit at 12/19/2013 03:03AM by bodhi.
Re: NSA 325 V2 Debian Is Possible!
December 19, 2013 05:14AM
with the second command the dumped uboot got this far:

sudo ./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.mtd0.bak -p

Sending boot message. Please reboot the target...-
Sending boot image...
  0 % [....+............+.............................................+......]
  1 % [.............................+................................+.......]
  3 % [.........................+................+........++.................]
  4 % [...+.................+.......+................................++......]
  6 % [....................+.............+...................+.......++......]
  8 % [.........................+................................+...........]
  9 % [....................+................................+................]
 11 % [................+.........+xmodem: Protocol error
and produces a 512kb uboot image.

the first command produced a 528kb ish image and got this far:

sudo ./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.mtd0.bak -p

Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [......................................................................]
  1 % [...................+xmodem: Bad message

I attached the result of printenv in uboot. Incase that helps.



Edited 1 time(s). Last edit at 12/19/2013 05:18AM by Buttzy10169.
Attachments:
open | download - nsa325 env (2.4 KB)
Re: NSA 325 V2 Debian Is Possible!
December 20, 2013 03:39AM
Buttzy,

I think the 2nd dump command is the right one (one that produces exact 512 KB)
nanddump -nf uboot.mtd0.bak -l 0x80000 /dev/mtd0

The correct sequence is

- execute kwboot command on the host (with option -p). It will start spining the / character clockwise direction.
- reboot the NSA25. You should see the / character starts spinning in counter clockwise direction when it tries to handshake. Wait a few seconds to see if the handshake works, if not then press control-C to abort. Up arrow to recall command and execute it again.
- whenever you see the error (bad modem message or protocol error), up arrow to recall the command and run it again. Repeat this as many times as you can (perhaps 20, 30 times).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA 325 V2 Debian Is Possible!
December 20, 2013 10:51AM
I gave it a try like you sujested. But at the most it gets to is about 23%.

Then any try after that barely gets started and then a few tries later the device just boots normaly.
Re: NSA 325 V2 Debian Is Possible!
January 02, 2014 03:28PM
Buttzy10169 Wrote:
[...]
> Install debian package "acpid"
[...]
> And the following python script lets you do something with the copy button:
[...]
> If anyone know's a better or more responsive way
> to use the copy button let me know as to use the
> buttons at the moment i have to keep them pressed
> for a second or 2

Hi,
You may try the "esekeyd" package, using the "evtest" package to capture the supported events.
See: https://github.com/davidedg/NAS-DNS325-mod/blob/master/rootfs-initramfs/rootfs-nand.txt#L268

Also, I have one question: is the serial on the NSA3252 easily accessible?
Also, is it possible to modify its u-boot environment so that if the hdd is present it will load debian, otherwise it will load the original firmware on flash? It's for a friend: I want to show him the power of a custom made NAS, but let him the ability to go back by just removing the hdd.

Bye!

--
DavideDG http://davidedg.github.io/NAS-DNS325-mod/
Re: NSA 325 V2 Debian Is Possible!
January 02, 2014 04:31PM
I think I seen someone before who had some kind of if statement in uboot but you would have to check on that I forget where I seen it was when I first started with goflex net.

As for the serial you will have to disassemble the nas to get at it. I made a small hole at the front on mine and installed a 3.5 mm jack plug attached to the serial for easy access to it. Its on the back of the board so you have to remove it from the case to get to it.
Re: NSA 325 V2 Debian Is Possible!
January 03, 2014 06:14AM
Buttzy10169 Wrote:
-------------------------------------------------------
> I think I seen someone before who had some kind of
> if statement in uboot but you would have to check
> on that I forget where I seen it was when I first
> started with goflex net.

Oh no problem with that, I just mean: is it possible with its stock u-boot or I should compile a new one?

> As for the serial you will have to disassemble the
> nas to get at it. I made a small hole at the front
> on mine and installed a 3.5 mm jack plug attached
> to the serial for easy access to it. Its on the
> back of the board so you have to remove it from
> the case to get to it.

Does it need soldering or the board already has pins ?

Thanks! :D
Re: NSA 325 V2 Debian Is Possible!
January 03, 2014 06:18AM
No no soldering on mine anyway it already had pins.

And for uboot its risky compileing and flashing a new one unless you can get uart booting to work or have a jtag. I think its possible with the default uboot but I'm unsure of how an if is written in uboot.
Re: NSA 325 V2 Debian Is Possible!
January 03, 2014 06:39AM
The stock uBoot does not have advance scripting capability, so I don't think "if" statement would work, IIRC what WarheadsSE said.

However, a limited uBoot envs scripting capability would be able to work for this purpose. If you set it up to look for /boot/uImage on HDD first, and it fails, it will execute the next env to look for /boot/uImage on the USB, and then if it fails, it will execute the next one t look for uImage on NAND.

For example:
bootcmd=run hdd_bootcmd; run usb_bootcmd; run stock_bootcmd
hdd_bootcmd=setenv ide1 0:1; run make_hdd_bootargs; run hdd_boot
usb_bootcmd=setenv usb1 0:1; run make_usb_bootargs; run usb_boot
stock_bootcmd=setenv ????; run make_nand_bootargs; run nand_boot

Replace ??? above with correct nand device. And so on… define the rest of the other uBoot envs.

Just an idea. I'm sure Buttzy can script it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA 325 V2 Debian Is Possible!
January 03, 2014 10:30AM
@Buttzy: is the serial a TTL 3.3V one?

@Bodhi, that's clear, and I admit I kinda already knew this, but ignorantly thought it was available only in custom compiled u-boot - thank you for reminding me the obvious :D
So it seems I have a viable option now.
I saw your signature post (latest uboot builds): are you an u-boot dev or, simpler, do you know if latest u-boots (from official site) come with support for GPT? Last time (it was 6 or 7 months ago), I had to create a hybrid MBR :(

Thanks!

--
DavideDG
My NAS userspace configs
My Zyxel NSA325 mod
My D-Link DNS325 mod
My Lacie NS2MAX mod
Re: NSA 325 V2 Debian Is Possible!
January 03, 2014 11:07AM
davidedg,

Yes. The 2013.10 uBoot builds for GoFlex Home, GoFlex Net and Pogo E02, that I've uploaded, support GPT booting and other latest features (the official uBoot does provide GPT, I only needed to turn it on).

But we don't have the patch for NSAxxx so I can't build one. I hope eventually we will. If the NSA325 V2 ever available in US then I hope to get my hand on one and build it. There is a basic patch for NSA320 on Peter Schildmann GIT hub.

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



Edited 1 time(s). Last edit at 01/03/2014 11:11AM by bodhi.
Re: NSA 325 V2 Debian Is Possible!
January 03, 2014 11:47AM
Yeah it is a 3.3V TTL as far as I know.
Re: NSA 325 V2 Debian Is Possible!
January 03, 2014 04:41PM
Buttzy10169 Wrote:
-------------------------------------------------------
> No no soldering on mine anyway it already had
> pins.
>
> And for uboot its risky compileing and flashing a
> new one unless you can get uart booting to work or
> have a jtag. I think its possible with the default
> uboot but I'm unsure of how an if is written in
> uboot.

Can you advice me a starting point to learn using jtag?
Ty again !

--
DavideDG
My NAS userspace configs
My Zyxel NSA325 mod
My D-Link DNS325 mod
My Lacie NS2MAX mod
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: