Welcome! Log In Create A New Profile

Advanced

Problem in flashing NSA325 u-boot

Posted by gendouhydeist 
Problem in flashing NSA325 u-boot
May 10, 2017 03:17PM
@bodhi
My device has different partition, The expected behavior was different from the guide.
When I'm deleting 4 blocks it only deletes one.

/e-data/4089-AD8E/tools # flash_erase /dev/mtd0 0 4
Erasing 128 Kibyte @ 60000 -- 100 % complete

now when I flash the uboot I get this
/e-data/4089-AD8E # nandwrite /dev/mtd0 kirkwood/generic/u-boot-nsa325/u-boot.kw
b
Input file is not page aligned
Data did not fit into device, due to bad blocks
: Success

/etc/fw_env.config
MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
NAND example
/dev/mtd1               0x0000          0x20000         0x20000                 4

cat /proc/mtd
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"

original env
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=AA03
PRODUCT_NAME=NSA-325
FEATURE_BIT=00
CONTRY_TYPE=FF
VENDOR_NAME=MitraStar Technology Corp.
run_diag=yes
ethaddr=FC:F5:28:00:00:00

after flashing uboot
Warning: Bad CRC, using default environment
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
nandEcc=1bit
kernel_addr=480000
MODEL_ID=A203
PRODUCT_NAME=NSA-310
FEATURE_BIT=00
CONTRY_TYPE=FF
VENDOR_NAME=ZyXEL Communications Corp.

I have backup of mtd0
What should I do now?



Edited 3 time(s). Last edit at 05/10/2017 03:39PM by bodhi.
Re: Problem in flashing NSA325 u-boot
May 10, 2017 03:35PM
gendouhydeist,

> My device has different partition,

It does look the same. It is the stock definition which I did not change.

mtd0: 00100000 00020000 "uboot"


Quote

When I'm deleting 4 blocks it only deletes one.

/e-data/4089-AD8E/tools # flash_erase /dev/mtd0 0 4
Erasing 128 Kibyte @ 60000 -- 100 % complete

Did you check for bad block as instructed?

dmesg | grep -i bad

Don't shut down or reboot. Find out if you have bad blocks first and we'll go from there.

And one more question:

/e-data/4089-AD8E # nandwrite /dev/mtd0 kirkwood/generic/u-boot-nsa325/u-boot.kwb

Which u-boot is this you are trying to flash to your device? (it is not one that I released).

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



Edited 3 time(s). Last edit at 05/10/2017 03:44PM by bodhi.
https://forum.lede-project.org/t/installing-lede-on-nsa325/3611
bobafetthotmail told me that I should use the one from LEDE snapshot, the one I'm using right now came from buildroot of LEDE.

The weird thing is that there's no bad block at all.

/e-data/4089-AD8E/tools # dmesg | grep -i bad
Scanning device for bad blocks
gendouhydeist Wrote:
-------------------------------------------------------
> https://forum.lede-project.org/t/installing-lede-o
> n-nsa325/3611
> bobafetthotmail told me that I should use the one
> from LEDE snapshot, the one I'm using right now ca
> me from buildroot of LEDE.

So you are installing LEDE?

>
> The weird thing is that there's no bad block at al
> l.
>
> /e-data/4089-AD8E/tools # dmesg | grep -i bad
> Scanning device for bad blocks

Given your mtd0 is the correct definition, try to erase the whole partition:
flash_erase /dev/mtd0 0 0

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
/e-data/4089-AD8E/tools # flash_erase /dev/mtd0 0 0
Erasing 128 Kibyte @ e0000 -- 100 % complete

/e-data/4089-AD8E/tools # nandwrite /dev/mtd0 /e-data/4089-AD8E/tools/u-boot.kwb
Input file is not page aligned
Data did not fit into device, due to bad blocks
: Success

Still the same though...



