openSUSE Forums > Programming/Scripting » How to compile and install single (patched) kernel module?

Go Back   openSUSE Forums > Programming/Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 16-Aug-2008, 02:16
Puzzled Penguin
 
Join Date: Jul 2008
Posts: 7
fiete hasn't been rated much yet
Default 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) 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.
Reply With Quote
  #2 (permalink)  
Old 18-Aug-2008, 07:53
malcolmlewis's Avatar
Global Moderator
 
Join Date: Jun 2008
Location: Podunk
Posts: 4,710
malcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputation
Default Re: How to compile and install single (patched) kernel module?

Quote:
Originally Posted by fiete
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://tinyurl.com/5n97se)) for opensuse
5n97se ->
http://forums.opensuse.org/programmi...t-compile.html
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' (http://tinyurl.com/yo7cn7) for svn drivers. yo7cn7 ->
http://www.linuxtv.org/wiki/index.ph...device_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

--
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

Reply With Quote
  #3 (permalink)  
Old 18-Aug-2008, 16:51
Puzzled Penguin
 
Join Date: Jul 2008
Posts: 7
fiete hasn't been rated much yet
Default Re: How to compile and install single (patched) kernel modul

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
Reply With Quote
  #4 (permalink)  
Old 18-Aug-2008, 17:27
malcolmlewis's Avatar
Global Moderator
 
Join Date: Jun 2008
Location: Podunk
Posts: 4,710
malcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputation
Default Re: How to compile and install single (patched) kernel module?

Quote:
Originally Posted by fiete
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.

Code:
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

Reply With Quote
  #5 (permalink)  
Old 18-Aug-2008, 17:44
malcolmlewis's Avatar
Global Moderator
 
Join Date: Jun 2008
Location: Podunk
Posts: 4,710
malcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputation
Default Re: How to compile and install single (patched) kernel module?

Quote:
Originally Posted by Malcolm
Quote:
Originally Posted by fiete
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.

Code:
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
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

Reply With Quote
  #6 (permalink)  
Old 19-Aug-2008, 16:42
Puzzled Penguin
 
Join Date: Jul 2008
Posts: 7
fiete hasn't been rated much yet
Default Re: How to compile and install single (patched) kernel modul

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.
Reply With Quote
  #7 (permalink)  
Old 19-Aug-2008, 17:05
malcolmlewis's Avatar
Global Moderator
 
Join Date: Jun 2008
Location: Podunk
Posts: 4,710
malcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputationmalcolmlewis has great reputation
Default Re: How to compile and install single (patched) kernel module?

Quote:
Originally Posted by fiete
Hi Malcolm,
finally found the 'wiki' of documentation at 'Official openSUSE Kernel
2.6.22.12-0.1 Readme - openSUSE'
(http://en.opensuse.org/Official_open....12-0.1_Readme)
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 :-)

--
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

Reply With Quote
Reply

Bookmarks

Tags
compile, install, kernel, patch, single module


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2