编译驱动模块报错/home/zhongyi/workdir/ebf-buster-linux: No such file or directory. Stop.

编译驱动模块时遇到/home/zhongyi/workdir/ebf-buster-linux不存在的错误,尽管build_image文件夹存在。尝试重新构建内核、删除编译文件、执行编译脚本和sudo make仍报错,最终通过执行解决权限问题,成功编译生成驱动模块。
摘要由CSDN通过智能技术生成

错误

今天编译驱动模块的时候报错,具体如下所示。

zhongyi@ubuntu:~/workdir/linux_driver/device_tree_rgb_led$ make
make -C ../ebf-buster-linux/build_image/build M=/home/zhongyi/workdir/linux_driver/device_tree_rgb_led modules
make[1]: Entering directory '/home/zhongyi/workdir/linux_driver/ebf-buster-linux/build_image/build'
make[2]: Entering directory '/home/zhongyi/workdir/linux_driver/ebf-buster-linux/build_image/build'
make[2]: *** /home/zhongyi/workdir/ebf-buster-linux: No such file or directory.  Stop.
make[2]: Leaving directory '/home/zhongyi/workdir/linux_driver/ebf-buster-linux/build_image/build'
Makefile:24: recipe for target '__sub-make' failed
make[1]: *** [__sub-make] Error 2
make[1]: Leaving directory '/home/zhongyi/workdir/linux_driver/ebf-buster-linux/build_image/build'
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 2

提示进入 ‘/home/zhongyi/workdir/linux_driver/ebf-buster-linux/build_image/build’ 的时候失败。看了下,build_image文件夹确实是存在的。这就很奇怪了。

解决

尝试重新构建下内核。
执行以下命令,删除内核编译产生的所有文件。

make mrproper

执行编译内核的脚本

./make_deb.sh

再次尝试make编译驱动模块

zhongyi@ubuntu:~/workdir/linux_driver/device_tree_rgb_led$ make
make -C ../ebf-buster-linux/build_image/build M=/home/zhongyi/workdir/linux_driver/device_tree_rgb_led modules
make[1]: Entering directory '/home/zhongyi/workdir/linux_driver/ebf-buster-linux/build_image/build'
mkdir: cannot create directory ‘/home/zhongyi/workdir/linux_driver/device_tree_rgb_led/.tmp_versions’: Permission denied
/bin/sh: 1: cannot create /home/zhongyi/workdir/linux_driver/device_tree_rgb_led/modules.order: Permission denied
/home/zhongyi/workdir/linux_driver/ebf-buster-linux/scripts/Makefile.build:462: recipe for target '/home/zhongyi/workdir/linux_driver/device_tree_rgb_led/modules.order' failed
make[4]: *** [/home/zhongyi/workdir/linux_driver/device_tree_rgb_led/modules.order] Error 2
/home/zhongyi/workdir/linux_driver/ebf-buster-linux/Makefile:1519: recipe for target '_module_/home/zhongyi/workdir/linux_driver/device_tree_rgb_led' failed
make[3]: *** [_module_/home/zhongyi/workdir/linux_driver/device_tree_rgb_led] Error 2
Makefile:146: recipe for target 'sub-make' failed
make[2]: *** [sub-make] Error 2
Makefile:24: recipe for target '__sub-make' failed
make[1]: *** [__sub-make] Error 2
make[1]: Leaving directory '/home/zhongyi/workdir/linux_driver/ebf-buster-linux/build_image/build'
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 2

仍然报错,提示没有权限。
执行sudo make进行编译。问题解决。

zhongyi@ubuntu:~/workdir/linux_driver/device_tree_rgb_led$ sudo make
[sudo] password for zhongyi: 
make -C ../ebf-buster-linux/build_image/build M=/home/zhongyi/workdir/linux_driver/device_tree_rgb_led modules
make[1]: Entering directory '/home/zhongyi/workdir/linux_driver/ebf-buster-linux/build_image/build'
  CC [M]  /home/zhongyi/workdir/linux_driver/device_tree_rgb_led/rgb_led.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/zhongyi/workdir/linux_driver/device_tree_rgb_led/rgb_led.mod.o
  LD [M]  /home/zhongyi/workdir/linux_driver/device_tree_rgb_led/rgb_led.ko
make[1]: Leaving directory '/home/zhongyi/workdir/linux_driver/ebf-buster-linux/build_image/build

驱动模块也正常生成。

zhongyi@ubuntu:~/workdir/linux_driver/device_tree_rgb_led$ ls
imx6ull-seeed-npi.dts  Makefile  modules.order  Module.symvers  rgb_led.c  rgb_led.ko  rgb_led.mod.c  rgb_led.mod.o  rgb_led.o  test_app.c

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌入式与Linux那些事

您的鼓励将使我写出更好的文章

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值