[ATrpms-devel] Re: dev question--compiling kernel-module-lirc rpm
as normal user against a 'kernel-source' rpm
atrpms at butchwax.com
Wed May 26 00:23:48 CEST 2004
Hi, again, Axel!
I think that you might've been too busy with the FC2 stuff, and haven't
really followed what I've been saying. Let me spout it off again. ;)
I'll try to explain as clearly as possible.
1) My systems run *custom* kernels that are based on the RedHat RPMs.
How do you customize a RedHat kernel RPM? Two ways:
a) By adding or removing patches from the kernel RPM: Currently I
remove most of RedHat's patches, and apply my own.
b) By using a custom .config file: the RedHat RPM provides a
mechanism where you can define a macro called 'targetboard'; that will
use a special .config file and create a special RPM for that particular
I've been trying to get you to answer this question: Why do we need to
invent a special system for users to package custom kernels into RPMs
when RedHat has already given us a modifyable and customizable kernel
2) When you build the kernel RPM, a kernel-source RPM is also built.
It is installed into /usr/src/linux-<kernelversion>-<rpmrelease>/ and
contains *pre-configured* sources with symbol versions, etc.; it is all
ready to build working modules against, right out of the box! You can
actually install several kernel-source RPMs simultaneously; here is a
/usr/src/linux-2.4.20-8/ # stock RH9 kernel source
/usr/src/linux-2.4.20-8host108/ # stock RH9 kernel rebuilt with
# 'targetboard' set to 'host108'
/usr/src/linux-2.4.18-14/ # stock RH8.0 kernel source
You *can* use any one of these kernel-source rpms directly. You don't
need to modify Makefiles, and don't need to reconfigure for the target
kernel; they're already configured. You can install as many
kernel-source RPMs as you like; they don't conflict, and can be layed
out nicely right next to each other in /usr/src. To change a specfile
from building a module for the RH9 kernel to building one for the RH8
kernel, you only have to change the version number on one line in the
specfile. No PITA at all!
3) I haven't reinvented the wheel; I've taken two of your kernel-module
RPMs, ivtv and lirc, and modified them so that they can build *as a
normal user* against any of these installed kernel-source RPMs. They
produce proper kernel-modules with the right symbol versions that
install in the right place. In the case where you're building against a
stock RedHat kernel, two kernel-module RPMs are built: one for SMP, one
for UP. These RPMs *work*. You can download the ivtv module right now
and try it out.
Again, I'm just suggesting that you adopt this method too. I don't have
any idea what you're doing on your dev boxes, and you haven't explained,
so I'm probably missing something important here. But from the hints
I've gathered, it sounds pretty hairy, and your specfiles contain lots
of strange-looking macros that must do some interesting acrobatics to
work. My RPMs are very straightforward, easy to read, don't require any
strange macros. The only thing they require is the kernel-source RPM
from a RedHat-style (either stock or customized) kernel RPM.
Get the ivtv SRPM here. You'll see it's mostly your code in the
specfile. You really should give it a look!
> you cannot use the kernel-source rpm directly, you need to modify
> Makefiles and reconfigure for each target kernel. For kernel module
> rpm "production" you need to have kernel sources layed out for each
> flavour/arch combination. :(
> That's the real PITA. :/
> Anyway, why reinvent the wheel, when there are lirc kernel modules
> rpms already at ATrpms? If you want to support custom kernels, one
> should first support packaging these into rpms, otherwise you will be
> producing dangling kernel module rpms (i.e. no dependencies, no
> automated, reproducable builds in chroot etc.).
> BTW all ATrpms rpms are built as a non-root user.
> Axel.Thimm at ATrpms.net
More information about the atrpms-devel