kernel build hacks for vanilla builds

Roland McGrath roland at redhat.com
Thu Mar 29 10:24:22 UTC 2007


This is enough for "make vanilla-scratch-build" to work (or vanilla-i686,
vanilla-compile, etc).  It might even be enough for "make vanilla-tag
vanilla-build", but I'd have to check it in to test that kludge.

Attached below is my linux-2.6.17-nonintconfig.patch, my old replacement
for linux-2.6-build-nonintconfig.patch (that didn't even need any
rediffing).  It adds a second option "make loose_nonintconfig".  IIRC, this
is necessary when upstream adds config options not yet in our config-*
files, so you get defconfig answers for new things instead of errors.  This
probably doesn't come up with rawhide vanilla builds since those are only
"downgrades", but it can come up when trying builds from GIT branches for
experimental new things, and I found it much nicer to have defconfig win
for this instead of hand-tweak config-foo in my otherwise pristine checkout.

For doing builds from GIT branches, there's some more makefile magic and a
little script to be dusted off.  If you like this stuff, I'll check it in
and then fiddle some more for the GIT variant.


Thanks,
Roland



Index: Makefile
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/Makefile,v
retrieving revision 1.45
diff -u -r1.45 Makefile
--- Makefile	19 Mar 2007 21:32:30 -0000	1.45
+++ Makefile	29 Mar 2007 10:03:08 -0000
@@ -68,3 +68,25 @@
 
 # since i386 isn't a target...
 compile compile-short: DIST_DEFINES += --target $(shell uname -m)
