Hello. I recently flashed BalenaOS into our device (BalenaOS: 6.5.53, generic x86_64 GPT) and spent this last two weeks trying to compile and insert an old driver kernel module for an Ixxat USB-to-CAN interface.
I followed the GitHub repo to build out-of-tree kernel modules, basically:
- Pasting our low-level driver tree into src/
- Setting OS_VERSION directly from the docker compose yml file as arg
- Modifying the build.sh script to directly get the headers from url, untar them and calling make
- Copying the generated .ko into a shared volume
- Making the second service insmod this new kernel module to check it loads
But this insmod call fails as seen from Balena Cloud logs:
[loader] insmod: ERROR: could not insert module /modules/ix_usb_can.ko: Invalid module format
Checking with dmesg gives the following line:
module ix_usb_can: .gnu.linkonce.this_module section size must match the kernel’s built struct module size at run time
and using modinfo, I noticed this mismatch:
# modinfo /modules/ix_usb_can.ko | grep vermagic
vermagic: 5.15.62-yocto-standard SMP preempt mod_unload
Url https://files.balena-cloud.com/images/${SLUG}/${OS_VERSION}/kernel_modules_headers.tar.gz using generic-amd64 and 6.5.53 access the 6.12.36-yocto-standard libraries which we use after slightly modyfing our Makefile to get them from a tmp dir instead of /lib/modules/ (we used to compile this in a Ubuntu with no problem).
Any help trying to solve this mismatch issue? Something we may be missing? We noticed uname -r giving the correct yocto version in Balena Cloud terminals but incorrect ones in the compile process when pushing to our fleet.