nsa 325v2 vs debian noob questions
April 08, 2018 10:47AM
Hiya,
i own a nsa 325v2 and would like to install debian on it, just i have some questions i cannot seem to find the answer anywhere, so if there's some sort of noob guide i've missed, please gimme the link.

So.. first of all i've read this from nas central and this from Buttzy10169: so if i have understood it well the procedure needs to modify the inborn boot manager, right?
Is there any way to revert these changes?

Once i modify the boot order should i update the uboot? any cons?

Next step is to prepare the usb drive with debian, right?
According to nas central i just have to unzip and put folders into the two partitions, while on bodhi instructions setlist the thing is much longer: which procedure should i follow?

Is there any easy way to backup all of the nas firmware, boot, etc and to flash it back in case i brick it?
Re: nsa 325v2 vs debian noob questions
April 08, 2018 05:26PM
Carlo,

> So.. first of all i've read
> this
> from nas central and
> this
> from Buttzy10169: so if i have understood it well
> the procedure needs to modify the inborn boot
> manager, right?

Yes, usually you should install both Debian rootfs and install u-boot at the same time while inside stock OS.

> Is there any way to revert these changes?
>

Yes. During installing u-boot, the instruction recommend backing up mtd0 (where u-boot resides). And to revert to stock, you would flash it back while running Debian.

> Once i modify the boot order should i update the
> uboot? any cons?
>

This is only if you are booting Debian from stock u-boot.

> Is there any easy way to backup all of the nas
> firmware, boot, etc and to flash it back in case i
> brick it?

Yes.

What you should do as the 1st thing before attempt anything

Since you are learning to do this, the first tool that I very strongly recommend is to connect serial console, and then try booting new u-boot using kwboot. As I stated in the instruction:

Quote

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

Once you can load u-boot using kwboot and start the box in serial console, then it is almost impossible to brick this box entirely. This is the rescue mechanism.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 09, 2018 02:28AM
Thank you very much bodhi: that was the reference i was missing,

i've had only a quick read so far, and i'll do it better as i get home again

is the backup made through the "cp" command, besides the "fw_printenv > current_envs.txt"?
Re: nsa 325v2 vs debian noob questions
April 09, 2018 02:59AM
Carlo,

> is the backup made through the "cp" command,
> besides the "fw_printenv > current_envs.txt"?

That is only part of the back up. nanddump is the command we use to back up mtd0.

Quote

3. Be sure to save your current uBoot image in mtd0, or have a backup image saved somewhere as precaution. And save your current u-boot envs with fw_printenv, or just copy/paste the listing into a text file. Note the nanddump command below allows future restoration to the same box you're backing up, and also can be used to restore a differrent box's mtd0 if needed.

Dumping NAND mtd0:
nanddump --noecc --omitoob -l 0x80000 -f mtd0 /dev/mtd0

You have a lot of room for error if you have serial console and can kwboot the box. And that's the must -have tool when you start hacking these embedded Linux boxes.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 09, 2018 07:35AM
Edit: i had to cross the rx and the tx cable

now, should i worry:
Bad block at 0xc80000 in erase block from 0xc80000 will be skipped
this was given me from the boot

Edit 2: i made some more experiments
i've plugged the hd somehow
and now i've checked for bad sectors, and this is the answer:
/ # dmesg | grep -i 'bad'
Scanning device for bad blocks
Bad eraseblock 100 at 0x000000c80000
Bad eraseblock 200 at 0x000001900000




Quote
Carlo
I guess i'm more noob than i thought:
i have this thingy, so i used it to link the nas board to my pc.
i have linked the grd, the tx and the rx pins to that thingy, and given the
sudo screen /dev/ttyUSB0 115200

but the screen console is a blank window and cannot do anything
same result if i give the command as root
in the meantime the nas boots normally, considering i haven't plugged back the hd board yet

my dmesg seems to recognize the board

[ 4350.051886] cp210x 3-2:1.0: device disconnected
[ 4350.360332] usb 3-2: new full-speed USB device number 10 using xhci_hcd
[ 5163.052405] usb 3-1: new full-speed USB device number 11 using xhci_hcd
[ 5163.201863] usb 3-1: New USB device found, idVendor=10c4, idProduct=ea60
[ 5163.201867] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5163.201869] usb 3-1: Product: CP2104 USB to UART Bridge Controller
[ 5163.201871] usb 3-1: Manufacturer: Silicon Labs
[ 5163.201873] usb 3-1: SerialNumber: 0100AFF7
[ 5163.202544] cp210x 3-1:1.0: cp210x converter detected
[ 5163.203374] usb 3-1: cp210x converter now attached to ttyUSB0

i have checked three times i've linked the right pins, and seems so
what might it be?



Edited 3 time(s). Last edit at 04/09/2018 12:39PM by Carlo.
Re: nsa 325v2 vs debian noob questions
April 09, 2018 03:37PM
Bad eraseblock 100 at 0x000000c80000
Bad eraseblock 200 at 0x000001900000

These bad blocks are OK. They are far away from mtd0.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 09, 2018 04:27PM
thank you very much, bodhi

do i need to follow davygravy uart guide?

i have tried to check the md.. but...
Marvell>> md ff00003c
ff00003c: 00000000 00000000 00000000 00000000    ................
ff00004c: 00000000 00000000 00000000 00000000    ................
ff00005c: 00000000 00000000 00000000 00000000    ................
ff00006c: 00000000 00000000 00000000    ............

and next step is to put rootfs and u-boot on a flash memory, right?



Edited 1 time(s). Last edit at 04/09/2018 04:33PM by Carlo.
Re: nsa 325v2 vs debian noob questions
April 09, 2018 06:22PM
Carlo Wrote:
-------------------------------------------------------
> thank you very much, bodhi
>
> do i need to follow
> davygravy
> uart guide?
j
>
> i have tried to check the md.. but...
>
> Marvell>> md ff00003c
> ff00003c: 00000000 00000000 00000000 00000000   
> ................
> ff00004c: 00000000 00000000 00000000 00000000   
> ................
> ff00005c: 00000000 00000000 00000000 00000000   
> ................
> ff00006c: 00000000 00000000 00000000   
> ............
>
>

