From: Sam Ravnborg Following patchs allows one to specify default target when doing make *config. This has the advantage that kbuild knows the final target, a knowledge that is required when building rpm's or deb's. The following patch introduce selecting default target for i386, and is mainly a RFC. If there is no big complains I will update it to cover a few more architectures before submitting. Signed-off-by: Andrew Morton --- 25-akpm/Makefile | 12 +++++------- 25-akpm/arch/i386/Kconfig | 36 ++++++++++++++++++++++++++++++++++++ 25-akpm/arch/i386/Makefile | 18 ++++++++++-------- 3 files changed, 51 insertions(+), 15 deletions(-) diff -puN arch/i386/Kconfig~kbuild-specify-default-target-during-configuration arch/i386/Kconfig --- 25/arch/i386/Kconfig~kbuild-specify-default-target-during-configuration 2004-05-31 16:47:53.368222448 -0700 +++ 25-akpm/arch/i386/Kconfig 2004-05-31 16:47:53.376221232 -0700 @@ -29,6 +29,42 @@ config GENERIC_ISA_DMA bool default y +choice + prompt "Default kernel image" + default KERNEL_IMAGE_BZIMAGE + help + Specify which kernel image to be build when executing 'make' with + no arguments. + +config KERNEL_IMAGE_BZIMAGE + bool "bzImage - Compressed kernel image" + help + bzImage - located at arch/i386/boot/bzImage. + bzImage can accept larger kernels than zImage + +config KERNEL_IMAGE_ZIMAGE + bool "zImage - Compressed kernel image" + help + zImage - located at arch/i386/boot/zImage. + zImage is seldom used. zImage supports smaller kernels than bzImage, + and is only used in special situations. + +config KERNEL_IMAGE_VMLINUX + bool "vmlinux - the bare kernel" + help + vmlinux - located at the root of the kernel tree + vmlinux contains the kernel image with no additional bootloader. + vmlinux is seldom used as target for i386. + +endchoice + +config KERNEL_IMAGE + string + default arch/i386/boot/bzImage if KERNEL_IMAGE_BZIMAGE + default arch/i386/boot/zImage if KERNEL_IMAGE_ZIMAGE + default vmlinux if KERNEL_IMAGE_VMLINUX + + source "init/Kconfig" diff -puN arch/i386/Makefile~kbuild-specify-default-target-during-configuration arch/i386/Makefile --- 25/arch/i386/Makefile~kbuild-specify-default-target-during-configuration 2004-05-31 16:47:53.370222144 -0700 +++ 25-akpm/arch/i386/Makefile 2004-05-31 16:47:53.377221080 -0700 @@ -119,18 +119,20 @@ AFLAGS += $(mflags-y) boot := arch/i386/boot -.PHONY: zImage bzImage compressed zlilo bzlilo \ - zdisk bzdisk fdimage fdimage144 fdimage288 install +# Lot's of documentation refer to these, so keep the short versions for now +.PHONY: bzImage zImage compressed +bzImage: $(boot)/bzImage +zImage: $(boot)/zImage +compressed: $(boot)/zImage -all: bzImage +# Target's that install the kernel +.PHONY: zlilo bzlilo zdisk bzdisk fdimage fdimage144 fdimage288 install BOOTIMAGE=arch/i386/boot/bzImage -zImage zlilo zdisk: BOOTIMAGE=arch/i386/boot/zImage +zlilo zdisk: BOOTIMAGE=arch/i386/boot/zImage -zImage bzImage: vmlinux - $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE) - -compressed: zImage +$(boot)/zImage $(boot)/bzImage: vmlinux + $(Q)$(MAKE) $(build)=$(boot) $@ zlilo bzlilo: vmlinux $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo diff -puN Makefile~kbuild-specify-default-target-during-configuration Makefile --- 25/Makefile~kbuild-specify-default-target-during-configuration 2004-05-31 16:47:53.371221992 -0700 +++ 25-akpm/Makefile 2004-05-31 16:47:53.377221080 -0700 @@ -409,13 +409,6 @@ scripts: scripts_basic include/config/MA scripts_basic: include/linux/autoconf.h - -# That's our default target when none is given on the command line -# Note that 'modules' will be added as a prerequisite as well, -# in the CONFIG_MODULES part below - -all: vmlinux - # Objects we will link into vmlinux / subdirs we need to visit init-y := init/ drivers-y := drivers/ sound/ @@ -449,6 +442,11 @@ endif include $(srctree)/arch/$(ARCH)/Makefile +# Let all: depend on target selected in .config +# Hereby user only have to issue 'make' to build the kernel, including +# selected kernel +all: $(subst ",,$(CONFIG_KERNEL_IMAGE)) + ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE CFLAGS += -Os else _