Welcome! Log In Create A New Profile

Advanced

Help with NSA310 kernel installation

Posted by tejeskifly 
tejeskifly
Help with NSA310 kernel installation
December 30, 2016 07:08AM
Hi,

I have a NSA310 wit this linux on hdd:

https://forum.nas-central.org/viewtopic.php?f=249&t=5145

How can i install this kernel and debian on my box?

I have serial connection and i try to reset env to default and boot back to original os but i got crc error on kernel load.



Edited 1 time(s). Last edit at 12/30/2016 03:07PM by bodhi.
Re: Help with NSA310 kernel installation
December 30, 2016 03:11PM
tejeskifly Wrote:
-------------------------------------------------------
> Hi,
>
> I have a NSA310 wit this linux on hdd:
>
> https://forum.nas-central.org/viewtopic.php?f=249&;
> t=5145
>
> How can i install this kernel and debian on my
> box?
>
> I have serial connection and i try to reset env to
> default and boot back to original os but i got crc
> error on kernel load.

There is not enough information to help.

Please post serial console boot log (from u-boot banner until Debian prompt). And post output of

fw_printenv
cat /proc/mtd
cat /etc/fw_env.config

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
tejeskifly
Re: Help with NSA310 kernel installation
January 02, 2017 07:15AM
Here is the boot:

http://pastebin.com/LmP6JNMP

mtd:

root@HomeNas:~# cat /proc/mtd
dev: size erasesize name
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"


I don't have fw_printenv and fw_env.config. I can update to debian 7 and install u-boot-tools. But instend off upgrade i want to install the jessie rootfs and your kernel and u-boot if needed.
Re: Help with NSA310 kernel installation
January 02, 2017 03:55PM
tejeskifly,

> I don't have fw_printenv and fw_env.config. I can
> update to debian 7 and install u-boot-tools. But
> instend off upgrade i want to install the jessie
> rootfs and your kernel and u-boot if needed.

There are a few of options.

1. Use your existing rootfs. And install kernel linux-4.9.0-kirkwood-tld-1 on it. And then later, install new u-boot. This is a minimalist approach that take you step by step to run a latest kernel.

Quote

Updated 17 Dec 2016:

Kernel linux-4.9.0-kirkwood-tld-1 package has been uploaded.

2. Replace the rootfs with Debian-4.4.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2. You would do this if you don't care about your current rootfs. After you run this rootfs, upgrade the kernel to linux-4.9.0-kirkwood-tld-1. And then later, install new u-boot.

3. A variation of number 2: create a new partition on you HDD. And put the Debian-4.4.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2 on it. And you can adjust u-boot envs while in serial console to boot this new rootfs correctly. Save your current rootfs as is in case you want to boot back to it.


All 3 options starting with the old u-boot. Note that I asked to see the entire serial console log, but your pastebin log does not have u-boot booting part. Before you proceed, it's best that you post that so I can see which u-boot version is on your box. And you can list the envs while in serial console:
printenv

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Help with NSA310 kernel installation
January 02, 2017 04:13PM
Sorry for nick change, but i find i have registred account...


Here is the requested part: http://pastebin.com/JPasXMQy

I don't care about the current rootfs so option two is the best for me.
Re: Help with NSA310 kernel installation
January 02, 2017 04:49PM
bttd Wrote:
-------------------------------------------------------
> Sorry for nick change, but i find i have registred
> account...
>
>
> Here is the requested part:
> http://pastebin.com/JPasXMQy
>
> I don't care about the current rootfs so option
> two is the best for me.

OK then it's a lot easier! Since you have serial console, things should go smoothly than doing it blind.

Summary:

