Welcome! Log In Create A New Profile

Advanced

Boot Debian from USB on Zyxel NSA310

Posted by mari8b 
Boot Debian from USB on Zyxel NSA310
August 15, 2018 08:34AM
I prepared me an USB drive with Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 following this instructions.

Now I can boot Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 (uImage and uinitrd read from USB, the rest read from HDD), but mtd0 partition is read only. How can I mount it writeable?

U-Boot 2013.07 (Sep 20 2013 - 15:45:03)
ZyXEL NSA310 1-Bay Power Media Server


SoC:   Kirkwood 88F6281_A1
DRAM:  256 MiB
WARNING: Caches not enabled
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
PHY reset timed out
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot:  0
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
3834666 bytes read in 377 ms (9.7 MiB/s)
7245696 bytes read in 434 ms (15.9 MiB/s)
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-4.12.1-kirkwood-tld-1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3834602 Bytes = 3.7 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 00d00000 ...
   Image Name:   initramfs-4.12.1-kirkwood-tld-1
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    7245632 Bytes = 6.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.12.1-kirkwood-tld-1 (root@tldDebian) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 PREEMPT Sat Jul 15 21:40:50 PDT 2017
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: ZyXEL NSA310
[    0.000000] Memory policy: Data cache writeback
[    0.000000] INITRD: 0x00d00000+0x006e9000 overlaps in-use memory region - disabling initrd
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/sda1
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 246440K/262144K available (8192K kernel code, 716K rwdata, 1972K rodata, 1024K init, 288K bss, 15704K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0900000   (9184 kB)
[    0.000000]       .init : 0xc0c00000 - 0xc0d00000   (1024 kB)
[    0.000000]       .data : 0xc0d00000 - 0xc0db3274   ( 717 kB)
[    0.000000]        .bss : 0xc0db9b9c - 0xc0e01e60   ( 289 kB)
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000007] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.000042] Switching to timer-based delay loop, resolution 5ns
[    0.000503] Console: colour dummy device 80x30
[    0.000537] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=2000000)
[    0.000559] pid_max: default: 32768 minimum: 301
[    0.000754] Security Framework initialized
[    0.000875] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000894] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.001743] CPU: Testing write buffer coherency: ok
[    0.002768] Setting up static identity map for 0x100000 - 0x100058
[    0.003057] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[    0.006316] devtmpfs: initialized
[    0.011065] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.011092] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.011483] prandom: seed boundary self test passed
[    0.015219] prandom: 100 self tests passed
[    0.015232] pinctrl core: initialized pinctrl subsystem
[    0.016386] NET: Registered protocol family 16
[    0.016765] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.018372] cpuidle: using governor ladder
[    0.018442] cpuidle: using governor menu
[    0.018835] Feroceon L2: Enabling L2
[    0.018882] Feroceon L2: Cache support initialised.
[    0.024247] No ATAGs?
[    0.033537] vgaarb: loaded
[    0.033856] SCSI subsystem initialized
[    0.034337] usbcore: registered new interface driver usbfs
[    0.034415] usbcore: registered new interface driver hub
[    0.034498] usbcore: registered new device driver usb
[    0.035576] clocksource: Switched to clocksource orion_clocksource
[    0.124157] VFS: Disk quotas dquot_6.6.0
[    0.124241] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.134755] NET: Registered protocol family 2
[    0.135500] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.135539] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.135623] TCP: Hash tables configured (established 2048 bind 2048)
[    0.135714] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.135744] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.135924] NET: Registered protocol family 1
[    0.136340] RPC: Registered named UNIX socket transport module.
[    0.136353] RPC: Registered udp transport module.
[    0.136360] RPC: Registered tcp transport module.
[    0.136368] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.136679] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.137624] audit: initializing netlink subsys (disabled)
[    0.138031] Initialise system trusted keyrings
[    0.138083] Key type blacklist registered
[    0.138181] audit: type=2000 audit(0.132:1): state=initialized audit_enabled=0 res=1
[    0.138266] workingset: timestamp_bits=30 max_order=16 bucket_order=0
[    0.138335] zbud: loaded
[    0.139316] NFS: Registering the id_resolver key type
[    0.139347] Key type id_resolver registered
[    0.139355] Key type id_legacy registered
[    0.139373] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.139383] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.139576] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.139773] fuse init (API version 7.26)
[    0.140116] orangefs_debugfs_init: called with debug mask: :none: :0:
[    0.140317] orangefs_init: module version upstream loaded
[    0.140328] SGI XFS with ACLs, security attributes, realtime, no debug enabled
[    2.555584] random: fast init done
[    5.975060] Key type asymmetric registered
[    5.975078] Asymmetric key parser 'x509' registered
[    5.975143] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    5.975155] io scheduler noop registered
[    5.975164] io scheduler deadline registered
[    5.975241] io scheduler cfq registered (default)
[    5.976609] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    5.978514] mvebu-pcie mbus@f1000000:pcie-controller@82000000: PCI host bridge to bus 0000:00
[    5.978535] pci_bus 0000:00: root bus resource [io  0x1000-0xfffff]
[    5.978549] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xefffffff]
[    5.978563] pci_bus 0000:00: root bus resource [bus 00-ff]
[    5.978889] PCI: bus0: Fast back to back transfers disabled
[    5.978915] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    6.005694] PCI: bus1: Fast back to back transfers disabled
[    6.005904] pci 0000:00:01.0: BAR 14: assigned [mem 0xe0000000-0xe00fffff]
[    6.005920] pci 0000:00:01.0: BAR 13: assigned [io  0x10000-0x10fff]
[    6.005939] pci 0000:01:00.0: BAR 6: assigned [mem 0xe0000000-0xe000ffff pref]
[    6.005956] pci 0000:01:00.0: BAR 4: assigned [mem 0xe0010000-0xe0013fff 64bit pref]
[    6.005980] pci 0000:01:00.0: BAR 2: assigned [mem 0xe0014000-0xe0014fff 64bit pref]
[    6.006001] pci 0000:01:00.0: BAR 0: assigned [io  0x10000-0x100ff]
[    6.006017] pci 0000:00:01.0: PCI bridge to [bus 01]
[    6.006031] pci 0000:00:01.0:   bridge window [io  0x10000-0x10fff]
[    6.006047] pci 0000:00:01.0:   bridge window [mem 0xe0000000-0xe00fffff]
[    6.006142] pcieport 0000:00:01.0: enabling device (0140 -> 0143)
[    6.006667] mv_xor f1060800.xor: Marvell shared XOR driver
[    6.066319] mv_xor f1060800.xor: Marvell XOR (Registers Mode): ( xor cpy sg intr )
[    6.066543] mv_xor f1060900.xor: Marvell shared XOR driver
[    6.126314] mv_xor f1060900.xor: Marvell XOR (Registers Mode): ( xor cpy sg intr )
[    6.126764] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    6.128134] console [ttyS0] disabled
[    6.128205] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 26, base_baud = 12500000) is a 16550A
[    6.824166] console [ttyS0] enabled
[    6.836097] loop: module loaded
[    6.839823] sata_mv f1080000.sata: slots 32 ports 2
[    6.847542] scsi host0: sata_mv
[    6.851149] scsi host1: sata_mv
[    6.854552] ata1: SATA max UDMA/133 irq 32
[    6.858726] ata2: SATA max UDMA/133 irq 32
[    6.863633] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xf1
[    6.870128] nand: Samsung NAND 128MiB 3,3V 8-bit
[    6.874765] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    6.882399] Scanning device for bad blocks
[    6.906519] Bad eraseblock 207 at 0x0000019e0000
[    6.989756] 9 ofpart partitions found on MTD device orion_nand
[    6.995635] Creating 9 MTD partitions on "orion_nand":
[    7.000806] 0x000000000000-0x000000100000 : "uboot"
[    7.007047] 0x000000100000-0x000000180000 : "uboot_env"
[    7.013596] 0x000000180000-0x000000200000 : "key_store"
[    7.020211] 0x000000200000-0x000000280000 : "info"
[    7.026230] 0x000000280000-0x000000c80000 : "etc"
[    7.032125] 0x000000c80000-0x000001680000 : "kernel_1"
[    7.038543] 0x000001680000-0x000004640000 : "rootfs1"
[    7.045114] 0x000004640000-0x000005040000 : "kernel_2"
[    7.051623] 0x000005040000-0x000008000000 : "rootfs2"
[    7.059518] libphy: Fixed MDIO Bus: probed
[    7.064487] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    7.071120] ehci-pci: EHCI PCI platform driver
[    7.075679] ehci-orion: EHCI orion driver
[    7.079922] orion-ehci f1050000.ehci: EHCI Host Controller
[    7.085468] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[    7.093487] orion-ehci f1050000.ehci: irq 30, io mem 0xf1050000
[    7.125682] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[    7.132001] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    7.138875] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    7.146172] usb usb1: Product: EHCI Host Controller
[    7.151077] usb usb1: Manufacturer: Linux 4.12.1-kirkwood-tld-1 ehci_hcd
[    7.157846] usb usb1: SerialNumber: f1050000.ehci
[    7.163225] hub 1-0:1.0: USB hub found
[    7.167099] hub 1-0:1.0: 1 port detected
[    7.171656] usbcore: registered new interface driver usb-storage
[    7.178091] mousedev: PS/2 mouse device common for all mice
[    7.184261] rtc-mv f1010300.rtc: rtc core: registered f1010300.rtc as rtc0
[    7.191383] i2c /dev entries driver
[    7.198194] hidraw: raw HID events driver (C) Jiri Kosina
[    7.203980] drop_monitor: Initializing network drop monitor service
[    7.210578] NET: Registered protocol family 17
[    7.215121] Key type dns_resolver registered
[    7.220161] registered taskstats version 1
[    7.224279] Loading compiled-in X.509 certificates
[    7.229182] zswap: loaded using pool lzo/zbud
[    7.236088] Key type big_key registered
[    7.241823] Key type encrypted registered
[    7.247281] rtc-mv f1010300.rtc: setting system clock to 2018-08-15 14:20:11 UTC (1534342811)
[    7.365627] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[    7.376477] ata1.00: ATA-9: WDC WD20EFRX-68AX9N0, 80.00A80, max UDMA/133
[    7.383212] ata1.00: 3907029168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[    7.392828] ata1.00: configured for UDMA/133
[    7.407712] scsi 0:0:0:0: Direct-Access     ATA      WDC WD20EFRX-68A 0A80 PQ: 0 ANSI: 5
[    7.417031] sd 0:0:0:0: [sda] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
[    7.424818] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    7.430667] sd 0:0:0:0: [sda] Write Protect is off
[    7.435696] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    7.459386]  sda: sda1 sda2
[    7.463940] sd 0:0:0:0: [sda] Attached SCSI disk
[    7.525613] usb 1-1: new high-speed USB device number 2 using orion-ehci
[    7.717372] usb 1-1: New USB device found, idVendor=05e3, idProduct=0608
[    7.724135] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    7.731360] usb 1-1: Product: USB2.0 Hub
[    7.736335] hub 1-1:1.0: USB hub found
[    7.740496] hub 1-1:1.0: 4 ports detected
[    7.760423] ata2: SATA link down (SStatus 0 SControl F300)
[    7.776759] EXT4-fs (sda1): couldn't mount as ext3 due to feature incompatibilities
[    7.799433] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[    7.807289] VFS: Mounted root (ext4 filesystem) readonly on device 8:1.
[    7.826817] devtmpfs: mounted
[    7.832688] Freeing unused kernel memory: 1024K
INIT: version 2.88 booting
[    8.065617] usb 1-1.3: new high-speed USB device number 3 using orion-ehci
[    8.221123] usb 1-1.3: New USB device found, idVendor=125f, idProduct=db8a
[    8.228170] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    8.239775] usb 1-1.3: Product: ADATA USB Flash Drive
[    8.245459] usb 1-1.3: Manufacturer: ADATA
[    8.253473] usb 1-1.3: SerialNumber: 27B221117003017D
[    8.260598] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[    8.269821] scsi host2: usb-storage 1-1.3:1.0
[info] Using makefile-style concurrent boot in runlevel S.
ERROR: could not open /proc/stat: No such file or directory
findfs: unable to resolve 'LABEL=rootfs'
[....] Starting the hotplug events dispatcher: systemd-udevdstarting version 232
. ok
[....] Synthesizing the initial hotplug events...[    9.452620] scsi 2:0:0:0: Direct-Access     ADATA    USB Flash Drive  1100 PQ: 0 ANSI: 6
[    9.482947] sd 2:0:0:0: [sdb] 30310400 512-byte logical blocks: (15.5 GB/14.5 GiB)
[ ok     9.502561] sd 2:0:0:0: [sdb] Write Protect is off
[    9.521600] sd 2:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
done.
[    9.550801]  sdb: sdb1
[    9.557172] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[    9.564523] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[....] Waiting for /dev to be fully populated...[    9.867845] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    9.873545] r8169 0000:01:00.0: enabling device (0140 -> 0143)
[    9.899764] hwmon_vid: Unknown VRM version of your CPU
[    9.899791] adt7475 0-002e: hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
[    9.899958] adt7475 0-002e: ADT7476 device, revision 1
[    9.899966] adt7475 0-002e: Optional features: in0 in4 fan4 pwm2 vid
[    9.917666] orion_wdt: Initial timeout 21 sec
[   10.019014] marvell-cesa f1030000.crypto: CESA device successfully registered
[   10.038376] sd 0:0:0:0: Attached scsi generic sg0 type 0
[   10.038597] sd 2:0:0:0: Attached scsi generic sg1 type 0
[   10.045389] usbcore: registered new interface driver uas
[   10.286852] r8169 0000:01:00.0 eth0: RTL8168d/8111d at 0xd0dbe000, 00:00:00:00:00:30, XID 083000c0 IRQ 33
[   10.338852] r8169 0000:01:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[   10.634048] r8169 0000:01:00.0 enp1s0: renamed from eth0
done.
[ ok ] Setting hostname to 'debian'...done.
[ ok ] Activating swap:.
[   11.812878] EXT4-fs (sda1): re-mounted. Opts: (null)
[....] Will now check root file system:fsck from util-linux 2.29.2
[/sbin/fsck.ext4 (1) -- /] fsck.ext4 -y -C0 /run/rootdev
e2fsck 1.43.4 (31-Jan-2017)
rootfs: clean, 14480/196608 files, 154801/786432 blocks
. ok
[   12.035717] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[ ok ] Will now activate lvm and md swap:done.
[info] Will now check all file systems.
fsck from util-linux 2.29.2
Checking all file systems.
LABEL=rootfs is not mounted
[/sbin/fsck.ext4 (1) -- /] fsck.ext4 -y -C0 /dev/sdb1
e2fsck 1.43.4 (31-Jan-2017)
rootfs: clean, 14456/948416 files, 191552/3788544 blocks
[ ok ] Done checking file systems. A log is being saved in /var/log/fsck/checkfs if that location is writable..
[....] Cleaning [   13.392668] random: crng init done
[ ok mporary files...[....] Cleaning /tmp...done.
[ ok .
[ ok ] Will now mount local filesystems:.
[ ok ] Will now activate swapfile swap:done.
[ ok ] Checking minimum space in /tmp...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables...done.
[ ok ] Initializing random number generator...done.
[....] Configuring network interfaces...Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Cannot find device "eth0"
Failed to get interface index: No such device

If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug.  These pages explain the proper
process and the information we find helpful for debugging..

exiting.
ifup: failed to bring up eth0
failed.
[   15.275931] NET: Registered protocol family 10
[   15.283520] Segment Routing with IPv6
[ ok ] Starting RPC port mapper daemon: rpcbind.
[ ok ] Starting NFS common utilities: statd idmapd.
[ ok ] Cleaning up temporary files....
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
[....] Starting busybox' syslogd implementation : syslogdStarting /sbin/syslogd...
1223 (syslogd)
. ok
[ ok ] Starting system message bus: dbus.
[ ok ] Starting NFS common utilities: statd idmapd.
[ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
[warn] Not starting NFS kernel daemon: no exports. ... (warning).
[ ok ] Starting NTP server: ntpd.
[ ok ] Starting OpenBSD Secure Shell server: sshd.
[....] Starting busybox' klogd implementation : klogdStarting /sbin/klogd...
1226 (klogd)
. ok
[ ok ] Running local boot scripts (/etc/rc.local).

Debian GNU/Linux 9 debian ttyS0

debian login: root

NSA310> printenv
CONTRY_TYPE=FF
FEATURE_BIT=00
MODEL_ID=A203
PRODUCT_NAME=NSA-310
VENDOR_NAME=ZyXEL Communications Corp.
baudrate=115200
bootargs=console=ttyS0,115200 root=/dev/sda1
bootcmd=usb reset;ext4load usb 0:1 0x800000 /boot/uImage;ext4load usb 0:1 0xd00000 /boot/uInitrd;bootm 0x800000 0xd00000
bootdelay=3
ethact=egiga0
ethaddr=cc:5d:4e:c9:f8:f6
kernel_addr=480000
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x100000(uboot),0x80000(stock_uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2)
nandEcc=1bit
nandEnvBase=100000
stderr=serial
stdin=serial
stdout=serial

Environment size: 686/131068 bytes

root@debian:~# cat /etc/fw_env.config
# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Notice, that the "Number of sectors" is ignored on NOR.

# MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
/dev/mtd0               0xc0000         0x20000         0x20000

root@debian:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "uboot"
mtd1: 00080000 00020000 "uboot_env"
mtd2: 00080000 00020000 "key_store"
mtd3: 00080000 00020000 "info"
mtd4: 00a00000 00020000 "etc"
mtd5: 00a00000 00020000 "kernel_1"
mtd6: 02fc0000 00020000 "rootfs1"
mtd7: 00a00000 00020000 "kernel_2"
mtd8: 02fc0000 00020000 "rootfs2"

root@debian:~# ls -all /dev/mt*
crw------- 1 root root 90,  0 Aug 15 07:34 /dev/mtd0
crw------- 1 root root 90,  1 Aug 15 07:34 /dev/mtd0ro
crw------- 1 root root 90,  2 Aug 15 07:34 /dev/mtd1
crw------- 1 root root 90,  3 Aug 15 07:34 /dev/mtd1ro
crw------- 1 root root 90,  4 Aug 15 07:34 /dev/mtd2
crw------- 1 root root 90,  5 Aug 15 07:34 /dev/mtd2ro
crw------- 1 root root 90,  6 Aug 15 07:34 /dev/mtd3
crw------- 1 root root 90,  7 Aug 15 07:34 /dev/mtd3ro
crw------- 1 root root 90,  8 Aug 15 07:34 /dev/mtd4
crw------- 1 root root 90,  9 Aug 15 07:34 /dev/mtd4ro
crw------- 1 root root 90, 10 Aug 15 07:34 /dev/mtd5
crw------- 1 root root 90, 11 Aug 15 07:34 /dev/mtd5ro
crw------- 1 root root 90, 12 Aug 15 07:34 /dev/mtd6
crw------- 1 root root 90, 13 Aug 15 07:34 /dev/mtd6ro
crw------- 1 root root 90, 14 Aug 15 07:34 /dev/mtd7
crw------- 1 root root 90, 15 Aug 15 07:34 /dev/mtd7ro
crw------- 1 root root 90, 16 Aug 15 07:34 /dev/mtd8
crw------- 1 root root 90, 17 Aug 15 07:34 /dev/mtd8ro
brw-rw---- 1 root disk 31,  0 Aug 15 07:34 /dev/mtdblock0
brw-rw---- 1 root disk 31,  1 Aug 15 07:34 /dev/mtdblock1
brw-rw---- 1 root disk 31,  2 Aug 15 07:34 /dev/mtdblock2
brw-rw---- 1 root disk 31,  3 Aug 15 07:34 /dev/mtdblock3
brw-rw---- 1 root disk 31,  4 Aug 15 07:34 /dev/mtdblock4
brw-rw---- 1 root disk 31,  5 Aug 15 07:34 /dev/mtdblock5
brw-rw---- 1 root disk 31,  6 Aug 15 07:34 /dev/mtdblock6
brw-rw---- 1 root disk 31,  7 Aug 15 07:34 /dev/mtdblock7
brw-rw---- 1 root disk 31,  8 Aug 15 07:34 /dev/mtdblock8

Re: Boot Debian from USB on Zyxel NSA310
August 15, 2018 10:58PM
mari8b,

Quote

Now I can boot Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 (uImage and uinitrd read from USB, the rest read from HDD), but mtd0 partition is read only. How can I mount it writeable?

At the moment, you can only change u-boot envs in serial console for the NSA310. This was an oversight on my part when I put in the changes to allow these Kirkwood devices RW access to mtd0 (In Linux mainline, they are default RO to protect u-boot and its envs from user's mistake).

Since you have serial console, you can wait until my next kernel release (4.18.x) to have this capability. But let me know if you need it sooner, I'll recompile the new NSA310 DTB for you.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Boot Debian from USB on Zyxel NSA310
August 16, 2018 03:17AM
bodhi Wrote:
-------------------------------------------------------

> Since you have serial console, you can wait until
> my next kernel release (4.18.x) to have this
> capability. But let me know if you need it sooner,
> I'll recompile the new NSA310 DTB for you.

So long I'm able to boot new Debian (with new kernel) with my current U-boot, I don't need it now.

But I got problem with network:
[....] Configuring network interfaces...Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Cannot find device "eth0"
Failed to get interface index: No such device

If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug.  These pages explain the proper
process and the information we find helpful for debugging..

exiting.
ifup: failed to bring up eth0
failed.

Maybe are my envs wrong? fw_printenv isn't able to read real U-boot envs...
root@debian:~# fw_printenv ethaddr
Warning: Bad CRC, using default environment
ethaddr=00:00:11:22:33:44

Or it is because nand bad blocks?
root@debian:~# dmesg | grep -i 'bad'
[    6.882391] Scanning device for bad blocks
[    6.906517] Bad eraseblock 207 at 0x0000019e0000

Or something else?

Maybe I can flash new U-boot from boot serial console?
ide reset;ext2load ide 0:1 0x800000  /home/uboot.2017.07-tld-1.nsa310.mtd0.kwb
nand erase 0x0 0x80000
nand write.e 0x800000 0x0 0x80000
reset



Edited 1 time(s). Last edit at 08/16/2018 03:19AM by mari8b.
Re: Boot Debian from USB on Zyxel NSA310
August 16, 2018 04:03AM
Network problem solved. I've overseen, that eth0 was renamed to enp1s0.
[   10.634048] r8169 0000:01:00.0 enp1s0: renamed from eth0
So I modified /etc/network/interfaces and everything's ok now...

But the other question(s) - can I flash new U-boot from serial console? Do I need it actually? Should I care about envs bad CRC or bad blocks?



Edited 1 time(s). Last edit at 08/16/2018 04:11AM by mari8b.
Re: Boot Debian from USB on Zyxel NSA310
August 16, 2018 04:07AM
mari8b,

> So long I'm able to boot new Debian (with new
> kernel) with my current U-boot, I don't need it
> now.
>
> But I got problem with network:

> Maybe are my envs wrong? fw_printenv isn't able to
> read real U-boot envs...

> root@debian:~# fw_printenv ethaddr
> Warning: Bad CRC, using default environment


Probably, this is because you are running an old u-boot, not one I provided:
https://forum.doozan.com/read.php?3,12381


> root@debian:~# dmesg | grep -i 'bad'
> [ 6.882391] Scanning device for bad blocks
> [ 6.906517] Bad eraseblock 207 at
> 0x0000019e0000


This bad block is ok. It is far away from mtd0, where u-boot is.

> Maybe I can flash new U-boot from boot serial
> console?
>
> ide reset;ext2load ide 0:1 0x800000 
> /home/uboot.2017.07-tld-1.nsa310.mtd0.kwb
> nand erase 0x0 0x80000
> nand write.e 0x800000 0x0 0x80000
> reset 
>


You could do this and it should work. But later, default envs image also needs to flashed to make it correctly saved. There is another serial console method to do this, but make sure you can do UART booting first.

Before you flash new u-boot, you should try UART booting using kwboot to ensure you can recover from problem that migh occur during flashing.

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).

Here is an example of using kwboot:
https://forum.doozan.com/read.php?3,51739,51919#msg-51919

====

Note:

This NSA310 box is most problematic as far as network is concerned. There are 3 variations of NSA310, at least one of them uses Realtek NIC, instead of the standard Marvell NIC.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Boot Debian from USB on Zyxel NSA310
August 16, 2018 05:04AM
mari8b,

> But the other question(s) - can I flash new U-boot
> from serial console? Do I need it actually? Should
> I care about envs bad CRC or bad blocks?

See parts of my answer above.


You don't need to flash new u-boot to run the latest rootfs.

The CRC error indicated that your u-boot version does not not use the same location for the envs that the rootfs expected. So you can find out where that is and adjust its address in /etc/fw_env.config.

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