[Cbe-oss-dev] PS3 zImage.initrd.

David Woodhouse dwmw2 at infradead.org
Sun Apr 15 00:13:57 EST 2007


I poked at zImage.initrd a bit last night and today. The code in the
bootwrapper for adding device-tree nodes was fairly buggered, and once
that was fixed the kernel itself actually reserving the initrd memory --
that's done in prom_init() for OF platforms but but never happens when
it's just put in the device-tree from the wrapper.

It seems people had debugged and fixed all of this already -- some of it
quite a long time ago, but the fixes haven't yet been merged. Attached
are the ones I needed just to get the PS3 zImage.initrd to boot.

FWIW this hack makes it slightly easier to debug the zImage.initrd in
userspace... and if you run 'gdb zImage.initrd 3>dtblob' you can call
wtree() from gdb to make it dump the device-tree to a file which can
then be inspected with 'dtc -I dtb'.

--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -23,7 +23,7 @@
 all: $(obj)/zImage
 
 HOSTCC		:= gcc
-BOOTCFLAGS	:= $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
+BOOTCFLAGS	:= $(HOSTCFLAGS) -fno-builtin -nostdinc -g -isystem \
 		   $(shell $(CROSS32CC) -print-file-name=include) -fPIC
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc
 
--- a/arch/powerpc/boot/ps3-head.S
+++ b/arch/powerpc/boot/ps3-head.S
@@ -45,3 +45,21 @@ __system_reset_entry:
 	b	smp_secondary_hold
 1:
 	b	_zimage_start
+
+.globl printhack
+printhack:
+	mr	5,4
+	mr	4,3
+	li	0,4
+	li	3,1
+	sc
+	blr
+
+	.globl wtree
+wtree:
+	mr	5,4
+	mr	4,3
+	li	0,4
+	li	3,3
+	sc
+	blr
--- a/arch/powerpc/boot/ps3.c
+++ b/arch/powerpc/boot/ps3.c
@@ -42,6 +42,8 @@ extern char _dtb_end[];
 
 PLATFORM_STACK(4096);
 
+unsigned char fish[0x4000000];
+
 static void ps3_console_write(const char *buf, int len)
 {
 }
@@ -52,18 +54,20 @@ static void ps3_exit(void)
 	lv1_panic(0); /* zero = no reboot */
 	while(1);
 }
+extern void printhack(const char *buf, int len);
 
 int platform_init(void)
 {
 	const u32 heapsize = 0x4000000 - (u32)_end; /* 64M */
 
-	console_ops.write = ps3_console_write;
+	console_ops.write = printhack;//ps3_console_write;
 	platform_ops.secondary_release = smp_secondary_release;
 	platform_ops.exit = ps3_exit;
 
 	printf("\n-- PS3 bootwrapper --\n");
 
-	simple_alloc_init(_end, heapsize, 32, 64);
+	//simple_alloc_init(_end, heapsize, 32, 64);
+	simple_alloc_init(fish, 0x4000000, 32, 64);
 	platform_ops.vmlinux_alloc = platform_ops.malloc;
 
 	ft_init(_dtb_start, 0, 4);

-- 
dwmw2
-------------- next part --------------
An embedded message was scrubbed...
From: David Gibson <david at gibson.dropbear.id.au>
Subject: [PATCH 1/2] powerpc: Allow duplicate lmb_reserve() calls
Date: Wed, 28 Feb 2007 14:12:29 +1100 (EST)
Size: 4926
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20070414/7409baab/attachment.eml>
-------------- next part --------------
An embedded message was scrubbed...
From: David Gibson <david at gibson.dropbear.id.au>
Subject: [PATCH 2/2] Automatically lmb_reserve() initrd
Date: Wed, 28 Feb 2007 14:12:29 +1100 (EST)
Size: 6011
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20070414/7409baab/attachment-0001.eml>
-------------- next part --------------
An embedded message was scrubbed...
From: Scott Wood <scottwood at freescale.com>
Subject: [PATCH 09/18] Use map_string() instead of lookup_string() in
	ft_prop().
Date: Wed, 24 Jan 2007 15:07:15 -0600
Size: 4144
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20070414/7409baab/attachment-0002.eml>
-------------- next part --------------
An embedded message was scrubbed...
From: Scott Wood <scottwood at freescale.com>
Subject: [PATCH 07/18] Preserve the pp pointer in ft_make_space() when
	calling ft_reorder().
Date: Wed, 24 Jan 2007 15:07:11 -0600
Size: 4387
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20070414/7409baab/attachment-0003.eml>
-------------- next part --------------
An embedded message was scrubbed...
From: Scott Wood <scottwood at freescale.com>
Subject: [PATCH 08/18] Modify *pp, not *p, in ft_shuffle().
Date: Wed, 24 Jan 2007 15:07:13 -0600
Size: 4149
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20070414/7409baab/attachment-0004.eml>


More information about the cbe-oss-dev mailing list