How can you build a kernel module for a kernel that isn't running on your system?
GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
The sources may need to be pre-configured in order to build your module.
What do you mean by this? Like I said this whole process is new to me so I'm sort of like a half blind person feeling their way through a topiary maze.
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.
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.