enginning/cmake-kernel-module

...doesn't work.

Opened this issue · 4 comments

fatal error: asm/linkage.h: No such file or directory

the same error. on 5.10 branch.

trying to fix it via:

22 # Find the headers
23 find_path(
24         KERNELHEADERS_DIR
25         include/linux/user.h
26         PATHS /usr/src/linux-headers-${KERNEL_RELEASE}
27 )
28 find_path(
29         KERNELHEADERS_ASM
30         include/asm/linkage.h
31         PATHS /usr/src/linux-headers-${KERNEL_RELEASE}/arch/x86
32 )
33
34 message(STATUS "Kernel release: ${KERNEL_RELEASE}")
35 message(STATUS "Kernel headers: ${KERNELHEADERS_DIR}")
36 message(STATUS "Kernel generic: ${KERNELHEADERS_ASM}")
37
38 # Add header files
39 include_directories(
40         ${KERNELHEADERS_DIR}/include
41 )
42 include_directories(
43         ${KERNELHEADERS_ASM}/include
44 )
45

but recursive includes and redefinition's appears...

I verified that this problem persists.

Any pointers on the reported issue? I am also hitting the same with 5.4 kernel

You have to build it with: "make driver" instead of "make"
Calling "make" tries to build the target "dummy_target" which tries to create a library by compiling hello.c.
But "dummy_target" is only a placeholder to parse the source file when you are using an IDE like clion.