[RFC] addnote and pmac

Geoff Levand geoffrey.levand at am.sony.com
Wed Aug 10 07:05:58 EST 2005


Benjamin Herrenschmidt wrote:
> On Mon, 2005-08-08 at 11:27 -0700, Geoff Levand wrote:
> 
>>I found that my Mac G5 wouldn't boot with a zImage modified by 
>>addnote.  It worked OK when the image wasn't run through addnote 
>>though.  I took just a brief look at addnote.c, and it seems this 
>>step is specific to the OF implementation, or could it be needed 
>>by older tool chains?
>>
>>At any rate, by default it is run for all zImage builds, which 
>>we'll need to change to support at least some machines.  Below is 
>>what I got working, but someone more familiar with the boot 
>>makefile and the needs of other machines could certainly do 
>>better.
> 
> The problem is that your G5 does understand the added Note header but
> doesn't like it's content.
> 
> IBM Open Firmware only works properly in real mode, while Apple's only
> works properly in virtual mode. The Note header is set to real mode,
> thus causing Apple's OF to do a double-reboot into a mode where it craps
> itself. 

OK, I understand.

> There is no way unfortunately to "fix" that other than
> generating two zImages, or better, having the distro add the Note
> section for IBM machines at zImage install time.

It seems like an inconvenience to need to add something later...

> Note that your patch is wrong, as this has nothing to do with iSeries,
> but it's a pSeries issue. But since you can built kernels images that
> can be booted on both a G5 and a pSeries, using a CONFIG_ option for
> that isn't a good solution anyway.

If I understand it correctly, we need it so you can build a kernel image 
(vmlinux) that could be binary compatible with both G5 and pSeries 
machines, and maybe others, but that the OF compatible wrapper program, 
if built, needs to have a note header added for pSeries machines.

It seems both you and Olaf suggested to make two build targets, so I set 
them up as zImage and zImage.rs6k.  

I wonder if we could use zImage.real, since I imagine any OF machine 
would need one or the other, or are there other machine specific things 
needed by others?

-Geoff

Index: alp-linux--dev-2-6-12--1.7/arch/ppc64/Makefile
===================================================================
--- alp-linux--dev-2-6-12--1.7.orig/arch/ppc64/Makefile	2005-08-09 13:24:43.000000000 -0700
+++ alp-linux--dev-2-6-12--1.7/arch/ppc64/Makefile	2005-08-09 13:28:14.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
@@ -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: alp-linux--dev-2-6-12--1.7/arch/ppc64/boot/Makefile
===================================================================
--- alp-linux--dev-2-6-12--1.7.orig/arch/ppc64/boot/Makefile	2005-08-09 13:27:38.000000000 -0700
+++ alp-linux--dev-2-6-12--1.7/arch/ppc64/boot/Makefile	2005-08-09 13:32:59.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
@@ -95,11 +98,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

-EOF






More information about the Linuxppc64-dev mailing list