It is simpler if you create the Debian 4.4 rootfs on USB first, and boot with it (don't worry about the kernel upgrade for now). After the Debian 4.4 booted, shutdown and tar this USB rootfs to a tarball (using another Linux box). Boot back, wipe out the HDD (make backup first if you like). And restore the USB rootfs to the HDD.

Steps:

1. Inside this running NSA310. Create the USB rootfs using Debian-4.4.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2 as instructed in this post
http://forum.doozan.com/read.php?2,12096

Quote

Updated 20 Feb 2016:

This Debian-4.4.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2 is to keep in sync with kernel Linux-4.4.0-kirkwood-tld-1.

Important to follow the instruction very closely: being root user (not sudo), single Ext3 partition, label rootfs. And you are booting with stock u-boot, so you must do step 4 to append DTB to uImage using the appropriate nsa310 DTB in /boot/dts (there are 3 variations).

2. Boot with serial console, interrupt it and adjust the envs to boot with USB

setenv mtdparts '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)'
setenv set_bootargs 'setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $(mtdparts)'
setenv bootcmd 'run set_bootargs; run bootcmd_exec'
setenv bootcmd_exec 'usb start; ext2load usb 0:1 0x800000 /boot/uImage; ext2load usb 0:1 0x1100000 /boot/uInitrd; bootm 0x800000 0x1100000'
And then boot to Debian
boot

Let's come back here after you booted the new USB rootfs, or if any problem please post the entire serial console log.

Note: The /etc/fw_env.config file needs to be modified to be the same as stock (I forgot what it was) so you can use fw_printev/setenv.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Help with NSA310 kernel installation
January 04, 2017 03:36AM
Ok, now the system booted from usb, and i copy everything to my hdd.

I make an fstab for my partitions:

# <file system> <mount point> <type> <options> <dump> <pass>
/dev/sda1 /boot ext3 noatime,errors=remount-ro 0 1
/dev/sda2 / ext4 noatime,errors=remount-ro 0 1
/dev/sda6 /home ext4 defaults 0 1
/dev/sda5 swap swap defaults 0 0
tmpfs /tmp tmpfs defaults 0 0


Can you help me the next steps? First update u-boot than make it bootable from hdd. My mtd partition's looks different than what i need.
Re: Help with NSA310 kernel installation
January 04, 2017 06:03AM
bttd Wrote:
-------------------------------------------------------
> Ok, now the system booted from usb, and i copy
> everything to my hdd.
>
> I make an fstab for my partitions:
>
> # <file system> <mount point> <type> <options>
> <dump> <pass>
> /dev/sda1 /boot ext3
> noatime,errors=remount-ro 0 1
> /dev/sda2 / ext4
> noatime,errors=remount-ro 0 1
> /dev/sda6 /home ext4 defaults
> 0 1
> /dev/sda5 swap swap defaults
> 0 0
> tmpfs /tmp tmpfs defaults
> 0 0
>
>
> Can you help me the next steps? First update
> u-boot than make it bootable from hdd. My mtd
> partition's looks different than what i need.


Go ahead follow the instruction in the uboot thread. Keep the log. At each step where you have question, or not sure how to proceed, post the entire log until that question.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Help with NSA310 kernel installation
January 04, 2017 04:24PM
My first question:

Quote

- And your mtd partitions should be:

cat /proc/mtd

dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 02000000 00020000 "rootfs"
mtd3: 0db00000 00020000 "data"


My mtd partitions look like:

root@HomeNas:~# cat /proc/mtd
dev: size erasesize name
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"

This is ok?
Re: Help with NSA310 kernel installation
January 04, 2017 08:37PM
bttd Wrote:
-------------------------------------------------------
> My first question:
>
>
Quote

- And your mtd partitions should be:
>
> cat /proc/mtd
>
> dev: size erasesize name
> mtd0: 00100000 00020000 "u-boot"
> mtd1: 00400000 00020000 "uImage"
> mtd2: 02000000 00020000 "rootfs"
> mtd3: 0db00000 00020000 "data"
>
>
> My mtd partitions look like:
>
> root@HomeNas:~# cat /proc/mtd
> dev: size erasesize name
> 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"
>
> This is ok?

It is OK to flash.

Quoting Step 1 in the instruction:

Quote

If you don't have /etc/fw_env.config file in your system then go ahead and create this file with the above content. MTD parts are not importan for booting and it can be adjusted later. For users who like to keep the stock mtd definition, there is no need to adjust it to the above definition. As long as mtd0 is defined as 1MB (0x 00100000) or greater then it will be OK:
mtd0: 00100000 00020000 "u-boot"

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Help with NSA310 kernel installation
January 06, 2017 01:33PM
I have some problem with fw_printenv

root@debian:~# fw_printenv ethaddr
Warning: Bad CRC, using default environment
## Error: "ethaddr" not defined

root@debian:~# fw_printenv
Warning: Bad CRC, using default environment
bootargs=
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=3
baudrate=115200
stdin=serial,cros-ec-keyb
stdout=serial,lcd
stderr=serial,lcd
Re: Help with NSA310 kernel installation
January 06, 2017 03:43PM
bttd Wrote:
-------------------------------------------------------
> I have some problem with fw_printenv
>
> root@debian:~# fw_printenv ethaddr
> Warning: Bad CRC, using default environment
> ## Error: "ethaddr" not defined
>
> root@debian:~# fw_printenv
> Warning: Bad CRC, using default environment
> bootargs=
> bootcmd=bootp; setenv bootargs root=/dev/nfs
> nfsroot=${serverip}:${rootpath}
> ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:$
> {hostname}::off; bootm
> bootdelay=3
> baudrate=115200
> stdin=serial,cros-ec-keyb
> stdout=serial,lcd
> stderr=serial,lcd

That's OK. It means the envs area was not flashed yet, and that area was not initialized by any thing that the fw_printenv can read. After you've done flashing u-boot envs image, fw_printenv will work.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Help with NSA310 kernel installation
January 08, 2017 03:45AM
OK i finished with uboot upgrade and hdd install. Now rootfs partition on sda1 and home on sda2 but my system still boot from usb. If i unplug the usb the nas won't boot.



Edited 1 time(s). Last edit at 01/08/2017 03:49AM by bttd.
Re: Help with NSA310 kernel installation
January 08, 2017 05:36AM
bttd,

Advise: for a booting problem, always post the log, from the u-boot banner to the point where it failed to boot. This will get you the answer faster, because I will need to see it. And probably we are in different time zones, so you don't want to take a whole day before you see a response.

In your case, you have serial console connected, so please post the entire serial console boot log.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Help with NSA310 kernel installation
January 08, 2017 02:43PM
Here it is:

U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:59:20 -0700)
ZyXEL NSA310 1-Bay Power Media Server


SoC: Kirkwood 88F6281_A0
DRAM: 256 MiB
WARNING: Caches not enabled
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Net: egiga0
PHY reset timed out
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot: 0
starting USB...
USB0: USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found

no USB devices available
importing envs ...
## Info: input data size = 349676 = 0x555EC
ERROR: Environment import failed: errno = 22

at cmd/nvedit.c:1084/do_env_import()
## Error: "scan_disk" not defined
** Bad device usb 0 **
** Bad device usb 0 **
Wrong Image Format for bootm command
Error occured, error code = 112
ERROR: can't get kernel image!

NAND read: Wrong Image Format for bootm command
Error occured, error code = 112
ERROR: can't get kernel image!
Re: Help with NSA310 kernel installation
January 08, 2017 05:13PM
bttd Wrote:
-------------------------------------------------------
> Here it is:
>
> U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:59:20
> -0700)
> ZyXEL NSA310 1-Bay Power Media Server
>
>
> SoC: Kirkwood 88F6281_A0
> DRAM: 256 MiB
> WARNING: Caches not enabled
> NAND: 256 MiB
> In: serial
> Out: serial
> Err: serial
> Net: egiga0
> PHY reset timed out
> MV88E1318 PHY initialized on egiga0
> Hit any key to stop autoboot: 0
> starting USB...
> USB0: USB EHCI 1.00
> scanning bus 0 for devices... 2 USB Device(s)
> found
> scanning usb for storage devices... 0
> Storage Device(s) found
>
> no USB devices available
> importing envs ...
> ## Info: input data size = 349676 = 0x555EC
> ERROR: Environment import failed: errno = 22
>
> at cmd/nvedit.c:1084/do_env_import()
> ## Error: "scan_disk" not defined
> ** Bad device usb 0 **
> ** Bad device usb 0 **
> Wrong Image Format for bootm command
> Error occured, error code = 112
> ERROR: can't get kernel image!
>
> NAND read: Wrong Image Format for bootm command
> Error occured, error code = 112
> ERROR: can't get kernel image!

Interrupt serial console and

printenv

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Help with NSA310 kernel installation
January 10, 2017 10:55AM
Her is the printenv output:

NSA310> printenv
arcNumber=4022
baudrate=115200
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run bootcmd_recovery;
bootcmd_exec=usb start; ext2load usb 0:1 0x800000 /boot/uImage; ext2load usb 0:1 0x1100000 /boot/uInitrd; bootm 0x800000 0x1100000
bootcmd_recovery=run set_recovery_bootargs; nand read 0x800000 nand0,7 ; bootm 0x800000
bootcmd_sata=run sata_init; run set_bootargs_sata; run sata_boot
bootcmd_uenv=run uenv_load; if test -eq 1; then run uenv_import; fi; sleep 3
bootcmd_usb=run usb_init; run set_bootargs_usb; run usb_boot
bootdelay=10
console=ttyS0,115200
device=0:1
dtb_file=/boot/dts/kirkwood-nsa310b-lmsensor-redusbled.dtb
ethact=egiga0
ethaddr=b6:d0:5e:0f:a1:17
led_error=orange blinking
led_exit=green off
led_init=green blinking
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:
mtdparts_recovery=mtdparts=orion_nand:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(nope_kernel_1),0x2FC0000(nope_rootfs1),0xA00000(kernel),0x2FC0000(rootfs)
partition=nand0,2
rootdelay=10
rootfstype=ext2
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
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $(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
set_recovery_bootargs=setenv bootargs console=ttyS0,115200 rootdelay=10 $mtdparts_recovery
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x810000
uenv_load=usb start; setenv uenv_loaded 0; for devtype in usb; do for disknum in 0; do run uenv_read_disk; done; done
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x810000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if $devtype part $disknum; then run uenv_read; fi
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: 2604/131068 bytes

If i check my hdd the label is fine:

root@debian:~# e2label /dev/sda1
rootfs



Edited 1 time(s). Last edit at 01/10/2017 11:00AM by bttd.
Re: Help with NSA310 kernel installation
January 10, 2017 03:00PM
bttd,

This the old envs settings. You did not flash the new default envs image:

Quote

8. Flashing default u-boot envs image uboot.2016.05-tld-1.environment.img in step 8 (section B).

As described in step 1, u-boot envs must be defined in etc/fw_env.config as

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

A special section (B. Flashing default u-boot envs image) about flashing default u-boot envs is included at the end of this installation procedure. Please follow the instruction in this section B to perform this step before continuing with step 9.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Help with NSA310 kernel installation
January 11, 2017 04:04AM
This is what i forget. I read it befor but when i'm do the update i forget to do the env upgrade. Now my nas working, i upgrade the kernel to latest.

Thanks for your help!
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: