gpt4 book ai didi

使用 arm-eabi-gcc 交叉编译模块

转载 作者:太空宇宙 更新时间:2023-11-04 08:11:30 27 4
gpt4 key购买 nike

我有一个视频模块,我正在使用 arm-eabi-gcc 交叉编译器进行编译。我使用以下命令进行编译$ arm-eabi-gcc -O2 -DMODULE -D__KERNEL__ -W -Wall -isystem/lib/modules/uname -r/build/include panel-xxxxxxx.c

出现如下错误

 In file included from /lib/modules/3.13.0-32-generic/build/include/linux/types.h:5:0,
from /lib/modules/3.13.0-32-generic/build/include/linux/list.h:4,
from /lib/modules/3.13.0-32-generic/build/include/linux/module.h:9,
from panel-gis317.c:17:
/lib/modules/3.13.0-32-generic/build/include/uapi/linux/types.h:4:23: fatal error: asm/types.h: No such file or directory
compilation terminated.

在谷歌上搜索后,我发现我需要指定硬件架构,但我找不到在命令行上使用 archgcc 的正确用法。

任何人都可以建议我可以使用哪些标志在命令行上交叉编译给定的 .c 文件(模块)而不使用 Makefile

注意:我这样做是为了在硬件上执行 .ko 模块的 insmod 以进行测试。

顺便说一句,借助.o文件,我们可以知道使用哪个交叉编译器来编译.c文件

最佳答案

对于 linux 内核体系结构,特定的包含在 arch//include 中。虽然它可能无法确保仅设置正确的编译......

但是尝试将/lib/modules/$(uname -r)/build/arch/arm/include 添加到您的包含路径。

以下是在您的 PC 上为 Pi2 构建您自己的内核和模块的简单指南: http://lostindetails.com/blog/post/Compiling-a-kernel-module-for-the-raspberry-pi-2

他们使用 makefile 方法。

关于使用 arm-eabi-gcc 交叉编译模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39037805/

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