[Yum] Building kernel modules (was: kernel module distribution via yum?)

Axel Thimm Axel.Thimm at physik.fu-berlin.de
Wed Jul 16 20:02:38 UTC 2003


Hi,

this is not really yum related, but fun nonetheless. ;)
(Cced rpm-list at redhat.com)

On Wed, Jul 16, 2003 at 11:35:48AM -0700, Lars Damerow wrote:
> We're trying to find a way to distribute kernel modules using
> yum. It's trivial if all of the machines syncing to the repository
> run the same kernel, but that's not true in our case.
> 
> We could build single RPM that contains copies of the module built
> for each of our kernels, but that could get pretty ugly. We'd have
> to manually build the module on each kernel and then move the
> resulting .o file into our RPM by hand.

No, that would be bad indeed. Especially because that single package
would depend on all the kernel flavour/arch combinations, so
installing it would require installing the correspondig kernels. You
could of course drop the dependencies, but this is ugly.

> What we'd like to do is have one SRPM that we'd rebuild on each kernel,
> resulting in an RPM specifically versioned for that kernel. We'd put all of
> those RPMs into our yum repository. Then, when a client updates, it'd only
> install the RPM for its kernel.
> 
> Is there some requires/provides magic we can use to get this behavior, or any
> better approaches for the same result?

No that's the right way to go, but there are still nasty pitfalls. Say
you have

foo-1.2.3-4.src.rpm

and want to support

kernel-smp-2.4.20-13.9.i386.rpm and kernel-2.4.20-18.9.2atrpms.athlon.rpm 
to name two examples.

You may end up with [1]

foo-1.2.3-4.i386.rpm
foo-kmdl-2.4.20-smp-13.9-1.2.3-4.i386.rpm
foo-kmdl-2.4.20-19.9.2atrpms-1.2.3-4.athlon.rpm

You can now let foo-1.2.3-4.i386.rpm
Requires: foo-kmdl = 1.2.3-4 (note it is kernel verrel independent)

And let the other two
Provides: foo-kmdl = 1.2.3-4

Therefore yum install foo or apt-get install foo should know that one
of the two need to be installed. Now you can make these depend on the
correspondig kernels and ready you are.

So far the theory ;)
In real life you have the following two problems:

a) There is a dependency bug in rpm which makes all kernels match if
   only the version part match (ignoring the revision). Tehrefore
   Requires: kernel = 2.4.20-13.9
   is also satisfied by any other kernel-2.4.20-XXX
   I don't what triggers this bug. I reviewed the rpm code and found
   no explicit behaviour based on kernel rpms. Maybe the bug is
   triggered with all packages simultaneously installed with different
   versions/releases.

b) People usually have mor ethan one kernel around (due to upgrades,
   testing etc.). In that case multiple solutions are possible for
   yum/apt and only one is picked (usually according to Murphy the
   wrong one).

[1] This is not standardized, there exist variants like
    kernel-module-foo-1.2.3-4_2.4.20-19.9.2atrpms.athlon.rpm or
    foo-kernel-1.2.3-4_2.4.20-19.9.2atrpms.athlon.rpm
    which contain the kernel version/release data in the packages
    release tag instead of the name tag. Mechanics work differently
    then, as the different kernel modules are not considered distinct
    packages, but the same with different versioning, making automatic
    upgrading impossible.
-- 
Axel.Thimm at physik.fu-berlin.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.baseurl.org/pipermail/yum/attachments/20030716/23d798f0/attachment-0001.pgp 


More information about the Yum mailing list