Wednesday, April 28, 2010

Rebuilding a single kernel module

Due to Bug 596844, I had to rebuild the i915 module with a patch. I have done things like that quite often over the last years, and every time I have to dig through the documentation, so I'll put it up here in the hope that I'll find it easier in the future and that it might be useful for somebody else ;)

There are only a few steps, following the README.SUSE in the kernel-source package:

  • install the kernel-syms and kernel-source packages

  • copy the kernel sources to some other place where you have write access as a normal user (this is not in the README, but I hate doing stuff like that as root, so I'm doing it anyway)

  • patch the source

  • build the module


Or, as an almost-copy'n'pasteable list of commands:
cd /tmp
cp -a /usr/src/linux/ . # do not only copy the symlink ;)
cd linux/drivers/gpu/drm/i915/
patch < /tmp/i915-nofbc.diff # your diff
make -C /usr/src/linux-obj/x86_64/desktop M=$(pwd)
ls -l i915.ko

You need to adjust the directory given to "make -C" to your desired kernel flavour, of course, but that's it. Copy the module over to /lib/modules and reboot (I usually save the old module somewhere else, in case something goes wrong, but you probably figured that out already).

No comments:

Post a Comment