Welcome! Log In Create A New Profile

Advanced

Installing new u-boot for NSA310S

Posted by mpmc 
Installing new u-boot for NSA310S
April 02, 2017 09:19AM
Update!

I took the risk/plunge and upgraded to your uboot on my NSA310S (I'm planning on doing the old NSA310, Is it A or B, I can't tell which I have, it's the one with the lm85 sensor. It's the original one).

It was a bit hairy in places as I kept getting CRC errors when running fw_printenv in Debian, but looked on another thread in which you told someone else to ignore it, but anyway..

Does this output look okay?

NSA3x0S> reset
resetting ...


U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:55:45 -0700)
ZyXEL NSA310S/320S 1/2-Bay Power Media Server

SoC:   Kirkwood 88F6702_A1
DRAM:  256 MiB
WARNING: Caches not enabled
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot:  0
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices...
Use USB retry period from the environment: 15 second(s)
1 Storage Device(s) found

Reset IDE: Bus 0: OK Bus 1: not available
  Device 0: Model: WDC WD5000AAKX-001CA0  Firm: 15.01H15 Ser#:  WD-WMAYU0489005
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 476940.0 MB = 465.7 GB (976773168 x 512)
Unknown command 'mmc' - try 'help'

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            15630336        00b8b120-01     0b
loading envs from usb 0 ...
reading /boot/uEnv.txt
** Unable to read file /boot/uEnv.txt **

Partition Map for IDE device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            1951744         11c04297-01     83 Boot
  2     974819328       1951744         11c04297-02     82
  3     1953792         972865536       11c04297-03     83
loading envs from ide 0 ...
** File not found /boot/uEnv.txt **
Unknown command 'mmc' - try 'help'
running scan_disk ...
Scan device usb
device usb 0:1
reading /boot/uImage
** Unable to read file /boot/uImage **
device usb 1:1
** Bad device usb 1 **
device usb 2:1
** Bad device usb 2 **
device usb 3:1
** Bad device usb 3 **
Scan device ide

Reset IDE: Bus 0: OK Bus 1: not available
  Device 0: Model: WDC WD5000AAKX-001CA0  Firm: 15.01H15 Ser#:  WD-WMAYU0489005
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 476940.0 MB = 465.7 GB (976773168 x 512)
device ide 0:1
** File not found /boot/uImage **
device ide 1:1
** Bad device ide 1 **
device ide 2:1
** Bad device ide 2 **
device ide 3:1
** Bad device ide 3 **
Scan device mmc
Unknown command 'mmc' - try 'help'
device mmc 0:1
** Bad device mmc 0 **
device mmc 1:1
** Bad device mmc 1 **
device mmc 2:1
** Bad device mmc 2 **
device mmc 3:1
** Bad device mmc 3 **
loading uImage ...
reading /boot/uImage
** Unable to read file /boot/uImage **
loading uInitrd ...
reading /boot/uInitrd
** Unable to read file /boot/uInitrd **
loading DTB /boot/dts/kirkwood-pogo_e02.dtb ...
reading /boot/dts/kirkwood-pogo_e02.dtb
** Unable to read file /boot/dts/kirkwood-pogo_e02.dtb **
Wrong Image Format for bootm command
Error occured, error code = 112
ERROR: can't get kernel image!
NSA3x0S> printenv
arcNumber=4931
bootargs=console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
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 load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
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
dtb_file=/boot/dts/kirkwood-pogo_e02.dtb
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
init_ide=ide reset
init_mmc=mmc rescan
init_usb=usb start
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
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
scan_ide=ide reset
scan_mmc=mmc rescan
scan_usb=usb start
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_loaded=0
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
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
usb_ready_retry=15

Environment size: 3114/131068 bytes

NSA3x0S>

I'm pretty sure I've missed something out as there is a ton of errors. I haven't reconfigured the drive yet so that'll explain the missing files.

Bodhi, Could you answer these questions for me please? :)

  • Do I need to set the mtdparts? If so, how do I set them correctly? I'm not sure of the values.
  • Can I load my kernel/Initrd images like on the stock uboot [fatload usb 0 0x800000 uImage] or is the placement [0x80000] different? Am I still limited to images to a max of 3.1mb?
  • I'm guessing I need to set the IP address/mac, anything else :p?
  • Recovery on a failed boot? I'm not sure how I go about this, do I need to set something for it to work? :p

Many thanks for your help & work on these devices! I'm tempted to try my ix2-ng next!



Edited 2 time(s). Last edit at 04/02/2017 04:08PM by bodhi.
Re: Linux Kernel 4.10.0 Kirkwood package and Debian rootfs
April 02, 2017 12:58PM
Did you follow http://forum.doozan.com/read.php?3,12381 , where you have specific U-Boot images for various models (poog, goflexnet) envs ?

I see you stilll have pogo_e02 in your dtb env:
dtb_file=/boot/dts/kirkwood-pogo_e02.dtb
Re: Linux Kernel 4.10.0 Kirkwood package and Debian rootfs
April 02, 2017 04:16PM
That thread split was a wild ride!

@jst818

Good catch, I'll update that, but even it it's wrong it doesn't cause too much of an issue as I'm attaching the dtb to the kernel image anyway (for now).

@bodhi

I kind of answered one of my own questions, "can I load my kernel/Initrd images like on the stock uboot", the answer to that is, yes! It worked fine.
Re: Installing new u-boot for NSA310S
April 02, 2017 04:30PM
mpmc,

> I took the risk/plunge and upgraded to your uboot
> on my NSA310S (I'm planning on doing the old NSA31
> 0, Is it A or B, I can't tell which I have, it's t
> he one with the lm85 sensor. It's the original one
> ).
>
> It was a bit hairy in places as I kept getting CRC
> errors when running fw_printenv in Debian, but loo
> ked on another thread in which you told someone el
> se to ignore it, but anyway..
>
> Does this output look okay?

It does look OK as far as u-boot is concerned. However, your rootfs kernel files are in the wrong place.

Quote


> ** Unable to read file /boot/uImage **
> device ide 0:1
> ** File not found /boot/uImage **
> device ide 1:1
> loading uInitrd ...
> reading /boot/uInitrd
> ** Unable to read file /boot/uInitrd **
> loading DTB /boot/dts/kirkwood-pogo_e02.dtb ...
> reading /boot/dts/kirkwood-pogo_e02.dtb
> ** Unable to read file /boot/dts/kirkwood-pogo_e02
> .dtb **

> Wrong Image Format for bootm command
> Error occured, error code = 112
> ERROR: can't get kernel image!

Make sure that your rootfs has the kernel files uImage and uInitrd in /boot, and DTB file in /boot/dts.

> dtb_file=/boot/dts/kirkwood-pogo_e02.dtb

And this needs to be adjusted (as noticed by jst8181, it was instructed in the u-boot installation post):

dtb_file=/boot/dts/kirkwood-nsa310s.dtb


> I'm pretty sure I've missed something out as there
> is a ton of errors. I haven't reconfigured the dri
> ve yet so that'll explain the missing files.
>

Yes, the rootfs drive needs to be plugged in. And the rootfs needs to be in partition 1 of this drive.

> Do I need to set the mtdparts? If so, how do I
> set them correctly? I'm not sure of the values.

This can be done once you are inside Debian.

> Can I load my kernel/Initrd images like on the
> stock uboot [fatload usb 0 0x800000 uImage] or is
> the placement [0x80000] different?

With the rootfs kernel files in the right place, there is no need to adjust these u-boot envs.

/boot/uInitrd
/boot/uImage
/boot/dts/kirkwood-nsa310s.dtb

> Am I still limi
> ted to images to a max of 3.1mb?

No limitation.

> I'm guessing I need to set the IP address/mac,
> anything else :p?

Yes, set it to your own setting.

> Recovery on a failed boot? I'm not sure how I
> go about this, do I need to set something for it t
> o work? :p

There is no rescue system on this box, yet. I meant to work on booting back to stock FW, but have not got time to look into it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Linux Kernel 4.10.0 Kirkwood package and Debian rootfs
April 02, 2017 04:31PM
mpmc,

> I kind of answered one of my own questions, "ca
> n I load my kernel/Initrd images like on the stock
> uboot
", the answer to that is, yes! It worked
> fine.

Cool!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Linux Kernel 4.10.0 Kirkwood package and Debian rootfs
April 02, 2017 04:41PM
bodhi Wrote:
-------------------------------------------------------
> .. snip ..

Thanks for answering, shame you can't get a rescue system going, but I it's not a big deal :)

I'll fix those little issues & put it all back together, then move onto the NSA310 & maybe my ix2 after :p

---
NSA310s, NSA310, C.H.I.P, Banana Pi, Orange Pi PC & Zero, RPI 1,2Bx8
Re: Linux Kernel 4.10.0 Kirkwood package and Debian rootfs
April 03, 2017 01:18AM
> Thanks for answering, shame you can't get a rescue
> system going, but I it's not a big deal :)

I've estimated that this is not a time consuming task. But when I am busy with works and other obligations, I have little time to get to the hardware (posting and answering questions can be done from anywhere).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Installing new u-boot for NSA310S
April 03, 2017 09:45AM
I'm still struggling to get the thing to load a kernel image over 3.1mb. It's more than likely being truncated, leading to a CRC error..

NSA3x0S> fatload usb 0 0x800000 boot.uImage-nsa310s
reading boot.uImage-nsa310s
3231728 bytes read in 139 ms (22.2 MiB/s)
NSA3x0S> fatload usb 0 0xb00000 initrd
reading initrd
9437184 bytes read in 339 ms (26.5 MiB/s)
NSA3x0S> setenv bootargs 'console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0x9      00000 ramdisk=32768'
NSA3x0S> bootm 0x800000
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux Kernel for NSA310S
   Created:      2017-04-03  14:16:03 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3231664 Bytes = 3.1 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... Bad Data CRC
Error occured, error code = 3
ERROR: can't get kernel image!

Using a smaller kernel for install it is!

---
NSA310s, NSA310, C.H.I.P, Banana Pi, Orange Pi PC & Zero, RPI 1,2Bx8
Re: Installing new u-boot for NSA310S
April 03, 2017 01:47PM
mpmc,

> Using a smaller kernel for install it is!

There is no limitation in the new u-boot. Just use the envs exactly as I wrote it in the default envs image. Load all 3 images.

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


and
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params

Don't try to change the address of uImage/zImage/uInitrd .... or use a different loading scheme like you are using. There is a good reason why I wrote the envs they way they are in the default envs. They were not being pulled out of thin air, in case you are wondering :))

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



Edited 1 time(s). Last edit at 04/03/2017 01:49PM by bodhi.
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: