planning to revert NSA325 V2 to stock

This forum is for topics dealing with problems with software specifically in the ARMv5 repo.

planning to revert NSA325 V2 to stock

Postby papou » Tue Oct 30, 2018 9:45 pm

Hi,
i may be able to provide you with the contents of the mtdparts as well

After several year of using Archlinux on one NSA-325 V2 (nicknamed A) and keeping another one in stock (nicknamed B), I plan to give away both.

I have exploited the information provided by Bodi in the the post
"Backup and Restore NAND mtds - Pogoplug V4 original MTD partitions"
https://forum.doozan.com/read.php?3,29362,29392

I would like your comments on the steps I plan to follow

1/ enable rsh on B

2/ using PuTTY, log into B as admin

3/ verify the size of Partitions
$this->bbcode_second_pass_code('', '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"')

4/ verify can write to public folder on first drive
$this->bbcode_second_pass_code('', 'ls /i-data/1c4ced0b/autre/')

5/ dump the content of each partition
I have a question : should I use the options --omitbad and -l 0x80000 ??
It seems the option --noecc is not available


$this->bbcode_second_pass_code('', './sbin/nanddump --omitoob -f /i-data/1c4ced0b/autre/mtd0 /dev/mtd0
./sbin/nanddump --omitoob -f /i-data/1c4ced0b/autre/mtd1 /dev/mtd1
./sbin/nanddump --omitoob -f /i-data/1c4ced0b/autre/mtd2 /dev/mtd2
./sbin/nanddump --omitoob -f /i-data/1c4ced0b/autre/mtd3 /dev/mtd3
./sbin/nanddump --omitoob -f /i-data/1c4ced0b/autre/mtd4 /dev/mtd4
./sbin/nanddump --omitoob -f /i-data/1c4ced0b/autre/mtd5 /dev/mtd5
./sbin/nanddump --omitoob -f /i-data/1c4ced0b/autre/mtd6 /dev/mtd6
./sbin/nanddump --omitoob -f /i-data/1c4ced0b/autre/mtd7 /dev/mtd7
./sbin/nanddump --omitoob -f /i-data/1c4ced0b/autre/mtd8 /dev/mtd8')

6/execute fw_printenv
$this->bbcode_second_pass_code('', './zyxel/sbin/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=xx:xx:xx:xx:xx:xx
root@NSA325:')

I am quite surprise to see the IP address for ipaddr and serverip

7/ using PuTTY, log into A as root

8/ transfer the files to A

9/ verify the partitions match the earlier one
$this->bbcode_second_pass_code('', ' 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"')

10/ Check that ther are no bad blocks
$this->bbcode_second_pass_code('', 'dmesg | grep -i bad')

11/ install nandwrite and fw_printenv
$this->bbcode_second_pass_code('', 'pacman -S mtd-utils uboot-tools')

12/ verify nandwrite is where it is expected
$this->bbcode_second_pass_code('', 'ls ./usr/bin/na*
./usr/bin/named-journalprint ./usr/bin/namei ./usr/bin/nanddump ./usr/bin/nandwrite
./usr/bin/named-rrchecker ./usr/bin/nameif ./usr/bin/nandtest ./usr/bin/nano')

13/ verify fw_printenv is here it is expected
$this->bbcode_second_pass_code('', 'ls ./usr/bin/fw_printenv
./usr/bin/fw_printenv')

14/ edit the fw_configuration file and append 2 lines
$this->bbcode_second_pass_code('', 'nano ./etc/fw_env.config')
$this->bbcode_second_pass_quote('', 'N')AS325
/dev/mtd1 0x0 0x20000 0x20000


15/ run fw_printenv in case
$this->bbcode_second_pass_code('', './usr/bin/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
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
MODEL_ID=AE03
PRODUCT_NAME=NSA-325v2
FEATURE_BIT=00
CONTRY_TYPE=FF
VENDOR_NAME=MitraStar Technology Corp.
run_diag=yes
ethaddr=xx:xx:xx:xx:xx:xx:xx
arcNumber=4495
bootargs_stock=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
bootargs_linux=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/sda2 rw rootwait loglevel=8
bootcmd_linux=setenv bootargs $(bootargs_linux); ide reset; ext2load ide 0:1 $(loadaddr) /uImage; bootm $(loadaddr)
bootcmd_stock=setenv bootargs $(bootargs_stock); nand read.e $(loadaddr) $(kernel_addr) 0xA00000; bootm $(loadadr)
to_stock=setenv mainlineLinux no; setenv bootcmd \'run bootcmd_stock\'; saveenv; reset
to_linux=setenv mainlineLinux yes; setenv bootcmd \'run bootcmd_linux\'; saveenv; reset
stdin=serial
stdout=serial
stderr=serial
console=console=ttyS0,115200 mtdparts=nand_mtd:0xc0000@0(uboot)ro,0x7f00000@0x100000(root)
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
ethprime=egiga0
netbsd_en=no
vxworks_en=no
bootargs_root=root=/dev/nfs rw
bootargs_end=:::orion:eth0:none
image_name=uImage
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;
lcd0_enable=0
lcd0_params=640x480-16@60
disaMvPnp=no
ethmtu=1500
mvPhoneConfig=mv_phone_config=dev[0]:fxs,dev[1]:fxo
mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500
usb0Mode=host
yuk_ethaddr=00:00:00:EE:51:81
netretry=no
rcvrip=169.254.100.100
loadaddr=0x02000000
autoload=no
image_multi=yes
enaAutoRecovery=yes
kernel_addr=0x4640000
pcieTune=no
pcieTune1=no
ethact=egiga0
mainlineLinux=yes
bootcmd='run bootcmd_linux'')

once again, I am quite surprise to see the IP address for ipaddr and serverip

16/ erase each partition with the same erase size (a block is 128K, 2M is 16 blocks 00020000).
$this->bbcode_second_pass_code('', './usr/bin/flash_erase /dev/mtd0 0 16
./usr/bin/flash_erase /dev/mtd0 1 16
./usr/bin/flash_erase /dev/mtd0 2 16
./usr/bin/flash_erase /dev/mtd0 3 16
./usr/bin/flash_erase /dev/mtd0 4 16
./usr/bin/flash_erase /dev/mtd0 5 16
./usr/bin/flash_erase /dev/mtd0 6 16
./usr/bin/flash_erase /dev/mtd0 7 16
./usr/bin/flash_erase /dev/mtd0 8 16 ')

17/write each partition
$this->bbcode_second_pass_code('', './usr/bin/nandwrite --markbad /dev/mtd0 mtd0
./usr/bin/nandwrite --markbad /dev/mtd0 mtd1
./usr/bin/nandwrite --markbad /dev/mtd0 mtd2
./usr/bin/nandwrite --markbad /dev/mtd0 mtd3
./usr/bin/nandwrite --markbad /dev/mtd0 mtd4
./usr/bin/nandwrite --markbad /dev/mtd0 mtd5
./usr/bin/nandwrite --markbad /dev/mtd0 mtd6
./usr/bin/nandwrite --markbad /dev/mtd0 mtd7
./usr/bin/nandwrite --markbad /dev/mtd0 mtd8')

18/ reboot
$this->bbcode_second_pass_code('', 'systemctl reboot')

What do you think ?
papou
 
Posts: 5
Joined: Fri Oct 25, 2013 7:59 am

Re: planning to revert NSA325 V2 to stock

Postby papou » Tue Oct 30, 2018 11:32 pm

Well, after all this preparatory work,
I was tempted to go ahead...

I have an error with flash-erase :cry:

$this->bbcode_second_pass_code('', '$ su -
Password:
[root@alarm ~]# cd /
[root@alarm /]# ls
bin dev home lost+found mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr
[root@alarm /]# uname -r
4.2.5-1-ARCH
[root@alarm /]# ls -l /dev/mtd*
crw------- 1 root root 90, 0 Sep 14 22:22 /dev/mtd0
crw------- 1 root root 90, 1 Sep 14 22:22 /dev/mtd0ro
crw------- 1 root root 90, 2 Sep 14 22:22 /dev/mtd1
crw------- 1 root root 90, 3 Sep 14 22:22 /dev/mtd1ro
crw------- 1 root root 90, 4 Sep 14 22:22 /dev/mtd2
crw------- 1 root root 90, 5 Sep 14 22:22 /dev/mtd2ro
crw------- 1 root root 90, 6 Sep 14 22:22 /dev/mtd3
crw------- 1 root root 90, 7 Sep 14 22:22 /dev/mtd3ro
crw------- 1 root root 90, 8 Sep 14 22:22 /dev/mtd4
crw------- 1 root root 90, 9 Sep 14 22:22 /dev/mtd4ro
crw------- 1 root root 90, 10 Sep 14 22:22 /dev/mtd5
crw------- 1 root root 90, 11 Sep 14 22:22 /dev/mtd5ro
crw------- 1 root root 90, 12 Sep 14 22:22 /dev/mtd6
crw------- 1 root root 90, 13 Sep 14 22:22 /dev/mtd6ro
crw------- 1 root root 90, 14 Sep 14 22:22 /dev/mtd7
crw------- 1 root root 90, 15 Sep 14 22:22 /dev/mtd7ro
crw------- 1 root root 90, 16 Sep 14 22:22 /dev/mtd8
crw------- 1 root root 90, 17 Sep 14 22:22 /dev/mtd8ro
[root@alarm /]# ./usr/bin/flash_erase /dev/mtd0 0 16
flash_erase: error!: /dev/mtd0
error 13 (Permission denied)
')

I checked
$this->bbcode_second_pass_code('', '# dmesg | grep nand
[ 0.000000] Kernel command line: 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/sda2 rw rootwait loglevel=8
[ 13.931687] nand: device found, Manufacturer ID: 0x92, Chip ID: 0xf1
[ 13.938070] nand: Eon NAND 128MiB 3,3V 8-bit
[ 13.942540] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 14.012303] Creating 9 MTD partitions on "orion_nand":
[root@alarm /]# mtdinfo
Count of MTD devices: 9
Present MTD devices: mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6, mtd7, mtd8
Sysfs interface supported: yes

[root@alarm /]# sbin/flash_unlock -i /dev/mtd0
flash_unlock: error!: could not open: /dev/mtd0
error 13 (Permission denied)')

I have serial access as well

Doing so additional search, I found a post about how to identify the discrepancies in kernel
as revealed by uname -a

I appies the fix described elsewhere to copy the kernel onto the boot HD
$this->bbcode_second_pass_quote('', 'C')d /tmp
mkdir a1
mount /dev/sda1 /tmp/a1
cd /tmp/a1
mv uImage uImage.bak
cp /boot/uImage .
sync
sync
shutdown -r now


the latest ?? kirkwood-kernel is thus installed
$this->bbcode_second_pass_code('', 'uname -a
Linux alarm 4.4.162-1-ARCH #1 PREEMPT Sun Oct 28 04:26:25 UTC 2018 armv5tel GNU/ ')

the system is uptodate
$this->bbcode_second_pass_code('', 'pacman -Syyu
:: Synchronizing package databases...
core 189.2 KiB 2.64M/s 00:00 [##########################################] 100%
extra 1960.5 KiB 7.98M/s 00:00 [##########################################] 100%
community 4.3 MiB 6.88M/s 00:01 [##########################################] 100%
alarm 26.2 KiB 1312K/s 00:00 [##########################################] 100%
aur 4.4 KiB 0.00B/s 00:00 [##########################################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Packages (12) bind-tools-9.13.3-3 cryptsetup-2.0.5-1 cups-filters-1.21.3-2 harfbuzz-2.0.2-2 harfbuzz-icu-2.0.2-2
icu-63.1-2 libgcrypt-1.8.4-1 libxml2-2.9.8-6 poppler-0.70.1-1 sdl2-2.0.8-11 tzdata-2018g-1
webkit2gtk-2.22.2-2

Total Download Size: 34.46 MiB
Total Installed Size: 160.92 MiB
Net Upgrade Size: 0.79 MiB

:: Proceed with installation? [Y/n] y')

The error is still there

$this->bbcode_second_pass_code('', '[root@alarm /]# dmesg | grep nand
[ 0.000000] Kernel command line: 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/sda2 rw rootwait loglevel=8
[ 13.805478] nand: device found, Manufacturer ID: 0x92, Chip ID: 0xf1
[ 13.812052] nand: Eon NAND 128MiB 3,3V 8-bit
[ 13.816336] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 13.886032] Creating 9 MTD partitions on "orion_nand":
')
$this->bbcode_second_pass_code('', '[root@alarm /]# mtdinfo
Count of MTD devices: 9
Present MTD devices: mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6, mtd7, mtd8
Sysfs interface supported: yes
[root@alarm /]# sbin/flash_unlock -i /dev/mtd0
flash_unlock: error!: could not open: /dev/m[/quote]td0
error 13 (Permission denied)

[root@alarm /]# ls -l /dev/mtd*
crw------- 1 root root 90, 0 Sep 14 22:21 /dev/mtd0
crw------- 1 root root 90, 1 Sep 14 22:22 /dev/mtd0ro
crw------- 1 root root 90, 2 Sep 14 22:21 /dev/mtd1
crw------- 1 root root 90, 3 Sep 14 22:22 /dev/mtd1ro
crw------- 1 root root 90, 4 Sep 14 22:21 /dev/mtd2
crw------- 1 root root 90, 5 Sep 14 22:22 /dev/mtd2ro
crw------- 1 root root 90, 6 Sep 14 22:21 /dev/mtd3
crw------- 1 root root 90, 7 Sep 14 22:22 /dev/mtd3ro
crw------- 1 root root 90, 8 Sep 14 22:21 /dev/mtd4
crw------- 1 root root 90, 9 Sep 14 22:22 /dev/mtd4ro
crw------- 1 root root 90, 10 Sep 14 22:21 /dev/mtd5
crw------- 1 root root 90, 11 Sep 14 22:22 /dev/mtd5ro
crw------- 1 root root 90, 12 Sep 14 22:21 /dev/mtd6
crw------- 1 root root 90, 13 Sep 14 22:22 /dev/mtd6ro
crw------- 1 root root 90, 14 Sep 14 22:21 /dev/mtd7
crw------- 1 root root 90, 15 Sep 14 22:22 /dev/mtd7ro
crw------- 1 root root 90, 16 Sep 14 22:22 /dev/mtd8
crw------- 1 root root 90, 17 Sep 14 22:22 /dev/mtd8ro
')

As a side note, despite my /etc/fstab, the 2nd disk is no longer mounted
papou
 
Posts: 5
Joined: Fri Oct 25, 2013 7:59 am

Re: planning to revert NSA325 V2 to stock

Postby summers » Wed Oct 31, 2018 9:06 am

Is the problem just on /dev/mtd0? e.g. whatever you set its Read Only?

The problem was the kernel driver - it changed name at one stage of the kernel. Originally it was "nand_mtd", with modern kernel its "orion_nand". Anyway modern kernels use one, and stock NSA325 used the other .... mixing the two looked like it was working, except that mtd0 wasn't writeable ...
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: planning to revert NSA325 V2 to stock

Postby WarheadsSE » Wed Oct 31, 2018 12:02 pm

Assuming that your flash is intact at this point, get a serial console, and get to the u-boot prompt. From there, you can revert to the stock behaviors with $this->bbcode_second_pass_code('', 'run to_stock')
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: planning to revert NSA325 V2 to stock

Postby papou » Thu Nov 08, 2018 4:28 pm

Done successfully and trivially.
and not fun this box as standard.
installing FFP or any other package is a mess

So I am changing my mind again... ;-)

I have found external 8TB HD for 120€, so I am debating how many I'll buy

I want to play some more and put together a self-cloud storage solution

Thanks for the help
papou
 
Posts: 5
Joined: Fri Oct 25, 2013 7:59 am


Return to ARMv5

Who is online

Users browsing this forum: No registered users and 1 guest