Welcome! Log In Create A New Profile

Advanced

2017.07-2023.04 U-Boot Kirkwood - GoFlexNet, GoFlexHome, PogoE02, Dockstar, iConnect, NetgearStora, PogoV4/Mobile, Sheevaplug, NSA325, NSA320, NSA310S, NSA320S, NSA310, HP T5325, Dreamplug

Posted by bodhi 
going through instructions on uboot update, and I get only few lines when running this command on stock uboot on NSA325:

fw_printenv
root@nas:/tmp# 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

cat /etc/fw_env.config
# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Notice, that the "Number of sectors" is ignored on NOR.

# MTD device name       Device offset   Env. size       Flash sector size      Number of sectors
/dev/mtd0               0xc0000         0x20000         0x20000

from dmesg it appears, that eboot_env is at 0x100000
[   21.268215] nand: Eon NAND 128MiB 3,3V 8-bit
[   21.272520] nand: 128MiB, SLC, page size: 2048, OOB size: 64
[   21.278206] Scanning device for bad blocks
[   21.288035] Bad eraseblock 100 at 0x000000c80000
[   21.298323] Bad eraseblock 200 at 0x000001900000
[   21.354281] Creating 9 MTD partitions on "orion_nand":
[   21.359512] 0x000000000000-0x000000100000 : "uboot"
[   21.364740] 0x000000100000-0x000000180000 : "uboot_env"
[   21.370313] 0x000000180000-0x000000200000 : "key_store"
[   21.375825] 0x000000200000-0x000000280000 : "info"
[   21.380975] 0x000000280000-0x000000c80000 : "etc"
[   21.385972] 0x000000c80000-0x000001680000 : "kernel_1"
[   21.391442] 0x000001680000-0x000004640000 : "rootfs1"
[   21.396815] 0x000004640000-0x000005040000 : "kernel_2"
[   21.402306] 0x000005040000-0x000008000000 : "rootfs2"

why there is bad CRC on fw_printenv?
Can i proceed with flashing new uboot anyway? I have saved env output from stock uboot using serial console...

EDIT: it appears, that going from stock uboot I have to do section B: in order to write default envs to new MTD location to have succesfull read



Edited 1 time(s). Last edit at 10/08/2014 11:42AM by rasto.
rasto,

> EDIT: it appears, that going from stock uboot I
> have to do section B: in order to write default
> envs to new MTD location to have succesfull read

You got it! the stock envs location is different. That's the reason for the CRC error.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Following section B: on env flashing at this point I don't have arcNumber or machid for Zyxel NSA325
e. Modify the following u-boot variables using fw_setenv:
fw_setenv arcNumber 
fw_setenv machid

I take it NSA325 does not use these, so the solution is to skip this step?

Next step is setup of mtdparts, rootfstype and ethaddr:
fw_setenv mtdparts 'xxxxxxxxx'
fw_setenv rootfstype 'xxxx'
fw_setenv ethaddr 'xx:xx:xx:xx:xx:xx'

rootfstype and ethaddr is clear, but what I have from stock envs, is:
mtdparts=nand_mtd:0xc0000@0(uboot)ro,0x7f00000@0x100000(root)

which differs from what is written in new uboot by default
# fw_printenv mtdparts
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)

skip changing mtdparts as well?
@rasto,

Your question raised some concern. So far what installation have you done? are you trying to boot the Debian rootfs as the first step, or did you install the NAND version for NSA325 in this post ?

Update1:

OK. I reread your post and realize that you are running stock u-boot and trying to boot Debian rootfs? is that where you are at? If this is true, then you only need to change /etc/fw_even.config to be able to access the envs.

# cat /etc/fw_env.config
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
# nsa325
/dev/mtd1                0x0000         0x20000    0x20000

Update2:

Another thought, see this thread: http://forum.doozan.com/read.php?2,14351

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



Edited 2 time(s). Last edit at 10/10/2014 02:19PM by bodhi.
Dear All,

Hope this is a proper thread.
I wanted to flash uboot.2013.10-tld-1.nsa325.bodhi.tar to my nsa325v2, however it is stated in this thread that there should be no bad blocks in the first 1M of the NAND, yet I have:
# dmesg | grep -i 'bad'
[   19.196524] Scanning device for bad blocks
[   19.206352] Bad eraseblock 100 at 0x000000c80000
[   19.216639] Bad eraseblock 200 at 0x000001900000

how should I proceed further,

TIA,
pepesz
pepesz,

The bad blocks are way out in other areas. Block 100 (location 0x000000c80000) is at about 12.5M of NAND. So these are OK.

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

I shall proceed with the uboot flash (2013.10-tld-1).
One more question -maybe for rasto.
I have the same problem with 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

How should I set the env variables (what values for 2013.10-tld-1)?
I know my rootfstype and mac - thats it.

