Proposal to add build of kernel-backports package to kernel.spec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So, I have a little proposal for the Fedora kernel SRPM...

TL;DR -- I want to create a kernel-backports package that includes the
output of building compat-wireless against the corresponding kernel.  A
version of this package will automatically be built for every kernel
RPM built.

Why?

Hardware enablement is an endless treadmill.  As Fedora has matured,
the delta between current Fedora kernels and current upstream kernels
has tended to widen (at least for older releases e.g. F14).  This can
cause problems both for users needing cutting-edge hardware support
and for developers trying to diagnose problems in Fedora kernels that
may have already been fixed upstream.

Creating a seperate package allows both of the above situations to
be addressed while allowing "normal" users to use the base kernel
without unnecessary risk of destabilization.  Integrating the build
of that package with the kernel build ensures that every new kernel
automatically has a kernel-backports package built without need of
human intervention or creative scripting.

How does this proposal look?

I have a scratch F14 kernel build available here:

	http://koji.fedoraproject.org/koji/taskinfo?taskID=3404605

You will also need an updated module-init-tools package:

	http://koji.fedoraproject.org/koji/taskinfo?taskID=3404725

When you install the kernel-backports package, modinfo for an affected
driver (e.g. iwlagn) will show that the driver chosen by depmod will
change.  Removing kernel-backports will point you back to the version
from the base kernel.

What is in the kernel-backports package?

At present, a stable release of the compat-wireless project would be
included in the kernel-backports package:

	http://www.linuxwireless.org/en/users/Download

The compat-wireless project contains backports of sources from current
upstream kernels.  These are not out-of-tree drivers in the traditional
sense.  These drivers are in-tree -- just a later version of the tree.
As such, the compat-wireless sources follow the same license as the
upstream Linux kernel (i.e. GPLv2).

The compat-* project is expected/intended to expand to include wired
networking drivers and more in the future.  As that happens, those new
compat-* drivers will be included in the kernel-backports package as
well.

Isn't this just a big kmod package?

No, or at least not exactly.  Existing kmod package standards require a
separate kmod build for every kernel build.  Most (or all?) of them
require complex versioning to distinquish between versions of the kmod
package and versions of the target kernel.  They are a nightmare to
maintain.  Worse, they require multiple kmod packages for multiple drivers,
multiplying the maintenance burden.

This proposal minimizes the maintenance required while maximizing the
coverage of driver upates.  A single compat-wireless package update will
suffice to update a full suite of drivers all at once.

Isn't this too "bleeding edge" for non-rawhide Fedora?

Perhaps so, at least for many people.  That is the advantage of having a
separate kernel-backports package.  Those that don't want to use the
cutting-edge hardware support will simply not install the package.
Those who want or need that support will have it easily available.

Why not just use Rawhide?

Rawhide might have even more "bleeding" edge hardware support than the
kernel-backports package would get.  Plus, Rawhide kernels will have
less mature core kernel changes as well.  Keeping a stable release
kernel with a kernel-backports package offers an intermediate step
towards cutting-edge hardware support while maintaining a stable core
kernel.

Who will maintain it?

For now, I will.  When I am old and gone, my successor will only have
to update the compat-wireless bits once per upstream kernel release
and perhaps add a few Fedora-specific compat-wireless patches as
things are backported to the Fedora base kernel that conflict with
the compat layer in compat-wireless.

Can we turn it off easily?

Yes.  The spec file changes are all bracketed by a "with_backports"
symbol already.  In fact, with_backports will have to be turned-off
in Rawhide and in any other Fedora releases where the kernel version
is the same or newer than the latest compat-wireless stable release.

What do the changes look like?

I'll paste the kernel.spec file changes for F14 below.  I'll attach the
required module-init-tools.spec file patch to this email for reference
as well.

Conclusion

So, there is my proposal.  What are the objections?

Once any major objections are addressed, I'll pursue any required Fedora
project management items required (e.g. a Feature page).

John

---

diff --git a/kernel.spec b/kernel.spec
index cc12bce..b96c348 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -25,6 +25,7 @@ Summary: The Linux kernel
 #
 # % define buildid .local
 ###################################################################
+%define buildid .1.compat
 
 # The buildid can also be specified on the rpmbuild command line
 # by adding --define="buildid .whatever". If both the specfile and
@@ -147,6 +148,10 @@ Summary: The Linux kernel
 # should we do C=1 builds with sparse
 %define with_sparse	%{?_with_sparse:      1} %{?!_with_sparse:      0}
 
+# Include driver backports (e.g. compat-wireless) in the kernel build.
+# This builds a separate kernel-backports package.
+%define with_backports %{?_with_backports:    1} %{?!_with_backports:    0}
+
 # Set debugbuildsenabled to 1 for production (build separate debug kernels)
 #  and 0 for rawhide (all kernels are debug kernels).
 # See also 'make debug' and 'make release'.
@@ -531,6 +536,9 @@ BuildRequires: rpm-build >= 4.4.2.1-4
 %endif
 
 Source0: ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-%{kversion}.tar.bz2
+%if %{with_backports}
+Source1: compat-wireless-3.0-2.tar.bz2
+%endif
 
 Source11: genkey
 Source14: find-provides
@@ -864,6 +872,10 @@ Patch14050: x86-PCI-don-t-use-native-Broadcom-CNB20LE-driver-whe.patch
 # RHBZ #648571
 Patch14051: modules-Fix-module_bug_list-list-corruption-race.patch
 
+%if %{with_backports}
+Patch20000: compat-wireless-vzalloc.patch
+%endif
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1042,6 +1054,37 @@ It should only be installed when trying to gather additional information
 on kernel bugs, as some of these options impact performance noticably.
 
 
+%if %{with_backports}
+
+#
+# This macro creates a kernel-backports-<subpackage>.
+#	%%kernel_variant_backports_package <condition> <subpackage>
+#
+%define kernel_variant_backports_package() \
+%if %{1}\
+%package %{?2:%{2}-}backports\
+Summary: Drivers backported from later versions of the Linux kernel\
+Group: System Environment/Kernel\
+License: GPLv2\
+Requires: kernel = %{rpmversion}-%{pkg_release}\
+Requires(post): module-init-tools >= 3.11.1-6.1.compat\
+%description %{?2:%{2}-}backports\
+This package provies pre-compiled drivers backported from later versions\
+of the Linux kernel.  This package contains drivers from the upstream\
+Linux kernel exclusively.  Out-of-tree drivers are not provided.\
+This version matches the kernel%{?2:-%{2}} package.\
+%{nil}\
+%endif
+
+%kernel_variant_backports_package %{with_up}
+%kernel_variant_backports_package %{with_smp} smp
+%kernel_variant_backports_package %{with_debug} debug
+%kernel_variant_backports_package %{with_pae} PAE
+%kernel_variant_backports_package %{with_pae_debug} PAEdebug
+
+%endif
+
+
 %prep
 # do a few sanity-checks for --with *only builds
 %if %{with_baseonly}
@@ -1670,6 +1713,16 @@ find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null
 
 cd ..
 
+%if %{with_backports}
+
+# Extract the compat-wireless bits
+%setup -q -n kernel-%{kversion}%{?dist} -T -D -a 1
+
+cd compat-wireless-3.0-2
+%patch20000 -p1
+
+%endif
+
 ###
 ### build
 ###
