[PATCH 1/2] ppc64: zimage build fix

Geoff Levand geoffrey.levand at am.sony.com
Thu Aug 11 10:57:38 EST 2005


Please consider for inclusion in the post 2.6.13 patches.

-Geoff



This patch makes it possible to build ppc64 kernel image files for all
targeted machines when several CONFIG_PPC_XXX machine type options are
enabled simultaneously.  To accomplish this it introduces two new build
targets, zImage.rs6k and zImage.initrd.rs6, which will make the proper
ELF note header needed by pSeries machines.  It falls out from these
changes that compressed zImages for the Powermac G5 can now be built.
Previously only vmlinux images could be for that machine.

One remaining problem not addressed by this patch is how to specify the 
'make install' target when several CONFIG_PPC_XXX machine type options are
enabled simultaneously.

Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>


Index: linux-2.6.13-rc6.ppc64-makefile/arch/ppc64/Makefile
===================================================================
--- linux-2.6.13-rc6.ppc64-makefile.orig/arch/ppc64/Makefile	2005-08-10 17:30:56.000000000 -0700
+++ linux-2.6.13-rc6.ppc64-makefile/arch/ppc64/Makefile	2005-08-10 17:34:01.000000000 -0700
@@ -87,14 +87,15 @@
 
 boot := arch/ppc64/boot
 
-boottarget-$(CONFIG_PPC_PSERIES) := zImage zImage.initrd
-boottarget-$(CONFIG_PPC_MAPLE) := zImage zImage.initrd
-boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm
-boottarget-$(CONFIG_PPC_BPA) := zImage zImage.initrd
-$(boottarget-y): vmlinux
+boottargets-$(CONFIG_PPC_PSERIES) += zImage.rs6k zImage.initrd.rs6k
+boottargets-$(CONFIG_PPC_PMAC) += zImage zImage.initrd
+boottargets-$(CONFIG_PPC_MAPLE) += zImage zImage.initrd
+boottargets-$(CONFIG_PPC_ISERIES) += vmlinux.sminitrd vmlinux.initrd vmlinux.sm
+boottargets-$(CONFIG_PPC_BPA) += zImage zImage.initrd
+$(boottargets-y): vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
-bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
+bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage.rs6k
 bootimage-$(CONFIG_PPC_PMAC) := vmlinux
 bootimage-$(CONFIG_PPC_MAPLE) := $(boot)/zImage
 bootimage-$(CONFIG_PPC_BPA) := zImage
@@ -103,7 +104,7 @@
 install: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
 
-defaultimage-$(CONFIG_PPC_PSERIES) := zImage
+defaultimage-$(CONFIG_PPC_PSERIES) := zImage.rs6k
 defaultimage-$(CONFIG_PPC_PMAC) := vmlinux
 defaultimage-$(CONFIG_PPC_MAPLE) := zImage
 defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
@@ -122,10 +123,12 @@
 	$(call filechk,gen-asm-offsets)
 
 define archhelp
-  echo  '* zImage       - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
-  echo  '  zImage.initrd- Compressed kernel image with initrd attached,'
-  echo  '		   sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
-  echo  '		   (arch/$(ARCH)/boot/zImage.initrd)'
+  echo  '  zImage            - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
+  echo  '  zImage.initrd     - Compressed kernel image with initrd attached,'
+  echo  '		       sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
+  echo  '		       (arch/$(ARCH)/boot/zImage.initrd)'
+  echo  '  zImage.rs6k       - zImage for pSeries machines'
+  echo  '  zImage.initrd.rs6k- zImage with initrd for pSeries machines'
 endef
 
 CLEAN_FILES += include/asm-ppc64/offsets.h
Index: linux-2.6.13-rc6.ppc64-makefile/arch/ppc64/boot/Makefile
===================================================================
--- linux-2.6.13-rc6.ppc64-makefile.orig/arch/ppc64/boot/Makefile	2005-08-10 17:30:56.000000000 -0700
+++ linux-2.6.13-rc6.ppc64-makefile/arch/ppc64/boot/Makefile	2005-08-10 17:34:01.000000000 -0700
@@ -37,6 +37,9 @@
 quiet_cmd_bootas = BOOTAS  $@
       cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
 
+quiet_cmd_bootld = BOOTLD  $@
+      cmd_bootld = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(2)
+
 $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
 	$(call if_changed_dep,bootcc)
 $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
@@ -75,8 +78,8 @@
 		--add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(patsubst %.o,%.gz, $(1)) \
 		--set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(OBJCOPYFLAGS)
 
-quiet_cmd_addnote = ADDNOTE $@ 
-      cmd_addnote = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(obj-boot) && $(obj)/addnote $@
+quiet_cmd_addnote = ADDNOTE $@
+      cmd_addnote = $(obj)/addnote $@
 
 $(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE
 	$(call if_changed,gzip)
@@ -92,11 +95,19 @@
 	$(call addsection, $@)
 
 $(obj)/zImage: obj-boot += $(call obj-sec, $(required))
-$(obj)/zImage: $(call obj-sec, $(required)) $(obj-boot) $(obj)/addnote FORCE
-	$(call if_changed,addnote)
+$(obj)/zImage: $(call obj-sec, $(required)) $(obj-boot) FORCE
+	$(call cmd,bootld,$(obj-boot))
 
 $(obj)/zImage.initrd: obj-boot += $(call obj-sec, $(required) $(initrd))
-$(obj)/zImage.initrd: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(obj)/addnote FORCE
+$(obj)/zImage.initrd: $(call obj-sec, $(required) $(initrd)) $(obj-boot) FORCE
+	$(call cmd,bootld,$(obj-boot))
+
+$(obj)/zImage.rs6k: $(obj)/zImage $(obj)/addnote FORCE
+	@cp -f $< $@
+	$(call if_changed,addnote)
+
+$(obj)/zImage.initrd.rs6k: $(obj)/zImage.initrd $(obj)/addnote FORCE
+	@cp -f $< $@
 	$(call if_changed,addnote)
 
 $(obj)/imagesize.c: vmlinux.strip




More information about the Linuxppc64-dev mailing list