Welcome! Log In Create A New Profile

Advanced

Problems Switching from OpenWRT to Debian Zyxel NSA-325

Posted by Predi 
Dear all,

first of all excuse me for my bad english and im not so familar with the linux.

Hab success with the guide from OpenWRT to install an flash uboot and the OpenWRT Image.
Want to install OMV and thats the reason why i want to switch to debian.

But i can't boot from USB Stick, tried many guides... also i have not the same mtd drives in my list, like shown here. Hope you can help me.


thank you

greetings

Predi



root@OpenWrt:/# cat /etc/fw_env.config

/dev/mtd1 0x0 0x20000 0x20000



printenv
baudrate=115200
bootcmd=run setenv bootargs; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000
bootdelay=3
console=console=ttyS0,115200
ethact=egiga0
ethaddr=5C:F4:AB:51:66:57
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x00c0000(uboot),0x80000(uboot_env),0x7ec0000(ubi)
stderr=serial
stdin=serial
stdout=serial

Environment size: 349/131068 bytes
Re: Problems Switching from OpenWRT to Debian Zyxel NSA-325
February 06, 2023 03:02PM
Predi,

> Hab success with the guide from OpenWRT to install
> an flash uboot and the OpenWRT Image.
> Want to install OMV and thats the reason why i
> want to switch to debian.
>
> But i can't boot from USB Stick, tried many
> guides... also i have not the same mtd drives in
> my list, like shown here. Hope you can help me.

The easiest way to install Debian is to treat the OpenWrt as stock u-boot. This way you can avoid have to install another u-boot. OpenWrt u-boot works almost as well as my released u-boot 2017.07 here.

So see this post:

https://forum.doozan.com/read.php?2,102054,105374#msg-105374

Quote

Boot Kirkwood rootfs with stock u-boot

Note: I've updated this instruction to make it more robust (to take into consideration the limitation of much older stock u-boots)

Assuming you have created a USB rootfs following the instruction in the release thread.

.... so on

So you should create the USB rootfs first, plug it in the NSA325 and follow the steps to set up the u-boot envs and boot it.

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

thank you very much for your help, after flashing your u-boot 2017.7 and setting the envs like describes in the post from above i hab success with booting, but some error messages. I read something about dtb but dont know what is was... sorry :-)

NSA325> usb reset
resetting 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> fatload usb 0 0x1000000 u-boot.kwb
524288 bytes read in 55 ms (9.1 MiB/s)
NSA325> nand erase 0x0 0x100000

NAND erase: device 0 offset 0x0, size 0x100000
Erasing at 0xe0000 -- 100% complete.
OK
NSA325> nand write 0x1000000 0x00000 0x100000

NAND write: device 0 offset 0x0, size 0x100000
1048576 bytes written: OK
NSA325> reset
resetting ...


U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:42:03 -0700)
ZyXEL NSA325 2-Bay Power Media Server

SoC: Kirkwood 88F6282_A1
DRAM: 512 MiB
WARNING: Caches not enabled
NAND: 128 MiB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: egiga0
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot: 0
NSA325> setenv usb_set_bootargs 'setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 earlyprintk=ser ial'
NSA325> setenv load_uimage 'ext2load usb 0:1 0x800000 /boot/uImage'
NSA325> setenv load_uinitrd 'ext2load usb 0:1 0x2100000 /boot/uInitrd'
NSA325> setenv usb_boot 'mw 0x800000 0 1; run load_uimage; run load_uinitrd; bootm 0x800000 0x2100000'
NSA325> setenv usb_bootcmd 'run usb_set_bootargs; run usb_boot'
NSA325> setenv bootcmd 'usb reset; run usb_bootcmd; usb stop; reset'
NSA325> printenv
arcNumber=4495
baudrate=115200
bootcmd=usb reset; run usb_bootcmd; usb stop; reset
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_uimag e_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
console=console=ttyS0,115200
device=0:1
devices=usb ide
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-nsa325.dtb
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
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=ext2load usb 0:1 0x800000 /boot/uImage
load_uimage_addr=0x800000
load_uinitrd=ext2load usb 0:1 0x2100000 /boot/uInitrd
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x100000(uboot),0x80000(stock_uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0x A00000(kernel_2),0x2FC0000(rootfs2)
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 $devi ces; 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 $diskn um: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; seten v 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; do ne;
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=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_boot=mw 0x800000 0 1; run load_uimage; run load_uinitrd; bootm 0x800000 0x2100000
usb_bootcmd=run usb_set_bootargs; run usb_boot
usb_ready_retry=15
usb_set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 earlyprintk=serial

Environment size: 3245/131068 bytes
NSA325> boot
resetting 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
5435888 bytes read in 1061 ms (4.9 MiB/s)
9671091 bytes read in 1042 ms (8.9 MiB/s)
## Booting kernel from Legacy Image at 00800000 ...
Image Name: Linux-5.13.6-kirkwood-tld-1
Created: 2021-09-24 0:22:58 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 5435824 Bytes = 5.2 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 02100000 ...
Image Name: initramfs-5.13.6-kirkwood-tld-1
Created: 2021-09-24 1:06:32 UTC
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 9671027 Bytes = 9.2 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Loading Kernel Image ... OK
Loading Ramdisk to 1f1d4000, end 1fb0d173 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Error: invalid dtb and unrecognized/unsupported machine ID
r1=0x0000118f, r2=0x00000100
r2[]=05 00 00 00 01 00 41 54 00 00 00 00 00 00 00 00
Available machine support:

ID (hex) NAME
ffffffff Generic DT based system
ffffffff Marvell Kirkwood (Flattened Device Tree)

Please check your kernel config and/or bootloader.
Re: Problems Switching from OpenWRT to Debian Zyxel NSA-325
February 06, 2023 05:06PM
Predi,

> thank you very much for your help, after flashing
> your u-boot 2017.7

Ah, I see you've already flashed new u-boot!

> *** Warning - bad CRC, using default environment

You've missed Step 8 (flashing default envs image). But it is OK, the internal envs should allow you to boot into Debian on USB without any modification.

The USB rootfs must be created with Debian-5.13.6-kirkwood-tld-1-rootfs-bodhi.tar.bz2, which you did.

But make sure you did not do Step 4. Because you're booting with new u-boot.

Quote

4. (Stock u-boot only) Create uImage with embedded DTB for booting with older u-boots (2012 or earlier). Skip this step if you have installed the latest U-Boot for Kirkwood (or are installing this u-boot at the same time, or running kwboot with latest u-boot image).

So if you did Step 4 then reverse it. Mount the USB on another Linux box and assuming it is mounted at /media/sdb1

cd /media/sdb1/boot
cp -a uImage.orig uImage
sync
And umount, take it back to to NSA325, attach the USB roots, and power up. Watch serial console, it should boot all the way into Debian. You don't need to enter any new envs.

If there is problem, post the entire serial console log here.

=====

After you have booted successfully into Debian, you can come back to the u-boot serial console and save the envs. There is some minor modification that should be done. Post back and I'll show you which one and what to do.

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



Edited 1 time(s). Last edit at 02/06/2023 05:07PM by bodhi.
bodhi,

you're the best of all :-) Thank you again for your expert help..

Quote
bodhi
You've missed Step 8 (flashing default envs image). But it is OK, the internal envs should allow you to boot into Debian on USB without any modification.
yes i did not flash it, because i dont know what it does, flashing u-boot feels safe for me...flashed it now many times, also OpenWRT bin.
i think the problem was an env setting that i did:

setenv mtdparts 'mtdparts=orion_nand:0x00c0000(uboot),0x80000(uboot_env),0x7ec0000(ubi)'

After that debian could not boot and i had to flash your uboot again and i could see many more partitions, now its booting.
Actually its installing OMV.

There are some error messages about partitions at startup.

OMV Install failed

but now its time to go to sleep :-)

thank you
Re: Problems Switching from OpenWRT to Debian Zyxel NSA-325
February 06, 2023 05:56PM
> setenv mtdparts
> 'mtdparts=orion_nand:0x00c0000(uboot),0x80000(uboot_env),0x7ec0000(ubi)'
>
> After that debian could not boot and i had to
> flash your uboot again and i could see many more
> partitions, now its booting.

Cool!

> Actually its installing OMV.
>
> There are some error messages about partitions at
> startup.

That's OK. The defaultt envs scan all possible ports to see where the kernel is. Once you are running OK, you can go back and remove devices like MMC (not applicable), or arrange the order of scanning to make it boot faster and less noisy.

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

was a hard night (morning) but OMV is installed now, had some problems with certificates at the beginning of the installation, then many errors at the end but there are many tools in omw to repair the whole installation and configure the eth0 and password with the first aid tool...after that i had access to the webui

still have some problems with quota check and ext4 Raid md0, maybe i have to unmount and clean the (used) harddrives with gdisk.
Quote

quotacheck: Your kernel probably supports ext4 quota feature but you are using external quota files. Please switch your filesystem to use ext4 quota feature as external quota files on ext4 are deprecated.

samba works fine now with windows 10, im happy... the webui and configuration could be something faster, but for the first time im very happy....was a hard thing to do, would be better to buy a new NAS, but i like to do things like this.

i did the env flash, and it was succesful, but i dont know whats the benefit of the env image, isnt it the same when do the setenv coommands ?


thank you bodhi !! :-)


Many greetings

Predi
Re: Problems Switching from OpenWRT to Debian Zyxel NSA-325
February 07, 2023 03:19PM
> was a hard night (morning) but OMV is installed
> now, had some problems with certificates at the
> beginning of the installation, then many errors at
> the end but there are many tools in omw to repair
> the whole installation and configure the eth0 and
> password with the first aid tool...after that i
> had access to the webui

That seem to be the story with OMV. It takes a bit of works to install it correctly.

> still have some problems with quota check and ext4
> Raid md0, maybe i have to unmount and clean the
> (used) harddrives with gdisk.
>
Quote

quotacheck: Your kernel probably supports
> ext4 quota feature but you are using external
> quota files. Please switch your filesystem to use
> ext4 quota feature as external quota files on ext4
> are deprecated.
>
> samba works fine now with windows 10, im happy...
> the webui and configuration could be something
> faster, but for the first time im very
> happy....was a hard thing to do, would be better
> to buy a new NAS, but i like to do things like
> this.
>
> i did the env flash, and it was succesful, but i
> dont know whats the benefit of the env image, isnt
> it the same when do the setenv coommands ?

The envs image is needed for u-boot to run. U-boot first looks for the envs on flash, if it cannot find a valid set of envs (the CRC checksum is created when you save the envs), then it will fall back to the internal envs (inside u-boot image). Often time you would modify the envs to do something specific to the box, and it will be saved on flash. For example, the serverip and ipaddress are specific to your network environment (eg. 192.168.0.1 is the router). These are envs needed for u-boot to load kernel over the network when you run tftpboot, or booting with nfs rootfs. And that is just an example among many things you can set up and save to flash.

While it is possible to manually create the good set of envs at Linux shell, it is quite error prone and mistakes could lock you out of the box (and in some rare circumtances, it could also brick the box). So I provided the default envs image for flashing as a part of the installation.

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