Skip to contentSkip to conversation

linux/x86: match native behavior of 'make install'

PATCH New Jan Beulich 1 participant 1 message Sep 18, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/x86: match native behavior of 'make install'

Placement of the final image and handling of the install process should match native (whether to implicitly create an initrd is just one example). This includes there not being a need for a special boot-xen subdirectory and more unification of arch/*/Makefile pieces.

arch/i386/Makefile +6 -9
Index: head-2007-09-03/arch/i386/Makefile
===================================================================
@@ -124,20 +124,18 @@ AFLAGS += $(mflags-y)
 
 boot := arch/i386/boot
 
-PHONY += zImage bzImage compressed zlilo bzlilo \
+PHONY += zImage bzImage vmlinuz compressed zlilo bzlilo \
          zdisk bzdisk fdimage fdimage144 fdimage288 isoimage install
 
 ifdef CONFIG_XEN
 CPPFLAGS := -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen $(CPPFLAGS)
-boot := arch/i386/boot-xen
-.PHONY: vmlinuz
 all: vmlinuz
 
-vmlinuz: vmlinux
-	$(Q)$(MAKE) $(build)=$(boot) $@
+# KBUILD_IMAGE specifies the target image being built
+KBUILD_IMAGE := $(boot)/vmlinuz
 
-install:
-	$(Q)$(MAKE) $(build)=$(boot) $@
+vmlinuz: vmlinux
+	$(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)
 else
 all: bzImage
 
@@ -158,10 +156,10 @@ zdisk bzdisk: vmlinux
 
 fdimage fdimage144 fdimage288 isoimage: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
+endif
 
 install:
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
-endif
 
 archclean:
 	$(Q)$(MAKE) $(clean)=arch/i386/boot
@@ -180,4 +178,3 @@ endef
 CLEAN_FILES += arch/$(ARCH)/boot/fdimage \
 	       arch/$(ARCH)/boot/image.iso \
 	       arch/$(ARCH)/boot/mtools.conf
-CLEAN_FILES += vmlinuz vmlinux-stripped
arch/i386/boot/Makefile +9 -1
Index: head-2007-09-03/arch/i386/boot/Makefile
===================================================================
@@ -26,7 +26,7 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
 #RAMDISK := -DRAMDISK=512
 
 targets		:= vmlinux.bin bootsect bootsect.o \
-		   setup setup.o zImage bzImage
+		   setup setup.o zImage bzImage vmlinuz vmlinux-stripped
 subdir- 	:= compressed
 
 hostprogs-y	:= tools/build
@@ -133,5 +133,13 @@ zlilo: $(BOOTIMAGE)
 	cp System.map $(INSTALL_PATH)/
 	if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
 
+$(obj)/vmlinuz: $(obj)/vmlinux-stripped FORCE
+	$(call if_changed,gzip)
+	@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
+
+$(obj)/vmlinux-stripped: OBJCOPYFLAGS := -g --strip-unneeded
+$(obj)/vmlinux-stripped: vmlinux FORCE
+	$(call if_changed,objcopy)
+
 install:
 	sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
arch/i386/boot-xen/Makefile deleted +0 -19
Index: head-2007-09-03/arch/i386/boot-xen/Makefile
===================================================================
@@ -1,19 +0,0 @@
-
-OBJCOPYFLAGS := -g --strip-unneeded
-
-vmlinuz: vmlinux-stripped FORCE
-	$(call if_changed,gzip)
-
-vmlinux-stripped: vmlinux FORCE
-	$(call if_changed,objcopy)
-
-INSTALL_ROOT := $(patsubst %/boot,%,$(INSTALL_PATH))
-
-XINSTALL_NAME ?= $(KERNELRELEASE)
-install:
-	mkdir -p $(INSTALL_ROOT)/boot
-	install -m0644 vmlinuz $(INSTALL_ROOT)/boot/vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
-	install -m0644 vmlinux $(INSTALL_ROOT)/boot/vmlinux-syms-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
-	install -m0664 .config $(INSTALL_ROOT)/boot/config-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
-	install -m0664 System.map $(INSTALL_ROOT)/boot/System.map-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
-	ln -f -s vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX) $(INSTALL_ROOT)/boot/vmlinuz-$(VERSION).$(PATCHLEVEL)$(shell [ -e $(objtree)/localversion-xen ] && cat $(objtree)/localversion-xen)$(INSTALL_SUFFIX)
arch/x86_64/Makefile +6 -8
Index: head-2007-09-03/arch/x86_64/Makefile
===================================================================
@@ -88,22 +88,20 @@ drivers-$(CONFIG_KDB)			+= arch/x86_64/k
 
 boot := arch/x86_64/boot
 
-PHONY += bzImage bzlilo install archmrproper \
+PHONY += bzImage bzlilo vmlinuz install archmrproper \
 	 fdimage fdimage144 fdimage288 isoimage archclean
 
 ifdef CONFIG_XEN
 CPPFLAGS := -Iinclude$(if $(KBUILD_SRC),2)/asm/mach-xen $(CPPFLAGS)
 LDFLAGS_vmlinux := -e startup_64
-boot := arch/i386/boot-xen
-.PHONY: vmlinuz
 #Default target when executing "make"
 all: vmlinuz
 
-vmlinuz: vmlinux
-	$(Q)$(MAKE) $(build)=$(boot) $@
+BOOTIMAGE                     := $(boot)/vmlinuz
+KBUILD_IMAGE                  := $(BOOTIMAGE)
 
-install:
-	$(Q)$(MAKE) $(build)=$(boot) $@
+vmlinuz: vmlinux
+	$(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE)
 else
 #Default target when executing "make"
 all: bzImage
@@ -122,10 +120,10 @@ bzdisk: vmlinux
 
 fdimage fdimage144 fdimage288 isoimage: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
+endif
 
 install:
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ 
-endif
 
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
arch/x86_64/boot/Makefile +9 -1
Index: head-2007-09-03/arch/x86_64/boot/Makefile
===================================================================
@@ -26,7 +26,7 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
 #RAMDISK := -DRAMDISK=512
 
 targets		:= vmlinux.bin bootsect bootsect.o \
-		   setup setup.o bzImage mtools.conf
+		   setup setup.o bzImage mtools.conf vmlinuz vmlinux-stripped
 
 EXTRA_CFLAGS := -m32
 
@@ -131,5 +131,13 @@ zlilo: $(BOOTIMAGE)
 	cp System.map $(INSTALL_PATH)/
 	if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
 
+$(obj)/vmlinuz: $(obj)/vmlinux-stripped FORCE
+	$(call if_changed,gzip)
+	@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
+
+$(obj)/vmlinux-stripped: OBJCOPYFLAGS := -g --strip-unneeded
+$(obj)/vmlinux-stripped: vmlinux FORCE
+	$(call if_changed,objcopy)
+
 install:
 	sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"