Pavunkumar
Pavunkumar

Reputation: 5335

Loading 64-bit module to a 32-bit kernel using insmod

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

Upvotes: 2

Views: 1277

Answers (3)

Ben Voigt
Ben Voigt

Reputation: 283694

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.

Upvotes: 1

austin1howard
austin1howard

Reputation: 4955

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.

Upvotes: 2

drrlvn
drrlvn

Reputation: 8437

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.

Upvotes: 2

Related Questions