I am developing a dual-boot image config for x86 platforms (e.g. APU2) in the style found in more expensive managed switches. The SD card has 3 partitions, the usual
rootfs A and a
By default, the system boots from the
active image (either
B), while firmware upgrades always are being written to the
backup image (also
B). A cmdline utility and a LuCI module lets users exchange the image types, so that either the factory default can be retained permanently by always flashing to the same image or the previous firmware version can be stored in the
backup image depending of the requirements of the user. It's in a way similar to the dualboot-images in T1/T2/T3 switches from TP-Link and in Ubiquiti's EdgeMax routers.
So far everything works fine, but when booting the
B image (3rd partition), LEDE doesn't mount the
/boot partition, but if loading the
A image (2nd partition), the
/boot partition will be mounted below
/boot, albeit read-only (why? It should be mounted read/write IMHO).
I tracked this down to the preinit script
79_move_config, which moves the saved config in
/boot/sysupgrade.tgz to the root directory, but to be honest, I don't understand the logic in
boot_hook_add preinit_mount_root move_config. Which program calls this hook?
Of course, the kernel cmdline is correct for both images as far as I can see.
A on partition 2 it reads:
BOOT_IMAGE=/boot/vmlinuz-flashA root=PARTUUID=9a0f04d3-02 rootfstype=ext4 rootwait console=ttyS0,115200n8 noinitrd
B on partition 3 it is:
BOOT_IMAGE=/boot/vmlinuz-flashB root=PARTUUID=9a0f04d3-03 rootfstype=ext4 rootwait console=ttyS0,115200n8 noinitrd
Except for the cmdline, both kernels and rootfs partitions are identical.
So my question is: is this intentional that a config can be restored only in the 2nd partition or is this probably a bug?