I copied the soource files and Makefile from the Linux source tree. And hardcoded the config in the Makefile to build as a module. So far so good, I have peak_pciefd.ko module file.
When the container starts up on balena run.sh it tells me:
insmod: ERROR: could not insert module peak_canfd_intel-nuc_2.47.1+rev1.prod/peak_pciefd.ko: Operation not permitted
I have also tried manually copying the .ko file to the Host OS and installing it there manually. But that gives me:
insmod: ERROR: could not insert module /peak_pciefd.ko: Unknown symbol in module
Now I don’t know what else to try to get our canbus card going. Help is very much appreciated.
Hi Erik, thanks for contacting support. I would first make sure that the module can be inserted from the hostOS as in your second comment above.
The “Unknown symbol in module” usually indicates that the kernel source you have compiled against does not match the running kernel in the device.
Please check that you have modified the VERSION argument in the Dockerfile from kernel-module-build to match the BalenaOS release the target device is running.
ENV VERSION '2.29.0+rev1.prod'
2.29.0+rev1.prod should match the release on your device.
Once you have rebuilt the module, see if the insmod in the hostOS works, and retry the insmod from the container, although the latter might be a different problem altogether.
I have solved the operation not permitted issue, I needed to make the container privileged. Now I have the same Unknown symbol error in the container. It’s progress.
The version is the same between my Dockerfile and the running Host OS. In fact I managed to get a different out of tree driver for a different canbus card installed with the same Dockerfile. The Unknown symbol must be casued by something else, is there a way I can get it to tell me which symbol is unknown? That would make searching quite a lot easier.
If you have the .ko file in the modules directory inside your container, can you use depmod(8) with the verbose flag? I think that should tell you more…