How can you build a kernel module for a kernel that isn't running on your system?
I have been searching for hours trying to find any guides or information in general for how to build a kernel module for a kernel I am not currently running.
The situation I'm in is as follows: I am running debian stable (kernel 3.2 x64) on my laptop, and I am trying to build a kernel module for a desktop running an ubuntu variant called Zorin (kernel 3.13 x32). The reason I am building it on my laptop is because the desktop in question has no internet access and this module will solve that problem. So, how can I build this module for the 3.13.0-32 kernel if I'm running 3.2.04-amd64 kernel? |
The kernel or module you are compiling has no relation to the running kernel. You simply need to use the sources for the kernel version you are compiling for.
|
Ok, could you tell me how to do that? When I've tried to compile this module, it just builds it for the kernel I currently have which I have the source for as well obviously. I have the source for the 3.13 kernel, but I don't know how to tell 'make' to use the 3.13 source.
|
Why not just transfer the source code of the module to the desktop and build it there, then install it there ?
|
I tried that, and it kept failing with "make[2] (path to source) Error 1" or "make[1] (path to source) Error 2" so the easiest method I could think to do it was to build it with the 3.13 source on my laptop. But I can't figure out how to do this without the module building for the kernel I am currently using. I have the source for 3.13 in /usr/src, but when I run make it still only builds for the kernel I am currently running.
|
There is a symlink to the source in '/lib/modules/3.13/source', I believe that is what it checks first.
|
Thay still doesn't help me understand what I need to do to have the make command see that symlink, or see 3.13 at all.
|
Usually, /usr/src/linux is a symlink to the sources for the running version and some module sources will look there first for the kernel sources. Some sources let you specify the pathh to the kernel sources to use. If your code does not, then changing the /usr/src/linux link to püoint to the desired sources should work. The sources may need to be pre-configured in order to build your module.
|
Quote:
|
Are the sources for the module completely separate from the kernel sources? Post a link to the sources for us.
|
Yes. The module source is realtek module for a usb wifi dongle. Find that here.
|
You need to edit the Makefile starting at line 200 to set the path to the kernel sources and to the module sources (as part of following the directions in the file README_STA_usb.
|
Just loaded Zorin in a VM to build the module then copy it over to the destination machine, but it errored (see here).
In the morning I will try to explicitly set path to kernel and such on my main system (not VM) and see if that works. |
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
http://www.linuxquestions.org/questi...em-4175517399/ --jeremy |
All times are GMT -5. The time now is 02:03 PM. |