No need to. Just download kwboot from my uboot release post if you connect serial console using ARM Linux box. Or use davygravy built 64 bit kwboot for x86 if your Linux console is x86. Try it with the 2017.07-tld-1 uboot for NSA325.

> and next step is to put rootfs and u-boot on a
> flash memory, right?

No, the rootfs is meant to be on USB or HDD. uboot is in NAND flash.

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



Edited 1 time(s). Last edit at 04/10/2018 05:53PM by bodhi.
Re: nsa 325v2 vs debian noob questions
April 10, 2018 07:57AM
Quote
Bodhi
No need to. Just download kwboot from my uboot release post if you connect serial console using ARM Linux box. Or use davygravy built 64 bit kwboot for x86 if your Linux console is x86. Try it with the 2017.07-tld-1 uboot for Goflex Net.

Wel... i'm running an nsa325 v2, thus it should be an arm.. should i go for the Goflex as well?


i've tried to run nudump with the noecc option, but my nandump hasn't it: is it a problem?

and.. uh.. i guess i haven't the /boot partition/directory.. is that much of an issue?
/tmp # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mtdblock6           48896     44376      4520  91% /zyxel/mnt/nand
/dev/sda1               482922    475988      6934  99% /zyxel/mnt/sysdisk
/dev/loop0              138829    122778     16051  88% /ram_bin
/dev/loop0              138829    122778     16051  88% /usr
/dev/loop0              138829    122778     16051  88% /lib/security
/dev/loop0              138829    122778     16051  88% /lib/modules
/dev/ram0                 5120         4      5116   0% /tmp/tmpfs
/dev/ram0                 5120         4      5116   0% /usr/local/etc
/dev/ram0                 5120         4      5116   0% /usr/local/var
/dev/mtdblock4           10240      1500      8740  15% /etc/zyxel
/dev/md0             2883792120 2039937428 843854692  71% /i-data/ae0b0151
/dev/md0             2883792120 2039937428 843854692  71% /usr/local/zy-pkgs
/dev/md0             2883792120 2039937428 843854692  71% /etc/zyxel/zy-pkgs
/dev/md0             2883792120 2039937428 843854692  71% /usr/local/apache/htdocs/adv,/pkg
/dev/md0             2883792120 2039937428 843854692  71% /usr/lib/locale/locale-archive
/dev/md0             2883792120 2039937428 843854692  71% /i-data/ae0b0151/admin/zy-pkgs/gallery/modules
/dev/md0             2883792120 2039937428 843854692  71% /i-data/ae0b0151/admin/zy-pkgs/gallery/themes
/dev/md0             2883792120 2039937428 843854692  71% /usr/local/zy-pkgs/gui/gallery/var
/dev/md0             2883792120 2039937428 843854692  71% /usr/local/apache/htdocs/adv,/pkg/gallery/var
/dev/md0             2883792120 2039937428 843854692  71% /i-data/ae0b0151/admin/zy-pkgs/WordPress/plugins
/dev/md0             2883792120 2039937428 843854692  71% /i-data/ae0b0151/admin/zy-pkgs/WordPress/themes
/dev/md0             2883792120 2039937428 843854692  71% /usr/local/apache/web_framework/data/cache
/dev/mtdblock4           10240      1500      8740  15% /usr/local/apache/web_framework/data/config
/dev/md0             2883792120 2039937428 843854692  71% /usr/local/mysql
/dev/md0             2883792120 2039937428 843854692  71% /usr/local/apache/htdocs/adv,/res/imdb_poster

/ # ls -lsa
   0 drwxr-xr-x   19 root     root             0 Apr 10 14:57 .
   0 drwxr-xr-x   19 root     root             0 Apr 10 14:57 ..
   0 drwxr-xr-x    2 root     root             0 Apr 10 14:30 bin
   4 -rw-r--r--    1 root     root           604 Apr 10 14:57 current_envs.txt
   0 drwxr-xr-x    6 root     root             0 Apr 10 14:30 dev
   0 drwxr-xr-x    2 root     root             0 Jun 23  2017 e-data
   0 drwxr-xr-x   16 root     root             0 Apr 10 14:32 etc
 520 -rw-r--r--    1 root     root        532480 Apr 10 14:39 file
   0 drwxr-xr-x    3 root     root             0 Jun 23  2017 home
   0 drwxrwxrwx    3 root     root             0 Jan 26  2015 i-data
   4 -rwxr-xr-x    1 root     root          3013 Jun 21  2017 init
   0 drwxr-xr-x    4 root     root             0 Apr 10 14:30 lib
   0 lrwxrwxrwx    1 root     root            11 Jun 23  2017 linuxrc -> bin/busybox
   0 drwxr-xr-x    5 root     root             0 Apr 10 14:30 mnt
1024 -rw-r--r--    1 root     root       1048576 Apr 10 14:53 mtd0
   0 dr-xr-xr-x  100 root     root             0 Jan  1  1970 proc
   1 drwxr-xr-x   10 root     root          1024 Jun 23  2017 ram_bin
   0 drwxr-xr-x    2 root     root             0 Jun 23  2017 root
   0 drwxr-xr-x    2 root     root             0 Apr 10 14:29 sbin
   0 drwxr-xr-x   11 root     root             0 Jan  1  1970 sys
   0 drwxrwxrwx    7 root     root             0 Apr 10 15:11 tmp
   1 drwxr-xr-x    8 root     root          1024 Jun 21  2017 usr
   0 drwxr-xr-x   11 root     root             0 Jun 23  2017 var
   0 drwxr-xr-x    6 root     root             0 Jun 23  2017 zyxel



Edited 2 time(s). Last edit at 04/10/2018 08:12AM by Carlo.
Re: nsa 325v2 vs debian noob questions
April 10, 2018 05:53PM
Carlo,

> Wel... i'm running an nsa325 v2, thus it should be
> an arm.. should i go for the Goflex as well?

Sorry I've mixed it up! the payload should be the NSA325 u-boot image. I meant if you run an ARM box like GoFlexnet then use the binary I uploaded.

>
>
> i've tried to run nudump with the noecc option,
> but my nandump hasn't it: is it a problem?
>

Post the log of your dumping NAND. Also get the output of these before executing the command

