我已经通过 u-boot / 串行控制台在“ReadyNAS 102”上安装了 Debian Buster。我正在关注本教程。但是,替换为使用不同的链接来下载当前的 Debian 安装程序和设备树 Blob:
- http://ftp.debian.org/debian/dists/buster/main/installer-armhf/current/images/device-tree/armada-370-netgear-rn102.dtb
- http://ftp.debian.org/debian/dists/buster/main/installer-armhf/current/images/netboot/initrd.gz
- http://ftp.debian.org/debian/dists/buster/main/installer-armhf/current/images/netboot/vmlinuz
安装工作正常,除了 grub 的安装(根据教程已知会失败)。相反,您必须手动安装/配置该flash-kernel
包。
我还必须手动调用“mtdpart”来创建uImage
和minirootfs
分区,最终才能成功运行“update-initramfs”:
# mtdpart add /dev/mtd0 uImage 0x200000 0x600000
# mtdpart add /dev/mtd0 minirootfs 0x800000 0x1000000
# update-initramfs -u
到目前为止,一切都很好。我启动了内核,但启动后我有一些预配置的“mtd 分区”,它们似乎源自内核设备树:
~# cat /proc/mtd
dev: size erasesize name
mtd0: 00180000 00020000 "u-boot"
mtd1: 00020000 00020000 "u-boot-env"
mtd2: 00600000 00020000 "uImage"
mtd3: 00400000 00020000 "minirootfs"
mtd4: 07400000 00020000 "ubifs"
问题是:“minirootfs”对于生成的 initramfs 来说太小(只有 4 MB):
# update-initramfs -u -k 4.19.0-6-armmp
update-initramfs: Generating /boot/initrd.img-4.19.0-6-armmp
Using DTB: armada-370-netgear-rn102.dtb
Installing /usr/lib/linux-image-4.19.0-6-armmp/armada-370-netgear-rn102.dtb into /boot/dtbs/4.19.0-6-armmp/./armada-370-netgear-rn102.dtb
Taking backup of armada-370-netgear-rn102.dtb.
Installing new armada-370-netgear-rn102.dtb.
Installing /usr/lib/linux-image-4.19.0-6-armmp/armada-370-netgear-rn102.dtb into /boot/dtbs/4.19.0-6-armmp/./armada-370-netgear-rn102.dtb
Taking backup of armada-370-netgear-rn102.dtb.
Installing new armada-370-netgear-rn102.dtb.
flash-kernel: installing version 4.19.0-6-armmp
The initial ramdisk is too large. This is often due to the unnecessary inclusion
of all kernel modules in the image. To fix this set MODULES=dep in one or both
/etc/initramfs-tools/conf.d/driver-policy (if it exists) and
/etc/initramfs-tools/initramfs.conf and then run 'update-initramfs -u -k 4.19.0-6-armmp'
Not enough space for initrd in MTD 'minirootfs' (need 4971360 but is actually 4194304).
run-parts: /etc/initramfs/post-update.d//flash-kernel exited with return code 1
mtdpart 无法删除、编辑或重新创建新的 /dev/mtd0 到 /dev/mtd4 设备。我还尝试设置mtdparts
内核参数(由于巴斯特中的错误,该参数需要为“cmdlinepart.mtdparts”;我也尝试过“mtdparts=”):
# cat /proc/cmdline
console=ttyS0,115200 cmdlinepart.mtdparts=armada-nand:0x180000@0(u-boot),0x20000@0x180000(u-boot-env),(uImage),0x1000000@0x800000(minirootfs),-(ubi)
mtd分区似乎是在内核附带的*.dtb文件中定义的:
以下消息出现在“dmesg”中,涉及“5 个固定分区”。
[ 18.310935] 5 fixed-partitions partitions found on MTD device pxa3xx_nand-0
[ 18.318030] Creating 5 MTD partitions on "pxa3xx_nand-0":
root@ReadyNAS102:~# dmesg | grep 'MTD' -A 3
[ 18.310935] 5 fixed-partitions partitions found on MTD device pxa3xx_nand-0
[ 18.318030] Creating 5 MTD partitions on "pxa3xx_nand-0":
(...some other lines...)
[ 18.443214] 0x000000000000-0x000000180000 : "u-boot"
[ 18.497255] 0x000000180000-0x0000001a0000 : "u-boot-env"
[ 18.543756] 0x000000200000-0x000000800000 : "uImage"
[ 18.601234] 0x000000800000-0x000000c00000 : "minirootfs"
[ 18.661169] 0x000000c00000-0x000008000000 : "ubifs"
我尝试使用dtc工具编辑内核附带的*.dtb文件(/boot/dtbs/4.19.0-6-armmp/armada-370-netgear-rn102.dts):
# dtc -I dtb -O dts armada-370-netgear-rn102.dtb > armada-370-netgear-rn102.dts
# editing the *.dts file
# dtc -I dts -O dtb armada-370-netgear-rn102.dts > armada-370-netgear-rn102.dtb
我将 *.dts 文件更改如下:
nand-controller@d0000 {
compatible = "marvell,armada370-nand-controller";
reg = < 0xd0000 0x54 >;
#address-cells = < 0x01 >;
#size-cells = < 0x00 >;
interrupts = < 0x71 >;
clocks = < 0x0d 0x00 >;
status = "okay";
nand@0 {
reg = < 0x00 >;
label = "pxa3xx_nand-0";
nand-rb = < 0x00 >;
marvell,nand-keep-config;
nand-on-flash-bbt;
nand-ecc-strength = < 0x04 >;
nand-ecc-step-size = < 0x200 >;
partitions {
compatible = "fixed-partitions";
#address-cells = < 0x01 >;
#size-cells = < 0x01 >;
partition@0 {
label = "u-boot";
reg = < 0x00 0x180000 >;
read-only;
};
partition@180000 {
label = "u-boot-env";
reg = < 0x180000 0x20000 >;
read-only;
};
partition@200000 {
label = "uImage";
reg = < 0x200000 0x600000 >;
};
partition@800000 {
label = "minirootfs";
reg = < 0x800000 0x1000000 >;
};
partition@c00000 {
label = "ubifs";
reg = < 0xc00000 0x7400000 >;
};
};
};
};
特别是,我更改了“reg = < 0x800000 0x400000 >;”到“reg = < 0x800000 0x1000000 >;”为了partition@800000
:
partition@800000 {
label = "minirootfs";
reg = < 0x800000 0x1000000 >;
};
“ubifs”分区之前有足够的空间,无论如何我都不使用它。但是,重新启动后,内核仍然告诉我有关旧设置的信息。我该如何解决这个问题?
我可能可以通过 uboot 手动将“vmlinuz + *.dtb”安装到 NAND。但是,一旦安装了下一个内核更新,这种情况就会消失。
我希望内核解释“mtdparts”命令行参数。
有任何想法吗?
编辑#1:
我现在(ab)使用分区“ubifs”而不是“minirootfs”作为 initramfs。这可行,但我想知道是否有更干净的解决方案。当然,我还必须更改 u-boot 中的“bootcmd”以加载/使用该分区中的数据:
setenv bootcmd 'nand read 0x2000000 0x200000 0x600000; nand read 0x3000000 0xc00000 0x800000; bootm 0x2000000 0x3000000'
saveenv
reset
答案1
就像您已经尝试过的那样编辑 dtb 就足够了。
partition@800000 {
label = "minirootfs";
reg = <0x0800000 0x800000>; /* 8MB */
};
/* Last MB is for the BBT, i.e. not writable */
partition@1000000 {
label = "ubifs";
reg = <0x01000000 0x7000000>; /* 112MB */
};
我怀疑您只是忘记将 dtb 添加到内核中。
mtdinfo 然后报告:
mtd3
Name: minirootfs
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 64 (8388608 bytes, 8.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size: 2048 bytes
OOB size: 64 bytes
Character device major/minor: 90:6
Bad blocks are allowed: true
Device is writable: true
这是使用 debian 4.19.0-10 内核