Welcome! Log In Create A New Profile

Advanced

Kernel 6.8.7: no mtd devices on my NAS326

Posted by ptosch 
Kernel 6.8.7: no mtd devices on my NAS326
May 18, 2024 07:18AM
Heya,

recently I installed my NSA326 from scratch, but unfortunately with kernel 6.8.7 I do not see any mtd devices.
So I found out that I have to modprobe mtdblock, but there are still no mtd devices. If using the same rootfs but with kernel 4.9.0 fw_print shows alls the uboot variables, with 6.8.7 I get "Configuration file wrong or corrupted).

root@nas326:~# dmesg | grep -i nand
[    0.000000] Kernel command line: console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=pxa3xx_nand-0:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2) earlyprintk=serial
[    2.612649] marvell-nfc f10d0000.flash: too many NAND chips: 7 (max = 4 CS)

root@nas326:~# modprobe mtdblock

root@nas326:~# fw_printenv 
Configuration file wrong or corrupted

root@nas326:~# ls -la /dev/m*
crw-r----- 1 root kmem 1, 1 May 18 05:04 /dev/mem

/dev/mapper:
total 0
drwxr-xr-x  2 root root      60 May 18 05:03 .
drwxr-xr-x 13 root root   12880 May 18 05:04 ..
crw-------  1 root root 10, 236 May 18 05:04 control
root@nas326:~#

I am stuck now since I would expect the mtd device to appear after modprobe.

How could I get mtd running again under kernel 6.8.7?

TIA
Peter
Attachments:
open | download - envs.txt (5.3 KB)
open | download - dmesg.txt (29 KB)
Re: Kernel 6.8.7: no mtd devices on my NAS326
May 18, 2024 02:03PM
Peter,

> recently I installed my NSA326 from scratch, but
> unfortunately with kernel 6.8.7 I do not see any
> mtd devices.

[Sat May 18 05:15:08 2024] marvell-nfc f10d0000.flash: too many NAND chips: 7 (max = 4 CS)
[Sat May 18 05:15:08 2024] marvell-nfc: probe of f10d0000.flash failed with error -22



> I am stuck now since I would expect the mtd device
> to appear after modprobe.

The problem was the NAND chip was not probed successully, not because of the module needed to be modprobe. At this point, you have no NAND flash in Linux.

Let me take a look closer.

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



Edited 1 time(s). Last edit at 05/18/2024 02:20PM by bodhi.
Re: Kernel 6.8.7: no mtd devices on my NAS326
May 18, 2024 02:23PM
Peter,

Your envs look weird. It shows the bootcmd boots from NAND kernel, not the fall back method that I wrote in the instruction.

Please post the entire serial boot log (from u-boot banner until Debian login prompt).

Also, log in and

cat /proc/cmdline

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



Edited 1 time(s). Last edit at 05/18/2024 03:11PM by bodhi.
Re: Kernel 6.8.7: no mtd devices on my NAS326
May 19, 2024 05:12AM
Hello Bodhi,

long time no write! Thank you very much for your assistance. As requested, I have attached the complete boot log from the system, which I created today again.

This is the cmdline:
root@nas326:~# cat /proc/cmdline
console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=pxa3xx_nand-0:2m(u-boot),2m(env),2m(config),15m(kernel1),110m(rootfs1),15m(kernel2),-(rootfs2) earlyprintk=serial
root@nas326:~#

To be candid, I encountered some issues during the installation process. The primary challenge was executing dpkg without a functional root file system (rootfs) on the box. Only the 4.9.0 rootfs successfully booted; all other rootfs versions resulted in an ‘invalid dtb’ error.

Here’s how I tried:
Since the box has an old U-Boot, I initially used the 4.9.0 rootfs to boot into Debian. In this 4.9.0 system, I created the 6.8.7 uImage and uInitrd using dpkg. Subsequently, I removed the 4.9.0 system, unpacked the 6.6.2 rootfs, and replaced the boot directory with the one I had generated in 4.9.0.

However, this approach led to the system booting in read-only mode on the first boot with this message:
Activating swap:.
[   25.032611][ T1574] EXT4-fs (sda1): re-mounted 62189c02-7649-443b-9a7e-0d694bff0270 ro. Quota mode: none.
Will now check root file system:[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -y -C0 /dev/sda1 
e2fsck 1.47.0 (5-Feb-2023)
fsck.ext3: Device or resource busy while trying to open /dev/sda1
Filesystem mGive root password for maintenance

To resolve this, I logged in, mounted the system as read-write, and installed the 6.8.7 kernel deb package. After these adjustments, the system booted normally.

As a precaution, I recreated then the uImage and uInitrd. Unfortunately, this method resultes in a non-functioning MTD device.

TIA,
Peter
Attachments:
open | download - screenlog.0 (33.3 KB)
Re: Kernel 6.8.7: no mtd devices on my NAS326
May 19, 2024 03:08PM
Peter,

It seems your rootf is no longer reliable after you've done this

Quote

Since the box has an old U-Boot, I initially used the 4.9.0 rootfs to boot into Debian. In this 4.9.0 system, I created the 6.8.7 uImage and uInitrd using dpkg. Subsequently, I removed the 4.9.0 system, unpacked the 6.6.2 rootfs, and replaced the boot directory with the one I had generated in 4.9.0.

Since you're installing from scratch, you should start with the Debian-6.6.2-mvebu-tld-1-rootfs-bodhi.tar.bz2 rootfs. Boot, and then after login, install kernel linux-6.8.7-mvebu-tld-1.

====

The dpkg process populates the rootfs with necessary files in the root file system (under /etc and /lib/modules), in addition to the kernel files in /boot.The initramfs created in an old Debian rootfs should not be used in a much newer Debian rootfs (they are likely to have some differences). So don't copy the entire /boot files over.

Basically, if you want to boot a different kernel temporarily, you could use that kernel uImage to boot, but don't boot with uInitrd (you need to change u-boot envs temporarily in this case).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Kernel 6.8.7: no mtd devices on my NAS326
May 19, 2024 03:55PM
bodhi Wrote:
-------------------------------------------------------

> Since you're installing from scratch, you should
> start with the
> Debian-6.6.2-mvebu-tld-1-rootfs-bodhi.tar.bz2
> rootfs. Boot, and then

... and then I got kernel message:

Found 1 device(s).
5179584 bytes read in 170 ms (29.1 MiB/s)
5257173 bytes read in 169 ms (29.7 MiB/s)
## Booting kernel from Legacy Image at 02000000 ...
   Image Name:   Linux-6.6.2-mvebu-tld-1
   Created:      2023-12-12  22:01:11 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5179520 Bytes = 4.9 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 02900000 ...
   Image Name:   initramfs-6.6.2-mvebu-tld-1
   Created:      2023-12-12  22:03:52 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    5257109 Bytes = 5 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...


Error: invalid dtb and unrecognized/unsupported machine ID
  r1=0x00000210, 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 MMP2 (Device Tree Support)
ffffffff        Marvell MMP3
ffffffff        Marvell Armada 39x (Device Tree)
ffffffff        Marvell Armada 380/385 (Device Tree)
ffffffff        Marvell Armada 375 (Device Tree)
ffffffff        Marvell Armada 370/XP (Device Tree)
ffffffff        Marvell Dove

Please check your kernel config and/or bootloader.
Re: Kernel 6.8.7: no mtd devices on my NAS326
May 19, 2024 04:27PM
Peter,

You've missed this step during rootfs creation.

3. Create uImage with DTB appended. I am using the Zyxel NAS326 as an example here. Please replace armada-380-zyxel-nas326.dtb below with the appropriate DTB name for your box. 

cd /media/sdb1/boot
cp -a uImage uImage.orig
cp -a zImage-6.6.2-mvebu-tld-1 zImage.fdt 
cat dts/armada-380-zyxel-nas326.dtb >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-6.6.2-mvebu-tld-1 -d zImage.fdt uImage

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Kernel 6.8.7: no mtd devices on my NAS326
May 20, 2024 03:30AM
Bodhi,

thanks for the hint, unfortunately I got a bit confused with the instructions.
Now kernel 6.8.7 boots fine with working mtd device.

I'm just not sure if my environment variables are ok, I've uploaded them again now.
Should I run the following command on my box to be on the safe side?

fw_setenv /boot/dts/armada-380-zyxel-nas326.dtb
Attachments:
open | download - fw_env.txt (5.3 KB)
Re: Kernel 6.8.7: no mtd devices on my NAS326
May 20, 2024 02:08PM
Peter,

> I'm just not sure if my environment variables are
> ok, I've uploaded them again now.

It looks OK.

> Should I run the following command on my box to be
> on the safe side?
>
>
> fw_setenv /boot/dts/armada-380-zyxel-nas326.dtb
>

No need to worry about the DTB. Since we boot this box with the DTB appended to uImage, the DTB location is not relevant.

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