Load a 32bit kernel module on 64bit OS?
Hi.
Here is the scenario: I have a third party software (SDK) that uses a kernel module to drive an infrared camera. The software are 32bit libraries of which I have not source code. The driver (kernel module) in the other hand is provided as source code. Now I have tested without problem this system on 32 bit machine. For some reasons now I must make this work on 64 bit machine. So I installed the 32 bit support libraries for Linux (Ubuntu). With this, the software runs. But I have issues trying the software to work with the driver. >If I build the driver against the 64 bit kernel, modprobe loads the module, but the software throws a "segmentation fault (core dumped)". Obviously there is a mismatch between 32bit software and 64 bit driver. >If I build the driver against the 32 bit kernel, modprobe fails with "ERROR: could not insert 'moduleName': Exec format error". A 32 bit module does not simply loads on 64 bit OS. My question is what can i do to get this work. I supposed that if 32 bit software can run on 64 bit OS, a kernel module can too, but obviously is not so simple. Is there a way to achieve this?. Thanks. |
Hi:
I've heard that re-compiling the kernel will get things that didn't work to work. https://help.ubuntu.com/community/Kernel/Compile Your program is only allowed to touch memory that belongs to it. Any access outside of those areas will cause a segmentation fault. Maybe debugging will help? Here's a few links that may help or at least get you pointed in the right direction. Sorry I don't know more. http://www.cprogramming.com/debugging/segfaults.html https://www.netbsd.org/docs/guide/en/chap-kernel.html https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel Debugging:- https://wiki.ubuntu.com/DebuggingProcedures https://wiki.ubuntu.com/Kernel/Debugging HTH |
Generally it should work - but ... have a read of this. Opensuse, but generally applicable.
The 32-bit API should cover most cases as it says - else the vendor needs to supply compatible binaries. |
Thanks for the link syg00-:)
|
Quote:
32-bit applications work with 64-bit drivers in Linux (and other OS's). A correctly designed driver interfaces with the kernel in a way that should make the issue of the application bit size invisible to the driver. The kernel takes care of dealing with the 32-bit application. So your guess that the 32-bit application is not compatible with 64-bit driver is not easy to completely rule out, but it is also not easy for me to believe. Quote:
Quote:
A 64-bit driver and 64-bit kernel and 32-bit application should all play well together. So hopefully that is what you meant by "it". |
Indeed - the OP basically proved the 64-bit kernel requirement.
Didn't realise I was being ambidextrous. |
It may also depend on any ioctls that may be implemented by the kernel module... These get translated by the 32bit ABI, but custom ioctls would not. This in turn would cause a segmentation fault in the 32bit libraries as the data being passed would be for 64 bit rather than 32 bit. The only way to find out is to trace the segmentation fault.
And 32 bit kernel modules DON'T WORK in a 64 bit kernel. The kernel internal APIs are 64 bit only. |
Thanks all for your answers.
Quote:
Code:
#define USB_FJVEINCAM_IOCTL_CTRLMSG _IOWR(0xB4,0x01,struct fjveincam_cmsg) |
The void *data would be wrong.
In a 32 bit binary that is a 32 bit address. The driver would be assuming it got a 64 bit address - which would be invalid, and possibly be the cause of your segmentation error. It would be if the fault is traced to the ioctl. |
By far the simplest solution would be to ask the vendor for appropriate drivers. I'm not quite sure why "an infrared camera" has kernel requirements, anyway. How is this camera connected?
|
Quote:
I THINK (but not sure) the 32 bit version of libusb would work on a 64 bit system. |
It can't hurt to re-compile the kernel and see if that works. It might just work but you won't know till you give it a go.
See here for libusb- http://www.libusb.org/ The Infrared-HOWTO provides an introduction to Linux and infrared devices- (not sure if this will help but none the less I looked it up. http://www.tldp.org/HOWTO/html_single/Infrared-HOWTO/ What make and model is your camera ferite? |
I've compiled the same driver for different architectures, do you still need any help?
|
Run a virtual machine in 32 bit??
|
All times are GMT -5. The time now is 09:38 AM. |