PDA

View Full Version : Packaging kernel modules


nguyenkims
21st June 2010, 10:14 AM
Hello,

I'd like to package a kernel module for my company repository ( I know that fedora doesn't accept kernel module for official repo). I have followed the link
http://rpmfusion.org/Packaging/KernelModules/Kmods2
But when I build the spec file, there are always some errors like:
kernel-devel-uname-r = 2.6.32.14-127.fc12.i686.PAEdebug.PAE is needed by mymodule-kmod-0.0-1{?dist}.1.src
that I don't have any idea about.

Actually, I don't really understand this mechanism: if for example, I want to install foo on my machine with kernel 2.6.32.14 but there is only kmod-foo-2.6.32.12 avaiable, does yum take this package automatically? Or do I need to make a package for kernel 2.6.32.14? What kmod does exactly?
I know that there is a lot of questions, but I can't find many documentation about that. Answers from someone with experience with kernel packaging would be very appreciated.

Thank you in advance,
Son.

leigh123linux
21st June 2010, 10:46 AM
You probably using the wrong command to build, try


rpmbuild -ba packagename.spec --define "kernels $(uname -r)" --target $(uname -m)
or

rpmbuild -ba packagename.spec --define "kernels 2.6.32.14-127.fc12.i686" --target $(uname -m)


Post your spec file or srpm for more help.

nguyenkims
21st June 2010, 12:19 PM

After adding these options, it works !
So I suppose what kmodtool does is just automate the process of creating the package corresponding to a kernel ( like finding the kernel version to change in spec fille)? We can't decide, for example, a package for kernel 2.6.32.12 can be used for kernel 2.6.32.14?
I have uploaded my spec file but it is not very different from the template file.

leigh123linux
21st June 2010, 12:55 PM
After adding these options, it works !
So I suppose what kmodtool does is just automate the process of creating the package corresponding to a kernel ( like finding the kernel version to change in spec fille)? We can't decide, for example, a package for kernel 2.6.32.12 can be used for kernel 2.6.32.14?
I have uploaded my spec file but it is not very different from the template file.

You need to rebuild for every kernel update.


The src URL isn't valid so I couldn't find the source code to test.

http://mymodule.com/downloads/%{kmodname}-%{version}.tar.bz2

nguyenkims
21st June 2010, 02:06 PM
It's just a module I wrote for testing. It does nothing (except writing "My testing module" after insmoding).
I have managed to rpmbuild the two packages: mymodule and mymodule-kmod. But apparently, the mymodule-kmod file doesn't provide a good package ( even I have explicitly added
Provides:%{kmodname}-kmod = %{version}

Do you have any idea about this?

Just a curious question: how yum coud identify the corresponding kmod package? ( for ex, for installing open-vm-tools, we need kmod-open-vm-tools-`uname -r` )

nguyenkims
22nd June 2010, 02:49 PM
I have (finally) succeed in creating some kmod package corresponding to each kernel version.
But when tested in another machine with an old kernel, yum always takes the newest kmod package instead of the right one :confused: ! Even if I disable the official repo to prevent yum from getting the newer kernel.
I compared my Spec file to some others like open-vm one, but I don't still see why :(.
Does someone know how yum decide which package is the right one for another?

Thanks in advance,