cat /proc/mtd
fw_printenv
dmesg

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 11, 2018 07:49AM
uh.. the mtd0 file i've previously created seems to have disappeared.. is it normal?

/ # 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"

/ # fw_printenv
bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2) root=/dev/nfs rw init=/init
bootcmd=nand read.e 0x2000000 $(kernel_addr) 0xA00000; bootm 0x2000000
bootdelay=2
baudrate=115200
loads_echo=0
ipaddr=10.4.52.165
serverip=10.4.52.7
rootpath=/srv/ubuntu
netmask=255.255.255.0
nandEcc=1bit
kernel_addr=C80000
MODEL_ID=AE03
PRODUCT_NAME=NSA-325v2
FEATURE_BIT=00
CONTRY_TYPE=FF
VENDOR_NAME=MitraStar Technology Corp.
run_diag=yes
ethaddr=4C:9E:FF:5B:4F:D1

/ # dmesg
Linux version 2.6.31.8 (root@BuildMachine) (gcc version 4.3.2 (sdk3.3-ct-ng-1.4.1) ) #2 Fri Jun 23 1
1:03:47 CST 2017
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: Feroceon-KW
Using UBoot passing parameters structure
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 131072
free_area_init_node: node 0, pgdat c0868014, node_mem_map c0888000
  Normal zone: 1024 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 130048 pages, LIFO batch:31
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 130048
Kernel command line: console=ttyS0,115200 mtdparts=nand_mtd:0x100000(uboot),0x80000(uboot_env),0x800
00(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2) root=/dev/nfs rw init=/init
PID hash table entries: 2048 (order: 11, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 512MB = 512MB total
Memory: 506752KB available (5360K code, 302K data, 2872K init, 0K highmem)
Hierarchical RCU implementation.
NR_IRQS:128
Console: colour dummy device 80x30
Calibrating delay loop... 1599.07 BogoMIPS (lpj=7995392)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
Feroceon L2: Enabling L2
Feroceon L2: Cache support initialised.
invoking softwareStaggeredSpinUp()..., it will delay 5 seconds to spin up the second harddisk

CPU Interface
-------------
SDRAM_CS0 ....base 00000000, size 512MB
SDRAM_CS1 ....disable
SDRAM_CS2 ....disable
SDRAM_CS3 ....disable
PEX0_MEM ....base e0000000, size 128MB
PEX0_IO ....base f2000000, size   1MB
PEX1_MEM ....base e8000000, size 128MB
PEX1_IO ....base f2100000, size   1MB
INTER_REGS ....base f1000000, size   1MB
NFLASH_CS ....base fa000000, size   2MB
SPI_CS ....base f4000000, size  16MB
BOOT_ROM_CS ....no such
DEV_BOOTCS ....no such
CRYPT_ENG ....base f0000000, size   2MB

  Marvell Development Board (LSP Version KW_LSP_5.1.3_patch18)-- DB-88F6282A-BP  Soc: MV88F6282 Rev 1 LE

 Detected Tclk 200000000 and SysClk 533333333
Marvell USB EHCI Host controller #0: d003a740
        [BlueDBG] reseting SoC Pex[0]  0 ...
PEX0 interface detected Link X1
        [BlueDBG] reseting SoC Pex[1]  0 ...
        [BlueDBG] reseting SoC Pex[1]  1 ...
        [BlueDBG] reseting SoC Pex[1]  2 ...
        [BlueDBG] reseting SoC Pex[1]  3 ...
        [BlueDBG] reseting SoC Pex[1]  4 ...
        [BlueDBG] reseting SoC Pex[1]  5 ...
        [BlueDBG] reseting SoC Pex[1]  6 ...
        [BlueDBG] reseting SoC Pex[1]  7 ...
        [BlueDBG] reseting SoC Pex[1]  8 ...
        [BlueDBG] reseting SoC Pex[1]  9 ...
        [BlueDBG] reseting SoC Pex[1]  10 ...
PEX1 interface detected no Link.
pci 0000:00:01.0: reg 10 64bit mmio: [0x000000-0x001fff]
pci 0000:00:01.0: PME# supported from D0 D3hot
pci 0000:00:01.0: PME# disabled
PCI: bus0: Fast back to back transfers disabled
PCI: bus1: Fast back to back transfers enabled
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
IP route cache hash table entries: 16384 (order: 4, 65536 bytes)
TCP established hash table entries: 65536 (order: 7, 524288 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 65536 bind 65536)
TCP reno registered
NET: Registered protocol family 1
cpufreq: Init kirkwood cpufreq driver
cpufreq: High frequency: 1600000KHz - Low frequency: 533333KHz
cpufreq: Setting CPU Frequency to 1600000 KHz
cpufreq: Setting PowerSaveState to off
XOR registered 4 channels
XOR 2nd invalidate WA enabled
mvCesaInit: sessions=640, queue=64, pSram=f0000000
Warning: TS unit is powered off.
gpio_dev = fd00000
LED_SET_CTL_IOC_NUM= 6702
High gpio polarity = 50
High gpio polarity = 70
Enable Interrupt
mv88f6281_wdt: Watchdog Timer timeout = 8 sec.
mv88f6281_wdt: HW Watchdog timeout    = 15 sec.
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
fuse init (API version 7.12)
SGI XFS with security attributes, large block/inode numbers, no debug enabled
SGI XFS Quota Management subsystem
yaffs built Jun 23 2017 10:49:20 Installing.




YAFFS-WARNING CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED selected.



msgmni has been set to 990
alg: No test for cipher_null (cipher_null-generic)
alg: No test for ecb(cipher_null) (ecb-cipher_null)
alg: No test for digest_null (digest_null-generic)
alg: No test for compress_null (compress_null-generic)
alg: No test for stdrng (krng)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
io scheduler noop registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
console [ttyS0] enabled
brd: module loaded
loop: module loaded
Integrated Sata device found
IRQ 21/mvSata: IRQF_DISABLED is not guaranteed on shared IRQs
Wake up disk0......
Wake up disk1......
scsi0 : Marvell SCSI to SATA adapter
scsi1 : Marvell SCSI to SATA adapter
scsi 0:0:0:0: Direct-Access              WD30EFRX-68EUZN0 82.0 PQ: 0 ANSI: 5
EnablePowerSaving
PowerSavingTime = 15
sd 0:0:0:0: [sda] Sector size 0 reported, assuming 512.
sd 0:0:0:0: [sda] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
sd 0:0:0:0: [sda] 0-byte physical blocks
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 23 00 10 00
sd 0:0:0:0: Attached scsi generic sg0 type 0
Loading Marvell Ethernet Driver:
  o Cached descriptors in DRAM
  o DRAM SW cache-coherency
  o 1 Giga ports supported
  o Single RX Queue support - ETH_DEF_RXQ=0
  o Single TX Queue support - ETH_DEF_TXQ=0
  o TCP segmentation offload (TSO) supported
  o Large Receive offload (LRO) supported
  o Receive checksum offload supported
  o Transmit checksum offload supported
  o Network Fast Processing (Routing) supported - (Disabled)
  o Driver ERROR statistics enabled
  o Proc tool API enabled
  o SKB Reuse supported - (Disabled)
  o SKB Recycle supported - (Disabled)
  o Rx descripors: q0=128
  o Tx descripors: q0=532
  o Loading network interface(s):
     o register under mv88fx_eth platform
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
sd 0:0:0:0: [sda] Sector size 0 reported, assuming 512.
     o eth0, ifindex = 2, GbE port = 0

mvFpRuleDb (d1090000): 16384 entries, 65536 bytes
Counter=0, opIdx=6, overhead=16
Counter=1, opIdx=2, overhead=0
Counter=2, opIdx=1, overhead=18
Counter=3, opIdx=2, overhead=0
NAND device: Manufacturer ID: 0x92, Chip ID: 0xf1 (Unknown NAND 128MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 100 at 0x000000c80000
Bad eraseblock 200 at 0x000001900000
9 cmdlinepart partitions found on MTD device nand_mtd
Using command line partition definition
Creating 9 MTD partitions on "nand_mtd":
0x000000000000-0x000000100000 : "uboot"
 sda:
0x000000100000-0x000000180000 : "uboot_env"
0x000000180000-0x000000200000 : "key_store"
0x000000200000-0x000000280000 : "info"
0x000000280000-0x000000c80000 : "etc"
0x000000c80000-0x000001680000 : "kernel_1"
0x000001680000-0x000004640000 : "rootfs1"
0x000004640000-0x000005040000 : "kernel_2"
0x000005040000-0x000008000000 : "rootfs2"
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci_marvell ehci_marvell.70059: Marvell Orion EHCI
ehci_marvell ehci_marvell.70059: new USB bus registered, assigned bus number 1
 sda1 sda2
sd 0:0:0:0: [sda] Sector size 0 reported, assuming 512.
sd 0:0:0:0: [sda] Attached SCSI disk
ehci_marvell ehci_marvell.70059: irq 19, io base 0xf1050100
ehci_marvell ehci_marvell.70059: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
uhci_hcd: USB Universal Host Controller Interface driver
usbcore: registered new interface driver usblp
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
usbcore: registered new interface driver ums-usbat
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
rtc-pcf8563 0-0051: chip found, driver version 0.4.3
rtc-pcf8563 0-0051: rtc core: registered rtc-pcf8563 as rtc0
md: linear personality registered for level -1
md: raid0 personality registered for level 0
md: raid1 personality registered for level 1
cpufreq: Setting CPU Frequency to 1600000 KHz
cpufreq: Setting PowerSaveState to off
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
mmc0: mvsdio driver initialized, lacking card detect (fall back to polling)
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
TCP cubic registered
NET: Registered protocol family 10
lo: Disabled Privacy Extensions
Mobile IPv6
IPv6 over IPv4 tunneling driver
sit0: Disabled Privacy Extensions
ip6tnl0: Disabled Privacy Extensions
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
rtc-pcf8563 0-0051: setting system clock to 2018-04-11 12:35:10 UTC (1523450110)
Freeing init memory: 2872K
usb 1-1: new high speed USB device using ehci_marvell and address 2
In hub_port_init, and number is 1, retry 0, port 1 .....
usb 1-1: configuration #1 chosen from 1 choice
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
eth0: mac address changed
egiga0: link down
egiga0: started
ADDRCONF(NETDEV_UP): egiga0: link is not ready
yaffs: dev is 32505862 name is "mtdblock6" ro
yaffs: passed flags ""
yaffs: Attempting MTD mount of 31.6,"mtdblock6"
yaffs: restored from checkpoint
yaffs_read_super: isCheckpointed 1
egiga0: link up, full duplex, speed 100 Mbps
ADDRCONF(NETDEV_CHANGE): egiga0: link becomes ready
yaffs: dev is 32505860 name is "mtdblock4" rw
yaffs: passed flags ""
yaffs: Attempting MTD mount of 31.4,"mtdblock4"
yaffs_read_super: isCheckpointed 0
egiga0: link down
NTFS driver 2.1.29 [Flags: R/O MODULE].
tntfs: module license 'Commercial. For support email ntfs-support@tuxera.com.' taints kernel.
Disabling lock debugging due to kernel taint
Tuxera NTFS driver 3011.12.23 [Flags: R/W MODULE].
PPP generic driver version 2.4.2
PPP MPPE Compression module registered
PPP Deflate Compression module registered
NET: Registered protocol family 24
PPP BSD Compression module registered
egiga0: link up, full duplex, speed 100 Mbps
md: md0 stopped.
md: bind<sda2>
md0: detected capacity change from 0 to 3000079745024
 md0: unknown partition table
EXT4-fs (md0): barriers disabled
kjournald2 starting: pid 1557, dev md0:8, commit interval 5 seconds
EXT4-fs (md0): warning: maximal mount count reached, running e2fsck is recommended
EXT4-fs (md0): internal journal on md0:8
EXT4-fs (md0): delayed allocation enabled
EXT4-fs: file extents enabled
EXT4-fs: mballoc enabled
EXT4-fs (md0): recovery complete
EXT4-fs (md0): mounted filesystem with writeback data mode
DisablePowerSaving
TimerState = 1
EnablePowerSaving
PowerSavingTime = 15
PCI: enabling device 0000:00:01.0 (0140 -> 0142)
xhci_hcd 0000:00:01.0: xHCI Host Controller
xhci_hcd 0000:00:01.0: new USB bus registered, assigned bus number 2
xhci_hcd 0000:00:01.0: irq 9, io mem 0xe0000000
usb usb2: config 1 interface 0 altsetting 0 endpoint 0x81 has no SuperSpeed companion descriptor
usb usb2: configuration #1 chosen from 1 choice
xHCI xhci_add_endpoint called for root hub
xHCI xhci_check_bandwidth called for root hub
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 4 ports detected
Adding 524280k swap on /i-data/.system/swap_ul6545p.  Priority:-1 extents:3 across:540664k
svc: failed to register lockdv1 RPC service (errno 97).
GbE port 0: TxEnable WA - Enabled, deep=1, tx_en_bk=1
Re: nsa 325v2 vs debian noob questions
April 11, 2018 05:46PM
Carlo,

No it is not mormal. Try the dump again with a more descriptive file name

nanddump --noecc --omitoob -f mtd0.nsa325 /dev/mtd0
and list it to check the size.
ls -lh mtd0.nsa325

Everything you post looks good.

So you should try kwboot and if you can run the new u-boot 2017.07-tld-1 with kwboot, then you can flash the new u-boot image and its default envs image.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 12, 2018 07:59AM
here we go

/ # ls -lsa
   0 drwxr-xr-x   19 root     root             0 Jan  1  1970 .
   0 drwxr-xr-x   19 root     root             0 Jan  1  1970 ..
   0 drwxr-xr-x    2 root     root             0 Apr 12 14:37 bin
   0 drwxr-xr-x    6 root     root             0 Apr 12 14:37 dev
   0 drwxr-xr-x    2 root     root             0 Jun 23  2017 e-data
   0 drwxr-xr-x   16 root     root             0 Apr 12 14:39 etc
   0 drwxr-xr-x    3 root     root             0 Jun 23  2017 home
   0 drwxrwxrwx    3 root     root             0 Jan 26  2015 i-data
   4 -rwxr-xr-x    1 root     root          3013 Jun 21  2017 init
   0 drwxr-xr-x    4 root     root             0 Apr 12 14:37 lib
   0 lrwxrwxrwx    1 root     root            11 Jun 23  2017 linuxrc -> bin/busybox
   0 drwxr-xr-x    5 root     root             0 Apr 12 14:37 mnt
   0 dr-xr-xr-x   98 root     root             0 Jan  1  1970 proc
   1 drwxr-xr-x   10 root     root          1024 Jun 23  2017 ram_bin
   0 drwxr-xr-x    2 root     root             0 Jun 23  2017 root
   0 drwxr-xr-x    2 root     root             0 Apr 12 14:37 sbin
   0 drwxr-xr-x   11 root     root             0 Jan  1  1970 sys
   0 drwxrwxrwx    7 root     root             0 Apr 12 14:51 tmp
   1 drwxr-xr-x    8 root     root          1024 Jun 21  2017 usr
   0 drwxr-xr-x   11 root     root             0 Jun 23  2017 var
   0 drwxr-xr-x    6 root     root             0 Jun 23  2017 zyxel

/ # nanddump --noecc --omitoob -f mtd0.nsa325 /dev/mtd0
nanddump: unrecognized option '--noecc'
Usage: nanddump [OPTIONS] MTD-device
Dumps the contents of a nand mtd partition.

           --help               display this help and exit
           --version            output version information and exit
-f file    --file=file          dump to file
-i         --ignoreerrors       ignore errors
-l length  --length=length      length
-o         --omitoob            omit oob data
-b         --omitbad            omit bad blocks from the dump
-p         --prettyprint        print nice (hexdump)
-s addr    --startaddress=addr  start address

/ # nanddump -i --omitoob -f mtd0.nsa325 /dev/mtd0
Block size 131072, page size 2048, OOB size 64
Dumping data starting at 0x00000000 and ending at 0x00100000...

[code/ # ls -lsa
0 drwxr-xr-x 19 root root 0 Apr 12 14:52 .
0 drwxr-xr-x 19 root root 0 Apr 12 14:52 ..
0 drwxr-xr-x 2 root root 0 Apr 12 14:37 bin
0 drwxr-xr-x 6 root root 0 Apr 12 14:37 dev
0 drwxr-xr-x 2 root root 0 Jun 23 2017 e-data
0 drwxr-xr-x 16 root root 0 Apr 12 14:39 etc
0 drwxr-xr-x 3 root root 0 Jun 23 2017 home
0 drwxrwxrwx 3 root root 0 Jan 26 2015 i-data
4 -rwxr-xr-x 1 root root 3013 Jun 21 2017 init
0 drwxr-xr-x 4 root root 0 Apr 12 14:37 lib
0 lrwxrwxrwx 1 root root 11 Jun 23 2017 linuxrc -> bin/busybox
0 drwxr-xr-x 5 root root 0 Apr 12 14:37 mnt
1024 -rw-r--r-- 1 root root 1048576 Apr 12 14:52 mtd0.nsa325
0 dr-xr-xr-x 100 root root 0 Jan 1 1970 proc
1 drwxr-xr-x 10 root root 1024 Jun 23 2017 ram_bin
0 drwxr-xr-x 2 root root 0 Jun 23 2017 root
0 drwxr-xr-x 2 root root 0 Apr 12 14:37 sbin
0 drwxr-xr-x 11 root root 0 Jan 1 1970 sys
0 drwxrwxrwx 7 root root 0 Apr 12 14:53 tmp
1 drwxr-xr-x 8 root root 1024 Jun 21 2017 usr
0 drwxr-xr-x 11 root root 0 Jun 23 2017 var
0 drwxr-xr-x 6 root root 0 Jun 23 2017 zyxel
[/code]

/ # ls -lh mtd0.nsa325
-rw-r--r--    1 root     root        1.0M Apr 12 14:52 mtd0.nsa325

i gave reset
i've noticed that it writes
eth0: mac address changed
is it worrysome?

i've rebooted and...
/ # ls -lsa
   0 drwxr-xr-x   19 root     root             0 Jan  1  1970 .
   0 drwxr-xr-x   19 root     root             0 Jan  1  1970 ..
   0 drwxr-xr-x    2 root     root             0 Apr 12 14:55 bin
   0 drwxr-xr-x    6 root     root             0 Apr 12 14:56 dev
   0 drwxr-xr-x    2 root     root             0 Jun 23  2017 e-data
   0 drwxr-xr-x   16 root     root             0 Apr 12 14:57 etc
   0 drwxr-xr-x    3 root     root             0 Jun 23  2017 home
   0 drwxrwxrwx    3 root     root             0 Jan 26  2015 i-data
   4 -rwxr-xr-x    1 root     root          3013 Jun 21  2017 init
   0 drwxr-xr-x    4 root     root             0 Apr 12 14:56 lib
   0 lrwxrwxrwx    1 root     root            11 Jun 23  2017 linuxrc -> bin/busybox
   0 drwxr-xr-x    5 root     root             0 Apr 12 14:55 mnt
   0 dr-xr-xr-x   98 root     root             0 Jan  1  1970 proc
   1 drwxr-xr-x   10 root     root          1024 Jun 23  2017 ram_bin
   0 drwxr-xr-x    2 root     root             0 Jun 23  2017 root
   0 drwxr-xr-x    2 root     root             0 Apr 12 14:55 sbin
   0 drwxr-xr-x   11 root     root             0 Jan  1  1970 sys
   0 drwxrwxrwx    7 root     root             0 Apr 12 14:59 tmp
   1 drwxr-xr-x    8 root     root          1024 Jun 21  2017 usr
   0 drwxr-xr-x   11 root     root             0 Jun 23  2017 var
   0 drwxr-xr-x    6 root     root             0 Jun 23  2017 zyxel

maybe i' should move that file somewhere?
Re: nsa 325v2 vs debian noob questions
April 12, 2018 05:10PM
Carlo,

>
> / # ls -lh mtd0.nsa325
> -rw-r--r--    1 root     root        1.0M Apr 12 14:52 mtd0.nsa325
>

The nanddump was OK. Note the size is 1M even. It means there is no OOB. Stock OS did not recognize -noecc option. It is OK. However, you could have used the NAND dump binary I provided in the u-boot installation thread.

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

A. Flashing Instruction:


Installation is the same for each u-Boot image, the instruction below is written to include all boxes. So choose the platform name that you are installing for, and copy/paste the appropriate commands.

If you are running kernel that do not provide mtd-utils and uboot-tools (fw_setenv, fw_printenv, flash_erase, nandwrite), you can download the NAND and U-Boot tools binaries here in this thread.

> maybe i' should move that file somewhere?

Yes, copy it to the Debian rootfs drive you've already created.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 13, 2018 01:48PM
Quote
Bodhi
However, you could have used the NAND dump binary I provided in the u-boot installation thread.
as i said before i'm soooooo noooob, there's so much info scattered around, but no organic guide....

however, i've somehow managed to run the nanddump from your package:
i've taken a usb drive, partitioned it in two: the first partition is a fat32

first partition
/e-data/3057-F1B5 # ./nanddump --noecc --omitoob -l 0x80000 -f mtd0 /dev/mtd0
Block size 131072, page size 2048, OOB size 64
Dumping data starting at 0x00000000 and ending at 0x00080000...
/e-data/3057-F1B5 # killall: twonkystarter: no process killed
chmod: /i-data/md0/.media/cdsAgent: Read-only file system
chmod: /i-data/md0/.media/cdsAgent: Read-only file system

however the mtd0 now is persistant but it's got a different size from the other thing i've created with the "standard" nanddump

/e-data/3057-F1B5 # nanddump -i --omitoob -l 0x80000 -f mtd0-original /dev/mtd0
Block size 131072, page size 2048, OOB size 64
Dumping data starting at 0x00000000 and ending at 0x00100000...
/e-data/3057-F1B5 # nanddump -i --omitoob -l 0x80000 -f mtd0-original2 /dev/mtd0
Block size 131072, page size 2048, OOB size 64
Dumping data starting at 0x00000000 and ending at 0x00100000...
/e-data/3057-F1B5 # ls -lsh
1580 -rwxrwxrwx    1 nobody   root        1.5M Nov 15  2010 busybox
 772 -rwxrwxrwx    1 nobody   root      768.6K Jun 20  2011 e2fsck
  28 -rwxrwxrwx    1 nobody   root       25.0K Jun 30  2014 flash_erase
   4 -rwxrwxrwx    1 nobody   root         329 May 17  2016 fw_env.config
 656 -rwxrwxrwx    1 nobody   root      652.8K May 17  2016 fw_printenv
 512 -rwxrwxrwx    1 nobody   root      512.0K Apr 13  2018 mtd0
1024 -rwxrwxrwx    1 nobody   root        1.0M Apr 13 18:42 mtd0-original
1024 -rwxrwxrwx    1 nobody   root        1.0M Apr 13 18:42 mtd0-original2
  28 -rwxrwxrwx    1 nobody   root       25.9K Jun 30  2014 nanddump
  32 -rwxrwxrwx    1 nobody   root       28.9K Jun 30  2014 nandwrite

should i go on?
Re: nsa 325v2 vs debian noob questions
April 13, 2018 05:16PM
Carlo,

They look OK.

512 -rwxrwxrwx    1 nobody   root      512.0K Apr 13  2018 mtd0
1024 -rwxrwxrwx    1 nobody   root        1.0M Apr 13 18:42 mtd0-original

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 13, 2018 05:48PM
oki: tomorrow i'm going to give my try

should i prepare the usb stick with the fat 32 partition as in buttzy post?

or straiglt follow instructions in uboot and kernel/rootfs post?

thanks
Re: nsa 325v2 vs debian noob questions
April 13, 2018 08:20PM
Carlo,

> or straiglt follow instructions in uboot and
> kernel/rootfs post?

This.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 14, 2018 11:04AM
hi,
i've followed your instructions, put the debian system (i didn't get the linux file) where it should be, i've gone one with the uboot procedure, but as i checked w_env.config i noticed that's not mtd0

/ # cat /etc/fw_env.config
# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundand
# 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
# NAND example
/dev/mtd1               0x0000          0x20000         0x20000                 4

should i go on?
Re: nsa 325v2 vs debian noob questions
April 14, 2018 05:36PM
Carlo Wrote:
-------------------------------------------------------
> hi,
> i've followed your instructions, put the debian
> system (i didn't get the linux file) where it
> should be, i've gone one with the uboot procedure,
> but as i checked w_env.config i noticed that's not
> mtd0
>
>
> / # cat /etc/fw_env.config
> # Configuration file for fw_(printenv/saveenv)
> utility.
> # Up to two entries are valid, in this case the
> redundand
> # 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
> # NAND example
> /dev/mtd1               0x0000          0x20000   
>      0x20000                 4
>
>
> should i go on?

Yes.

This is only relevant after you installed new u-boot. This file fw_env.config is to allow access to the NAND area to set u-boot envs inside Linux. It will not affect booting.

For the 2017.07-tld-1 for NSA325, the correct content is:

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

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 14, 2018 05:55PM
ok
if i give ...
/usr/sbin # /usr/sbin/flash_erase /dev/mtd0 0xc0000 1
-/bin/sh: /usr/sbin/flash_erase: not found

should i use flash_erase from this tar?
or use the default flash_eraseall?



Edited 1 time(s). Last edit at 04/14/2018 06:01PM by Carlo.
Re: nsa 325v2 vs debian noob questions
April 14, 2018 08:02PM
Carlo,

> if i give ...
>
> /usr/sbin # /usr/sbin/flash_erase /dev/mtd0
> 0xc0000 1
> -/bin/sh: /usr/sbin/flash_erase: not found
>
>
> should i use flash_erase from
> this
> tar
?

Yes.

> or use the default flash_eraseall?

No. You are not erasing all of mtd0, only 1 block inside it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 15, 2018 03:20AM
fw_setenv mtdparts 'xxxxxxxxx'

/mnt/backup # cat current_envs2.txt 
bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2) root=/dev/nfs rw init=/init
bootcmd=nand read.e 0x2000000 $(kernel_addr) 0xA00000; bootm 0x2000000
bootdelay=2
baudrate=115200
loads_echo=0
ipaddr=10.4.52.165
serverip=10.4.52.7
rootpath=/srv/ubuntu
netmask=255.255.255.0
nandEcc=1bit
kernel_addr=C80000
MODEL_ID=AE03
PRODUCT_NAME=NSA-325v2
FEATURE_BIT=00
CONTRY_TYPE=FF
VENDOR_NAME=MitraStar Technology Corp.
run_diag=yes
ethaddr=4C:9E:FF:5B:4F:D1

should the xxxxxxxx be replaced by the whole string
"nand_mtd:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2) root=/dev/nfs rw init=/init
bootcmd=nand read.e 0x2000000 $(kernel_addr) 0xA00000; bootm 0x2000000" ?
Re: nsa 325v2 vs debian noob questions
April 15, 2018 04:14AM
Re: nsa 325v2 vs debian noob questions
April 15, 2018 05:05AM
i've reached step 9 of the uboot guide.. my printenv seems a bit redundant...

/mnt/boot/dts # fw_printenv
bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2) root=/dev/nfs rw init=/init
bootcmd=nand read.e 0x2000000 $(kernel_addr) 0xA00000; bootm 0x2000000
bootdelay=2
baudrate=115200
loads_echo=0
ipaddr=10.4.52.165
serverip=10.4.52.7
rootpath=/srv/ubuntu
netmask=255.255.255.0
nandEcc=1bit
kernel_addr=C80000
MODEL_ID=AE03
PRODUCT_NAME=NSA-325v2
FEATURE_BIT=00
CONTRY_TYPE=FF
VENDOR_NAME=MitraStar Technology Corp.
run_diag=yes
arcNumber=4495
ethaddr=4C:9E:FF:5B:4F:D1
mtdparts=nand_mtd:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2)
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi; sleep 3
dtb_file=kirkwood-nsa325.dtb
Re: nsa 325v2 vs debian noob questions
April 15, 2018 05:48PM
Carlo Wrote:
-------------------------------------------------------
> i've reached step 9 of the uboot guide.. my
> printenv seems a bit redundant...
>
>
> /mnt/boot/dts # fw_printenv
> bootargs=console=ttyS0,115200
> mtdparts=nand_mtd:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2)
> root=/dev/nfs rw init=/init
> bootcmd=nand read.e 0x2000000 $(kernel_addr)
> 0xA00000; bootm 0x2000000
> bootdelay=2
> baudrate=115200
> loads_echo=0
> ipaddr=10.4.52.165
> serverip=10.4.52.7
> rootpath=/srv/ubuntu
> netmask=255.255.255.0
> nandEcc=1bit
> kernel_addr=C80000
> MODEL_ID=AE03
> PRODUCT_NAME=NSA-325v2
> FEATURE_BIT=00
> CONTRY_TYPE=FF
> VENDOR_NAME=MitraStar Technology Corp.
> run_diag=yes
> arcNumber=4495
> ethaddr=4C:9E:FF:5B:4F:D1
> mtdparts=nand_mtd:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2)
> bootcmd_uenv=run uenv_load; if test $uenv_loaded
> -eq 1; then run uenv_import; fi; sleep 3
> dtb_file=kirkwood-nsa325.dtb
>

