Re: Zyxel NAS326 - Debian / Boot from USB? March 15, 2017 03:46AM |
Registered: 9 years ago Posts: 295 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 15, 2017 04:25AM |
Admin Registered: 13 years ago Posts: 18,997 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 15, 2017 06:14PM |
Admin Registered: 13 years ago Posts: 18,997 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 16, 2017 04:58AM |
Registered: 9 years ago Posts: 295 |
lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.0 (stretch) Release: 9.0 Codename: stretch
[ 0.000000] Linux version 4.10.3-rm-1 (root@debiannas326) (gcc version 6.3.0 20170205 (Debian 6.3.0-6) ) #1 SMP Fri Mar 17 19:13:20 CET 2017 [ 0.000000] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt:Machine model: Zyxel NAS326
Re: Zyxel NAS326 - Debian / Boot from USB? March 19, 2017 02:40AM |
Registered: 13 years ago Posts: 20 |
Quote
curr_bootfrom=1
next_bootfrom=1
load_dtb_addr=0x1000000
load_image_addr=0x02000000
load_initrd_addr=0x2900000
usb_init=mw.l f1018100 20420000; mw.l f1018140 003E8800; sleep 3; usb start
set_bootargs_stock=setenv bootargs "console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2"
bootcmd_stock_1=run set_bootargs_stock; echo Booting from NAND kernel 1 ...; nand read 0x2000000 0x00E00000 0xF00000 && bootz 0x2000000
bootcmd_stock_2=run set_bootargs_stock; echo Booting from NAND kernel 2 ...; nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000
usb_set_bootargs=setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial init=/bin/systemd"
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
bootcmd_custom=if run usb_bootcmd; then; else if run bootcmd_stock_1; then; else run bootcmd_stock_2; reset; fi; fi
kernel_addr_1=0x00000000; run bootcmd_custom;
change_boot_part=1
bootargs=console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2) earlyprintk=serial init=/bin/systemd
kernel_addr=${kernel_addr_1}
kernel_addr_2=0x08700000
kernel_addr_r=2080000
kernel_mtd_1=3
kernel_mtd_2=5
mtdparts=mtdparts=armada-nand:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2)
Quote
nandtest /dev/mtd4
ECC corrections: 0
ECC failures : 0
Bad blocks : 1
BBT blocks : 0
00740000: reading...
1 bit(s) ECC corrected at 00740000
02900000: reading...
2 bit(s) ECC corrected at 02900000
Bad block at 0x04120000
069e0000: checking...
Finished pass 1 successfully
Re: Zyxel NAS326 - Debian / Boot from USB? March 19, 2017 03:11AM |
Admin Registered: 13 years ago Posts: 18,997 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 19, 2017 05:19AM |
Registered: 13 years ago Posts: 20 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 19, 2017 05:54AM |
Admin Registered: 13 years ago Posts: 18,997 |
Zyxel NAS326 Serial Pinouts (same as NSA325 and NSA310S/320S) GND RX TX +----+----+ | | | +----+----+----+----+----+ |3.3V| TX | RX | | GND| +----+----+----+ +----+
ZyXEL NAS326 Serial Cable and temp sensor March 25, 2017 03:43AM |
Registered: 9 years ago Posts: 295 |
pengu@debiannas326:~$ sensors armada_thermal-virtual-0 Adapter: Virtual device temp1: +73.7°C pengu@debiannas326:~$
Re: ZyXEL NAS326 Serial Cable and temp sensor March 25, 2017 04:08AM |
Admin Registered: 13 years ago Posts: 18,997 |
Quote
Updated 03 Feb 2017:
Kernel linux-4.9.0-mvebu-tld-12 package has been uploaded. This kernel has been fully developed with all the capabilities similar to the Kirkwook kernel.
Notables:
- This kernel is configured as SMP PREEMPT (supports up to 4 cores and run with preemptive scheduler).
- Power Off works fine, but will print out a warning in console (which can be safely ignored).
- For fan speed and CPU temperature reading see this post.
- SPI is temporarily removed until we can find out more info.
Re: ZyXEL NAS326 Serial Cable and temp sensor March 25, 2017 04:11AM |
Admin Registered: 13 years ago Posts: 18,997 |
Quote
B3. Normal Operation
The USB rootfs should be plugged in permanently, and if there is serial console module attached before then it should be removed during booting.
1. Whenever the NAS326 is rebooted or cold started, to boot without manual intervention, the serial console module must be unplugged from the NAS326. If the serial console module is plugged in, then step 1 in the Section A2 installation instruction must be executed (so that the NAS326 will continue booting when it detected the serial console present).
2. If you want to boot back to stock OS in NAND, just shutdown the box, unplug the USB and power up the box. It will boot the kernel 1 in NAND and then if not successful, it will try kernel 2.
This also serves as a rescue system. Whenever the rootfs on USB has problem and cannot boot (the effect is just like the USB drive is not plugged in), the NAS326 will fall back to booting the kernel 1 or 2 in NAND. When this occurs, the u-boot envs in step 4 must be reentered at Debian command line again to allow booting back to USB rootfs.
Re: ZyXEL NAS326 Serial Cable and temp sensor March 25, 2017 05:14AM |
Registered: 9 years ago Posts: 295 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 25, 2017 03:17PM |
Admin Registered: 13 years ago Posts: 18,997 |
B2. Installation .... 4. Enter the following commands (copy/paste each line to the stock OS command line). fw_setenv curr_bootfrom 1 fw_setenv next_bootfrom 1 fw_setenv load_dtb_addr 0x1000000 fw_setenv load_initrd_addr 0x2900000 fw_setenv load_image_addr 0x02000000 fw_setenv usb_init 'mw.l f1018100 20420000; mw.l f1018140 003E8800; sleep 3; usb start' fw_setenv set_bootargs_stock 'setenv bootargs "console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2"' fw_setenv bootcmd_stock_1 'run set_bootargs_stock; echo Booting from NAND kernel 1 ...; nand read 0x2000000 0x00E00000 0xF00000 && bootz 0x2000000' fw_setenv bootcmd_stock_2 'run set_bootargs_stock; echo Booting from NAND kernel 2 ...; nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000' fw_setenv usb_set_bootargs 'setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial"' fw_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' fw_setenv bootcmd_custom 'if run usb_bootcmd; then; else if run bootcmd_stock_1; then; else run bootcmd_stock_2; reset; fi; fi' fw_setenv kernel_addr_1 '0x00000000; run bootcmd_custom; ' fw_setenv change_boot_part 1
fw_printenv > current_envs.txt
fw_setenv bootcmd_custom 'if run usb_bootcmd; then; else if run bootcmd_stock_2; then; else run bootcmd_stock_1; reset; fi; fi'
Re: Zyxel NAS326 - Debian / Boot from USB? March 26, 2017 04:10AM |
Registered: 13 years ago Posts: 20 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 26, 2017 04:37AM |
Admin Registered: 13 years ago Posts: 18,997 |
0x000000e00000-0x000001d00000 : "Kernel-1" 0x000001d00000-0x000008700000 : "RootFS-1" 0x000008700000-0x000009600000 : "Kernel-2" 0x000009600000-0x000010000000 : "RootFS-2"
Re: Zyxel NAS326 - Debian / Boot from USB? March 26, 2017 05:08AM |
Registered: 13 years ago Posts: 20 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 27, 2017 02:02AM |
Admin Registered: 13 years ago Posts: 18,997 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 28, 2017 12:08AM |
Registered: 13 years ago Posts: 20 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 28, 2017 01:24AM |
Admin Registered: 13 years ago Posts: 18,997 |
mtd3 mtd4 mtd5 mtd6
mtd3: 00f00000 00020000 "Kernel-1" mtd4: 06a00000 00020000 "RootFS-1" mtd5: 00f00000 00020000 "Kernel-2" mtd6: 06a00000 00020000 "RootFS-2"
nanddump --noecc --omitoob -f mtd3 /dev/mtd3 nanddump --noecc --omitoob -f mtd4 /dev/mtd4 nanddump --noecc --omitoob -f mtd5 /dev/mtd5 nanddump --noecc --omitoob -f mtd6 /dev/mtd6
Re: Zyxel NAS326 - Debian / Boot from USB? March 28, 2017 03:04AM |
Registered: 13 years ago Posts: 20 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 28, 2017 03:30AM |
Admin Registered: 13 years ago Posts: 18,997 |
root@debian:/boot/nas326_nands# nanddump --noecc --omitoob -f mtd3 /dev/mtd3 Block size 131072, page size 2048, OOB size 64 Dumping data starting at 0x00000000 and ending at 0x00f00000... root@debian:/boot/nas326_nands# nanddump --noecc --omitoob -f mtd4 /dev/mtd4 Block size 131072, page size 2048, OOB size 64 Dumping data starting at 0x00000000 and ending at 0x06a00000... root@debian:/boot/nas326_nands# nanddump --noecc --omitoob -f mtd5 /dev/mtd5 Block size 131072, page size 2048, OOB size 64 Dumping data starting at 0x00000000 and ending at 0x00f00000... root@debian:/boot/nas326_nands# nanddump --noecc --omitoob -f mtd6 /dev/mtd6 Block size 131072, page size 2048, OOB size 64 Dumping data starting at 0x00000000 and ending at 0x06a00000...
Re: Zyxel NAS326 - Debian / Boot from USB? March 28, 2017 11:35AM |
Registered: 13 years ago Posts: 20 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 28, 2017 11:38AM |
Registered: 13 years ago Posts: 20 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 28, 2017 02:34PM |
Admin Registered: 13 years ago Posts: 18,997 |
Re: Zyxel NAS326 - Debian / Boot from USB? March 28, 2017 03:58PM |
Registered: 13 years ago Posts: 20 |
UBI error: ubi_attach_mtd_dev: failed to attach mtd2, error -22 UBIFS error (pid 1606): ubifs_mount: cannot open "ubi2:ubi_config", error -19Finally I got both NANDs working, by flashing firmware first from mtd6 and then from mtd4. Then I got rid of mtd2 errors and was able to save configuration. Before that it was default settings every reboot.
fw_setenv curr_bootfrom 2 fw_setenv next_bootfrom 2and boot to NAND1?
bootcmd_stock_1After that I got again the:
Marvell>> run bootcmd_stock_1 Booting from NAND kernel 1 ... NAND read: device 0 offset 0xe00000, size 0xf00000 15728640 bytes read: OK * kernel: cmdline image address = 0x02000000 Bad Linux ARM zImage magic!But flashing then from NAND2/mtd6 helped to fix it.
Re: Zyxel NAS326 - Debian / Boot from USB? March 28, 2017 04:17PM |
Admin Registered: 13 years ago Posts: 18,997 |
> fw_setenv curr_bootfrom 2 > fw_setenv next_bootfrom 2 >> and boot to NAND1?
Re: Zyxel NAS326 - Debian / Boot from USB? April 09, 2017 03:53PM |
Admin Registered: 13 years ago Posts: 18,997 |
Re: Zyxel NAS326 - Debian / Boot from USB? April 09, 2017 06:12PM |
Admin Registered: 13 years ago Posts: 18,997 |
ethtool -s eth0 wol gAnd then verify
ethtool eth0Expected result
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
etherwake <NAS326 mac address>
Re: Zyxel NAS326 - Debian / Boot from USB? April 13, 2017 08:47AM |
Registered: 13 years ago Posts: 20 |
Re: Zyxel NAS326 - Debian / Boot from USB? April 13, 2017 03:08PM |
Admin Registered: 13 years ago Posts: 18,997 |
dmesg ethtool eth0 ifconfig -a cat /etc/init.d/halt cat /etc/init.d/reboot
etherwake <mac address>