Identifying UBI volume instance / storing UBI volume metadata

valentio at free.fr valentio at free.fr
Tue Dec 14 09:40:22 PST 2021


> On 9.12.2021 21:11, Olivier Valentin wrote:
> > How about storing the squashfs into the rootfs ubi volume (as a
> > bare file), start with an initramfs appended to the kernel and
> > mount the root file with loopback block dev. The RW overlay part
> > would be stored directly in the ubifs. (All modifications to the
> > root image file would go in the overlay, so impossible to break
> > the image)
> > 
> > This way, when you flash a new firmware, everything gets wiped, and
> > you can factory reset by rm the RW directory.
> > 
> > It diverges quite a bit from OpenWRT usual way though.
> 
> Thanks for your reply. It doesn't fit OpenWrt's current design well
> but
> I think it's probably time to rework OpenWrt's init if needed.
> 
> Just to make sure I understood your correctly:
> 
> Do you suggest "rootfs" UBI volume using ubifs with something like:
> /root.squashfs
> /overlay/
> 
> (and then initramfs as you described)?

Hello, I think you got the idea

I would boot with:
- mount ubifs:rootfs as /rw
- loopback mount /rw/root.squashfs as /root
- bind mount /rw as /root/overlay
- pivot_root under /root
- mount overlayfs as usual

I never tried this twisted idea; I just don't yet see any reason why it wouldn't work :)

Regards,

Olivier



More information about the openwrt-devel mailing list