At step 9, the evns should not be new. The above envs are stock.

Check your fw_env.config file, it should be like below.
cat /etc/fw_env.config 

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

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 15, 2018 06:01PM
this is from the "nand" (hope it's correct)
/ # cat /etc/fw_env.config
# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundand
# 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
# NAND example
/dev/mtd1               0x0000          0x20000         0x20000                 4

this is from the sata disk i've put the kernel on
/ # cat /mnt/etc/fw_env.config 
# MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000
Re: nsa 325v2 vs debian noob questions
April 15, 2018 06:13PM
Carlo,

You are still inside stock OS. So the one being used is:
/dev/mtd1               0x0000          0x20000         0x20000                 4

If you want to verify your envs were flashed and set correctly:

cp -a /etc/fw_env.config /etc/fw_env.config.stock
echo "/dev/mtd0 0xc0000 0x20000 0x20000" > /etc/fw_env.config
fw_printenv

Now you can choose to leave the stock OS fw_env.config with the new content, or restore it back (it does not matter, since you will not boot into stock anymore.)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: nsa 325v2 vs debian noob questions
April 15, 2018 06:18PM
so... i'm ready to reboot?

/ # fw_printenv
arcNumber=2097
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr
 $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run l
oad_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
device=0:1
devices=usb ide mmc
disks=0 1 2 3
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
dtb_file=/boot/dts/kirkwood-pogo_e02.dtb
load_dtb_addr=0x1c00000
load_initrd_addr=0x1100000
load_uimage_addr=0x800000
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
machid=0x831
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=192.168.0.220
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15

looks a bit bigger than standard one



Edited 1 time(s). Last edit at 04/15/2018 06:21PM by Carlo.
Re: nsa 325v2 vs debian noob questions
April 16, 2018 12:05AM
Carlo,

> so... i'm ready to reboot?

Not yet. There are NSA325 specifics that you have not adjusted. See the bold parts in the quote below.

Quote

8. Flashing default u-boot envs image (if you are upgrading from 2016.05-tld-1 u-boot, you can skip this step 8).

As described in step 1, u-boot envs must be defined in /etc/fw_env.config as

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

This default envs image supports booting with multiple disk drives (and hubs) attached. The disk drives could be any type (usb, sata, sd card). The scanning logic and default envs were set to automatically boot the box with the following required configuration:

For whatever reason, if you can't set up your configuration to satisfy the following 4 requirements, then don't flash this defaut envs image. It might not boot properly. In this case, section C below can be used to tailor the envs to your specific configuration.

r1. There must be only one partition among all partitions from all drives that contains the kernel files. The 2 kernel files are /boot/uImage and /boot/uInitrd.
r2. The partition that contains the 2 kernel files must be partition 1 in a disk drive
r3. The partition that contains the rootfs must be labeled rootfs
r4. The rootfs partition is recommended to be type Ext3 (this is not a hard requirement, ext4 should boot OK, but Ext3 will ensure no problem).

So the bottom line is if you have only one rootfs in a single Ext3 partition, which is labeled as rootfs, then you're all set.

a. Download the default u-boot envs at Dropbox:

uboot.2016.05-tld-1.environment.bodhi.tar
md5:
3823eef10011b864859d31a76470e0e3
sha256:
c8db95a4225e8d78bdaaaa372bd5a87e4b98f3448dd9c62fc96c72b2df1a997c

This tarball includes 3 files:

uboot.2016.05-tld-1.environment.img (the default envs image to be flashed)
uboot.2016.05-tld-1.environment (the content of the default envs in text format)
uboot.2016.05-tld-1.environment.64K.img (small envs image to be flashed on HP T5325 only).

b. Extract the archive to /tmp
cd /tmp
tar -xf uboot.2016.05-tld-1.environment.bodhi.tar

c. Save current envs with fw_printenv, or just copy/paste the listing into a text file.
fw_printenv > current_envs.txt

d. Flash u-boot envs to NAND location 0xC0000.

Be extra careful with the next 2 commands, you should see output that look like below. If there is error, then do not reboot, post your problem here so we can help.

/usr/sbin/flash_erase /dev/mtd0 0xc0000 1
Expected output:
Erase Total 1 Units
Performing Flash Erase of length 131072 at offset 0xc0000 done

/usr/sbin/nandwrite -s 786432 /dev/mtd0 uboot.2016.05-tld-1.environment.img
Expected output:
Writing data to block 6 at offset 0xc0000

e. Modify the following u-boot variables using fw_setenv:

Note that arcNumber and machid are not necessary if you are booting with FDT kernel 3.17+ in the latest kernel and rootfs thread. But it does not hurt to set them anyway.

archNumber and machid are required for non-FDT kernel (3.16.x or earlier)

Also note that only some boxes need machid, some don't (so the command fw_setenv machid below clears them).

for Pogo V4/Mobile:
fw_setenv arcNumber 3960
fw_setenv machid f78

for iConnect:
fw_setenv arcNumber 2870
fw_setenv machid

for Stora:
fw_setenv arcNumber 2743
fw_setenv machid

for Dockstar:
fw_setenv arcNumber 2998
fw_setenv machid

for Pogo E02:
fw_setenv arcNumber 3542
fw_setenv machid dd6

for GoFlex Home:
fw_setenv arcNumber 3338
fw_setenv machid


for GoFlex Net:
fw_setenv arcNumber 3089
fw_setenv machid

for Sheevaplug:
fw_setenv arcNumber 2097
fw_setenv machid

for NSA325:
fw_setenv arcNumber 4495
fw_setenv machid


for NSA320:
fw_setenv arcNumber 3956
fw_setenv machid

for NSA310S/320S:
fw_setenv arcNumber 4931
fw_setenv machid

for NSA310:
fw_setenv arcNumber 4022
fw_setenv machid


Then for all boxes, restore these 2 envs using the saved envs text in step c (replace xxx with the real saved values)
fw_setenv mtdparts 'xxxxxxxxx'
fw_setenv ethaddr 'xx:xx:xx:xx:xx:xx'

Note: for boxes that boot with SATA as rootfs. Please make this adjustment if your boot drive is SATA:
fw_setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi; sleep 3'
(This will help the "ide reset" to work properly. There seems to be a bug in u-boot that if you do "ide reset" too quickly in succession, the SATA drive might have problem spinning up).

f. Adjust the DTB name to boot with a rootfs that has FDT kernel 3.17+ (this is the normal case):

Find your box DTB file in the rootfs /boot/dts directory and adjust the env to it. For example, if the box is the Dockstar
fw_setenv dtb_file '/boot/dts/kirkwood-dockstar.dtb'


In the special case when you are booting with a non-FDT kernel 3.16 or earlier, or if you have appended the DTB to uImage. Remove the DTB file env. If not sure please post question before continuing.
fw_setenv dtb_file

h. For sanity check, list you envs again
fw_printenv

If there is error in listing u-boot envs, stop here and post your problem so we can help.

Remember to save away your old envs text file created in step c for future reference in case more need to be restored.

i. Done step 8.

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