Compile a module for a kernel version not running

Discuss Programming
User avatar
Basher52
guru
guru
Posts: 923
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Compile a module for a kernel version not running

Post by Basher52 » Wed Nov 12, 2008 5:27 am

Isn't this possible? I think I've seen that somewhere, but not I can't find anything of it.

Instead, not I have to reboot the new the installed kernel, compile the module and see if that works, if not reboot back to the old one and start to see if there are a newer working one released yet.

and another thing...
Yesterday I rebooted into 2.6.26.6 and tried this but this time it seemed to compile perfect but when 'make install' it said that I compiled a module for 2.6.26.5 and wouldn't install it. Tried these several times.
If you need logs, I gotta get back home and do it because I can't reboot it from here, it won't come back up.

//B52

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Nov 12, 2008 7:33 am

This can be done, usually fairly easily but it can be dependent on the module. Can you point me to the module source that you are trying install? Obviously you have to have the kernel and headers installed for each kernel you want to install it for. Here's how you would do it for the madwifi driver:

http://cblfs.cross-lfs.org/index.php/Ma ... ing_Kernel

Here's how you would do it for nVidia (see --kernel-name):

http://olympus.het.brown.edu/cgi-bin/ma ... nstaller+1

So it can be dependent on the module itself as to how you do it.

User avatar
Basher52
guru
guru
Posts: 923
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Wed Nov 12, 2008 9:09 am

The module: http://www.highpoint-tech.com/BIOS_Driv ... 419.tar.gz


UPDATE:
Oh so this can vary. When you said that I took a look at the README and found it and that worked :)
I totally forgot the other problem, when I tried the make install, that it told me that I compiled a module for 2.6.26.5 and that it couldn't be used for current version.If you still don't know what I mean since i can't remember the exact message, I'll set my phone to remind me :P and put it in here.

User avatar
Basher52
guru
guru
Posts: 923
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Mon Nov 17, 2008 3:26 pm

here's the error i get:

Code: Select all

[root@ftp linux]# make
make[1]: Entering directory `/usr/src/kernels/2.6.26.6-49.fc8-i686'
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/os_linux.o
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/osm_linux.o
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/div64.o
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/hptinfo.o
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/config.o
  LD [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/rr2340.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: could not find /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/.him_rr2340.o.cmd for /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/him_rr2340.o
  LD [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/rr2340.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.26.6-49.fc8-i686'

[root@ftp linux]# make install
make[1]: Entering directory `/usr/src/kernels/2.6.26.6-49.fc8-i686'
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/os_linux.o
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/osm_linux.o
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/div64.o
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/hptinfo.o
  CC [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/config.o
  LD [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/rr2340.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: could not find /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/.him_rr2340.o.cmd for /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/him_rr2340.o
  LD [M]  /install/rr2340-linux-src-v1.5/product/rr2340/linux/.build/rr2340.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.26.6-49.fc8-i686'
You made a module for 2.6.26.5-28.fc8 which does not match current kernel.
The driver will be installed for kernel 2.6.26.5-28.fc8.
Deleting previous installed driver module rr2340...
Install the new driver module...
Updating module dependencies...Done.
Checking for initrd images to be updated...
14446 blocks                
[root@ftp linux]# 

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Mon Nov 17, 2008 4:58 pm

The same README says a "make install" will try and install for the current running kernel so you have to install it manually. Manuall copy the modules to this directory:

/lib/modules/<targetkernelversion>/kernel/drivers/scsi/rr2340

where <targetkernelversion> is the version of your target kernel (the one you build the module for). Just do an "ls /lib/modules" to see the module directories for each installed kernel. The "rr2340" subdirectory probably does not exist so you would want to create that first.

The README doesn't state it's required and it may no longer be required but you used to also have to do a depmod after installing new modules manually:

# depmod -a <targetkernelversion>

P.S. I don't see where you used the "KERNELDIR=..." param in your make to point to the source of your target kernel like the README suggests.

User avatar
Basher52
guru
guru
Posts: 923
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Tue Nov 18, 2008 10:06 am

well... the question about how to compile a module for another kernel version is when I sometime have rebooted to the new kernel and the compile doesn't work. That's why I wondered that, just to test the source.

In this last one I have already rebooted into kernel version 2.6.26.6
so I don't have to name the kernel version because I'm running it but the problem is that the install won't work thinking I'm still running 2.6.26.5
I think I've had this problem with this driver sometime before, but I can't remember how I fixed it.

Sorry that I couldn't explain more clearly.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Nov 18, 2008 10:21 am

So now you are currently running 2.6.26.6 and that is the one you want to build and install for? As long as you have the kernel-devel package installed for that kernel you should be able to just go into the module source directory "make clean", "make", "make install". Worst case would be do delete the module source directory and extract it again and do the "make;make install". I'm sure I am misunderstanding something.

User avatar
Basher52
guru
guru
Posts: 923
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Tue Nov 18, 2008 12:10 pm

well...
I am normally running 2.6.26.5 because when I did the upgrade to 2.6.26.6, rebooted into that and tried to compile the module the 'make install' didnt work telling me I just compiled a module for 2.6.26.5 which I can't have, so I rebooted back to 2.6.26.5 again.
That's why I normally run 2.6.26.5 because the module won't install.

Every time I got a new kernel, the only thing I did was to reboot into that version, do 'make' and 'make install' and after that 'modprobe rr2340' and it all worked, but not this time.

Am I still making you scratch your head :P

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Nov 18, 2008 1:29 pm

It sounds like your "build" link in your modules directory is pointing to the wrong source. What's in your modules directory:

Code: Select all

$ ls -l /lib/modules/2.6.26.6*

User avatar
Basher52
guru
guru
Posts: 923
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Tue Nov 18, 2008 1:47 pm

Code: Select all

[root@ftp install]# ls -l /lib/modules/2.6.26.6*
total 1824
lrwxrwxrwx 1 root root     45 2008-11-06 07:10 build -> ../../../usr/src/kernels/2.6.26.6-49.fc8-i686
drwxr-xr-x 2 root root   4096 2008-10-17 22:10 extra
drwxr-xr-x 9 root root   4096 2008-11-06 07:10 kernel
-rw-r--r-- 1 root root 391521 2008-11-06 07:10 modules.alias
-rw-r--r-- 1 root root   1542 2008-10-17 22:10 modules.block
-rw-r--r-- 1 root root     69 2008-11-06 07:10 modules.ccwmap
-rw-r--r-- 1 root root 322050 2008-11-06 07:10 modules.dep
-rw-r--r-- 1 root root    147 2008-11-06 07:10 modules.ieee1394map
-rw-r--r-- 1 root root    375 2008-11-06 07:10 modules.inputmap
-rw-r--r-- 1 root root  13083 2008-11-06 07:10 modules.isapnpmap
-rw-r--r-- 1 root root   1716 2008-10-17 22:10 modules.networking
-rw-r--r-- 1 root root     74 2008-11-06 07:10 modules.ofmap
-rw-r--r-- 1 root root  64025 2008-10-17 22:10 modules.order
-rw-r--r-- 1 root root 274100 2008-11-06 07:10 modules.pcimap
-rw-r--r-- 1 root root   1051 2008-11-06 07:10 modules.seriomap
-rw-r--r-- 1 root root 156195 2008-11-06 07:10 modules.symbols
-rw-r--r-- 1 root root 560203 2008-11-06 07:10 modules.usbmap
lrwxrwxrwx 1 root root      5 2008-11-06 07:10 source -> build
drwxr-xr-x 2 root root   4096 2008-10-17 22:10 updates
drwxr-xr-x 2 root root   4096 2008-11-06 07:10 vdso
drwxr-xr-x 2 root root   4096 2008-10-17 22:10 weak-updates
but this is listed from when I run 2.6.26.5, maybe this won't help?
oh stupid me, we're listing the 2.6.26.6 :P

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Nov 18, 2008 2:01 pm

I would remove the module source directory and re-extract a fresh copy of the module source while booted in your 2.6.26 kernel and try the make;make install again. There has to be something hanging around from your previous build that a "make clean" isn't cleaning up. Everything looks right to me. The only other option that I can think of is what's in /usr/src/kernels/2.6.26.6-49.fc8-i686 isn't right. You can verify it by:

Code: Select all

$ rpm -V kernel-2.6.26.6-49.fc8-i686
$ rpm -V kernel-devel-2.6.26.6-49.fc8-i686
$ rpm -V kernel-headers-2.6.26.6-49.fc8-i686
The above commands will verify your kernel, kernel-devel and kernel-headers packages and should not produce any output. Of course the new kernel RPMs could be broken although I think that is unlikely.

User avatar
Basher52
guru
guru
Posts: 923
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Tue Nov 18, 2008 2:39 pm

Code: Select all

[root@ftp ~]# rpm -V kernel-2.6.26.6-49.fc8-i686 
package kernel-2.6.26.6-49.fc8-i686 is not installed
[root@ftp ~]# rpm -V kernel-devel-2.6.26.6-49.fc8-i686 
package kernel-devel-2.6.26.6-49.fc8-i686 is not installed
[root@ftp ~]# rpm -V kernel-headers-2.6.26.6-49.fc8-i686
package kernel-headers-2.6.26.6-49.fc8-i686 is not installed
[root@ftp ~]# 
hmm they DID create an output :(

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Nov 18, 2008 2:46 pm

What does this give you:

Code: Select all

$ rpm -qa | grep kernel

User avatar
Basher52
guru
guru
Posts: 923
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Tue Nov 18, 2008 2:59 pm

Code: Select all

[root@ftp ~]# rpm -qa | grep kernel
kernel-devel-2.6.23.15-137.fc8
kernel-devel-2.6.26.3-14.fc8
kernel-2.6.26.3-14.fc8
kernel-2.6.23.1-42.fc8
kernel-devel-2.6.26.5-28.fc8
kernel-2.6.23.15-137.fc8
kernel-2.6.25.9-40.fc8
kernel-devel-2.6.26.6-49.fc8
kernel-headers-2.6.26.6-49.fc8
kernel-2.6.24.4-64.fc8
kernel-devel-2.6.24.4-64.fc8
kernel-2.6.24.5-85.fc8
kernel-2.6.25.10-47.fc8
kernel-2.6.25.14-69.fc8
kernel-2.6.26.5-28.fc8
kernel-2.6.26.6-49.fc8
kernel-devel-2.6.23.1-42.fc8
kernel-devel-2.6.24.5-85.fc8
kernel-devel-2.6.25.9-40.fc8
kernel-devel-2.6.25.10-47.fc8
kernel-devel-2.6.25.14-69.fc8
[root@ftp ~]# 
and it has to be installed since I can start it.
and this is in the grub.conf

Code: Select all

title Fedora (2.6.26.6-49.fc8)
        root (hd0,0)
        kernel /vmlinuz-2.6.26.6-49.fc8 ro root=LABEL=/1 vga=791 rhgb quiet
        initrd /initrd-2.6.26.6-49.fc8.img

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Nov 18, 2008 3:04 pm

Basher52 wrote:

Code: Select all

[root@ftp ~]# rpm -V kernel-2.6.26.6-49.fc8-i686 
package kernel-2.6.26.6-49.fc8-i686 is not installed
[root@ftp ~]# rpm -V kernel-devel-2.6.26.6-49.fc8-i686 
package kernel-devel-2.6.26.6-49.fc8-i686 is not installed
[root@ftp ~]# rpm -V kernel-headers-2.6.26.6-49.fc8-i686
package kernel-headers-2.6.26.6-49.fc8-i686 is not installed
[root@ftp ~]# 
hmm they DID create an output :(
Ooops, do the same commands I said again except without the "-i686" at the end.

Post Reply