Find the answer to your Linux question:
Results 1 to 7 of 7
Hi there - I'll try and make this as quick and simple as I can. At work, we have a linux based imaging software as port of the novell suite ...
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    4

    Compiling Modules for Old Kernels

    Hi there - I'll try and make this as quick and simple as I can. At work, we have a linux based imaging software as port of the novell suite (loaded via PXE into RAM), however, recently we got new machines that we'd like to create an image of - and the imaging distro does not pick up the network card (although it quite easily downloaded itself off the network prior to booting itself); we had this problem previously and i was able to fix it by forcing it to load a specific module via the linuxrc.config file - however, that same technique does not work for this card, as it requires a module that is not part of its distribution. I am running Ubuntu 9.04 as my desktop which I'm doing all this work on, and the destination live linux distro runs linux kernel 2.6.16.

    I figure to make this work, I'll need to build the module for the target kernel, rather than the one I'm running on, and somehow integrate that into the image, either the initramfs, or the root. I've never had to do this before, so I'd be much appreciative if someone could point me in the right direction, such as where to get the kernel headers for this kernel from, if that's even relevant, and how to compile it for that specific kernel, and how to install the drivers into the target system. Here is the network card's info that we are trying to do this for:

    Code:
    08: PCI 300.0: 0200 Ethernet controller                         
      [Created at pci.314]
      UDI: /org/freedesktop/Hal/devices/pci_10ec_8168
      Unique ID: OVRT.Lp0FmZo8Rb2
      Parent ID: hoOk.6RaQ2iO1oj0
      SysFS ID: /devices/pci0000:00/0000:00:1c.2/0000:03:00.0
      SysFS BusID: 0000:03:00.0
      Hardware Class: network
      Model: "Realtek RTL8111/8168B PCI Express Gigabit Ethernet controller"
      Vendor: pci 0x10ec "Realtek Semiconductor Co., Ltd."
      Device: pci 0x8168 "RTL8111/8168B PCI Express Gigabit Ethernet controller"
      SubVendor: pci 0x1028 "Dell"
      SubDevice: pci 0x02f5 
      Revision: 0x03
      Driver: "r8169"   #was using r1000 in the initrd
      Driver Modules: "r8169"
      Device File: eth13
      I/O Ports: 0xe800-0xe8ff (rw)
      Memory Range: 0xfdfff000-0xfdffffff (rw,prefetchable)
      Memory Range: 0xfdff8000-0xfdffbfff (rw,prefetchable)
      Memory Range: 0xfebe0000-0xfebfffff (ro,prefetchable,disabled)
      IRQ: 2300 (431 events)
      HW Address: 00:1f:16:f9:a5:e8
      Link detected: yes
      Module Alias: "pci:v000010ECd00008168sv00001028sd000002F5bc02sc00i00"
      Driver Info #0:
        Driver Status: r8169 is active
        Driver Activation Cmd: "modprobe r8169"
      Config Status: cfg=new, avail=yes, need=no, active=unknown
      Attached to: #22 (PCI bridge)
    Thanks,

    NE

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    You can get the kernel source from The Linux Kernel Archives.
    If the module has a configure script there might be an option where you can pass the kernel source/headers that you want to build for. If there is no configure, this should be in the makefile, you will have to edit it. Be aware that it may not compile, since the driver may be using API's that have changed since the target kernel and you may have to start hacking it.

  3. #3
    Just Joined!
    Join Date
    Oct 2009
    Posts
    4
    If I have the kernel source - how do I build the heards, or specify the source in the makefile so that it will build against this? It's not something I've done before, and support would be much appreciated. I have the kernel source (2.6.16.60) waiting and ready to go

    --------EDIT--------------

    I think I'm doing this right - started off by configuring it (make menuconfig) - didn't need to change any options, as far as I'm aware, as I'm only using the headers for it. Then, did make. From here - where do I specify the in the make file to look for the kernel headers, and how do I do it? Thanks.

  4. #4
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    I'm not sure you need to do anything with the kernel source in particular, you just need to compile the kernel module using the headers from the destination kernel.

    I would run the configure script for the kernel module and use --help to see what options it allows you to input. Hopefully there is one that lets you point to the kernel source.

  5. #5
    Just Joined!
    Join Date
    Oct 2009
    Posts
    4
    Well, this module doesn't actually have a configure script, only a make script, so I went through that and manually changed the paths to point to where my kernel is, hoping it would use that, however, it gives me the following output:
    Code:
    root@desktop:/home/desktop/zenworks_boot/r8168-8.014.00# make
    make -C src/ clean
    make[1]: Entering directory `/home/desktop/zenworks_boot/r8168-8.014.00/src'
    rm -rf *.o *.ko *~ core* .dep* .*.d .*.cmd *.mod.c *.a *.s .*.flags .tmp_versions Module.symvers Modules.symvers Module.markers *.order
    make[1]: Leaving directory `/home/desktop/zenworks_boot/r8168-8.014.00/src'
    make -C src/ modules
    make[1]: Entering directory `/home/desktop/zenworks_boot/r8168-8.014.00/src'
    make -C /home/desktop/zenworks_boot/linux-2.6.16.60/build SUBDIRS=/home/desktop/zenworks_boot/r8168-8.014.00/src modules
    make: Entering an unknown directory
    make: *** /home/desktop/zenworks_boot/linux-2.6.16.60/build: No such file or directory.  Stop.
    make: Leaving an unknown directory
    make[1]: *** [modules] Error 2
    make[1]: Leaving directory `/home/desktop/zenworks_boot/r8168-8.014.00/src'
    make: *** [modules] Error 2
    So it needs the "build" folder, which makes me think I need to compile the kernel; is this the case? Appreciate the help so far.

  6. #6
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    I'm not sure if this will work, but it might based on my directory structure.

    In my /lib/modules directory for my kernel, there is a build directory that is a symlink to the kernel source directory, so I am guessing that if you make a symlink from /home/desktop/zenworks_boot/linux-2.6.16.60 to /home/desktop/zenworks_boot/linux-2.6.16.60/build then you MIGHT get the desired results.

  7. #7
    Just Joined!
    Join Date
    Oct 2009
    Posts
    4
    So I decided to go with trying to build the kernel. I am compiling it on a Ubuntu 9.04 machine. The kernel craps out with the following error message during the "make" phase:
    CC fs/quota.o
    CC fs/dnotify.o
    CC fs/dcookies.o
    LD fs/built-in.o
    CC [M] fs/binfmt_aout.o
    fs/binfmt_aout.c: Assembler messages:
    fs/binfmt_aout.c:154: Error: suffix or operands invalid for `cmp'
    make[1]: *** [fs/binfmt_aout.o] Error 1
    make: *** [fs] Error 2
    Any ideas? I'm trying to find a distro already running the 2.6.16 kernel that I can try compiling on, but as of yet, none that I've tried has been successful.


    ------------UPDATE---------------
    So I got the kernel to compile in the end with a simple "make defconfig", and then "make", and "make install" - then, I didn't realise it (stupid me), but the linux-2.6.16.60.tar.bz2's extracted directory (which I was using for compiling kernel) is actually the headers! So I symlinked a build directory within their to that directory, and it seemed to build the module Now just for me to test it out!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...