[英]How to fix a weird linux kernel module build problem on raspbian that works fine on x64 ubuntu
I ran into this problem and figured it out but it took me a while because it wasn't obvious, so I thought I'd post here to help out if anybody else has this problem.我遇到了这个问题并想通了,但我花了一段时间,因为它并不明显,所以我想我会在这里发帖以帮助其他人是否有这个问题。
I have a linux kernel module that I build on x86 and on a bunch of raspberry pis running raspian.我有一个 linux kernel 模块,我在 x86 和一堆运行 raspian 的树莓派上构建。
the build works fine on x64 ubuntu and it works fine when I run make from the command line on the raspberry pis.该构建在 x64 ubuntu 上运行良好,当我从树莓派上的命令行运行 make 时它运行良好。
But I have a build script to automate all the things that have to build and only in that case was it failing on the raspians.但是我有一个构建脚本来自动化所有必须构建的东西,只有在这种情况下它才会在 raspians 上失败。
the error I was getting was:我得到的错误是:
make[1]: Entering directory '/usr/src/linux-headers-4.19.75-v7+' Makefile:614: arch/armv7l/Makefile: No such file or directory make[1]:
*** No rule to make target 'arch/armv7l/Makefile'. Stop. make[1]: Leaving directory '/usr/src/linux-headers-4.19.75-v7+'
Looked fine to me, and it worked fine from the command line just not my build script.对我来说看起来不错,它在命令行中运行良好,而不是我的构建脚本。 See below for the solution.
请参阅下面的解决方案。
I have a few raspberry pis that build different architectures so in my build script I had added我有一些构建不同架构的树莓派,所以在我的构建脚本中我添加了
export ARCH= uname -m
出口 ARCH=
uname -m
and I'd append that to the end of the build result filename.我将 append 放在构建结果文件名的末尾。
It turns out that something about the kernel module build where make forks make -C again uses the ARCH environment variable, which my script was changing unexpectedly.事实证明,关于 kernel 模块构建的东西,其中 make forks make -C 再次使用 ARCH 环境变量,我的脚本意外地改变了它。
I was confused by the message "*** No rule to make target 'arch/armv7l/Makefile'" because that looks legit, but apparently that was being derived from the incorrect ARCH environment variable.我对消息“*** No rule to make target 'arch/armv7l/Makefile'”感到困惑,因为这看起来是合法的,但显然这是源自不正确的 ARCH 环境变量。
I change the name of the ARCH variable in the script and it all started working again.我在脚本中更改了 ARCH 变量的名称,它又开始工作了。
Hope this helps somebody.希望这可以帮助某人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.