+#
+# $Id$
+#
+%define url $URL$
+
Summary: The Linux kernel (the core of the Linux operating system)
# What parts do we want to build? We must build at least one kernel.
# Versions of various parts
+# for module-tag.py - sublevel is used for the version (middle) part of tag names
+%define name linux-2.6
+%define module_version_varname sublevel
+%define taglevel 1
+
#
# Polite request for people who spin their own kernel rpms:
# please modify the "release" field in a way that identifies
# updated every time the PL kernel is updated.
%define vini_pl_patch 561
-%define specrelease 1
-
-%define release vs%{vsversion}.%{specrelease}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
+%define release vs%{vsversion}.%{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
%{!?pldistro:%global pldistro planetlab}
#
%define kernel_prereq fileutils, module-init-tools, initscripts >= 5.83, mkinitrd >= 3.5.5
-URL: http://svn.planet-lab.org/wiki/linux-2.6
+Vendor: PlanetLab
+Packager: PlanetLab Central <support@planet-lab.org>
+Distribution: PlanetLab %{plrelease}
+URL: %(echo %{url} | cut -d ' ' -f 2)
Name: kernel
Group: System Environment/Kernel
# Linux-VServer
Patch200: patch-%{rpmversion}-vs%{vsversion}.diff
+Patch210: linux-2.6-210-vserver-cpu-sched.patch
# IP sets
Patch250: linux-2.6-250-ipsets.patch
Patch560: linux-2.6-560-mmconf.patch
Patch570: linux-2.6-570-tagxid.patch
+# See also the file named 'sources' here for the related checksums
+# NOTE. iwlwifi should be in-kernel starting from 2.6.24
+# see http://bughost.org/bugzilla/show_bug.cgi?id=1584
+%define mac80211_version 10.0.4
+Patch600: http://intellinuxwireless.org/mac80211/downloads/mac80211-%{mac80211_version}.tgz
+%define iwlwifi_version 1.2.23
+Patch601: http://intellinuxwireless.org/iwlwifi/downloads/iwlwifi-%{iwlwifi_version}.tgz
+
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
%description
KERNEL_PREVIOUS=linux-%{kversion}-%1
# This is where the patches get applied
-%if "0%{patchlevel}"
+%if 0%{?patchlevel}
%ApplyPatch 0
%endif
%ApplyPatch 100
%ApplyPatch 200
+%ApplyPatch 210
%ApplyPatch 250
%ApplyPatch %vini_pl_patch
%endif
+# Run the mac80211 stuff in the kernel tree holding the last patch
+tar -xzf %{PATCH600}
+pushd mac80211-%{mac80211_version}
+mac80211_makeflags="KSRC=../$KERNEL_PREVIOUS"
+make $mac80211_makeflags modified
+make $mac80211_makeflags source
+make $mac80211_makeflags patch_kernel
+popd
+
+# Untar iwlwifi in the same place - needs to be compiled later
+tar -xzf %{PATCH601}
+# the install target is broken: first it does not pass the right -b flag to depmod
+# second we do not need to invoke depmod at this stage anyway
+# let's add our own patch/stuff in this Makefile for manual install later on
+pushd iwlwifi-%{iwlwifi_version}
+cat >> Makefile <<EOF
+module-list:
+ @echo \$(addprefix \$(DIR),\$(addsuffix .ko,\$(list-m)))
+EOF
+popd
+
rm -fr linux-%{kversion}
ln -sf $KERNEL_PREVIOUS linux-%{kversion}
cd linux-%{kversion}
make -s ARCH=$Arch %{?_smp_mflags} $MakeTarget
make -s ARCH=$Arch %{?_smp_mflags} modules || exit 1
+ # build the iwlwifi driver
+ make -C %{_builddir}/kernel-%{kversion}/iwlwifi-%{iwlwifi_version} ARCH=$Arch \
+ KSRC=%{_builddir}/kernel-%{kversion}/linux-%{_target_cpu}-%{kversion}$Flavour
+
# Start installing the results
%if "%{_enable_debug_packages}" == "1"
mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer
+ # install iwlwifi
+# make -C %{_builddir}/kernel-%{kversion}/iwlwifi-%{iwlwifi_version} ARCH=$Arch \
+# KSRC=%{_builddir}/kernel-%{kversion}/linux-%{_target_cpu}-%{kversion}$Flavour \
+# KMISC=$RPM_BUILD_ROOT/lib/modules/$KernelVer/kernel/drivers/net/wireless install
+ pushd %{_builddir}/kernel-%{kversion}/iwlwifi-%{iwlwifi_version}
+ iwlwifi_dest=$RPM_BUILD_ROOT/lib/modules/$KernelVer/kernel/drivers/net/wireless
+ # get the list and location of modules to install - no need to pass KSRC nor anything, let's keep it simple
+ iwlwifi_modules=$(make --no-print-directory module-list)
+ install -d $iwlwifi_dest
+ install -m 644 -c $iwlwifi_modules $iwlwifi_dest
+ popd
+
# And save the headers/makefiles etc for building modules against
#
# This all looks scary, but the end result is supposed to be: