I recently worked on getting an akmod package for RHEL5 for my work to
actually be useful. I know that there has been interest in getting
akmod for RHEL so I thought I would share what I had to do.
- akmods
For the akmods package I had to modify the actually akmods script to
work. This is mostly a hack but it at least builds an rpm with there
is no kmod package installed at all. It changes the value of kmodver
and akmodver to be compatible with the version of rpmdev-vercmp
provided in rhel5.3 (rpmdevtools-5.3-1.el5). Additionally it requires
only /lib/modules/<kernel version>/build/Makefile instead of requiring
both /usr/src/kernels/<kernel version>/Makefile and
/lib/modules/<kernel version>/build/Makefile. This is because (at
least on my systems), uname -r provides 2.6.18-128.1.10.el5 where as
the directories in /usr/src/kernels all include the arch. Perhaps a
better fix is to just include the arch? Not sure.
- buildsys-build-rpmfusion
I only had to change this package a little bit. I changed the name to
reflect our local repo and I updated the numbers to be for RHEL5.
- kmodtool
I tried modifying kmodtool to force kernel-headers and kernel-devel to
be required when building a kmod package but I failed miserably so now
I just include those as BuildRequires in the spec file.
I haven't had a change to test any of these changes heavily and I'll
be out of town for a few weeks but I wanted to post this to the list
to try and help anyone else who might be interested. I would love to
see this maintained and made better. I look forward to
questions/comments. You'll find the akmods patch attached.
-josh
--- akmods 2009-05-19 13:46:13.000000000 -0400
+++ /usr/sbin/akmods 2009-05-19 13:52:23.000000000 -0400
@@ -313,21 +313,23 @@ check_kmod_up2date()
akmods_echo 1 2 -n "Warning: Could not determine what package owns /lib/modules/${this_kernelver}/extra/${this_kmodname}/"
return 0
fi
- local kmodver=$(rpm -q --qf '%{EPOCH}:%{VERSION}-%{RELEASE}\n' "${kmodpackage}" | sed 's|(none)|0|; s!\.\(fc\|lvn\)[0-9]*!!g')
- local akmodver=$(rpm -qp --qf '%{EPOCH}:%{VERSION}-%{RELEASE}\n' /usr/src/akmods/"${this_kmodname}"-kmod.latest | sed 's|(none)|0|; s!\.\(fc\|lvn\)[0-9]*!!g')
+ local kmodver=$(rpm -q --qf '%{EPOCH} %{VERSION} %{RELEASE}\n' "${kmodpackage}" | sed 's|(none)|0|; s!\.\(fc\|lvn\)[0-9]*!!g')
+ local kmodver2=$(rpm -q --qf '%{EPOCH}:%{VERSION}-%{RELEASE}\n' "${kmodpackage}" | sed 's|(none)|0|; s!\.\(fc\|lvn\)[0-9]*!!g')
+ local akmodver=$(rpm -qp --qf '%{EPOCH} %{VERSION} %{RELEASE}\n' /usr/src/akmods/"${this_kmodname}"-kmod.latest | sed 's|(none)|0|; s!\.\(fc\|lvn\)[0-9]*!!g')
+ local akmodver2=$(rpm -qp --qf '%{EPOCH}:%{VERSION}-%{RELEASE}\n' /usr/src/akmods/"${this_kmodname}"-kmod.latest | sed 's|(none)|0|; s!\.\(fc\|lvn\)[0-9]*!!g')
# are they equal?
if [[ "${kmodver}" == "${akmodver}" ]]; then
return 0
fi
- local newestpkgver=$(rpmdev-vercmp "${kmodver}" "${akmodver}" 2>/dev/null | awk '{print $1}')
+ local newestpkgver=$(rpmdev-vercmp ${kmodver} ${akmodver} 2>/dev/null | awk '{print $1}')
if [[ ! "${kmodver}" ]] || [[ ! "${akmodver}" ]] || [[ ! "${newestpkgver}" ]] ; then
# seems we didn't get what we wanted
# well, better to do nothing in this case
akmods_echo 1 2 -n "Warning: Could not determine if akmod is newer then the installed kmod"
return 0
- elif [[ "${akmodver}" == "${newestpkgver}" ]] ; then
+ elif [[ "${akmodver2}" == "${newestpkgver}" ]] ; then
# build it
return 1
else
@@ -359,7 +361,7 @@ check_kmods()
if [[ "${continue_line}" ]]; then
akmods_echo 1 2 --warning
# if the files for building modules are not avilable don't even try to build modules
- if [[ ! -r /usr/src/kernels/"${this_kernelver}"/Makefile ]] || [[ ! -r /lib/modules/${this_kernelver}/build/Makefile ]]; then
+ if [[ ! -r /lib/modules/${this_kernelver}/build/Makefile ]]; then
akmods_echo 1 2 "Files needed for building modules against kernel"
akmods_echo 1 2 "${this_kernelver} could not be found as the following"
akmods_echo 1 2 "directories are missing:"