Edited 1 time(s). Last edit at 05/10/2017 04:03PM by gendouhydeist.
Ok I've used your uboot and it writes properly
/ # nandwrite /dev/mtd0 /e-data/4089-AD8E/uboot.2016.05-tld-1.nsa325.mtd0.kwb
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000

I check the env there's nothing there how I can put everything back?
/ # fw_printenv
Warning: Bad CRC, using default environment
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=5
baudrate=115200

Should I load LEDE from RAM and start sysupgrade?
Follow the tutorial here http://forum.doozan.com/read.php?3,123813 to backup all stock partitions and install uboot (it also provides tools). The image that you must use is the "u-boot.kwb" one. Ignore the part of the tutorial about flashing envs manually, the LEDE uboot has them compiled in already.



Edited 1 time(s). Last edit at 05/10/2017 04:29PM by gendouhydeist.
gendouhydeist,

>
> Should I load LEDE from RAM and start sysupgrade?
> Follow the tutorial here http://forum.doozan.co
> m/read.php?3,123813 to backup all stock partitions
> and install uboot (it also provides tools). The im
> age that you must use is the "u-boot.kwb" one. Ign
> ore the part of the tutorial about flashing envs m
> anually, the LEDE uboot has them compiled in alrea
> dy.



Not sure what you said above? that forum link was broken, too.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
This the link I refer to, please read the whole thread.
https://forum.lede-project.org/t/installing-lede-on-nsa325/3611/4

bobafetthotmail told me I should use the u-boot.kwb from LEDE instead of your compiled u-boot. He also told me that I should ignore installing env as LEDE provided it already.
gendouhydeist1,

-------------------------------------------------------
> This the link I refer to, please read the whole th
> read.
> https://forum.lede-project.org/t/installing-lede-o
> n-nsa325/3611/4
>
> bobafetthotmail told me I should use the u-boot.kw
> b from LEDE instead of your compiled u-boot. He al
> so told me that I should ignore installing env as
> LEDE provided it already.

Then you should post in this thread so bobafet will get notification and help you:
http://forum.doozan.com/read.php?4,29966

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Problem in flashing NSA325 u-boot
May 11, 2017 01:34PM
Hi bodhi I have ask you few question...

After successfully flashing your uboot is it ok for me to restart my device? then setenv afterwards? wouldn't cause problems for me cause I haven't populate env's yet if I restart my device?
Re: Problem in flashing NSA325 u-boot
May 11, 2017 02:54PM
gendouhydeist,

> Hi bodhi I have ask you few question...
>
> After successfully flashing your uboot is it ok fo
> r me to restart my device?

Yes, it would be OK.

> then setenv afterwards?
> wouldn't cause problems for me cause I haven't pop
> ulate env's yet if I restart my device?

No big problem, it will show the CRC error when u-boot tries to read the envs area. And then you can reboot and interrupt serial console, use the uEnv.txt capability to load the default envs in, and then adjust a couple variables to boot a Debian rootfs on USB , or HDD.

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

Quote

C. Add uEnv.txt to /boot directory

Create a text file in /boot directory with the content in the format that u-boot envs are listed.

Examples:

These 4 examples are only to demonstrate the syntax in uEnv.txt (they might or might not apply to your current settings):

- Load appropriate DTB file for the kernel to run GoFlex Net box.
- Use only USB drives for kernel and rootfs during booting
- Use SD card, USB and SATA for booting. The kernel and rootfs search order is as they are appeared on the list: mmc, usb, ide.
- Define that there are 8 storage devices (i.e. disk partitions).

cat /boot/uEnv.txt
dtb_file=/boot/dts/kirkwood-goflexnet.dtb
devices=usb
devices=mmc usb ide
disks=0 1 2 3 4 5 6 7

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Problem in flashing NSA325 u-boot
May 12, 2017 03:19AM
See here for example how to load the default envs using uEnv.txt during boot:
http://forum.doozan.com/read.php?3,33935,33992#msg-33992

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

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: