feat(preinit): support alternative roots
In A/B schemas, it is possible to have multiple rootfs.
Thus, it is necessary to let the B kernel preinitialize either the A rootfs or the B rootfs failing to mount the A rootfs.
Ideally, we should also try to switch to the B rootfs if we cannot start up the init on the A rootfs, but that's a FUTUREWORK.
If I understood correctly what this does, supplying altroot=/dev/foo root=/dev/bar as a command line parameter will cause it to attempt to mount /dev/foo if mounting /dev/bar failed ?
If I understood correctly what this does, supplying
altroot=/dev/foo root=/dev/baras a command line parameter will cause it to attempt to mount/dev/fooif mounting/dev/barfailed ?
That's correct!
OK, this work, but the altroot is semi-useless to be honest because of how UBI works.
If the first UBI device is not attached (failure), the second UBI failure will be attached and root=ubi:rootfs will be sufficient.
The interesting commit is 59d6640 (#4)
because it makes the Zyxel able to operate with one single DTB in A/B situations.
Though, it's important to notice that kernel A and B will boot in priority on UBI A.
Ideally, the next step is to have an overlayfs to mount rootfs_data on the top of UBI A and make changes persist to that UBI rather than to UBI A and go to a failover mode like OpenWRT where, if, the overlayfs prevent the boot, we can always enter the device into a mode where the personalization is ignored.
It bring forth a bunch of questions on how to deploy Liminix systems in production "safely" tbh.