gpt4 book ai didi

ARM架构内核模块的交叉编译

转载 作者:太空狗 更新时间:2023-10-29 11:05:03 31 4
gpt4 key购买 nike

我正在尝试从 linux x86 机器上为 ARM 制作一个 .ko 文件。我尝试了以下 Makefile:

1 obj-m +=helloworldtest_module.o 
2 modules_install:
3 make ARCH=$(ARCH) CC=$(CROSS_COMPILER) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
4 clean:
5 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

... 但是我在命令提示符下给出 make -f Makefile ARCH=arm CROSS_COMPILER=arm-linux-gnueabi-gcc 时出错,如下所示:

make ARCH=arm CC=arm-linux-gnueabi-gcc -C /lib/modules/3.2.0-29-generic/build M=/home/terenesas/sample modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-29-generic'
CC [M] /home/terenesas/sample/helloworldtest_module.o
In file included from /usr/src/linux-headers-3.2.0-29-generic/arch/arm/include/asm/types.h:4:0,
from include/linux/types.h:4,
from include/linux/list.h:4,
from include/linux/module.h:9,
from /home/terenesas/sample/helloworldtest_module.c:2:
include/asm-generic/int-ll64.h:11:29: fatal error: asm/bitsperlong.h: No such file or directory
compilation terminated.
make[2]: *** [/home/terenesas/sample/helloworldtest_module.o] Error 1
make[1]: *** [_module_/home/terenesas/sample] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-29-generic'
make: *** [modules_install] Error 2

我做错了什么?

最佳答案

快速修复,更改自:

#include <asm/bitsperlong.h>

到:

#include <asm-generic/bitsperlong.h>

关于ARM架构内核模块的交叉编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14806353/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com