Welcome! Log In Create A New Profile

Advanced

Debian on Zyxel NAS326

Posted by Kirsch 
Re: Zyxel NAS326 - Debian / Boot from USB?
February 19, 2017 03:45PM
nano326,

> If you set "rtcwake -60 -m off", the system will s
> huwdown completely and automatically wake up again
> after 60 seconds.

Cool!

> Thanks. I was looking for the "heartbeat" trigger.
> However, now I have to find out how to automatical
> ly switch the LED to heartbeat when it is spun dow
> n and vice versa.

As you probably have found, heartbeat is controlled the same way as default-on, none, .... and the rest of the triggers.

So in the rootfs I have these turned on after the system booted:
if [ -d /sys/class/leds/nsa326:white:sys ]; then
   echo default-on  > /sys/class/leds/nsa326:white:sys/trigger
   echo none        > /sys/class/leds/nsa326:red:sys/trigger
   echo ide-disk1  > /sys/class/leds/nsa326:white:sata1/trigger
   echo ide-disk2  > /sys/class/leds/nsa326:white:sata2/trigger
   echo usb-host > /sys/class/leds/nsa326:white:usb/trigger
fi

To turn on heartbeat
echo heartbeat  > /sys/class/leds/nsa326:white:sys/trigger

To cause the heartbeat to be executed during boot and shutdown, place the above command in /etc/default/rcS. However, you will need to play with this a bit and don't turn it on if it is already on (because the kernel boot and shutdown processes are running concurrently).

> Do you know how to enable wake-on-lan?
> ethtool does not seem to support this on the HW.

We don't have it yet. ATM, the kernel supports this ethernet chip, but not fully. It works fine, but need more development in the DTS and driver code to enable WOL.

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



Edited 2 time(s). Last edit at 02/19/2017 03:47PM by bodhi.
nano326
Re: Zyxel NAS326 - Debian / Boot from USB?
February 23, 2017 04:40AM
bodhi Wrote:
-------------------------------------------------------
> nano326,

> > Do you know how to enable wake-on-lan?
> > ethtool does not seem to support this on the HW.
>
> We don't have it yet. ATM, the kernel supports th
> is ethernet chip, but not fully. It works fine, bu
> t need more development in the DTS and driver code
> to enable WOL.

I have found this recent patch:
https://lkml.org/lkml/2017/2/6/40

[PATCH v5 net-next] net: mvneta: implement .set_wol and .get_wol

Quote: "The mvneta itself does not support WOL, but the PHY might.
So pass the calls to the PHY."
Re: Zyxel NAS326 - Debian / Boot from USB?
February 23, 2017 05:08AM
nano326,

Good find :) Yes, this ethernet PHY does support WOL. Something like this is very likely be the missing info. The Marvell ethernet driver has these 2 WOL routines for each type of chip.

I'll try this in kernel 4.10.

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



Edited 1 time(s). Last edit at 02/23/2017 05:10AM by bodhi.
Re: Zyxel NAS326 - Debian / Boot from USB?
February 24, 2017 04:05PM
> I have found this recent patch:
> https://lkml.org/lkml/2017/2/6/40
>
> [PATCH v5 net-next] net: mvneta: implement .set_wo
> l and .get_wol
>
> Quote: "The mvneta itself does not support WOL, bu
> t the PHY might.
> So pass the calls to the PHY."

This is only part of the solution, I think we'll need to do more in the DTS to activate WOL.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 - Debian / Boot from USB?
February 26, 2017 12:29AM
Could anybody boot to stock and check if WOL working in stock OS? mine does not.

I got everything required for WOL implemented in the new kernel 4.10. And ethtool shows the NIC has WOL supported and turned on.

