自 Buster 升级以来,mtdparts 参数似乎被 Linux 内核忽略

自 Buster 升级以来,mtdparts 参数似乎被 Linux 内核忽略

在我的 NAS 上运行 Debian 多年。 Vanilla Debian 与 linux-image-kirkwood/linux-image-kernel。引导加载程序是u-boot。

对于 Debian Stretch (4.9.0-11-marvell),一切都很好:u-boot 将参数传递mtdparts=orion_nand:896k(u-boot),128k(u-boot-env),-(root)给 Linux,Linux 使用它来映射 NAND,并且可以愉快地将第三个分区挂载/boot为 ubifs。

现在我升级到 Buster(内核 4.19.0-6-marvell),Linux 似乎忽略了 mtdparts 参数:它传递得很好:

# dmesg|grep mtdparts
[    0.000000] Kernel command line: console=ttyS0,115200 ubi.mtd=2 mtdparts=orion_nand:896k(u-boot),128k(u-boot-env),-(root) root=/dev/sda rootflags=device=/dev/sda,device=/dev/sdb,defaults,noatime rootfstype=btrfs

…但似乎由于某种原因被忽略,有利于其他一些布局(默认?):

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00500000 00020000 "uImage"
mtd2: 00500000 00020000 "ramdisk"
mtd3: 06600000 00020000 "image"
mtd4: 00a00000 00020000 "mini firmware"
mtd5: 00500000 00020000 "config"

我没有升级u-boot。

以下是u-boot方面的相关信息:

=> printenv 
autoload=no
baudrate=115200
boot_fdt=no
bootcmd=setenv bootargs console=${console} ${optargs} ${mtdparts} ${root_hdd} ; run load_ubifs ; bootm 0x1000000 0x1200000 0x0900000
bootdelay=3
bootenv=uEnv.txt
console=ttyS0,115200
ethact=egiga0
ethaddr=00:50:43:XX:XX:XX
filesize=8936df
importbootenv=echo Importing environment ...; env import -t ${loadaddr} ${filesize}
load_ubifs=ubi part root ; ubifsmount ubi:rootfs ; ubifsload 0x0900000 /kirkwood-dns325.dtb ; ubifsload 0x1000000 /uImage ; ubifsload 0x1200000 /uInitrd
loadaddr=0x800000
loadbootenv=fatload usb 0 ${loadaddr} ${bootenv}
mtddevname=u-boot
mtddevnum=0
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:896k(u-boot),128k(u-boot-env),-(root)
nandloadimage=nand read ${loadaddr} kernel
nandroot=ubi0:rootfs ubi.mtd=rootfs
nandrootfstype=ubifs
optargs=ubi.mtd=2
partition=nand0,0
root_flash=ubi.mtd=root root=ubi0:rootfs rootfstype=ubifs
root_hdd=root=/dev/sda rootflags=device=/dev/sda,device=/dev/sdb,defaults,noatime rootfstype=btrfs
setbootargs=setenv bootargs console=${console} ${optargs} ${mtdparts} root=${bootenvroot} rootfstype=${bootenvrootfstype}
setnandbootenv=echo Booting from nand ...; setenv bootenvroot ${nandroot}; setenv bootenvrootfstype ${nandrootfstype}; setenv bootenvloadimage ${nandloadimage}
stderr=serial
stdin=serial
stdout=serial
subbootcmd=run setbootargs; if run bootenvloadimage; then bootm ${loadaddr};fi;
=> mtdparts

device nand0 <orion_nand>, # parts = 3
 #: name                size            offset          mask_flags
 0: u-boot              0x000e0000      0x00000000      0
 1: u-boot-env          0x00020000      0x000e0000      0
 2: root                0x07f00000      0x00100000      0

active partition: nand0,0 - (u-boot) 0x000e0000 @ 0x00000000

defaults:
mtdids  : nand0=orion_nand
mtdparts: mtdparts=orion_nand:896k(u-boot),128k(u-boot-env),5m(kernel),-(rootfs)
=> version

U-Boot 2014.01 (Jan 21 2014 - 18:35:47)
D-Link DNS-325
arm-none-eabi-gcc (Sourcery CodeBench Lite 2013.05-23) 4.7.3
GNU ld (Sourcery CodeBench Lite 2013.05-23) 2.23.52.20130219

启动时,在切换到 linux 之前:

UBI: available PEBs:             0
UBI: total number of reserved PEBs: 1012
UBI: number of PEBs reserved for bad PEB handling: 10
UBI: max/mean erase counter: 13/7
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: mounted read-only
UBIFS: file system size:   127346688 bytes (124362 KiB, 121 MiB, 987 LEBs)
UBIFS: journal size:       9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: zlib
UBIFS: reserved for root:  0 bytes (0 KiB)
Loading file '/kirkwood-dns325.dtb' to addr 0x00900000 with size 12863 (0x0000323f)...
Done
Loading file '/uImage' to addr 0x01000000 with size 2045912 (0x001f37d8)...
Done

任何想法 ?

答案1

最后,我找到了解决方案。最新的 debian 中有一个相关的错误:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=931852

这个mtdparts选项已经成为cmdlinepart.mtdparts(至少在 Debian 领域)。

因此,在 u-boot 提示符下运行以下命令就可以了:

setenv bootcmd 'setenv bootargs console=${console} ${optargs} cmdlinepart.${mtdparts} ${root_hdd} ; run load_ubifs ; bootm 0x1000000 0x1200000 0x0900000'
saveenv
boot

相关内容