Thanks,
pepesz
pepesz,

You need to read the installation instruction in the first post for other Kirkwood u-boot and then apply it to the NSA325 u-boot.

The CRC error is because the old u-boot and the new u-boot use different location for the envs. So you will need to flash the default envs image (step 8, section B). Treat your NSA325 like one of the 3 boxes: Pogo V4, Netgear Stora, or iConnect (which does not have default envs at location 0xC0000 like other boxes).

I'm waiting for WarheadsSE to release this u-boot to Git Hub and then include this NSA325 in the next release.

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

I had my doubts about step B section 8 cause those envs are for the uboot.2014.07-tld-1 and I'm flashing uboot 2013.10-tld-1. Can I use those (2014.07-tld-1) envs?

Thanks again,
pepesz
Dear all,

Does anyone know:
fw_setenv arcNumber
fw_setenv machid
fw_setenv mtdparts
for NSA325v2

thanks,
pepesz
Dear all,

Before flashing new uboot(2013.10-tld-1) I wanted to try it via uart, however I got the ** File not found /boot/uImage **
** File not found /boot/uInitrd ** errors.

The debian is on the usb flash.

Here is the boot screen:
root@Cawdor:/home/tmp# ./tools/kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2013.10-tld-1.nsa325.uart.kwb -p
Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [......................................................................]
  2 % [......................................................................]
  5 % [......................................................................]
  8 % [......................................................................]
 11 % [......................................................................]
 14 % [......................................................................]
 17 % [......................................................................]
 20 % [......................................................................]
 22 % [......................................................................]
 25 % [......................................................................]
 28 % [......................................................................]
 31 % [......................................................................]
 34 % [......................................................................]
 37 % [......................................................................]
 40 % [......................................................................]
 43 % [......................................................................]
 45 % [......................................................................]
 48 % [......................................................................]
 51 % [......................................................................]
 54 % [......................................................................]
 57 % [......................................................................]
 60 % [......................................................................]
 63 % [......................................................................]
 65 % [......................................................................]
 68 % [......................................................................]
 71 % [......................................................................]
 74 % [......................................................................]
 77 % [......................................................................]
 80 % [......................................................................]
 83 % [......................................................................]
 85 % [......................................................................]
 88 % [......................................................................]
 91 % [......................................................................]
 94 % [......................................................................]
 97 % [................................................................]
[Type Ctrl-\ + c to quit]


U-Boot 2013.10-tld-1 (Aug 29 2014 - 22:07:26)
ZyXEL NSA325 2-Bay Power Media Server

SoC:   Kirkwood 88F6282_??
DRAM:  512 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
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
** File not found /boot/uImage **
** File not found /boot/uInitrd **
Wrong Image Format for bootm command
Error occured, error code = 112
ERROR: can't get kernel image!
Unknown command 'mmc' - try 'help'
** Bad device mmc 0 **
** Bad device mmc 0 **
Wrong Image Format for bootm command
Error occured, error code = 112
ERROR: can't get kernel image!

Reset IDE: ide_preinit failed
** Bad device size - ide 0 **
** Bad device size - ide 0 **
Wrong Image Format for bootm command
Error occured, error code = 112
ERROR: can't get kernel image!
resetting ...
Sollutions welcomed :)

pepesz
pepesz,

Most of the info about nsa325 installation are here:
http://forum.doozan.com/read.php?2,14351

arcNumber: 4495

machid: you don't need it

mtdparts: look in your existing stock installation.

Quote

I had my doubts about step B section 8 cause those envs are for the uboot.2014.07-tld-1 and I'm flashing uboot 2013.10-tld-1. Can I use those (2014.07-tld-1) envs?
Yes.

Quote

Before flashing new uboot(2013.10-tld-1) I wanted to try it via uart, however I got the ** File not found /boot/uImage **
** File not found /boot/uInitrd ** errors.

Look in your USB rootfs.

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



Edited 1 time(s). Last edit at 10/11/2014 03:43PM by bodhi.
dear bodhi,

I'm new to the nsa325.
I followed the instruction in http://forum.doozan.com/read.php?2,14351, and I have debian running from usb, no problem there.

Next step is upgrading the uboot as I mention before. The new uboot image is loaded via uart but doesn't see the boot images?

Quote

Look in your USB rootfs.

Not sure what I'm supposed to see there - the /boot/uImage and /boot/uInitrd are there.
Hi pepesz,

Boot with UART, interrupt serial console and browse the USB drive to see if you can see them:

usb start
ext2ls usb 0:1 /boot
then try to load them
ext2load usb 0:1 0x800000 /boot/uImage
ext2load usb 0:1 0x1100000 /boot/uInitrd

If there is error while you are executing these commands, please post them here. And also post the output of printenv here.

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

