Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    recompiling module without recompiling kernel

    Hey guys. I am looking to play around with some kernel modules for some MPT drivers to see if I can slightly alter their functionality, just to try and learn a bit more about them.

    I am facing a bit of a problem straight out of the gate though, and I am unable to recompile these modules without recompiling the whole kernel, which is a 2+ hour job for my super slow PC

    So does anyone know how to compile specific module without recompiling a whole Kernel?

    Extra info that might help:

    The module I am playing around with is called mptbase, located in /usr/src/linux-2.6.22/drivers/message/fusion/ and the related file in this directory are mptbase.o, mptbase.ko (the compiled module), mptbase.c and mptbase.h.

    I tried using a guide that suggested the following makefile...

    obj-m = mptbase.o
    all: make -C /lib/modules/2.6.22-3-686/build M=$(PWD) module
    clean: make -C /lib/modules/2.6.22-3-686/build M=$(PWD) clean
    I placed this makefile in a folder on my desktop and ran it but it errored all over the place with the following output...

    make[1]: entering directory `usr/src/linux-2.6.22`
    make[1]: *** No rule to make target `module`. Stop.
    make[1]: Leaving directory `/usr/src/linux-2.6.22`
    make: *** [all] Error 2
    I have also tried running the makefile in the modules directory but that errored everywhere too.

    Thanks for reading
    Last edited by aatwo; 08-01-2011 at 12:14 PM.

  2. #2
    you should say 'make -C /lib/modules/2.6.22-3-686/build M=$(PWD) modules', it is modules not module.

    First copy the mtpbase.c and mtpbase.h to a directory and write the above make file in that directory and run make.
    Last edited by oz; 08-09-2011 at 03:38 PM. Reason: removed spam redirect

Posting Permissions

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