ethtool eth0
Settings for eth0:
	Supported ports: [ TP MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	                                     1000baseT/Full 
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: No
	Speed: 1000Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 1
	Transceiver: internal
	Auto-negotiation: on
	Supports Wake-on: g
	Wake-on: g
	Link detected: yes

The problem is power-off GPIO 20 in this box kills all the power completely, i.e. including ethernet! So it does not matter if we set the netdown=no in /etc/init.d/halt, ethernet PHY was shutdown anyway.

WOL won't work when ethernet is down completely (it should be in a low power state waiting for the magic packet).

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



Edited 1 time(s). Last edit at 02/26/2017 03:18AM by bodhi.
Re: Zyxel NAS326 - Debian / Boot from USB?
February 28, 2017 09:38AM
Hi,
I am running latest stock OS V5.20(AAZF.1). WOL works, tho sometimes I have to send the wakeup command a few times.
BUT in older firmware versions there have been massive problems with WOL, like not waking up at all or after wakeup link capped to 100 MBit/s maximum.
If you need more info just let me know.
Re: Zyxel NAS326 - Debian / Boot from USB?
February 28, 2017 03:37PM
sebr Wrote:

> I am running latest stock OS V5.20(AAZF.1). WOL wo
> rks, tho sometimes I have to send the wakeup comma
> nd a few times.

Thanks sebr! good to know. I think there is perhaps a GPIO setting sequence that we might have not been aware of. Probably a handler needed to be registered with the kernel to set that.

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



Edited 1 time(s). Last edit at 03/01/2017 12:27AM by bodhi.
Re: Zyxel NAS326 - Debian / Boot from USB?
March 01, 2017 03:48AM
Thanks for the great work, very happy using Debian on my NAS326.
I'm booting from USB stick plugged in the front USB port (2.0). Whenever I plug it into the back USB ports, it will boot into failsafe.
Should I change some boot environments?
Re: Zyxel NAS326 - Debian / Boot from USB?
March 01, 2017 03:58AM
nielsek,

> Thanks for the great work, very happy using Debian
> on my NAS326.

Glad you got it working! Could you post your output of

uname -a

> I'm booting from USB stick plugged in the front US
> B port (2.0). Whenever I plug it into the back US
> B ports, it will boot into failsafe.
> Should I change some boot environments?

It will not work with the 2 USB 3.0 ports in the back. Stock u-boot does not support USB 3.0. Even the mainline u-boot has only begin to have some support for booting with USB 3.0. This might be possible in the future, not the near future.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 - Debian / Boot from USB?
March 01, 2017 10:49AM
bodhi Wrote:
-------------------------------------------------------
> Glad you got it working! Could you post your outpu
> t of
>
>
> uname -a
>
Linux nas.workgroup 4.9.0-mvebu-tld-12 #2 SMP PREEMPT Wed Feb 1 02:31:29 PST 2017 armv7l GNU/Linux
Thanks for clearing up the USB 3.0 support in uboot.
What about booting from SATA disk?
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
March 01, 2017 01:53PM
nielsek Wrote:

> What about booting from SATA disk?

That's what I'm doing:

bootargs=console=ttyS0,115200 root=/dev/sda2 init=/usr/lib/systemd/systemd
bootcmd=echo Booting Gentoo from sda1; setenv fdt_skip_update yes; \
    mw.l f1018100 20420000; mw.l f1018140 003ca800; scsi init; \
    ext2load scsi 0:1 0x02000000 /zImage_dtb; bootz 0x02000000

Additionally you have to do the hack described a page before in order to boot from kernel 1 at address 0x00000000.

I strongly advice you to create a separate boot partition. I tried before to boot directly from the root partition with the kernel located in a /boot/ folder. But for some reason, uboot wasn't able to enter any folders.

Uboot can boot from ext4 and ext2. If using ext4 you have to use ext4load of course. sda is the left slot in the NSA326. Before booting from harddisk you have to enable and to init the sata controller (the mw-stuff and scsi_init, described some pages before). scsi 0:1 means sda1.
Re: Zyxel NAS326 - Debian / Boot from USB?
March 01, 2017 03:57PM
musv & nielsek,

You don't need to create 2 partitions. If you boot Debian (with the uInitrd), with the envs I posted in the release thread, you should be able to boot 1 partition without problem.

Repeat it here:

setenv curr_bootfrom 1
setenv next_bootfrom 1
setenv load_dtb_addr 0x1000000
setenv load_initrd_addr 0x2900000
setenv load_image_addr 0x02000000
setenv usb_init 'mw.l f1018100 20420000; mw.l f1018140 003E8800; sleep 3; usb start'
setenv set_bootargs_stock 'setenv bootargs "console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2"'
setenv bootcmd_stock_1 'run set_bootargs_stock; echo Booting from NAND kernel 1 ...; nand read 0x2000000 0x00E00000 0xF00000 && bootz 0x2000000'
setenv bootcmd_stock_2 'run set_bootargs_stock; echo Booting from NAND kernel 2 ...; nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000'
setenv usb_set_bootargs 'setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial"'
setenv usb_bootcmd 'echo Booting from USB ...; setenv fdt_skip_update yes; run usb_init; ext2load usb 0:1 $load_image_addr /boot/zImage; ext2load usb 0:1 $load_dtb_addr /boot/dts/armada-380-zyxel-nas326.dtb; ext2load usb 0:1 $load_initrd_addr /boot/uInitrd; run usb_set_bootargs; bootz $load_image_addr $load_initrd_addr $load_dtb_addr'
setenv bootcmd_custom 'if run usb_bootcmd; then; else if run bootcmd_stock_1; then; else run bootcmd_stock_2; reset; fi; fi'
setenv kernel_addr_1 '0x00000000; run bootcmd_custom; '
saveenv

Adapt musv's envs to the above envs. If you found there is problem booting SATA, please post the boot log. We should be able to figure out what in the above env should be adjusted.

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



Edited 2 time(s). Last edit at 03/01/2017 04:16PM by bodhi.
Re: Zyxel NAS326 - Debian / Boot from USB?
March 01, 2017 04:18PM
@musv,

Are you booting without uInitrd? I recalled you are running Gentoo?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
March 02, 2017 11:28AM
Yes, I have the initrd deactivated in the kernel and compiled every stuff I need to boot directly into the kernel. As written above I just boot zImage_dtb.

But referring to the boot problem with directories. I don't remember exactly. But I ran into problems booting the kernel from a sata harddrive partition formatted with ext4 and the kernel located in a subdirectory. Uboot simply didn't find the kernel image. When I put the image into the root folder of this partition, Uboot loaded the image without any problems.

So it could be also related to ext4. Maybe it works with directories and ext2. On Gentoo separate boot partitions are used for traditional reasons. So it doesn't matter to me having this small extra partition.
Re: Zyxel NAS326 - Debian / Boot from USB?
March 02, 2017 02:49PM
> So it could be also related to ext4. Maybe it work
> s with directories and ext2. On Gentoo separate bo
> ot partitions are used for traditional reasons. So
> it doesn't matter to me having this small extra pa
> rtition.

I see! agree, it could be ext4.

When I have time, I'll work on scripting the envs to be more robust. As of right now, the envs are set up in a basic way, just to make it work.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 - Debian / Boot from USB?
March 02, 2017 07:06PM
Quote
nielsek
I'm booting from USB stick plugged in the front USB port (2.0). Whenever I plug it into the back USB ports, it will boot into failsafe.

As mentioned above, and I can confirm that, only front USB 2.0 port is visible from U-boot. So if you keep your kernel and initrd on USB stick - you can only boot from the front 2.0. I mean kernel booting. System rootfs can be anywhere - attached into rear usb 3.0 or on a hard-drive.

But, there are always work-arounds. Personally I flashed my kernel + initrd + dtb into NAS326 NAND partition (kernel1, /dev/mtd3) and U-boot just boots from there. USB drive with Ubuntu rootfs sits on rear USB 3.0 port - after kernel is booted, rootfs mounts with no probs. For more info see README's in my custom 4.9.5 kernel archive. They're probably not as good as bodhi's debian install guide :) So think twice before re-flashing NAND, please!

Regarding WOL. I fgrep-ed stock 3.10.39 kernel source (V5.11 + V5.20) - they define CONFIG_MV_ETH_PNC_WOL=y inside defconfig/STG328_Kernel.config. This definition is used heavily in drivers/net/ethernet/mvebu_net/neta/net_dev/mv_netdev.c. And, yep, they use "marvell,neta" ethernet drivers.

Anyone interested - see NAS326 firmware V5.20 520AAZF0C0 source code (direct link, not ZyXEL OSS form).

Our custom 4.9.x kernels use "marvell,armada-370-neta" drivers (because "marvell,neta" is not mainlined). So, there are probably things to port from zyxel source code to current 4.9.x to make WOL work. Or may be not if we're lucky :) Cheers!
Re: Zyxel NAS326 - Debian / Boot from USB?
March 03, 2017 05:49PM
rr4m

> Our custom 4.9.x kernels use "marvell,armada-37
> 0-neta"
drivers (because "marvell,neta" is not
> mainlined).

This stock driver will not be mainline, IMO. The appropriate way to implement the driver is already in the mainline mvneta (all Armada chips use this same driver). The ethernet chip we have here in the NAS326 is 88E1512, which is compatible with 88E1510, so everything has been already implemented except WOL.


So far what I had implemented in my working patch (using info from nano326's found link above, and the modified DTS) did set the WOL status to the card correctly.

I suspect the missing link right now is that somehow that WOL status did not get to the main PHY driver so it shutdown the PHY when power down. I'm tracking this down with some debug printk.

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



Edited 1 time(s). Last edit at 03/03/2017 05:51PM by bodhi.
Re: Zyxel NAS326 - Debian / Boot from USB?
March 04, 2017 01:28PM
https://picload.org/image/rloglgpi/nas326_layout.png

www.marvell.com%2Ftransceivers%2Fassets%2FAlaska_88E1512-001_product_brief.pdf

Sure that WoL is natively supported?
Re: Zyxel NAS326 - Debian / Boot from USB?
March 04, 2017 03:44PM
> Sure that WoL is natively supported?

I think so. Do you have info that say it might not?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 - Debian / Boot from USB?
March 04, 2017 09:18PM
Edda Wrote:
-------------------------------------------------------
> https://picload.org/image/rloglgpi/nas326_layout.p
> ng
>
> www.marvell.com%2Ftransceivers%2Fassets%2FAlaska_8
> 8E1512-001_product_brief.pdf
>
> Sure that WoL is natively supported?

By the way, it is a very nice pic of the board that you took :) Thanks!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 - Debian / Boot from USB?
March 05, 2017 07:01AM
bodhi Wrote:
-------------------------------------------------------

> Thanks sebr! good to know. I think there is perhap
> s a GPIO setting sequence that we might have not b
> een aware of. Probably a handler needed to be regi
> stered with the kernel to set that.


BTW on stock F/W ethtool egiga0 does not give any info at all about WoL support or status. I wonder...
Re: Zyxel NAS326 - Debian / Boot from USB?
March 05, 2017 07:11AM
Feel free to use my pic :) it's my digital magnifier for chipset identification. :D

No, i have no info about that WoL feature. I just compared the attached product briefs. Key feature of 88e1510 is

Quote
• Wake on LAN (WoL) • Provides programmable lower power (S5) event/pattern and link change detection

and I wonder that this is missing in 88e1512 brief.
So I started to ask dumb questions ;)
Attachments:
open | download - Marvell_Alaska_88E1510_18-002_product_brief.pdf (147.8 KB)
open | download - Alaska_88E1512-001_product_brief.pdf (181.7 KB)
Re: Zyxel NAS326 - Debian / Boot from USB?
March 05, 2017 03:19PM
Edda,

That make me wonder, too! why they did not advertise the feature.

Currently, the real problem is I can't keep the ethernet powered when using GPIO 20 for power off (it cut off all power). Once we can solve that, then we will know for sure if it supports WOL.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 - Debian / Boot from USB?
March 05, 2017 06:20PM
Eda,

I'm now quite positive that this Alaska 88E1512 chip supports WOL natively. I can't say with 100% certainty until we have set it up correctly, though.

Update:

I think I might need more settings in the DTS.

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



Edited 1 time(s). Last edit at 03/05/2017 06:26PM by bodhi.
Re: Zyxel NAS326 - Debian / Boot from USB?
March 06, 2017 04:44AM
sebr,