+
+
+vanilla-%: $(SPECFILE:.spec=-vanilla.spec)
+	@$(MAKE) $* SPECFILE=$<
+
+$(SPECFILE:.spec=-vanilla.spec): $(SPECFILE)
+	@rm -f $@
+	(echo %define nopatches 1; cat $<) > $@
+
+scratch-build: test-srpm
+	$(BUILD_CLIENT) $(BUILD_FLAGS) --scratch $(COLLECTION) \
+			$(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm
+
+ifdef BEEHIVE_SRPM_BUILD
+export CHECKOUT_TAG ?= $(shell sed s/^.// CVS/Tag)
+tag-pattern = $(TAG_NAME)-$(TAG_VERSION)-0_%_$(TAG_RELEASE)
+ifeq (,$(filter-out $(tag-pattern),$(CHECKOUT_TAG)))
+variant := $(patsubst $(tag-pattern),%,$(CHECKOUT_TAG))
+srpm: SPECFILE := $(SPECFILE:.spec=-$(variant).spec)
+srpm beehive-sprm: RELEASE := 0.$(variant).$(RELEASE)
+endif
+endif
Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.3025
diff -u -r1.3025 kernel-2.6.spec
--- kernel-2.6.spec	29 Mar 2007 00:00:55 -0000	1.3025
+++ kernel-2.6.spec	29 Mar 2007 10:03:09 -0000
@@ -32,7 +32,8 @@
 %define sublevel 20
 %define kversion 2.6.%{sublevel}
 %define rpmversion 2.6.%{sublevel}
-%define release %(R="$Revision: 1.3025 $"; RR="${R##: }"; echo ${RR%%?})%{?dist}
+%define specrelease %(R="$Revision: 1.3025 $"; RR="${R##: }"; echo ${RR%%?})%{?dist}
+%define release %{specrelease}
 
 %define make_target bzImage
 %define kernel_image x86
@@ -45,6 +46,28 @@
 %define KVERREL %{PACKAGE_VERSION}-%{PACKAGE_RELEASE}
 %define hdrarch %_target_cpu
 
+%if 0%{!?nopatches:1}
+%define nopatches 0
+%endif
+
+%if %{nopatches}
+%define includexen 0
+%else
+%define relsuffix .fedora
+%endif
+
+%define using_upstream_branch 0
+%if 0%{?upstream_branch:1}
+%define using_upstream_branch 1
+%define release 0.%{upstream_branch}%{?relsuffix}.%{specrelease}
+%define buildxen 0
+%define buildxenPAE 0
+%else
+%if %{nopatches}
+%define release 0.vanilla.%{specrelease}
+%endif
+%endif
+
 # groups of related archs
 #OLPC stuff
 %if 0%{?olpc}
@@ -169,6 +192,15 @@
 %define xen_image vmlinux.gz
 %endif
 
+%if %{nopatches}
+%define signmodules 0
+# Ignore unknown options in our config-* files.
+# Some options go with patches we're not applying.
+%define oldconfig_target loose_nonint_oldconfig
+%else
+%define oldconfig_target nonint_oldconfig
+%endif
+
 # To temporarily exclude an architecture from being built, add it to
 # %nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we
 # don't build kernel-headers then the new build system will no longer let
@@ -304,9 +336,17 @@
 #
 # Patches 0 through 100 are meant for core subsystem upgrades
 #
+
+%if %{using_upstream_branch}
+### BRANCH PATCH ###
+%else
 Patch1: patch-2.6.21-rc5.bz2
+%endif
+
 Patch3: git-geode.patch
 
+%if !%{nopatches}
+
 # Patches 10 through 99 are for things that are going upstream really soon.
 Patch10: linux-2.6-utrace.patch
 Patch11: nouveau-drm.patch
@@ -360,7 +400,9 @@
 # Patches 800 through 899 are reserved for bugfixes to the core system
 # and patches related to how RPMs are build
 #
-Patch800: linux-2.6-build-nonintconfig.patch
+%endif
+Patch800: linux-2.6.17-nonintconfig.patch
+%if !%{nopatches}
 
 # Exec-shield.
 Patch810: linux-2.6-execshield.patch
@@ -495,6 +537,7 @@
 Patch20002: xen-dom0-reboot.patch
 
 # END OF PATCH DEFINITIONS
+%endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root-%{_target_cpu}
 
@@ -867,9 +910,16 @@
 
 cd linux-%{kversion}.%{_target_cpu}
 
+%if %{using_upstream_branch}
+### BRANCH APPLY ###
+%else
+
 # Update to latest upstream.
 %patch1 -p1
 
+%endif
+%if !%{nopatches}
+
 # Patches 10 through 100 are meant for core subsystem upgrades
 
 # Roland's utrace ptrace replacement.
@@ -945,13 +995,14 @@
 # Patches 800 through 899 are reserved for bugfixes to the core system
 # and patches related to how RPMs are build
 #
-
+%endif
 
 # This patch adds a "make nonint_oldconfig" which is non-interactive and
 # also gives a list of missing options at the end. Useful for automated
 # builds (as used in the buildsystem).
 %patch800 -p1
 
+%if !%{nopatches}
 # Exec shield
 %patch810 -p1
 
@@ -1171,6 +1222,7 @@
 %patch10001 -p1
 
 # END OF PATCH APPLICATIONS
+%endif
 
 cp %{SOURCE10} Documentation/
 
@@ -1201,7 +1253,7 @@
 do
   mv $i .config
   Arch=`head -1 .config | cut -b 3-`
-  make ARCH=$Arch nonint_oldconfig > /dev/null
+  make ARCH=$Arch %{oldconfig_target} > /dev/null
   echo "# $Arch" > configs/$i
   cat .config >> configs/$i
 done
@@ -1295,7 +1347,7 @@
        KernelImage=arch/$Arch/boot/bzImage
     fi
 
-    make -s ARCH=$Arch nonint_oldconfig > /dev/null
+    make -s ARCH=$Arch %{oldconfig_target} > /dev/null
     make -s ARCH=$Arch %{?_smp_mflags} $MakeTarget %{?sparse_mflags}
     make -s ARCH=$Arch %{?_smp_mflags} modules %{?sparse_mflags} || exit 1
 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: linux-2.6.17-nonintconfig.patch
URL: <http://listman.redhat.com/archives/fedora-kernel-list/attachments/20070329/dbe2e333/attachment.ksh>


More information about the Fedora-kernel-list mailing list