Hi, I would also really like to see an Incus vm image for OpenWRT.
I have looked at your work, @tregubovav.dev, and I think we are on the right
track here. However, as Hauke said, it might be a better idea to build the drivers as modules, instead of building them into the kernel.
OpenWRT always tries to keep the kernel as small as possible and as not all devices deployments of the x86/64 or armsr targets will be running as a vm guest, having extra modules specific to vm guests built-in is not desirable.
I propose we build the drivers as modules and ship them as a kmod-* package. This does not affect installations that don't explicitly install these modules, so it has a low chance of causing regressions and does not add unnecessary overhead on the systems that don't need it.
A first attempt at packaging the relevant modules can be found here.
(I dropped theCONFIG_VSOCKETS_LOOPBACK option, as I could not find why it was needed and my vm worked fine without it).
For me incus-agent works when building for the x86/64 subtarget and selecting the following options in openwrt's make menuconfig:
CONFIG_PACKAGE_kmod-9pnet=y
CONFIG_PACKAGE_kmod-9pvirtio=y
CONFIG_PACKAGE_kmod-fs-9p=y
CONFIG_PACKAGE_kmod-fs-netfs=y
CONFIG_PACKAGE_kmod-vsock-virtio=y
This builds the kmod packages and includes them in the final rootfs image.
I have not tested this for armsr/armv8 as I don't have the hardware readily available, but I expect it to work without major problems.
It is good to note that on armsr/armv8 (as you already mentioned) vmw_vsock_virtio_transport_common and vsock are not built-in, so those kmods would automatically be selected as dependencies of vmw_vsock_virtio_transport by the build system.
The 9p modules are built-in on armsr/armv8, so those would not be needed.
As for distrobuilder, I wanted to start porting the openrc script, but then I realized some work has already been done on that front.
I searched a bit, but I could not find it. Would you mind sharing your progress on the changes to distrobuilder?
P.S. I also found that virtio-console-helper (a subpackage of qemu) does exactly what we need for the virtio-ports symlinks. One less problem to tackle.