Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3178

Please add built-in kernel UBIFS support for Kirkwood and any other boards with on-board eMMC flash (4 replies)

$
0
0
I am trying to update an Ionics Nimbus 100 SoC from Debian 6 (eMMC UBIFS rootfs) to Debian "stable". (The Ionics Nimbus 100 is a repackaged version of the Marvell SheevaPlug.) I am stuck at the point where my UBIFS rootfs fails to mount because none of the Linux Kirkwood kernel packages I have tried support UBIFS in the kernel, which is required to boot a UBIFS rootfs.

From "How do I mount UBIFS?" in "UBIFS FAQ and HOWTO":

"In order to mount UBIFS as the root file system, you have to compile UBIFS into the kernel (instead of compiling it as a kernel module) and specify proper kernel boot arguments and make the kernel mount UBIFS on boot. You have to provide the boot arguments to attach the UBI device (using the ubi.mtd= argument, see here). Then you should tell the kernel the file system type by providing the rootfstype= argument. And finally, you should specify which UBI volume has to be mounted on boot using the root= argument. The volume is specified the same way as described above (ubiX_Y or ubiX:NAME)."

Here's what I have tried:

Debian uses the Kirkwood ARMEL SheevaPlug installer for the Nimbus 100. Unfortunately, the Kirkwood ARMEL installer for Debian 12 fails to enumerate USB drives on my Nimbus 100 (yet, it does enumerate USB drives on my Marvell SheevaPlug). Debian 11 does not have this problem, which allowed me to install Debian 11 to a USB ext4 rootfs (LEXAR JD FIREFLY).

I found the USB drive enumeration failure is actually a bug in the Linux kernel. I built a micro rootfs using debootstrap and debuerreotype and wrote it to a UBIFS rootfs on the internal eMMC flash. I have booted both the Debian 11 Linux 5.10.0-32-marvell kernel and the Debian 12 Linux 6.1.0-25-marvell kernel. Neither kernel has built-in UBIFS support, so I get stuck in both cases at the point where they fail to mount the eMMC ubi0:rootfs. However, at that point I am able to see that Linux 6.1.0-25-marvell does not enumerate my USB drive, whereas Linux 5.10.0-32-marvell does.

I found the article Linux Kerne 6.10.11 Kirkwood package and Debian rootfs and went through the steps to unpack and install the linux-image-6.10.11-kirkwood-tld-1_1_armel.deb kernel package. I was hoping it would allow me to make progress to boot my UBIFS rootfs. I was also hoping it would be a more recent version of Linux 6 than the Debian Linux 6.1.0-25-marvell that fixes the problem enumerating a USB drive on a Nimbus 100.

I can report that the Linux 6.10.11-kirkwood-tld-1 kernel solves the problem of enumerating my Lexar USB drive:
[    6.409884][    T8] usb 1-1: New USB device found, idVendor=05dc, idProduct=a701, bcdDevice=11.00
[    6.418850][    T8] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    6.439428][    T8] usb 1-1: Product: JD FIREFLY
[    6.444099][    T8] usb 1-1: Manufacturer: LEXAR
[    6.448750][    T8] usb 1-1: SerialNumber: 1069A704000328051007
[    6.470773][    T8] usb-storage 1-1:1.0: USB Mass Storage device detected
[    6.490204][    T8] scsi host0: usb-storage 1-1:1.0
[    7.530971][   T32] scsi 0:0:0:0: Direct-Access     LEXAR    JD FIREFLY       1100 PQ: 0 ANSI: 0 CCS
[    7.554415][   T32] sd 0:0:0:0: [sda] 7864320 512-byte logical blocks: (4.03 GB/3.75 GiB)
[    7.570165][   T32] sd 0:0:0:0: [sda] Write Protect is off
[    7.579783][   T32] sd 0:0:0:0: [sda] No Caching mode page found
[    7.585872][   T32] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    7.617530][   T32]  sda: sda1
[    7.621207][   T32] sd 0:0:0:0: [sda] Attached SCSI removable disk
That is very good news. Unfortunately, the Linux 6.10.11-kirkwood-tld-1 kernel was built with UBIFS=m, which causes the failure to mount the eMMC ubi0:rootfs shown at the end of this post. You will see there that the list of all bdev filesystems built into the kernel is missing ubifs:
[   19.716242][    T1] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,253): error -19
[   19.725257][    T1] Please append a correct "root=" boot option; here are the available partitions:
[   19.734421][    T1] List of all bdev filesystems:
[   19.739153][    T1]  ext3
[   19.739161][    T1]  ext4
[   19.741840][    T1]  exfat
[   19.744482][    T1]  fuseblk
[   19.747200][    T1]  xfs
This is an unfortunate omission for a kernel built for a small SoC that is designed to boot from flash. Please add (restore?) the ability of the Kirkwood kernels to boot from an eMMC UBIFS rootfs.

