gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:36:07 24 4
gpt4 key购买 nike

我正在使用 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/

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