Firmware Partition Configuration Issue

Hi

I set the firmware in dts from 0x50000 to 0xfb0000, as shown in the dts below

        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <10000000>;
                broken-flash-reset;

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                label = "u-boot";
                                reg = <0x0 0x30000>;
                                read-only;
                        };

                        partition@30000 {
                                label = "u-boot-env";
                                reg = <0x30000 0x10000>;
                        };

                        factory: partition@40000 {
                                label = "factory";
                                reg = <0x40000 0x10000>;
                        };

                        partition@50000 {
                                compatible = "denx,uimage";
                                label = "firmware";
                                reg = <0x50000 0xfb0000>;
                        };
                };
        };

The settings worked till I built an image by adding the Luci codes from /www folder from openwrt-23.05.2-ramips-mt76x8-mediatek_mt7628an-eval-board-squashfs-sysupgrade.bin. The firmware boot failed with the message below:

[    1.246227] Creating 4 MTD partitions on "spi0.0":
[    1.255764] 0x000000000000-0x000000030000 : "u-boot"
[    1.268802] 0x000000030000-0x000000040000 : "u-boot-env"
[    1.280730] 0x000000040000-0x000000050000 : "factory"
[    1.294363] 0x000000050000-0x000001000000 : "firmware"
[    1.306266] 2 uimage-fw partitions found on MTD device firmware
[    1.318090] Creating 2 MTD partitions on "firmware":
[    1.327935] 0x000000000000-0x00000023304d : "kernel"
[    1.337777] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[    1.357449] 0x00000023304d-0x000000fb0000 : "rootfs"
[    1.367383] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[    1.386953] mtd: setting mtd5 (rootfs) as root device
[    1.398206] 1 squashfs-split partitions found on MTD device rootfs
[    1.410555] 0x000000c20000-0x000000fb0000 : "rootfs_data"

It seems there are two partitions under "firmware"—one is called "kernel," and the other is "rootfs." The kernel partition ends at 0x23304d, which is not an erase/write block. Are there any ways to know the boundary of a read/write block, and is it possible for us to customize the block scope?

With Regards,
Steven

I think it's the image creation stuff you want
like KERNEL_SIZE := 4096k

Thanks @Lucky1! It works.

Here's the setup in the file OpenWrt-ImageBuilder-ramips-mt76x8.Linux-x86_64/target/linux/ramips/image/mt76x8.mk:

define Device/mediatek_mt7628an-eval-board
  IMAGE_SIZE := 16064k
  DEVICE_VENDOR := MediaTek
  DEVICE_MODEL := MT7628 EVB
  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport
  SUPPORTED_DEVICES += mt7628
  KERNEL_SIZE := 6016k
endef
TARGET_DEVICES += mediatek_mt7628an-eval-board

The image was successfully created. I obtained the following MTD sections:

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 00fb0000 00010000 "firmware"
mtd4: 0023304d 00010000 "kernel"
mtd5: 00d7cfb3 00010000 "rootfs"
mtd6: 00390000 00010000 "rootfs_data"

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.