>
> BTW on stock F/W ethtool egiga0 does not give any
> info at all about WoL support or status. I wonder.
> ..

I think (hope) that was because stock kernel is a little bit too old. They did not have a full DTS (it is very basic).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 - Debian / Boot from USB?
March 10, 2017 04:25AM
Hi musv,

Do you see the same error message in your bootlog?

Booting from SATA ...
AHCI init for unit0
Target spinup took 0 ms.
SATA link 1 timeout.

Error: SCSI Controller(s) 1B4B:9215 1B4B:9235 not found
scanning bus for devices...
  Device 0: (0:0) Vendor: ATA Prod.: ST9250320AS Rev: BS04
            Type: Hard Disk
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
Found 1 device(s).

It does not affect the SATA booting, but I want to make sure we see the same warning.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 - Debian / Boot from USB?
March 11, 2017 05:17PM
Hey guys,

Could somebody answer this: what is the ethernet LED look like while the system is running? amber, green, flashing,...

- Running with stock
- Running with linux-4.9.0-mvebu-tld-12

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
musv
Re: Zyxel NAS326 - Debian / Boot from USB?
March 12, 2017 08:53AM
bodhi Wrote:
-------------------------------------------------------
> Hi musv,
>
> Do you see the same error message in your bootlog?
>
>
Error: SCSI Controller(s) 1B4B:9215 1B4B:9235 not found

