简体   繁体   English

如何在 raspbian 上修复一个奇怪的 linux kernel 模块构建问题,在 x64 上运行良好 ubuntu

[英]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.

相关问题 RTAI-3.8安装堆叠在ubuntu-12.04(x64)+ linux-kernel-2.6.32.2中 - RTAI-3.8 installation stacked in ubuntu-12.04(x64)+linux-kernel-2.6.32.2 在 x64 上,Linux kernel 如何访问数据段? 它在编译期间使用 -mcmodel=large 吗? - On x64, how does the Linux kernel access the data segment? Does it use -mcmodel=large during compilation? Linux x64组装 - Linux x64 Assembly 如何在Ubuntu 14.04 x64上使用带有eclipse kepler的subclipse? - how to use subclipse with eclipse kepler on ubuntu 14.04 x64? system() 如何影响 x64 linux 中的堆栈? - How does system() affect the stack in x64 linux? 如何在汇编(x64/Linux)中使用动态分配的 memory? - How to work with dynamically allocated memory in Assembly (x64/Linux)? 如何修复 kernel 模块(linux-image-cloud-amd64 内核)中的“未知符号 usb_create_hcd (err -2)” - How to fix “Unknown symbol usb_create_hcd (err -2)” in kernel module (linux-image-cloud-amd64 kernel) 如何在 Oracle Linux 6.4 x64 上安装 PostGIS? - How to install PostGIS on Oracle Linux 6.4 x64? 如何在Amazon Linux x64实例上安装IonCube Loader - How to install IonCube Loader on Amazon Linux x64 instance 如何在QEMU上构建和运行Linux内核模块? - How to build and run a Linux kernel module on QEMU?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM