aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/of.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-03-04 22:24:52 -0500
committerPaul Mackerras <paulus@samba.org>2007-03-12 22:35:01 -0400
commit79c8541924a220964f9f2cbed31eaa9fdb042eab (patch)
tree94e75bf65ea5cb0d40dfae7215ae432e1f914296 /arch/powerpc/boot/of.c
parentad9d2716cfc1cda5a7e0d7bc0db45e3af8a4adbb (diff)
[POWERPC] zImage: Cleanup and improve prep_kernel()
This patch rewrites prep_kernel() in the zImage wrapper code to be clearer and more flexible. Notable changes: - Handling of the initrd image from prep_kernel() has moved into a new prep_initrd() function. - The address of the initrd image is now added as device tree properties, as the kernel expects. - We only copy a packaged initrd image to a new location if it is in danger of being clobbered when the kernel moves to its final location, instead of always. - By default we decompress the kernel directly to address 0, instead of requiring it to relocate itself. Platforms (such as OF) where doing this could clobber still-live firmware data structures can override the vmlinux_alloc hook to provide an alternate place to decompress the kernel. - We no longer pass lots of information between functions in global variables. Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/of.c')
-rw-r--r--arch/powerpc/boot/of.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/powerpc/boot/of.c b/arch/powerpc/boot/of.c
index 0182f384f3e6..044f34770b96 100644
--- a/arch/powerpc/boot/of.c
+++ b/arch/powerpc/boot/of.c
@@ -208,6 +208,17 @@ static void of_image_hdr(const void *hdr)
208 } 208 }
209} 209}
210 210
211static void *of_vmlinux_alloc(unsigned long size)
212{
213 void *p = malloc(size);
214
215 if (!p) {
216 printf("Can't allocate memory for kernel image!\n\r");
217 exit();
218 }
219 return p;
220}
221
211static void of_exit(void) 222static void of_exit(void)
212{ 223{
213 call_prom("exit", 0, 0); 224 call_prom("exit", 0, 0);
@@ -261,6 +272,7 @@ int platform_init(void *promptr, char *dt_blob_start, char *dt_blob_end)
261 platform_ops.image_hdr = of_image_hdr; 272 platform_ops.image_hdr = of_image_hdr;
262 platform_ops.malloc = of_try_claim; 273 platform_ops.malloc = of_try_claim;
263 platform_ops.exit = of_exit; 274 platform_ops.exit = of_exit;
275 platform_ops.vmlinux_alloc = of_vmlinux_alloc;
264 276
265 dt_ops.finddevice = of_finddevice; 277 dt_ops.finddevice = of_finddevice;
266 dt_ops.getprop = of_getprop; 278 dt_ops.getprop = of_getprop;