I've installed Debian Buster on a "ReadyNAS 102" via u-boot / serial console. I was following this tutorial. But, replaced used different links to download current the Debian installer and Device Tree Blob:

Installation worked fine, except for the installation of grub (which is known to fail according to the tutorial). Instead you've to manually install/configure the flash-kernel package.

I also had to manually call "mtdpart" to create the uImage and minirootfs partitions to finally be able to successfully run "update-initramfs":

# mtdpart add /dev/mtd0 uImage 0x200000 0x600000
# mtdpart add /dev/mtd0 minirootfs 0x800000 0x1000000
# update-initramfs -u

So far so good. I got the kernel booting, but after booting I've some preconfigured "mtd partitions", which seem to originate from the kernel device tree:

~# 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"

The problem with this is: "minirootfs" is too small (only 4 MB) for the generated initramfs:

 # 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

The new /dev/mtd0 to /dev/mtd4 devices can not be removed, edited or recreated by mtdpart. I also tried to set the mtdparts kernel parameter (which needs to be 'cmdlinepart.mtdparts' due to a bug in buster; I've tried 'mtdparts=' too):

# cat /proc/cmdline
console=ttyS0,115200 cmdlinepart.mtdparts=armada-nand:0x180000@0(u-boot),0x20000@0x180000(u-boot-env),(uImage),0x1000000@0x800000(minirootfs),-(ubi)

The mtd partitions seem to be defined in the *.dtb file that comes with the kernel:

The following message appears in "dmesg" speaking about "5 fixed-partions".

   [   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"

I tried to edit the *.dtb file that comes with the kernel (/boot/dtbs/4.19.0-6-armmp/armada-370-netgear-rn102.dts) by using the dtc tool:

# 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

I changed the *.dts file as following:

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

                       partition@180000 {
                               label = "u-boot-env";
                               reg = < 0x180000 0x20000 >;

                       partition@200000 {
                               label = "uImage";
                               reg = < 0x200000 0x600000 >;

                       partition@800000 {
                               label = "minirootfs";
                               reg = < 0x800000 0x1000000 >;

                       partition@c00000 {
                               label = "ubifs";
                               reg = < 0xc00000 0x7400000 >;

Especially, I changed "reg = < 0x800000 0x400000 >;" to "reg = < 0x800000 0x1000000 >;" for partition@800000:

                       partition@800000 {
                               label = "minirootfs";
                               reg = < 0x800000 0x1000000 >;

There's enough space before the "ubifs" partition and I don't use it anyways. But, after a reboot the kernel still tells me about the old settings. How can I fix that?

I could probably manually install "vmlinuz + *.dtb" to the NAND via uboot. But, that would be gone as soon as the next kernel update is installed.

I would prefer the kernel to interpret the "mtdparts" command line parameter.

Any ideas?

EDIT #1:

I now (ab)use the partition "ubifs" instead of "minirootfs" for the initramfs. This works, but I would like to know if there is a more clean solution. Of course, I also had to change my "bootcmd" at u-boot to load/use data from this partition instead:

setenv bootcmd 'nand read 0x2000000 0x200000 0x600000; nand read 0x3000000 0xc00000 0x800000; bootm 0x2000000 0x3000000'

It should be enough to just edit the dtb just like you already tried.

    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 */

I suspect you simply forgot to append the dtb to the kernel.

mtdinfo then reports:

    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

This is using debian 4.19.0-10 kernel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.