module compiling : asm/linkage.h file not found

后端 未结 5 1596
别跟我提以往
别跟我提以往 2021-01-01 19:18

I am trying to compile an example of \"hello world\" Kernel Module, problems found on ubuntu 11.04, kernel 3.2.6, gcc 4.5.2 and fedora 16, kernel 3.2.7, gcc 4.6.7.

c

5条回答
  •  梦毁少年i
    2021-01-01 19:38

    The asm includes (such as linkage.h) are architecture specific. There should be a set of directories under:

        /usr/src/kernels/(kernel version goes here)/arch
    

    that provide specific includes for the specific CPU architecture you are targeting your code to be compiled for.

    Try adding this to your Makefile:

        KVERSION :=R(shell uname -r)
    

    and add the kernel and architecture (x86 in this example):

        INCDIRS = -I./include -I/usr/src/kernels/$(KVERSION)/include -I/usr/src/kernels/$(KVERSION)/arch/x86
    

提交回复
热议问题