@@ -1787,6 +1840,9 @@ BuildKernel() {
     # dirs for additional modules per module-init-tools, kbuild/modules.txt
     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/extra
     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/updates
+%if %{with_backports}
+    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/backports
+%endif
     # first copy everything
     cp --parents `find  -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
     cp Module.symvers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
@@ -1886,6 +1942,23 @@ BuildKernel() {
     mkdir -p $RPM_BUILD_ROOT/usr/src/kernels
     mv $RPM_BUILD_ROOT/lib/modules/$KernelVer/build $RPM_BUILD_ROOT/$DevelDir
     ln -sf ../../..$DevelDir $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
+
+%if %{with_backports}
+
+    cd ../compat-wireless-3.0-2/
+    make clean
+
+    make KLIB_BUILD=../linux-%{kversion}.%{_target_cpu} \
+	KMODPATH_ARG="INSTALL_MOD_PATH=$RPM_BUILD_ROOT" \
+	KMODDIR="backports" install-modules
+
+    # mark modules executable so that strip-to-file can strip them
+    find $RPM_BUILD_ROOT/lib/modules/$KernelVer/backports -name "*.ko" \
+	-type f | xargs --no-run-if-empty chmod u+x
+
+    cd -
+
+%endif
 }
 
 ###
@@ -2103,6 +2176,54 @@ fi}\
 %kernel_variant_post -v PAEdebug -r (kernel|kernel-smp)
 %kernel_variant_preun PAEdebug
 
+%if %{with_backports}
+
+#
+# This macro defines a depmod operation for install/remove of backports.
+#	%%kernel_variant_backports_depmod [-v <subpackage>]
+#
+%define kernel_variant_backports_depmod(v:) \
+%{expand:\
+/sbin/depmod -ae -F /boot/System.map-%{KVERREL}%{?-v:.%{-v*}} || exit $?\
+}\
+%{nil}
+
+#
+# This macro defines a %%post script for a kernel backports package.
+#	%%kernel_variant_backports_post <condition> <subpackage>
+#
+%define kernel_variant_backports_post() \
+%if %{1}\
+%{expand:%%post %{?2:%{2}-}backports}\
+%{expand:%%kernel_variant_backports_depmod %{?2:-v %{2}}}\
+%endif\
+%{nil}
+
+#
+# This macro defines a %%postun script for a kernel backports package.
+#	%%kernel_variant_backports_postun <condition> <subpackage>
+#
+%define kernel_variant_backports_postun() \
+%if %{1}\
+%{expand:%%postun %{?2:%{2}-}backports}\
+%{expand:%%kernel_variant_backports_depmod %{?2:-v %{2}}}\
+%endif\
+%{nil}
+
+%kernel_variant_backports_post %{with_up}
+%kernel_variant_backports_post %{with_smp} smp
+%kernel_variant_backports_post %{with_debug} debug
+%kernel_variant_backports_post %{with_pae} PAE
+%kernel_variant_backports_post %{with_pae_debug} PAEdebug
+
+%kernel_variant_backports_postun %{with_up}
+%kernel_variant_backports_postun %{with_smp} smp
+%kernel_variant_backports_postun %{with_debug} debug
+%kernel_variant_backports_postun %{with_pae} PAE
+%kernel_variant_backports_postun %{with_pae_debug} PAEdebug
+
+%endif
+
 if [ -x /sbin/ldconfig ]
 then
     /sbin/ldconfig -X || exit $?
@@ -2209,10 +2330,39 @@ fi
 %kernel_variant_files %{with_pae} PAE
 %kernel_variant_files %{with_pae_debug} PAEdebug
 
+
+%if %{with_backports}
+
+#
+# This macro defines the %%files sections for a kernel-backports
+# package.
+#	%%kernel_variant_backports_files <condition> <subpackage>
+#
+%define kernel_variant_backports_files() \
+%if %{1}\
+%{expand:%%files %{?2:%{2}-}backports}\
+%defattr(-,root,root)\
+/lib/modules/%{KVERREL}%{?2:.%{2}}/backports\
+%endif\
+%{nil}
+
+%kernel_variant_backports_files %{with_up}
+%kernel_variant_backports_files %{with_smp} smp
+%kernel_variant_backports_files %{with_debug} debug
+%kernel_variant_backports_files %{with_pae} PAE
+%kernel_variant_backports_files %{with_pae_debug} PAEdebug
+
+%endif
+
+
 # plz don't put in a version string unless you're going to tag
 # and build.
 
 %changelog
+* Tue Oct  4 2011 John W. Linville <linville@xxxxxxxxxx>
+- Add infrastructure for kernel-backports package
+- Include compat-wireless project in package above
+
 * Mon Sep 12 2011 Josh Boyer <jwboyer@xxxxxxxxxx>
 - Backport 5336377d to fix RHBZ #648571
 
-- 
John W. Linville		The water won't run clean until you get
linville@xxxxxxxxxx			the pigs out of the creek.
diff --git a/depmod-dist.conf b/depmod-dist.conf
index 8513288..0585676 100644
--- a/depmod-dist.conf
+++ b/depmod-dist.conf
@@ -3,4 +3,4 @@
 #
 
 # override default search ordering for kmod packaging
-search updates extra built-in weak-updates
+search updates extra backports built-in weak-updates
diff --git a/module-init-tools.spec b/module-init-tools.spec
index 50732c1..17b5fab 100644
--- a/module-init-tools.spec
+++ b/module-init-tools.spec
@@ -2,7 +2,7 @@ Summary: Kernel module management utilities.
 Name: module-init-tools
 Version: 3.11.1
 #define PreRelease
-Release: 6%{?dist}
+Release: 6.1.compat%{?dist}
 License: GPLv2+
 Group: System Environment/Kernel
 #Source: http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/module-init-tools-%{version}%{PreRelease}.tar.bz2
@@ -94,6 +94,9 @@ fi
 %ghost %config(noreplace) %verify(not md5 size mtime) /etc/modprobe.d/local.conf
 
 %changelog
+* Tue Oct  4 2011 John W. Linville <linville@xxxxxxxxxx> - 3.11.1-6.1.compat
+- Add "backports" directory to search line in depmod-dist.conf
+
 * Tue May 31 2011 Jon Masters <jcm@xxxxxxxxxxxxxx> - 3.11.1-6
 - Add patch supporting kernel x.y versions in depmod.
 - Update autotools bits to newer build versions.
_______________________________________________
kernel mailing list
kernel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/kernel

[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux