我需要在我的 archlinux 安装中编译this程序。
当我这样做时,按照该线程中的指示:
make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules
我收到以下错误:
make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules
scripts/Makefile.build:41: /home/jenia/Documents/kernel-modules/camera/Makefile: No such file or directory
make[1]: *** No rule to make target '/home/jenia/Documents/kernel-modules/camera/Makefile'. Stop.
make: *** [Makefile:2021: /home/jenia/Documents/kernel-modules/camera] Error 2
makefile 确实不在
/home/jenia/Documents/kernel-modules/camera/Makefile
,而是在:
ls -l /lib/modules/$(uname -r)/build/Makefile
-rw-r--r-- 1 root root 71855 Mar 3 10:58 /lib/modules/6.2.2-arch1-1/build/Makefile
如何正确指向
lib/modules/$(uname -r)/build/Makefile
?请注意,我已经在使用 -C
标志但无济于事。
半消息灵通的猜测。
你有:
make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules
M=$(pwd)
记录了您从中运行构建的目录,并且可能在 makefile
中用于确定应在何处找到包含的 makefile(kernel-modules/camera/Makefile
的某些子集)。但是您的 /home/jenia/Documents
目录中没有它。
丝毫没有测试过,我认为你的问题是你当前的目录需要更接近软件所在的位置。我不确定具体是哪个目录,但
/lib/modules
可能是一个合理的猜测(因此,它可能是错误的)。
但重点是:
您使用
-C
没问题;问题是M=$(pwd)
部分。
请注意,文件
/lib/modules/6.2.2-arch1-1/build/Makefile
可能不是scripts/Makefile.build
正在寻找的文件;那应该在某处的子目录camera
中。
为了支持我关于“从正确的目录开始”的理论,我注意到链接文章中的评论 #19 说:
首先,启用源代码存储库,然后在终端中使用以下命令获取源代码
apt-get source linux-modules-extra-$(uname -r)
然后导航到
目录并将/drivers/media/usb/uvc
重命名为uvcdriver.c
,然后在终端中选择打开目录uvcdriver.old
wget https://raw.githubusercontent.com/Giuliano69/uvc_driver-for-Quanta-HD-User-Facing-0x0408-0x4035-/main/uvc_driver.c make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules sudo cp uvcvideo.ko /lib/modules/$(uname -r)/kernel/drivers/media/usb/uvc/
然后看看它是否有效
这表明您应该从
/drivers/media/usb/uvc
目录启动您的构建。
如何正确指向
?lib/modules/$(uname -r)/build/Makefile
根据您正在执行的
make
命令,您报告的错误消息表明您已经将 make
定向到该 makefile。主要错误来自子make
,因此必须找到顶层makefile。
当我这样做时,按照该线程中的指示:
make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules
我收到以下错误:
make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules scripts/Makefile.build:41: /home/jenia/Documents/kernel-modules/camera/Makefile: No such file or directory make[1]: *** No rule to make target '/home/jenia/Documents/kernel-modules/camera/Makefile'. Stop. make: *** [Makefile:2021: /home/jenia/Documents/kernel-modules/camera] Error 2
该错误似乎表明尽管您正在执行从引用线程中提取的命令,但您没有完全按照那里的说明进行操作:
首先,启用源代码存储库,然后在终端中使用以下命令获取源代码
apt-get source linux-modules-extra-$(uname -r)
Then导航到
目录并将/drivers/media/usb/uvc
重命名为uvcdriver.c
,在终端中选择打开目录thenuvcdriver.old
wget https://raw.githubusercontent.com/Giuliano69/uvc_driver-for-Quanta-HD-User-Facing-0x0408-0x4035-/main/uvc_driver.c make -j4 -C /lib/modules/$(uname -r)/build M=$(pwd) modules sudo cp uvcvideo.ko /lib/modules/$(uname -r)/kernel/drivers/media/usb/uvc/
(添加了强调和一些格式。)
不清楚您究竟遵循了哪些说明,哪些没有,但可以肯定的是,您是从与
make
不同的目录运行 /drivers/media/usb/uvc
命令。可能您也在从中运行构建的任何目录中执行了 wget
命令,而不是在说明中指定的目录中。不知道你有没有运行apt-get
命令
可能有其他方法可以做到这一点,但你不能指望它能只选择一组特定指令中的一部分。