NSA325> usb start
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
NSA325> ext2ls usb 0:1 /boot
** Can not find directory. **
NSA325> printenv
arcNumber=4495
baudrate=115200
bootcmd=run bootcmd_usb; run bootcmd_mmc; run bootcmd_sata; reset
bootcmd_mmc=run mmc_init; run set_bootargs_mmc; run mmc_boot
bootcmd_sata=run sata_init; run set_bootargs_sata; run sata_boot;
bootcmd_usb=run usb_init; run set_bootargs_usb; run usb_boot;
bootdelay=10
console=ttyS0,115200
device=0:1
ethact=egiga0
ethaddr=00:50:43:00:02:02
if_netconsole=ping $serverip
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
machid=0x831
mainlineLinux=yes
mmc_boot=mw 0x800000 0 1; run mmc_load_uimage; if run mmc_load_uinitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
mmc_init=mmc rescan
mmc_load_uimage=ext2load mmc $device 0x800000 /boot/uImage
mmc_load_uinitrd=ext2load mmc $device 0x1100000 /boot/uInitrd
mmc_root=/dev/mmcblk0p1
mtdids=nand0=orion_nand
mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
rootdelay=10
rootfstype=ext4
sata_boot=mw 0x800000 0 1; run sata_load_uimage; if run sata_load_uinitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
sata_init=ide reset
sata_load_uimage=ext2load ide $device 0x800000 /boot/uImage
sata_load_uinitrd=ext2load ide $device 0x1100000 /boot/uInitrd
sata_root=/dev/sda1
serverip=192.168.0.220
set_bootargs_mmc=setenv bootargs console=$console root=$mmc_root rootdelay=$rootdelay rootfstype=$rootfstype $mtdparts
set_bootargs_sata=setenv bootargs console=$console root=$sata_root rootdelay=$rootdelay rootfstype=$rootfstype $mtdparts
set_bootargs_usb=setenv bootargs console=$console root=$usb_root rootdelay=$rootdelay rootfstype=$rootfstype $mtdparts
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
usb_boot=mw 0x800000 0 1; run usb_load_uimage; if run usb_load_uinitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
usb_init=usb start
usb_load_uimage=ext2load usb $device 0x800000 /boot/uImage
usb_load_uinitrd=ext2load usb $device 0x1100000 /boot/uInitrd
usb_root=/dev/sda1

Environment size: 2212/131068 bytes
NSA325>

usb flash details:
                              Disk Drive: /dev/sda
                        Size: 15611199488 bytes, 15.6 GB
             Heads: 11   Sectors per Track: 11   Cylinders: 251988

    Name        Flags      Part Type  FS Type          [Label]        Size (MB)
 ------------------------------------------------------------------------------
    sda1        Boot        Primary   ext2             [boot]            100.00
    sda2                    Primary   ext4             [rootfs]        15511.21*

Thanks for help,

pepesz
This indicates that there might be something not right with your USB drive enumeration:
NSA325> ext2ls usb 0:1 /boot
** Can not find directory.

at serial console prompt do
usb part

If you see boot partition as device 0:2 then that is the cause.

To simplify the installation process, it's best to use a single partition USB drive first. After everything is working then you can repartition your drive.

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

NSA325> usb part

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

Part    Start Sector    Num Sectors     UUID            Type
  1     11              195283          34362054-01     83 Boot
  2     195294          30295330        34362054-02     83
NSA325> ext2ls usb 0:1 /boot
** Can not find directory. **
but
NSA325> ext2ls usb 0:1 /
<DIR>       1024 .
<DIR>       1024 ..
<DIR>      12288 lost+found
          126443 config-3.16.0-kirkwood-tld-2
         6032401 initrd.img-3.16.0-kirkwood-tld-2
        22383302 linux-image-3.16.0-kirkwood-tld-2_2_armel.deb
         1947250 System.map-3.16.0-kirkwood-tld-2
         2756040 uImage
         6032465 uInitrd
         2755976 vmlinuz-3.16.0-kirkwood-tld-2
and
NSA325> ext2ls usb 0:2 /boot
<DIR>       4096 .
<DIR>       4096 ..
         1947250 System.map-3.16.0-kirkwood-tld-2
        22383302 linux-image-3.16.0-kirkwood-tld-2_2_armel.deb
         6032401 initrd.img-3.16.0-kirkwood-tld-2
         6032465 uInitrd
          126443 config-3.16.0-kirkwood-tld-2
         2755976 vmlinuz-3.16.0-kirkwood-tld-2
         2756040 uImage
the boot images are in the / on first partition, not in the /boot.
Should I set evns like this:
usb_load_uimage=ext2load usb $device 0x800000 /uImage
usb_load_uinitrd=ext2load usb $device 0x1100000 /uInitrd
?

Thanks,
pepesz
I would simply create symlink boot pointing to current dir.
ln -sf . boot
Thanks,

One step further, but still no success.
The booting stops (hangs) at:

[    7.197224] usbcore: registered new interface driver uas
I tried two different usb flash disks, both with same results.
full log at http://pastebin.com/UvU2uFA5

best regards,
pepesz
pepesz,

> the boot images are in the / on first partition,
> not in the /boot.

Ah! no wonder u-boot can't find it. This is not a very good placement of the boot files. Even though you have 2 separate partitions, the boot partition should have the same directory structure as the rootfs. So I would create a boot directory and move all these files in to that.

Of course you can put them anywhere you want, but u-boot envs need to be changed to point the correct location. This is the reason why we should not put them anywhere else other than /boot/

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

You need to remove machid. It has to match the NSA325 or not defined at all.

setenv machid

Instruction on 1st page:
Quote

Also note that only some boxes need machid, some don't (so the command fw_setenv machid below clears them).

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



Edited 1 time(s). Last edit at 10/12/2014 04:54AM by bodhi.
Hello,

I'm a bit further
[    7.367971] hub 3-0:1.0: USB hub found
[    7.371773] hub 3-0:1.0: 2 ports detected
[    7.654721] ata1: SATA link down (SStatus 0 SControl F300)
[    8.024714] ata2: SATA link down (SStatus 0 SControl F300)
[    8.885543] scsi 2:0:0:0: Direct-Access     Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 6
[    8.918013] sd 2:0:0:0: [sda] 30490624 512-byte logical blocks: (15.6 GB/14.5 GiB)
[    8.926738] sd 2:0:0:0: [sda] Write Protect is off
[    8.932352] sd 2:0:0:0: [sda] No Caching mode page found
[    8.937809] sd 2:0:0:0: [sda] Assuming drive cache: write through
[    8.949565]  sda: sda1 sda2
[    8.956357] sd 2:0:0:0: [sda] Attached SCSI removable disk
[    8.970984] sd 2:0:0:0: Attached scsi generic sg0 type 0
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
[   18.106971] EXT4-fs (sda1): mounted filesystem without journal. Opts: (null)
Begin: Running /scripts/local-bottom ... done.
done.
Begin: Running /scripts/init-bottom ... mount: mounting /dev on /root/dev failed: No such file or directory
done.
Target filesystem doesn't have requested /sbin/init.
No init found. Try passing init= bootarg.
modprobe: module i8042 not found in modules.dep
[   18.205174] uhci_hcd: USB Universal Host Controller Interface driver
[   18.217726] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   18.230783] usbcore: registered new interface driver usbhid
[   18.236505] usbhid: USB HID core driver


BusyBox v1.20.2 (Debian 1:1.20.0-7) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
(initramfs)

best regards,
pepesz
Use the rootfs label to ensure the rootfs is mounted correctly:

1. On a different Linux box, mount the USB rootfs, and set the label of the USB drive to "rootfs". Assuming the USB drive is assigned sda1:
# tune2fs -L rootfs /dev/sda1


2. Plug back the USB drive to the NSA325, power up, stop serial console and, set the environment variable usb_init:
setenv usb_init "run usb_scan; setenv usb_root LABEL=rootfs"


3. Continue booting, once booted into Debian, set the usb_init env above for real.

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

after setting setenv usb_init "run usb_scan; setenv usb_root LABEL=rootfs"
i got:
Hit any key to stop autoboot:  0
## Error: "usb_scan" not defined
** Bad device usb 0 **
** Bad device usb 0 **

cheers,
pepesz
OK,

it's solved.

I set the envs as follow:
usb_init=usb start
usb_root=LABEL=rootfs

usb_root was previously set to /dev/sda1 while my system is on /dev/sda2

Looks like I can try to flash it to nand.
Thanks a lot!!

pepesz
Try

setenv usb_init 'usb start; setenv usb_root LABEL=rootfs'

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

I just flashed the uboot to nand.
# ./tools/flash_erase /dev/mtd0 0 4
Erase Total 4 Units
Performing Flash Erase of length 131072 at offset 0x60000 done
# ./tools/nandwrite /dev/mtd0 uboot.2013.10-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

I do not see any errors but I'm wonder if it is safe to reboot. I was expecting one extra line:
Writing data to block 3 at offset 0x60000

Thanks a lot,
pepesz
It's OK. For sanity, list the envs with fw_printev. If there is no error, go ahead and reboot.

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

It is working!
Thank you very much.

Best regards,
pepesz
Hi bodhi,

Is there any chance you could provide complete step by step instructions to flashing the latest uboot on NSA325 in a single post? As it is, the information is scattered across multiple posts (some of which I don't quite understand), which makes it very confusing to follow.



Edited 1 time(s). Last edit at 10/14/2014 06:27PM by archon.
Sorry, you can't reply to this topic. It has been closed.