Linux kernel 交叉编译内核模块

Linux kernel 交叉编译内核模块,linux-kernel,arm,cross-compiling,Linux Kernel,Arm,Cross Compiling,我尝试交叉编译内核模块ARM时出现了一些错误: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make -C /lib/modules/4.4.0-57-generic/build M=/home/nari/Bureau modules make[1] : on entre dans le répertoire « /usr/src/linux-headers-4.4.0-57-generic » CC [M] /home/nari/Bure

我尝试交叉编译内核模块ARM时出现了一些错误:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
make -C /lib/modules/4.4.0-57-generic/build M=/home/nari/Bureau modules
make[1] : on entre dans le répertoire « /usr/src/linux-headers-4.4.0-57-generic »
  CC [M]  /home/nari/Bureau/hello.o
In file included from include/asm-generic/int-ll64.h:10:0,
                 from ./arch/arm/include/asm/types.h:4,
                 from include/uapi/linux/types.h:4,
                 from include/linux/types.h:5,
                 from include/linux/list.h:4,
                 from include/linux/module.h:9,
                 from /home/nari/Bureau/hello.c:1:
include/uapi/asm-generic/int-ll64.h:11:29: fatal error: asm/bitsperlong.h: Aucun fichier ou dossier de ce type
compilation terminated.
scripts/Makefile.build:264 : la recette pour la cible « /home/nari/Bureau/hello.o » a échouée
make[2]: *** [/home/nari/Bureau/hello.o] Erreur 1
Makefile:1420 : la recette pour la cible « _module_/home/nari/Bureau » a échouée
make[1]: *** [_module_/home/nari/Bureau] Erreur 2
make[1] : on quitte le répertoire « /usr/src/linux-headers-4.4.0-57-generic »
Makefile:4 : la recette pour la cible « all » a échouée
make: *** [all] Erreur 2
这是我的生成文件:

obj-m += hello.o

all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

我想这回答了你的问题:谢谢,但我已经尝试过这个解决方案。我使用了相同的makefile:谢谢,但我已经尝试过这个解决方案。我拿了同样的makefile。我只更改了这一行:KERNELDIR?=Bureau/u-boot-2016.07/kernel,但他甚至没有找到它:make[1]:***SUBDIRS=/home/nari/Bureau:没有这样的文件或目录..KERNELDIR?=Bureau/u-boot-2016.07/kernel是相对的parh吗?尝试将完整路径设置为“是”。它不起作用。只有当我使用路径而不是${KERNEL\u SOURCE}时,它才能识别路径。但当我尝试制作时,会出现其他错误,如: