我已经通过u引导/串行控制台在"ReadyNAS 102“上安装了Debian。我在跟踪本教程。但是,替换使用了不同的链接来下载当前的Debian安装程序和设备树Blob:
安装工作正常,但grub的安装除外(根据本教程,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"
这方面的问题是:对于生成的initramfs来说,"minirootfs“太小(只有4MB):
# 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
新的/dev/mtd0 0到/dev/mtd0 4设备不能被mtdpart删除、编辑或重新创建。我还尝试设置mtdparts
内核参数(由于buster中的一个bug,它需要是'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工具编辑内核(/boot/dtbs/4.19.0-6-armmp/armada-370-netgear-rn102.dts)附带的*.dtb文件:
# 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 >;
};
};
};
};
特别是,我将partition@800000
的"reg =< 0x800000 0x400000 >;“改为"reg =<0x8000000x1000000 >;”:
partition@800000 {
label = "minirootfs";
reg = < 0x800000 0x1000000 >;
};
在"ubifs“分区之前有足够的空间,无论如何我都不使用它。但是,在重新启动之后,内核仍然告诉我旧的设置。我怎么才能解决呢?
我可能可以通过uboot手动将"vmlinuz + *.dtb“安装到NAND。但是,一旦安装了下一个内核更新,这种情况就会消失。
我希望内核能够解释"mtdparts“命令行参数。
有什么想法吗?
我现在(Ab)对initramfs使用分区"ubifs“,而不是使用"minirootfs”。这是可行的,但我想知道是否有一个更清洁的解决方案。当然,我还必须在u引导时更改我的"bootcmd“,以加载/使用来自此分区的数据:
setenv bootcmd 'nand read 0x2000000 0x200000 0x600000; nand read 0x3000000 0xc00000 0x800000; bootm 0x2000000 0x3000000'
saveenv
reset
发布于 2020-08-26 12:26:28
就像您已经尝试过的那样,只编辑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内核
https://unix.stackexchange.com/questions/559593
复制相似问题