How to develop kernel modules on the target?


p32@...
 

Hello everyone,

I am using the Yocto-based build system provided by NXP (primarily via the meta-freescale layer) to create Linux images for an i.MX 8M board and would like to develop small kernel modules without going through the build process of the entire image after each modification. Therefore, I would prefer to compile the kernel modules on the target architecture and have added the following items to the IMAGE_INSTALL variable via my local.conf:
 - packagegroup-core-buildessential
 - kernel-modules
 - kernel-dev
 - kernel-devsrc

I then tried to follow the the official build instructions (https://www.kernel.org/doc/html/latest/kbuild/modules.html) on the target but was unable to create a kernel module:
imx8mqevk:~# make -C /lib/modules/$(uname -r)/build M=$PWD
make: Entering directory '/lib/modules/5.4.47-2.2.0+g5ec03d06f54e/build'
  CC [M]  /root/hello.o
In file included from ./include/linux/types.h:6,
                 from ./include/linux/list.h:5,
                 from ./include/linux/module.h:9,
                 from /root/hello.c:1:
./include/uapi/linux/types.h:5:10: fatal error: asm/types.h: No such file or directory
    [...]
compilation terminated.

What am I missing here? Is there something else I have to do on the target before I can compile kernel modules on the target?

For the sake of completeness: The build is based on the Zeus release and the following repo manifest file:
https://source.codeaurora.org/external/imx/imx-manifest/tree/imx-5.4.47-2.2.0.xml?h=imx-linux-zeus

Thanks!

Join yocto@lists.yoctoproject.org to automatically receive all group messages.