Bad eraseblocks on NSA310 (4.4.97-1-ARCH) & uboot update

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

Re: Bad eraseblocks on NSA310 (4.4.97-1-ARCH) & uboot update

Postby summers » Sat Apr 28, 2018 6:52 am

OK lets see if we can pull together everything:

$this->bbcode_second_pass_code('', ' flash_erase /dev/mtd0 0 4
flash_erase /dev/mtd0 0xc0000 1
nandwrite /dev/mtd0 /boot/uboot-nsa310.kwb
nandwrite -s 0xc0000 /dev/mtd0 /boot/uboot-nsa310.env')

Give bad block errors.

$this->bbcode_second_pass_code('', 'mtdinfo /dev/mtd0')

Says that mtd0 is writable - this means we are using the right kernel driver

Setting /etc/fw_env.config to:
$this->bbcode_second_pass_code('', '/dev/mtd1 0x00000 0x20000 0x20000')
and
$this->bbcode_second_pass_code('', 'fw_printenv')
doesn't work.

Setting /etc/fw_env.config to:
$this->bbcode_second_pass_code('', '/dev/mtd0 0xc0000 0x20000 0x20000')
and
$this->bbcode_second_pass_code('', 'fw_printenv')
doesn't work.

If all this is true, then I've exaushed my knowledge. Something odd going on, but I don#'t know how to debug ....
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: Bad eraseblocks on NSA310 (4.4.97-1-ARCH) & uboot update

Postby arti74 » Sat Apr 28, 2018 7:35 am

Hello summers, thanks for your great help.
I've changed /etc/fw_env.config for:
$this->bbcode_second_pass_code('', '/dev/mtd1 0xc0000 0x20000 0x20000')
Now the fw_printenv command shows:
$this->bbcode_second_pass_code('', 'Cannot read bad block mark: Invalid argument')
Then the other commands:

flash_erase /dev/mtd0 0 4
$this->bbcode_second_pass_code('', 'flash_erase: Skipping bad block at 00000000
flash_erase: Skipping bad block at 00020000
flash_erase: Skipping bad block at 00040000
flash_erase: Skipping bad block at 00060000
Erasing 128 Kibyte @ 60000 -- 100 % complete ')
flash_erase /dev/mtd0 0xc0000 1
$this->bbcode_second_pass_code('', 'flash_erase: Skipping bad block at 000c0000
Erasing 128 Kibyte @ c0000 -- 100 % complete
[rtorrent@alarm ~]$ sudo nandwrite /dev/mtd0 /boot/uboot-nsa310.kwb
Writing data to block 0 at offset 0x0
Bad block at 0, 1 block(s) will be skipped
Writing data to block 1 at offset 0x20000
Bad block at 20000, 1 block(s) will be skipped
Writing data to block 2 at offset 0x40000
Bad block at 40000, 1 block(s) will be skipped
Writing data to block 3 at offset 0x60000
Bad block at 60000, 1 block(s) will be skipped
Writing data to block 4 at offset 0x80000
Bad block at 80000, 1 block(s) will be skipped
Writing data to block 5 at offset 0xa0000
Bad block at a0000, 1 block(s) will be skipped
Writing data to block 6 at offset 0xc0000
Bad block at c0000, 1 block(s) will be skipped
Writing data to block 7 at offset 0xe0000
Bad block at e0000, 1 block(s) will be skipped
Writing data to block 8 at offset 0x100000
libmtd: error!: bad eraseblock number 8, mtd0 has 8 eraseblocks
nandwrite: error!: /dev/mtd0: MTD get bad block failed
error 22 (Invalid argument)
nandwrite: error!: Data was only partially written due to error
error 22 (Invalid argument)')
nandwrite -s 0xc0000 /dev/mtd0 /boot/uboot-nsa310.env
$this->bbcode_second_pass_code('', 'Writing data to block 6 at offset 0xc0000
Bad block at c0000, 1 block(s) will be skipped
Writing data to block 7 at offset 0xe0000
Bad block at e0000, 1 block(s) will be skipped
Writing data to block 8 at offset 0x100000
libmtd: error!: bad eraseblock number 8, mtd0 has 8 eraseblocks
nandwrite: error!: /dev/mtd0: MTD get bad block failed
error 22 (Invalid argument)
nandwrite: error!: Data was only partially written due to error
error 22 (Invalid argument)')
mtdinfo /dev/mtd0
$this->bbcode_second_pass_code('', 'mtd0
Name: uboot
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 8 (1048576 bytes, 1024.0 KiB)
Minimum input/output unit size: 2048 bytes
Sub-page size: 512 bytes
OOB size: 64 bytes
Character device major/minor: 90:0
Bad blocks are allowed: true
Device is writable: true')
I don't think that everything went smooth, so now I'm worried to reboot..
Well I have my serial cable if something...
EDIT: - it rebooted good, but the problem remains it seems.
Should I leave /etc/fw_env.config as:
$this->bbcode_second_pass_code('', '/dev/mtd1 0xc0000 0x20000 0x20000')
or change it back for:
$this->bbcode_second_pass_code('', '/dev/mtd0 0xc0000 0x20000 0x20000')
arti74
 
Posts: 75
Joined: Tue Apr 17, 2018 10:33 am

Re: Bad eraseblocks on NSA310 (4.4.97-1-ARCH) & uboot update

Postby summers » Sat Apr 28, 2018 8:25 am

As you have written the new uboot (all be it with nand errors) then new boot looks at 0xc0000 for the uboot env variables. So when wanting to access those you'll need the /dev/mtd0 0xc0000 option.

But the env variables for the original stock uboot are in /dev/mtd1 0x00000. So if you need to access old values, like the ethernet mac, then you'll need to write that.

Usually write the ethernet mac to the new env variables, but with your errors not sure if thats possible.

Yes the errors are worrying, you are using the orion_nand driver - and thats what I use on my nsa325, so I think its correct.

Think we need a hand from someone with nand flash expereince to make more progress ....
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: Bad eraseblocks on NSA310 (4.4.97-1-ARCH) & uboot update

Postby arti74 » Sat Apr 28, 2018 9:17 am

$this->bbcode_second_pass_quote('', 'B')ut the env variables for the original stock uboot are in /dev/mtd1 0x00000

Not in mtd0 and 0xc0000? I believe that were my original values in fw_env.config (I don't know though if correct) - stock uboot 1.1.4

EDIT: OK, I changed for this:
$this->bbcode_second_pass_code('', 'cat /etc/fw_env.config
/dev/mtd1 0x00000 0x20000 0x20000')
I don't see any difference after reboot though - thank you anyway for your support!

I'm not sure if it change anything, but the 'strace fw_printenv' command shows this:
$this->bbcode_second_pass_code('', 'strace fw_printenv
execve("/usr/bin/fw_printenv", ["fw_printenv"], 0xbeb74dc0 /* 13 vars */) = 0
brk(NULL) = 0x45c000
uname({sysname="Linux", nodename="alarm", ...}) = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=75877, ...}) = 0
mmap2(NULL, 75877, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f05000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0Pr\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1638968, ...}) = 0
mmap2(NULL, 1385872, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6db2000
mprotect(0xb6ef0000, 61440, PROT_NONE) = 0
mmap2(0xb6eff000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13d000) = 0xb6eff000
mmap2(0xb6f02000, 9616, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6f02000
close(3) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f46000
set_tls(0xb6f468b0) = 0
mprotect(0xb6eff000, 8192, PROT_READ) = 0
mprotect(0x45a000, 4096, PROT_READ) = 0
mprotect(0xb6f48000, 4096, PROT_READ) = 0
munmap(0xb6f05000, 75877) = 0
openat(AT_FDCWD, "/var/lock/fw_printenv.lock", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
flock(3, LOCK_EX) = 0
brk(NULL) = 0x45c000
brk(0x47d000) = 0x47d000
openat(AT_FDCWD, "/etc/fw_env.config", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=34, ...}) = 0
read(4, "/dev/mtd1 0x00000 0x20000 0x2000"..., 4096) = 34
read(4, "", 4096) = 0
close(4) = 0
openat(AT_FDCWD, "/dev/mtd1", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFCHR|0600, st_rdev=makedev(90, 2), ...}) = 0
ioctl(4, MIXER_READ(1) or MEMGETINFO, {type=MTD_NANDFLASH, flags=MTD_WRITEABLE, size=0x80000, erasesize=0x20000, writesize=0x800, oobsize=0x40, padding=0}) = 0
close(4) = 0
mmap2(NULL, 135168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6d91000
openat(AT_FDCWD, "/dev/mtd1", O_RDONLY) = 4
ioctl(4, MIXER_WRITE(11) or MEMGETBADBLOCK, [0]) = 1
ioctl(4, MIXER_WRITE(11) or MEMGETBADBLOCK, [131072]) = 1
write(2, "Too few good blocks within range"..., 33Too few good blocks within range
) = 33
close(4) = 0
munmap(0xb6d91000, 135168) = 0
flock(3, LOCK_UN) = 0
close(3) = 0
exit_group(1) = ?
+++ exited with 1 +++
')
arti74
 
Posts: 75
Joined: Tue Apr 17, 2018 10:33 am

Re: Bad eraseblocks on NSA310 (4.4.97-1-ARCH) & uboot update

Postby arti74 » Sat Apr 28, 2018 8:16 pm

printenv from the console:
$this->bbcode_second_pass_code('', 'NSA310>> 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
eth1addr=00:19:CB:00:51:82
ipaddr=10.4.50.165
serverip=10.4.50.5
rootpath=/mnt/ARM_FS/
netmask=255.255.255.0
nandEcc=1bit
MODEL_ID=A203
PRODUCT_NAME=NSA-310
FEATURE_BIT=00
CONTRY_TYPE=FF
VENDOR_NAME=ZyXEL Communications Corp.
run_diag=yes
console=100000
=ttyS0,115200 mtdparts=nand_mtd:0xc0000@0(uboot)ro,0x7f00000@0x100000(root)
CASset=min
ethprime=egiga1
bootargs_root=root=/dev/nfs rw
bootargs_end=:::DB88FXX81: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;
ethmtu=1500
eth1mtu=1500
mvPhoneConfig=mv_phone_config=dev0:fxs,dev1:fxs
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
arcNumber=4022
bootargs_stock=console=ttyS0,115200 mtdparts=orion_nand: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_linux=setenv bootargs $(bootargs_linux); ide reset; ext2load ide 0:1 $(loadaddr) /uImage; bootm $(loadaddr)
bootargs_linux=console=ttyS0,115200 mtdparts=orion_nand: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
to_stock="setenv mainlineLinux no
MALLOC_len=3
to_linux="setenv mainlineLinux yes
bootcmd='run bootcmd_linux'
ethaddr=CC:5D:4E:C9:F5:4A
stdin=serial
stdout=serial
stderr=serial
nandEnvBase=100000
mainlineLinux=yes
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
netbsd_en=no
vxworks_en=no
disaMvPnp=no
hddPowerCtrl=no
enaAutoRecovery=yes
kernel_addr=0xc80000
pcieTune=no
ethact=egiga1

Environment size: 2241/131068 bytes
')
arti74
 
Posts: 75
Joined: Tue Apr 17, 2018 10:33 am

Re: Bad eraseblocks on NSA310 (4.4.97-1-ARCH) & uboot update

Postby arti74 » Thu May 10, 2018 11:13 pm

arti74
 
Posts: 75
Joined: Tue Apr 17, 2018 10:33 am

Previous

Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 11 guests