> It does not affect the SATA booting, but I want to
> make sure we see the same warning.

Yes, I do:

NAND read: device 0 whole chip
Attempt to read outside the flash area
 0 bytes read: ERROR
Booting Gentoo from sda1
AHCI init for unit0
Target spinup took 0 ms.
Target spinup took 0 ms.

Error: SCSI Controller(s) 1B4B:9215 1B4B:9235 not found
scanning bus for devices...
  Device 0: (0:0) Vendor: ATA Prod.: TS256GSSD370 Rev: N111
            Type: Hard Disk
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)
  Device 1: (1:0) Vendor: ATA Prod.: ST9500325AS Rev: 0001
            Type: Hard Disk
            Capacity: 476940.0 MB = 465.7 GB (976773168 x 512)
Found 2 device(s).
4293698 bytes read in 111 ms (36.9 MiB/s)
*  kernel: cmdline image address = 0x02000000

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.8-gentoo (root@nas) (gcc version 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5) ) #3 SMP Wed Feb 8 18:39:45 CET 2017
[    0.000000] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d

Seems to be that thing:
1b4b:9215: https://h-node.org/hostcontrollers/view/en/1626/Marvell-Technology-Group-Ltd--Device-9215--rev-11-
1b4b:9235: https://pci-ids.ucw.cz/read/PC/1b4b/9235

Nevertheless I don't get any panic about this error. It appears at the point, when you execute scsi init in the uboot environment before booting the system. It doesn't have anything todo with our kernel config.
Re: Zyxel NAS326 - Debian / Boot from USB?
March 12, 2017 04:57PM
musv,

Thanks for the info!

Indeed, this occurs during u-boot is running, so it does not have any thing to do with the kernel. It is just a limitation of stock u-boot.

I was writing the instruction for SATA installation, and just wanted to cover all bases.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Zyxel NAS326 - Debian / Boot from USB?
March 14, 2017 03:26AM
Hi all,


bodhi Wrote:
-------------------------------------------------------
> Hey guys,
>
> Could somebody answer this: what is the ethernet
> LED look like while the system is running? amber,
> green, flashing,...
>
> - Running with stock
> - Running with linux-4.9.0-mvebu-tld-12

If you are running your own compiled kernel, the same question to you, too.

I am looking for how to set the LED to green. This seems to be the missing piece of the puzzle in WOL. I could already set it to amber as same as stock OS does.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
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: