This is specifically for non-tied kernel modules -- tied kmods will use the options from the kernel build and shouldn't change.
Currently, we must hack VIMAGE into independent kmod builds if the result is to be
used on a VIMAGE kernel and a VIMAGE-enabled kmod cannot run on a non-VIMAGE kernel. This causes some amount of pain in iterating on a new kmod if you're oblivious to the fact that you've created an incompatible kmod because you didn't match the VIMAGE status of the kernel you're planning to run it on.
Push non-tied kernel modules into determining at runtime how we're operating unless they've specifically been compiled with VIMAGE set. Major changes:
- Non-VIMAGE VNET_{DECLARE,DEFINE,DEFINE_STATIC} macros now name the global with the VNET_NAME from the VIMAGE case, so that we can consistently reference them from kmods
- The kernel now includes a vimage_configured symbol to indicate whether it's been configured for VIMAGE or not
- vnet_support.c has been added with vimage_configured and some sysinit shims that will proxy the sysinit/sysuninit bits to the proper underlying function based on how the kernel's configured
VNET_{DEFINE,DEFINE_STATIC} still uses linker sets in kernel modules, but should DTRT (from what I've managed to grok of the kernel linker) and get allocated in global space in non-VIMAGE kernels. This is then reflected in VNET_PTR/VNET in the VIMAGE_RUNTIME case.
This patch is likely incomplete... it does work in some of the more primitive cases, though.