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
the other problem is the these new kmod gives warning during install. ie if someone create a kickstart file which contains these kmods then anaconda warning about it: "Bad kmod package 'kmod-....' does not require a kernel" the reason for this is /usr/lib/anaconda/fedorakmod.py which has a check in resolveVersions. so hack the current find-requires.ksym to also requires at least kernel-%{arch} would be useful. at the same time write a newer short howto write kmods for centos-5. just my 2c. yours.
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-b86b6eec08d5719cf18...
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* EOF
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?
On Sat, Dec 20, 2008 at 4:08 PM, Ned Slider ned@unixmail.co.uk wrote:
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 :)
It was Johnny Hughes. (excerpt)
[Sat Jul 12 2008] [05:38:02] <NedSlider> can anyone help with a SPEC file problem please? [Sat Jul 12 2008] [05:38:15] <NedSlider> I was making a kmod module rpm... [Sat Jul 12 2008] [05:38:24] * toracat looks at hughesjr [Sat Jul 12 2008] [05:38:32] <NedSlider> and was trying to do dependencies... [Sat Jul 12 2008] [05:39:00] <NedSlider> added: Requires: package >= x.y.x [Sat Jul 12 2008] [05:39:12] <NedSlider> and it gets ignored by rpm [Sat Jul 12 2008] [05:40:00] <NedSlider> Requires: lm_sensors >= 2.10.2 [Sat Jul 12 2008] [05:44:10] <hughesjr> NedSlider: it should not be ignored [Sat Jul 12 2008] [05:44:41] <hughesjr> and that format looks OK <snip> [Sat Jul 12 2008] [05:47:53] <hughesjr> you will need to add the Require: to the script and not the SPEC [Sat Jul 12 2008] [05:48:23] <hughesjr> is it named kmodtool.sh or some such [Sat Jul 12 2008] [05:48:28] <hughesjr> let me check <snip> [Sat Jul 12 2008] [06:02:43] <hughesjr> NedSlider: if you edit the file kmodtool and add your require there it will fix the issue
Akemi / toracat
Ned Slider wrote:
My next question would be if Requires: doesn't work in a kmod SPEC file, will
BuildRequires: redhat-rpm-config
work?
Replying to my own thread after a quick investigation...
I added a fake BuildRequires (non-existent centos-rpm-config) to a kmod package spec file and tried to build it:
$ rpmbuild -ba --target=`uname -m` --define 'kversion 2.6.18-92.el5' --define 'kvariants ""' coretemp-kmod.spec Building target platforms: x86_64 Building for target x86_64 error: Failed build dependencies: centos-rpm-config is needed by coretemp-1.1-3.el5.x86_64
and it fails to build as expected, so yes, BuildRequires does work.
But when I add the same fake Requires the package builds fine but there's no sign of the fake Requires:
# rpm -Uvh --test kmod-coretemp-1.1-3.el5.x86_64.rpm Preparing... ########################################### [100%] # rpm -qp --requires kmod-coretemp-1.1-3.el5.x86_64.rpm rpmlib(VersionedDependencies) <= 3.0.3-1 /sbin/depmod /sbin/depmod lm_sensors >= 2.10.2 /bin/sh /bin/sh /bin/sh rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
It just gets ignored (but note the dependency for lm_sensors from the custom kmodtool script is there).
I have no idea why this is so.
Akemi Yagi wrote:
On Sat, Dec 20, 2008 at 4:08 PM, Ned Slider ned@unixmail.co.uk wrote:
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 :)
It was Johnny Hughes. (excerpt)
Thank you Akemi (who has logs of everything!) :)
2008/12/20 Farkas Levente lfarkas@lfarkas.org
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
Quick question. Have you considered how you proposal can be used with CentOS-4 rather than CentOS-5?
There is no C-4 /usr/lib/rpm/redhat/kmodtool -- unless I am mistaken. So to implement what you have proposed will cause a divergence of technique -- C-4 this way, C-5 that way. Not a good idea. :-(
Alan.
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-b86b6eec08d5719cf18...
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* EOF
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.
On Sun, Dec 21, 2008 at 1:10 PM, Farkas Levente lfarkas@lfarkas.org wrote:
Ned Slider wrote:
There is some information on building kABI tracking kmod packages in the BuildingKernelModules page on the Wiki:
http://wiki.centos.org/HowTos/BuildingKernelModules#head-b86b6eec08d5719cf18...
the only problem it's outdated.
It would help if you are more specific and tell us which part of it is outdated. You can see the edit history of that article here:
http://wiki.centos.org/HowTos/BuildingKernelModules?action=info
Alan has been actively and constantly working on it as you can see. So, any info/note that helps updating the content would be appreciated.
Akemi
On 21/12/2008, Alan Bartlett ajb.stxsl@googlemail.com wrote:
2008/12/20 Farkas Levente lfarkas@lfarkas.org
kmodtool shouldn't have to add to all packages rather use the /usr/lib/rpm/redhat/kmodtool from redhat-rpm-config ie:
<snip>
Quick question. Have you considered how you proposal can be used with
CentOS-4 rather than CentOS-5?
There is no C-4 /usr/lib/rpm/redhat/kmodtool -- unless I am mistaken. So to implement what you have proposed will cause a divergence of technique -- C-4 this way, C-5 that way. Not a good idea. :-(
Will you please answer my question, above -- or do you consider CentOS-4 "outdated"?
Alan.
Alan Bartlett wrote:
On 21/12/2008, *Alan Bartlett* <ajb.stxsl@googlemail.com mailto:ajb.stxsl@googlemail.com> wrote:
2008/12/20 Farkas Levente <lfarkas@lfarkas.org <mailto:lfarkas@lfarkas.org>> kmodtool shouldn't have to add to all packages rather use the /usr/lib/rpm/redhat/kmodtool from redhat-rpm-config ie:
<snip>
Quick question. Have you considered how you proposal can be used with CentOS-4 rather than CentOS-5? There is no C-4 /usr/lib/rpm/redhat/kmodtool -- unless I am mistaken. So to implement what you have proposed will cause a divergence of technique -- C-4 this way, C-5 that way. Not a good idea. :-(
Will you please answer my question, above -- or do you consider CentOS-4 "outdated"?
no actually i only has centos-5 so i can't check it. anyway the best probably would ba a centos specific kmodtool packages in extras with spec template etc. the question the main kmod packager interesting about it or not?
Akemi Yagi wrote:
On Sun, Dec 21, 2008 at 1:10 PM, Farkas Levente lfarkas@lfarkas.org wrote:
Ned Slider wrote:
There is some information on building kABI tracking kmod packages in the BuildingKernelModules page on the Wiki:
http://wiki.centos.org/HowTos/BuildingKernelModules#head-b86b6eec08d5719cf18...
the only problem it's outdated.
It would help if you are more specific and tell us which part of it is outdated. You can see the edit history of that article here:
http://wiki.centos.org/HowTos/BuildingKernelModules?action=info
Alan has been actively and constantly working on it as you can see. So, any info/note that helps updating the content would be appreciated.
the latest weak-updates spec files don't use the same template as mention on the above page. just look at the xfs kmod package. and i wouldn't like to rewire this page without the permission of the main kmod maintainers.
On Mon, Dec 22, 2008 at 2:28 PM, Farkas Levente lfarkas@lfarkas.org wrote:
Akemi Yagi wrote:
http://wiki.centos.org/HowTos/BuildingKernelModules#head-b86b6eec08d5719cf18...
the only problem it's outdated.
the latest weak-updates spec files don't use the same template as mention on the above page. just look at the xfs kmod package. and i wouldn't like to rewire this page without the permission of the main kmod maintainers.
The spec files used in CentOS-supplied kmods have never been the same as the example spec file on the Wiki. The latter is based on what is found upstream (Jon Master's) and is designed to build kABI-tracking kmods that survive kernel updates. The CentOS kmods used to be kernel version specific. This was recently changed and the latest version is now kernel independent.
With either spec file, we achieve the same goal, that is, kABI-tracking kmods. Therefore, at this point of time, I am hesitant to make changes to the example spec file on the Wiki. However, if there is a good reason to modify the spec to match the one used in the CentOS version rather than upstream's, we could do so as well. I just do not see the urgent need for that right now.
Akemi