r3223 - branches/kernel-image-2.6.11

Jurij Smakov jurij-guest@costa.debian.org
Mon, 23 May 2005 14:02:07 +0000


Author: jurij-guest
Date: 2005-05-23 14:02:07 +0000 (Mon, 23 May 2005)
New Revision: 3223

Modified:
   branches/kernel-image-2.6.11/Makefile
   branches/kernel-image-2.6.11/README
Log:
Implemented a nicer way to handle prefixing
of a make-kpkg call with blah32 for 32-bit flavours.


Modified: branches/kernel-image-2.6.11/Makefile
===================================================================
--- branches/kernel-image-2.6.11/Makefile	2005-05-23 11:42:29 UTC (rev 3222)
+++ branches/kernel-image-2.6.11/Makefile	2005-05-23 14:02:07 UTC (rev 3223)
@@ -41,7 +41,6 @@
 ifndef flavours
   flavours := $(patsubst config.%,%,$(configs))
 endif
-build_prefix := build-$(subarch)-
 
 -include $(basedir)/Makefile.inc
 
@@ -68,9 +67,16 @@
 ifdef build_makeflags
   kpkg_build_cmd := MAKEFLAGS=$(build_makeflags) $(kpkg_build_cmd)
 endif
-kpkg_image_cmd  := $(image_prefix) $(kpkg_build_cmd) --initrd kernel_image
-kpkg_image_cmd  := $(strip $(kpkg_image_cmd))
-kpkg_build_cmd  += build
+#
+# Note that next variable (kpkg_image_pre) is not going to be evaluated
+# immediately. When referenced, the variable $* will have the current
+# flavour for which the command is executed. So if this flavour will
+# happen to be in the image_prefix_flavours list, the call to make-kpkg
+# will be prepended with contents if image_prefix.
+#
+kpkg_image_pre = $(if $(filter $*,$(image_prefix_flavours)),$(image_prefix))
+kpkg_image_cmd := $(kpkg_build_cmd) --initrd kernel_image
+kpkg_build_cmd += build
 kpkg_headers_cmd += kernel-headers
 ifndef headers_dirs
   headers_dirs = $(karch)
@@ -104,7 +110,8 @@
 
 install-stamp-$(subarch)-%: build-$(subarch)-% build-stamp-$(subarch)-%
 	cp -al $< install-$*;
-	cd install-$*; $(subst @flavour@,$*,$(kpkg_image_cmd))
+	cd install-$*; \
+	$(strip $(kpkg_image_pre) $(subst @flavour@,$*,$(kpkg_image_cmd)))
 	cat install-$*/debian/files >> debian/files;
 	rm -rf install-$*;
 	touch install-stamp-$(subarch)-$*

Modified: branches/kernel-image-2.6.11/README
===================================================================
--- branches/kernel-image-2.6.11/README	2005-05-23 11:42:29 UTC (rev 3222)
+++ branches/kernel-image-2.6.11/README	2005-05-23 14:02:07 UTC (rev 3223)
@@ -182,15 +182,19 @@
   it only required on sparc for stripping of the kernel which is too big
   to be booted otherwise. Typical use is too ugly to be presented here.
 
+image_prefix_flavours
 image_prefix
 
-  This variable may contain an expression, which will be used as a wrapper
-  for the make-kpkg when its target is kernel_image. This option is a kludge,
-  needed for sparc, which has to prepend this call with either 'sparc32' or
-  'sparc64', depending on the flavour being built (otherwise depmod breaks
-  when building sparc32 kernels on sparc64). For this obscure case it may
-  be used like that (very evil):
+  These variables allow to prepend the 'make-kpkg kernel_image' call with
+  an arbitrary prefix for selected flavours. Some architectures have a
+  32- and 64-bit versions. If kernels are built on the 64-bit hardware, then
+  building a 32-bit kernel usually requires using a wrapper which sets the
+  correct execution domain (such as sparc32 or linux32). If the variable
+  image_prefix_flavours is non-empty and contains a space-separated list
+  if flavours, then make-kpkg invocation to create a kernel_image target
+  will be prepended with contents of the image_prefix variable. Typical
+  usage:
 
-  image_prefix := $${i%-smp}
-
-  The shell variable ${i} will contain the current flavour in the rules file.
+  image_prefix_flavours := sparc32 sparc32-smp
+  image_prefix          := sparc32
+