How to compile and install single (patched) kernel module?

Hello,

I have to apply a small patch for module dst.c
After that I want do compile and install just this module without recompiling the whole kernel.
I have found some information (e.g. “hello world” module wont compile - openSUSE Forums](http://forums.opensuse.org/programming-scripting/392853-hello-world-module-wont-compile.html)) for opensuse but I don’t want to skrew up the system. With kernel 2.6.18 I usually followed this instructions How to install DVB device drivers - LinuxTVWiki for svn drivers.

Can anybody point me into the right direction?

Thanks.

F.

Hi
Normally I copy a patch to the /usr/src/linux directory then cd into
the subdirectory and build the module.

Is there a problem with following the wiki on openSUSE? Or do you need
to follow the wiki, plus install a patch?

Please confirm, then can help with further instructions :slight_smile:


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel 2.6.25.11-0.1-default
up 10:27, 1 user, load average: 0.17, 0.13, 0.22
GPU GeForce 6600 TE/6200 TE - Driver Version: 173.14.12

Hi, I was not aware of a wiki (opensuse) dealing with kernel compiling. Today I have tried to compile this patched module (dst.c) by copying the patch to /usr/src/linux/drivers/media/dvb/br8xx/ , cd to this directory and after that do a make. Actually the procedure you suggested. But it won’t work for me. Message on screen is: "…no targets… ".
I will look into the wiki, please post the link.

I have had a look into the Makefile, seems that the configuration of the kernel is necessary for the build and compile? The Makefile (first line) uses a variable to determine the obj-(variable) thing. I have found the howto on http://www.tldp.org/LDP/lkmpg/2.6/html/index.html : no dice with examples on opensuse 11.0.

At the moment the question boils down to:
Do I have to configure the (= re-use original kernel configuration of opensuse 11.0) and then cd to ./dst.c followed by make?

Anyway, please post the link the wiki. I guess I will need any help available out there…

Thanks and cheers,

Fiete

Hi
No I meant the link you quoted (was a wiki?) The directory should be
bt8xx not br8xx?

Now you may have to install the kernel-syms as well… also watch the
line wrap on the copy commands.


cd /usr/src/linux
make clean
make oldconfig
cp /usr/src/linux-obj/i386/default/Module.symvers /usr/src/linux/
make scripts
make prepare
cd  /usr/src/linux/drivers/media/dvb/bt8xx/
make -C /usr/src/linux SUBDIRS=$PWD modules
cp /usr/src/linux/drivers/media/dvb/bt8xx/dst.ko /lib/modules/`uname
-r`/drivers/media/dvb/br8xx/
rmmod dst; modprobe dst


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel 2.6.25.11-0.1-default
up 1:37, 1 user, load average: 0.01, 0.21, 0.22
GPU GeForce 6600 TE/6200 TE - Driver Version: 173.14.12

Hi
Oops not sure if you on x86_64, so you would need to change i386.

There is this link which may also help;
http://www.howtoforge.com/kernel_compilation_suse

Not sure if your running a pae kernel either (can spit out a
versioning error). I use the default one.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel 2.6.25.11-0.1-default
up 2:09, 2 users, load average: 0.29, 0.11, 0.08
GPU GeForce 6600 TE/6200 TE - Driver Version: 173.14.12

Hi Malcolm,
finally found the ‘wiki’ of documentation at Official openSUSE Kernel 2.6.22.12-0.1 Readme - openSUSE and followed your advice again (cd to source of dst.c and then issue command make -C /usr/src/linux M=$(pwd).
Some remarks: I had to treat dst.c as external module (by using make scripts and make prepare).
Commands ‘make oldconfig’ and ‘make cloneconfig’ as described in the official documentation had to be done as root!! My understanding is that everything except ‘make install’ and ‘make module_install’ can be done as normal user! Puzzling…
the ‘make -C /usr/src/linux/ M=$(pwd) module_install’ command (while as root in ./bt8xx directory) will not replace module dst.ko in /lib/modules/2.6…/kernel/drivers/media/dvb/bt8xx/dst.ko (timestamp unchanged). modprobing dst will crash e.g. Kaffeine and MythTV. Then I copied dst.ko from the build directory to /lib/modules/2.6…/kernel/drivers/media/dvb/bt8xx manually and after a cold reboot I have picture of my Twinhand Cable-CI card!!! The docs about custom kernels are great!

I’m a happy but still puzzled penguin, and some questions remain…, however the basic concept of

  1. configure the kernel source
  2. cd to the module you want to compile
  3. prepare as external module
  4. compile

seem to work.
I’m not sure about the make … module_install

Thanks for your help

Cheers,

F.

Hi
I think your confused with the make/make install with a package, rather
than a kernel module?

I’m thinking that maybe you could have dst.c as part of the kernel
(hence the crash), rather than the module, hence a recompile of the
complete kernel would be necessary.

I’ve only ever had to recompile the acpi module so far. never
worried about the module-install routine… glad you got it working
though :slight_smile:


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.0 x86 Kernel 2.6.25.11-0.1-default
up 1 day 1:33, 1 user, load average: 0.06, 0.08, 0.04
GPU GeForce 6600 TE/6200 TE - Driver Version: 173.14.12