diff --git a/Makefile b/Makefile index 6e5b82e83..2a950e649 100755 --- a/Makefile +++ b/Makefile @@ -41,7 +41,6 @@ kdir := kernel-source-$(version)-$(subarch) ifndef flavours flavours := $(patsubst config.%,%,$(configs)) endif -build_prefix := build-$(subarch)- -include $(basedir)/Makefile.inc @@ -68,9 +67,16 @@ endif 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 @@ binary-arch: build headers-stamp $(istamps) 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)-$* diff --git a/README b/README index 8455f759d..50756def6 100644 --- a/README +++ b/README @@ -182,15 +182,19 @@ image_postproc 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 +