使用 insmod 将 64 位模块加载到 32 位内核
是否可以将在 64 位处理器系统中编译的 .ko 文件(内核对象文件)加载到 32 位处理器系统中?
实际上,当我在系统中发出 insmod 命令时,出现以下错误:
insmod: error inserting 'be2net.ko': -1 Invalid module format
Is is possible to load a .ko
file (kernel object file) which was compiled in 64-bit processor system into 32 bit processor system?
Actually I am getting following error when I issue the insmod command in my system:
insmod: error inserting 'be2net.ko': -1 Invalid module format
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
无法在 32 位系统中运行 64 位代码。根据要求,反之亦然(在 64 位系统中运行 32 位软件或库),但 32 位体系结构无法理解 64 位代码。您需要在您的系统上编译该模块。
首先从 kernel.org 下载内核源代码。然后解压,然后 cd 到
那里,输入(作为您的普通用户)
,然后
这应该适合您。
It is not possible to run 64-bit code in a 32-bit system. Depending on the requirements, the reverse can be true (running 32-bit software or libraries in a 64-bit system), but a 32-bit architecture cannot understand 64-bit code. You will need to compile the module on your system.
First download the kernel source from kernel.org. Then extract, and cd into
Once there, type (as your regular user)
and then
That should work for you.
不,无法将 64 位模块加载到 32 位内核,这就是您收到错误的原因。原因是64位和32位程序具有不兼容的ABI(例如不同的调用约定)。例如,这也是 64 位应用程序无法与 32 位库链接的原因。
请注意,insmod 通常会给出模糊的错误消息。有关更详细的消息,请查看 dmesg 的输出。
No, it is not possible to load 64-bit modules to a 32-bit kernel, and that is why you are getting an error. The reason is that 64 and 32-bit program have an incompatible ABI (e.g. different calling conventions). That is also the reason 64-bit applications can't be linked with 32-bit libraries, for example.
Note that insmod generally gives vague error message. For a more detailed message look at the output of
dmesg
.编译它的处理器根本不重要。编译器和编译器选项确实很重要。如果它是为 64 位处理器编译的,则它无法在 32 位处理器上运行,因为它使用不同的指令集。
但是,64 位处理器可以运行交叉编译器并创建 32 位二进制文件。您不太可能这样做过。
The processor where it was compiled matters not at all. The compiler and compiler options do matter. If it was compiled FOR a 64-bit processor, it cannot run on a 32-bit processor, because it uses a different instruction set.
However, a 64-bit processor can run a cross-compiler and create 32-bit binaries. It is unlikely that you've done this.