Welcome! Log In Create A New Profile

Advanced

Install u-boot on NSA320 - how to set fw_env.config

Posted by Meddle 
I'm trying to flash the latest U-Boot on my NSA-320. I got to step c and I get a bad block error when I try to execute "fw_printenv > current_envs.txt". In step 8 the "Device offset" was "0x0000", so I changed it to "0xc0000" as directed. When I changed it back to "0x0000" the "fw_printenv > current_envs.txt" command works fine.

I'm afraid to reboot now! What do I do?



Edited 1 time(s). Last edit at 04/01/2018 04:18PM by bodhi.
Re: Install u-boot on NSA320 - how to set fw_env.config
April 01, 2018 04:24PM
Meddle,

> I'm trying to flash the latest U-Boot on my
> NSA-320. I got to step c and I get a bad block
> error when I try to execute "fw_printenv >
> current_envs.txt". In step 8 the "Device offset"
> was "0x0000", so I changed it to "0xc0000" as
> directed. When I changed it back to "0x0000" the
> "fw_printenv > current_envs.txt" command works
> fine.
>
> I'm afraid to reboot now! What do I do?

Basically, the 0xc0000 address is only meaningful after you flashed the new u-boot default envs image in step 8.

Before that, the envs are still in the old location
#/dev/mtd1		0x0000		0x20000		0x20000			4

With new u-boot, the envs are in location
/dev/mtd0 0xc0000 0x20000 0x20000

If you are not sure, post the log of terminal session (every commands and output) when you did this.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Install u-boot on NSA320 - how to set fw_env.config
April 01, 2018 05:27PM
Thank you. That makes sense now.

Now I am down to this command: "fw_setenv mtdparts 'xxxxxxxxx'"
I can't find what to set mtdparts to.


Original env:
root@secondary:/i-data/4c772ad9/sec# ./tools/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
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
kernel_addr=480000
MODEL_ID=DD01
PRODUCT_NAME=NSA-320
FEATURE_BIT=00
CONTRY_TYPE=FF
VENDOR_NAME=ZyXEL Communications Corp.
run_diag=yes
ethaddr=FC:F5:28:30:61:1B


Current:

root@secondary:/i-data/4c772ad9/sec# ./tools/fw_printenv
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_ini                                                trd_addr; fi; else if run load_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
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
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 $l                                                oad_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
arcNumber=3956
ethaddr=FC:F5:28:30:61:1B



Edited 1 time(s). Last edit at 04/01/2018 06:24PM by meddle.
Re: Install u-boot on NSA320 - how to set fw_env.config
April 01, 2018 06:25PM
2 more setenvs and you're done.

fw_setenv 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)'
fw_setenv dtb_file '/boot/dts/kirkwood-nsa325.dtb'

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Install u-boot on NSA320 - how to set fw_env.config
April 01, 2018 06:27PM
thank you
Re: Install u-boot on NSA320 - how to set fw_env.config
April 01, 2018 08:26PM
Thanks to your question, I can see it is a little bit hard to find info to finish uboot installation. Will beef up the instruction next uboot release.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Install u-boot on NSA320 - how to set fw_env.config
April 02, 2018 03:25PM
Well, If I were a little smarter...

I rebooted the NSA320 and it didn't come back. I followed the netconsole instructions but I get no response and no ping on the IP address. Waiting for my serial cable to come now - I lost mine or lent it out.
Re: Install u-boot on NSA320 - how to set fw_env.config
April 02, 2018 07:22PM
Booting with the default envs using uEnv.txt loading capability using uboot.2016.05-tld-1.environment (the content of the default envs in text format) in u-boot envs tarball uboot.2016.05-tld-1.environment.bodhi.tar



1. Copy the default envs in text format to the rootfs on USB. Assuming the USB rootfs is mounted on another Linux box as /media/sdb1 (If the SD is used for rootfs, then the drive letter will be /dev/mmcblk0p1).

Become root and copy the default envs to uEnv.txt:
su
cp -a uboot.2016.05-tld-1.environment /media/sdb1/boot/uEnv.txt

2. Modify the uEnv.txt for NSA320 to replace the 2 envs devices and dtb_file as following:

devices=usb ide
dtb_file=/boot/dts/kirkwood-nsa320.dtb

Note: The devices env above indicates that u-boot will attempt to boot with the USB first, if it is not present then it will try HDD.

3. and then sync and unmount the USB

sync
umount /media/sdb1


4. Plug in this USB rootfs to the NSA320, and power up. Look for the box dynamic IP and log in with SSH.

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



Edited 1 time(s). Last edit at 04/02/2018 07:24PM by bodhi.
Re: Install u-boot on NSA320 - how to set fw_env.config
April 02, 2018 07:46PM
Meddle,

I've just realized I had a typo previously :) sorry about that.

Please follow the instruction to reset the envs above using uEnv.txt and try booting.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Install u-boot on NSA320 - how to set fw_env.config
April 03, 2018 04:38AM
bodhi Wrote:
-------------------------------------------------------
> I've just realized I had a typo previously :)
> sorry about that.
>

No worries. I actually noticed that one then made another of my own...

My usb/serial cable (www.amazon.com/gp/product/B00QT7LQ88/) arrived and I was able to fix it, install, and update Debian to 4.15. this cable worked perfectly and already had the correct jumpers.

Question:. To create a 'backup' rootfs file after upgrading, Would this work?
tar -cvzf myrootfs.tgz rootfs/
Re: Install u-boot on NSA320 - how to set fw_env.config
April 03, 2018 04:44AM
meddle,

> My usb/serial cable
> (www.amazon.com/gp/product/B00QT7LQ88/)
> arrived and I was able to fix it, install, and
> update Debian to 4.15. this cable worked
> perfectly and already had the correct jumpers.
>

Glad you got it working!

> Question:. To create a 'backup' rootfs file after
> upgrading, Would this work?
>
> tar -cvzf myrootfs.tgz rootfs/
>

Here is the post where I talked about this subject:
https://forum.doozan.com/read.php?2,12096,24034#msg-24034

It's the same idea, but I used bz2 to get a better compression. gzip is faster, though.

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