I'd like to spark some discussion on how to properly package kernel
modules for FC2. I have personally packaged a few kernel module
packages for FC1 for fedora.us (see
and Ville Skytta has packaged some others using a different technique.
I have spent some time this week getting more familiar with the linux
2.6 buildsystem, and have come up with a similar system to what I had
for 2.4. I'd like to explain the various parts of the problem and
solution and get some feedback so I can fix the procedure and propose it
First of all, a few things are different with 2.6 and FC2:
- you cannot use kernel-source anymore to build for all archs (i586,
i686 - athlon is dropped) and types (regular and -smp) This is because
you need a bunch of different headers and built files
- these built files are packaged in the kernel rpm and install in
/lib/modules/`uname -r`/build which is now no longer a symlink to
/usr/src/linux-(rel) but a real directory. This effectively prevents
you from building kernel modules for more than one arch at the same time
on your system, since there's no way to install the same kernel rpm for
- afaict the FC2 kernel no longer uses symbol versioning (MODVERSIONS
not defined, and Module.symvers only contains "0" versions. I have no
idea why this change has been made.
- 2.6 has a new kbuild system that makes it possible to build
out-of-source kernel modules more reliably/easily
So, how does the current procedure work ?
- I wrote a script (http://thomas.apestaart.org/download/tmp/kmd.py
which takes a set of kernel rpms for the same-version release, but
different arch/types, extracts them, then creates a symlink/copy forest
that produces a tree of dirs with the same contents as each of the four
The reason for doing this is so that modules for each arch/target combo
can again be built on one kernel, and the resulting rpm is smaller than
four copies of the other rpms.
Currently, this rpm puts files in
common is a symlink to /lib/modules/`uname -r` (which can be regular or
smp, and is symlinked at %post time by the rpm).
the four other directories are named exactly like the rpm they were part
of, and contains a tree of files that are different to the others, and
symlinks to the common directory.
- In the autostars project, we have come up with a set of scripts and a
sample project to package kernel modules and build them reliably and
reproducably against any kernel build tree
This has been updated with a full set of procedures to build for 2.6 as
well. Given only the argument
--with-linuxdir=/usr/share/kernel-module-devel-(ver-rel)/(rpm dir), it
can build the correct kernel module. (This same project can still be
used to build 2.4 modules correctly as well, including redhat's special
defines for boot,enterprise,smp,bigmem from /boot/kernel.h)
For 2.6, it includes a libtool-like script that takes care of installing
modules and taking into account symbol versions.
- like before, I have created patches to hostap and ipw2100 drivers to
autotoolize them using this setup. This only takes ten minutes if
you're used to autotools, and ten more if you want it to work out of the
box for both 2.4 and 2.6 (assuming the source allows this).
- Since ipw2100 needs symbol versions and include files from hostap,
I've made the hostap rpm install these files as part of a
kernel-module-devel-hostap-(ver-rel) rpm, in the same tree as the
original kernel-module-devel rpm. all hostap*.symvers files end up in
(which is where Modules.symvers lives).
The .h files I have for now put in
- the spec files for ipw2100 and hostap need some small tweaks to build
both on pre-fc2 (with 2.4) and post-fc2. It mainly consists of the
first buildrequire'ing kernel-source and kernel, and the second
buildrequiring kernel-module-devel-(ver-rel). For hostap, depending on
2.4 or 2.6, different symbol versioning files are installed
(builddir/include/linux/modules/*.ver versus builddir/*.symvers)
Currently the configure invocation is slightly different too, but this
could be fixed.
The resulting rpms are up at
and are of course built with mach.
I'd appreciate it if some other people (particularly on smp, though I
don't even know if there are people with an ipw2100 AND dual cpu's) try
them out and let me know if it works.
I'll work on some other kernel module projects as well (I've done the
qc-usb module too, but the resulting module doesn't seem to work
correctly. The original upstream build against my /lib/modules tree
doesn't work either, so I'm sure it's not my changes that break it :))
Here is a list of things I still need to decide or fix and would like to
have input on:
- the devel rpm containst the kernel's version and release as part of
the name, in accordance with fedora.us's policy for actual kernel
modules. It's not possible to have a "-" in the version number, so I
can't put kernel ver/rel in that, and I don't want to stick it in the
release tag since then it's impossible to buildrequire: it properly
since on fedora.us the resulting rpm gets a 0.fdr.2 appended to the
release tag. Is this ok ?
- the devel rpm currently stores its files in
Would it be more appropriate to put stuff in
/usr/lib/kernel-module-devel-(ver-rel) instead ?
- the devel rpm is currently set with arch i386. I've considered making
it noarch, since it contains files for more than one arch. But I assume
it's not possible anyway to easily build for x86, ppc and ia64 on the
same machine (though the -devel rpm could still be created for all of
them since it just unpacks rpms and compares files). Which of the two
would be preferable in this case ?
- the hostap rpm does the following:
- when built with --target i386, it does the build for the four
arch/type combos and packages only the devel files (symbol versions +
headers), installing them in the same dir as the kernel-module-devel
- when built with --target i586 or i686, it does only one build for
the given 'kernel' uname -r define, and removes the devel files.
This would be an argument in favour of having the -devel packages be
i386; I don't think it's possible to build a -devel rpm for ppc, x86 and
ia64 at the same time if you have to actually build the files.
- currently, .symvers files are installed in the root of the builddir,
and include files are installed in builddir/include/modules/(basename of
module). For the .symvers, I think this is an ok location. For the
headers, I'm not sure yet. Of course, this needs to be a location we
need to agree on so interdependent modules can be built correctly.
For building ipw2100, an extra include directive is given in the
Makefile.am patch that points to builddir/include/modules/hostap
Any suggestions on standardizing this or is this ok ? What would
projects like these be expected to install them to normally ?
- the module spec files could be made to work with fc2 and pre-fc2. I
normally use a check to scan /etc/fedora-release and build a conditional
based on that. Maybe it should check for the kernel version instead ?
If so, can that be done reliably without invoking rpm as part of the
check ? Is it worth it to try and integrate, or would it make more sense
to just do 2.4 and 2.6 spec files separately ?
- I cannot test the smp versions because my machine cannot boot the smp
kernel. For all 2.4 kernels this worked fine. Has it become impossible
to run smp kernels on up machines ? Does anyone know more about this ?
- Anyone know why FC2 module versioning is turned off ? AFAIK the build
setup we've come up with would take symbol versioning into account
correctly if it were turned on.
- any other suggestions/questions/objections ?
Dave/Dina : future TV today ! - http://www.davedina.org/
<-*- thomas (dot) apestaart (dot) org -*->
yes i am
a long way
<-*- thomas (at) apestaart (dot) org -*->
URGent, best radio on the net - 24/7 ! - http://urgent.fm/