linux - 交叉编译外部linux模块: M =`pwd` directory not found

标签 linux cross-compiling kernel-module

我正在使用 CentOS 针对完整的内核树编译外部模块。我已经在 Beaglebone 上成功地修改、交叉编译、构建和启动了这个内核。我正在使用 linaro 工具 (arm-gnueabihf-)。我正在使用相同的典型 Makefile 结构来编译自 2.6 发布以来我一直使用的模块。运行 make 规则时:

make ARCH=arm CROSS_COMPILE=${CC} -C $(KDIR) M=`pwd` modules

CCKDIR 为我的工具链和我的内核 src 树正确设置,kbuild 正确地将目录更改为 -C(内核src) 目录,但是当返回时(即处理 M)我得到以下错误:

scripts/Makefile.build:44: /home/foo/bar/
Makefile: No such file or directory

/home/foo/bar 实际上是我当前的工作目录,即 pwd

的正确结果

直接在 M= 中写入我的 pwd 路径或使用 make var 而不是调用 pwd 会产生相同的结果(不是语法问题)

有什么想法吗?

最佳答案

试试这个,因为我不知道你的 make 文件怎么样。

在/home/foo/bar 中创建 Makefile

obj-m += hello.o
KERNELDIR=/home/vinay.hunachyal/build/clfs/sources/linux-3.9
all:
    make -C  $(KERNELDIR) M=$(PWD) modules

clean: 
    make -C $(KERNELDIR)  M=$(PWD) clean

在上面的 Makefile 中编辑 KERNELDIR=(path-to-kernel-source) 还要更改 obj-m +=(你的模块)

在此之后,只需使用

构建您的模块

制作 ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

关于linux - 交叉编译外部linux模块: M =`pwd` directory not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18561905/

相关文章:

Python SSH Server(twisted.conch)大量echo时CPU占用率高

linux - libevent 的实现细节是什么?轮询机制的封装?

java - 在 Eclipse 中选择空的远程系统类型列表

c - 替换 linux 内核模块中的 sys/socket.h?

c - Linux内核线程: How to pass the Linux module write function as the function that the thread has to execute?

java - ubuntu/unity 的焦点问题

linux - 将 autogen.sh 与 ExternalProject_Add 结合使用

linux - 工具链 arm glibc 2.12.1 错误

cross-compiling - 尝试编译crosstool-ng-1.20.0

c - 在 Linux PCI 驱动程序中向设备添加多个属性