[CentOS-devel] kmod packaging guideline

Sun Dec 21 21:10:31 UTC 2008
Farkas Levente <lfarkas at lfarkas.org>

Ned Slider wrote:
> Farkas Levente wrote:
>> hi,
>> it'd be nice to write some kind of docs about how to write kmod packages
>> for centos. as i wrote in one of my earlier post there are two problems
>> currently with the weak-updates kmods:
>> kmodtool shouldn't have to add to all packages rather use the
>> /usr/lib/rpm/redhat/kmodtool from redhat-rpm-config ie:
>> ----------------------------------------------
>> @@ -1,7 +1,6 @@
>> -Source10: kmodtool
>>  Source11: find-requires
>>  Source12: find-requires.ksyms
>> -%define   kmodtool bash %{SOURCE10}
>> +%define   kmodtool bash /usr/lib/rpm/redhat/kmodtool
>> ----------------------------------------------
>> and add:
>> BuildRequires:	redhat-rpm-config
> Hi Farkas,
> There is some information on building kABI tracking kmod packages in the 
> BuildingKernelModules page on the Wiki:
> http://wiki.centos.org/HowTos/BuildingKernelModules#head-b86b6eec08d5719cf1838929f26a64af88e2b7f0

the only problem it's outdated.

> Unless I misunderstand your proposal above, one reason I have found for 
> including a custom kmodtool-foo source script with your kmod is for 
> satisfying Requires. For example, putting:
> Requires: foo-bar >= 1.2.3
> in the SPEC file for a kmod doesn't work. The Require needs to be added 
> to the kmodtool script:
> Requires(post): /sbin/depmod
> Requires(postun): /sbin/depmod
> *Requires: foo-bar >= 1.2.3*

no it can be use with both kmodtool (redhat and included), the problem
comes from the weak-updates style of kmod and the:
%global _use_internal_dependency_generator 0
anyway it's another problem how to solve.

> I came across this problem building some kmods that required a later 
> version of lm_sensors. An example can be seen in this kmod package for 
> the coretemp module:
> http://www.pperry.f2s.com/linux/coretemp/
> I'll admit I'm not an expert kmod packager, but placing the Requires in 
> the kmodtool script was the only solution I found (actually either 
> Johnny or Karanbir suggested it on IRC IIRC). In my case kmodtool-foo 
> was simply a copy of /usr/lib/rpm/redhat/kmodtool with the necessary 
> Requires added. If there's a simpler or more elegant solution then 
> please do enlighten me :)
> My next question would be if Requires: doesn't work in a kmod SPEC file, 
> will
> BuildRequires:	redhat-rpm-config
> work?

i hope so.

  Levente                               "Si vis pacem para bellum!"