Hello guys! I've been using OpenWRT on a micro-ATX PC for some years, I'm now buying a MOGINSOK appliance to have a router with 2,5 and 10 GbE. I decided to use this upgrade as chance to add to it a secondary SATA SSD and use RAID1.
I also decided to do a sort of A/B deploy: have 3 partitions to hold 3 distinct rootfs+kernel and 3 Grub2 entries, so that I can deploy a new version on one of the partitions and leave previous one unchanged, so that if some issue raises I can just switch entry and get to the working environment.
I decided to use Btrfs instead of mdadm + ext4 due to advanced features it has, specially be able to clone a subvolume into a readonly snapshot.
I've been working on last days on a QEMU VM to get it working. Soon enough I learned it can't be done from imagebuilder. The issue is that, to have rootfs on Btrfs, kernel needs the driver before it mounts the partition. On most distros the driver kmod package can just be added to initramfs, but OpenWRT imagebuilder doesn't support that.
Having seen that I need to compile the kernel, and therefore (AFAIK) all packages, the 2 possibilities I found is to either compile the driver on the kernel or build a kernel+initramfs that run on RAM and somehow mount the folders I need to be persistent.
I didn't try the 2nd option yet, it seems more complex. If I can compile a kernel with Btrfs support, I can just pass to it the rootfs subvolume and I'll have all changes persist.
But I keep failing to get that to work. The build system seems to be too much complex, with multiple config files, leading to a config in one file being overwritten by the same config in another, and it seems that there are also Makefile files that hardcode some actions and ignore or override configs.
From what I've seen, recently a new config KERNEL_BTRFS_FS was even created for buildroot/.config but it applies to only a few targets.
I added CONFIG_BTRFS_FS=y to buildroot/target/linux/x86/64/config-6.6 but then for some reason when buildroot/build_dir/target-x86_64_musl/linux-x86_64/linux-6.6.93/.config is created during make process it has CONFIG_BTRFS_FS=m
I'm even starting to think it'd be easier to switch to the initramfs solution, so that kernel has access to the driver as kmod before it needs to mount anything. I had studied some solutions to mount partitions early during init process, specially /etc, but haven't tried yet.