使用 insmod 将 64 位模块加载到 32 位内核

发布于 2024-12-28 06:24:37 字数 185 浏览 1 评论 0原文

是否可以将在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

肥爪爪 2025-01-04 06:24:37

无法在 32 位系统中运行 64 位代码。根据要求,反之亦然(在 64 位系统中运行 32 位软件或库),但 32 位体系结构无法理解 64 位代码。您需要在您的系统上编译该模块。

首先从 kernel.org 下载内核源代码。然后解压,然后 cd 到

linux/drivers/net/benet

那里,输入(作为您的普通用户)

make

,然后

sudo insmod be2net.ko

这应该适合您。

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

linux/drivers/net/benet

Once there, type (as your regular user)

make

and then

sudo insmod be2net.ko

That should work for you.

唠甜嗑 2025-01-04 06:24:37

不,无法将 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.

愚人国度 2025-01-04 06:24:37

编译它的处理器根本不重要。编译器和编译器选项确实很重要。如果它是为 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文