If that will take a while, please point me to the instructions I can follow to rebuild the Linux 6.10.11-kirkwood-tld-1 kernel with UBIFS support enabled (see "3. Kernel configuration" in How to support UBIFS through MTD) and I'll give that a try in the mean time.

Thank you,

Larry Baker
US Geological Survey (Ret.)

My stock Nimbus 100 U-Boot 2011.03-rc1 (Jun 23 2011 - 14:26:27) setup:
Marvell>> setenv bootcmd_ubi 'ubi part rootfs; ubifsmount rootfs; ubifsload 0x00800000 /boot/uImage'
Marvell>> setenv ubi_boot 'init_ionics mode bootup; run bootcmd_ubi; run set_ubi_bootargs; bootm 0x00800000'
Marvell>> setenv ubi_bootargs console=ttyS0,115200 cmdlinepart.$(mtdparts)
Marvell>> setenv set_ubi_bootargs 'setenv bootargs $(ubi_bootargs) ubi.mtd=rootfs rootfstype=ubifs root=ubi0:rootfs rw rootdelay=10 noswap earlyprintk=serial'
Marvell>> setenv ubi_bootcmd 'setenv bootcmd $(ubi_boot); saveenv'
Marvell>> run ubi_bootcmd
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x60000 -- 100% complete.
Writing to Nand... done
The U-Boot boot of the Linux 6.10.11-kirkwood-tld-1 kernel from the UBI rootfs /boot/uImage, to the point where the booted Linux kernel cannot mount the ubi0:rootfs rootfs and panics:
Marvell>> reset
resetting ...


U-Boot 2011.03-rc1 (Jun 23 2011 - 14:26:27)
IONICS-PlugComputer NIMBUS E0

SoC:   Kirkwood 88F6281_A0
DRAM:  512 MiB
NAND:  512 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot:  0 
Creating 1 MTD partitions on "nand0":
0x000000a00000-0x000020000000 : "mtd=3"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI: attached mtd1 to ubi0
UBI: MTD device name:            "mtd=3"
UBI: MTD device size:            502 MiB
UBI: number of good PEBs:        4015
UBI: number of bad PEBs:         1
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             39
UBI: total number of reserved PEBs: 3976
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 29/20
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: mounted read-only
UBIFS: file system size:   505257984 bytes (493416 KiB, 481 MiB, 3916 LEBs)
UBIFS: journal size:       25288704 bytes (24696 KiB, 24 MiB, 196 LEBs)
UBIFS: media format:       w5/r0 (latest is w4/r0)
UBIFS: default compressor: LZO
UBIFS: reserved for root:  5182151 bytes (5060 KiB)
Loading file '/boot/uImage' to addr 0x00800000 with size 6185336 (0x005e6178)...
Done
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   kernel 6.10.11-kirkwood-tld-1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    6185272 Bytes = 5.9 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

[    0.000000][    T0] Booting Linux on physical CPU 0x0
[    0.000000][    T0] Linux version 6.10.11-kirkwood-tld-1 (root@tldDebian) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils f4
[    0.000000][    T0] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000][    T0] CPU: VIVT data cache, VIVT instruction cache
[    0.000000][    T0] OF: fdt: Machine model: Globalscale Technologies SheevaPlug
[    0.000000][    T0] printk: legacy bootconsole [earlycon0] enabled
<snip>
[    0.000000][    T0] Kernel command line: console=ttyS0,115200 cmdlinepart.mtdparts=orion_nand:1m@0m(u-boot),4m@1m(kernel),5m@5m(l
[    0.000000][    T0] Unknown kernel command line parameters "noswap", will be passed to user space.
<snip>
[    4.954833][    T1] 4 cmdlinepart partitions found on MTD device orion_nand
[    4.961861][    T1] Creating 4 MTD partitions on "orion_nand":
[    4.967739][    T1] 0x000000000000-0x000000100000 : "u-boot"
[    4.974284][    T1] 0x000000100000-0x000000500000 : "kernel"
[    4.980842][    T1] 0x000000500000-0x000000a00000 : "pluginfo"
[    4.987568][    T1] 0x000000a00000-0x000020000000 : "rootfs"
<snip>
[    8.649097][    T1] ubi0: attaching mtd3
[    9.278672][    T1] ubi0: scanning is finished
[    9.302685][    T1] ubi0: attached mtd3 (name "rootfs", size 502 MiB)
[    9.309199][    T1] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
[    9.316862][    T1] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
[    9.324325][    T1] ubi0: VID header offset: 512 (aligned 512), data offset: 2048
[    9.331869][    T1] ubi0: good PEBs: 4015, bad PEBs: 1, corrupted PEBs: 0
[    9.338704][    T1] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[    9.346696][    T1] ubi0: max/mean erase counter: 29/20, WL threshold: 4096, image sequence number: 1245509428
[    9.356775][    T1] ubi0: available PEBs: 0, total reserved PEBs: 4015, PEBs reserved for bad PEB handling: 79
[    9.366870][  T129] ubi0: background thread "ubi_bgt0d" started, PID 129
<snip>
[   19.716242][    T1] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,253): error -19
[   19.725257][    T1] Please append a correct "root=" boot option; here are the available partitions:
[   19.734421][    T1] List of all bdev filesystems:
[   19.739153][    T1]  ext3
[   19.739161][    T1]  ext4
[   19.741840][    T1]  exfat
[   19.744482][    T1]  fuseblk
[   19.747200][    T1]  xfs
[   19.750148][    T1] 
[   19.754895][    T1] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,253)
[   19.764077][    T1] CPU: 0 PID: 1 Comm: swapper Not tainted 6.10.11-kirkwood-tld-1 #1 211932710076a3f6d6304997ca04b9111b47c9c4
[   19.775533][    T1] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[   19.782537][    T1] Call trace: 
[   19.782552][    T1]  unwind_backtrace from show_stack+0x10/0x14
[   19.791781][    T1]  show_stack from panic+0xf0/0x334
[   19.796882][    T1]  panic from mount_root_generic+0x1d0/0x2a8
[   19.802768][    T1]  mount_root_generic from prepare_namespace+0x1b8/0x244
[   19.809700][    T1]  prepare_namespace from kernel_init_freeable+0x1bc/0x20c
[   19.816806][    T1]  kernel_init_freeable from kernel_init+0x10/0x138
[   19.823312][    T1]  kernel_init from ret_from_fork+0x14/0x28
[   19.829108][    T1] Exception stack(0xa0819fb0 to 0xa0819ff8)
[   19.834895][    T1] 9fa0:                                     00000000 00000000 00000000 00000000
[   19.843817][    T1] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   19.852744][    T1] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[   19.860099][    T1] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,253) ]---]http://www.linux-mtd.infradead.org/faq/ubifs.html[/url]:

Viewing all articles
Browse latest Browse all 3178

Trending Articles