Repository navigation
infinity6c: the split NOR layout, without device tree partitions - #266
Conversation
The split NOR layout for the 5.10.61 SigmaStar infinity6c kernel, the same code as infinity6 (#195) and the other 4.9 kernels, on 5.10's partition model: - drivers/mtd/split_layout.c (MTD_SPLIT_LAYOUT): when the uImage at 0x50000 is followed by the root squashfs at the next 64 KiB boundary, register boot, env, firmware (to the end of the chip) and inside it kernel, rootfs and rootfs_data; the bootloader's mtdparts= is not used then. Anything else in the firmware area -- the fixed slots above all -- or a read error leaves the driver's partitions as before. 5.10's add_mtd_partitions() removes what it added when one partition fails, so the table is all there or not at all, and mtdpart.c needs none of the 4.9 port's bookkeeping; the root is looked up on the master's own partition list. - sstar/flash/nor/mtd_serflash.c (SS_NOR_ONEBIN, what infinity6c builds): tries that first, then registers as before with the command line's partitions. A registration that fails falls back to them. - init/do_mounts.c: root_dev_from_flash: the split rootfs is the root, and a root= naming an MTD device gives way to it. The SigmaStar U-Boot reads 2 MiB from 0x50000 and bootm's it, so it boots this layout unchanged. infinity6c's 8 MB lite images outgrew the fixed 5120K rootfs slot (OpenIPC/firmware ssc377/ssc378 lite: "size exceeded by 4KB"), and the split image lets the kernel's slack in its 2 MiB slot go to them. Off unless a board config sets CONFIG_MTD_SPLIT_LAYOUT=y.
PR Summary by QodoSupport split NOR firmware layout on infinity6c
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
…et fixed slots win Review on #266: split_find() took any "hsqs" with an in-range bytes_used right after the kernel as the root. The root is mounted from what it accepts, and a root= naming the bootloader's partition gives way to it, so a false match is a camera that does not boot. - The superblock must be one squashfs mounts: version 4.0, a block size of 4K-1M equal to 1 << block_log, and bytes_used at least a superblock and inside the chip. - A fixed-slot image written over an older split one, without erasing the kernel slot's tail, can leave the old split squashfs right after the new kernel, its end overwritten by the slot's own rootfs. When the squashfs after the kernel runs on over the fixed rootfs slot (0x250000) and a valid superblock starts there, the flash is fixed slots, and the driver registers its partitions as before. Checked with split_find() built on the host over crafted 8 MB images (the real ssc377 squashfs; a 1 MiB uImage puts the boundary at 0x160000): split image (qemu-booted) split, rootfs 0x250000, data 0x760000 split, small kernel split, rootfs 0x160000, data 0x670000 stale split under fixed slots not split (was: split at 0x160000) fixed slots, gap erased not split squashfs version 3 not split (was: split) block_size != 1 << block_log not split (was: split) "hsqs" followed by noise not split And in qemu-bench -M ssc377: the ssc377_lite split image still boots from the published U-Boot, twice, root on mtdblock4, overlay kept.
|
Addressed in 63f5fd4. The finding is right: the root is mounted from whatever
I tested
The |
The split NOR layout for the 5.10.61 infinity6c kernel. It's the same code as infinity6 (#195) and the other 4.9 kernels, ported to 5.10's partition model and this family's NOR driver.
It's needed by OpenIPC/firmware#2910. The ssc377, ssc377d, ssc377de, ssc377qe, ssc378de and ssc378qe lite images outgrew their fixed slots ("size exceeded by 4KB"; locally: uImage 1992KB/1983KB, rootfs 5124KB/5120KB). That PR moves them to the split image, as #2814 did for infinity6 and infinity6b0, and its
post-image-split.shrefuses a kernel withoutCONFIG_MTD_SPLIT_LAYOUT. So this has to land first.Changes
drivers/mtd/split_layout.c(MTD_SPLIT_LAYOUT):mtdparts=is ignored then.add_mtd_partitions()already removes what it added when one partition fails, somtdpart.cneeds none of the 4.9 port's bookkeeping. The rootfs is looked up on the master's own partition list.sstar/flash/nor/mtd_serflash.c(SS_NOR_ONEBIN, what infinity6c builds): tries that first, then registers as before with the command line's partitions. A failed registration falls back to them.init/do_mounts.c: setsroot_dev_from_flash. The split rootfs becomes the root, and aroot=naming an MTD device gives way to it.Off unless a board config sets
CONFIG_MTD_SPLIT_LAYOUT=y.Tested
In qemu-bench,
-M ssc377, with OpenIPC/firmware'sssc377_litebuilt against this branch. The NOR image was put together the way firmware'screate_splitdoes it: the publishedu-boot-ssc377-nor.binat 0,firmware.binat 320K, env erased.First boot: the published U-Boot boots it from its default environment.
U-Boot passes its fixed
mtdpartswith8192k(rootfs)androot=/dev/mtdblock3, and the kernel overrides both. Afterwards the flash holds:sensor=imx415in the env at 0x40000, sofw_setenvreachedenv.Second boot: it boots the same way and keeps both. The overlay grew to 126 nodes, not reformatted.
Not run on hardware: there's no infinity6c board in the lab.