Results 1 to 5 of 5

Thread: recompile one kernel module

  1. #1
    Join Date
    Feb 2005
    Beans
    425

    recompile one kernel module

    How can I rebuild just one kernel module, without building the whole kernel? I want to modify and rebuild a drm module.

    I downloaded the kernel source package, made my build directory "mytree", copied in a .config, cd back to the kernel source, and ran:

    make O=/home/tormod/kernel/mytree oldconfig
    make O=/home/tormod/kernel/mytree drivers/char/drm/

    And it successfully makes all the .o files. Then it stops, and complains about missing .mod files:
    /bin/sh: .tmp_versions/drm.mod: No such file or directory
    /bin/sh: .tmp_versions/tdfx.mod: No such file or directory
    /bin/sh: .tmp_versions/r128.mod: No such file or directory
    ...

    Anyone got a clue?
    Thanks,
    Tormod
    Please use launchpad to search for/report bugs and problems: https://help.ubuntu.com/community/ReportingBugs

  2. #2
    Join Date
    Feb 2005
    Beans
    425

    Re: recompile one kernel module

    I finally figured it out. I have to write it down anyway, so here it is:
    Code:
    apt-get source linux-image-2.6.15-27-386
    # modify the source files I want to change
    
    mkdir mytree
    cp /boot/config-2.6.15-27-386 mytree/.config
    cd linux-source-2.6.15-2.6.15
    make O=../mytree outputmakefile
    make O=../mytree archprepare
    make O=../mytree modules SUBDIRS=scripts
    make O=../mytree modules SUBDIRS=drivers/char/drm
    Although I have the feeling this procedure is not the most correct one. There is some warning about missing versioning. And other SUBDIRS might have to be added for other modules.
    Please use launchpad to search for/report bugs and problems: https://help.ubuntu.com/community/ReportingBugs

  3. #3
    Join Date
    Feb 2005
    Beans
    425

    Re: recompile one kernel module

    I usually start with a
    Code:
    make O=../mytree oldconfig
    after having copied the config file.

    The version warning that I get is:
    WARNING: Symbol version dump .../mytree/Module.symvers is missing; modules will have no dependencies and modversions.

    Does anyone have a clue how to easily get the Module.symvers generated? (Without having to compile the whole kernel or all the modules, that is.)
    Please use launchpad to search for/report bugs and problems: https://help.ubuntu.com/community/ReportingBugs

  4. #4
    Join Date
    Feb 2005
    Beans
    425

    Re: recompile one kernel module

    It's me again Copy the Module.symvers file from your linux-headers package first:
    Code:
    cp /usr/src/linux-headers-2.6.24-20-generic/Module.symvers mytree/
    And you might have to run
    Code:
    make O=../mytree prepare
    Last edited by tormod; July 28th, 2008 at 06:32 PM. Reason: make prepare
    Please use launchpad to search for/report bugs and problems: https://help.ubuntu.com/community/ReportingBugs

  5. #5
    Join Date
    May 2008
    Beans
    5

    Re: recompile one kernel module

    Thanks man for the description that you give us. I could compile only one module instead all the kernel with you workaround.

Bookmarks

Posting Permissions

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