patch-2.4.19 linux-2.4.19/arch/ppc/boot/pmac/coffmain.c

Next file: linux-2.4.19/arch/ppc/boot/pmac/dummy.c
Previous file: linux-2.4.19/arch/ppc/boot/pmac/chrpmain.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/arch/ppc/boot/pmac/coffmain.c linux-2.4.19/arch/ppc/boot/pmac/coffmain.c
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.coffmain.c 1.14 07/27/01 20:24:18 trini
+ * BK Id: SCCS/s.coffmain.c 1.15 01/11/02 10:46:07 trini
  */
 /*
  * Copyright (C) Paul Mackerras 1997.
@@ -9,11 +9,17 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <asm/processor.h>
+#include <asm/page.h>
+
 #include "nonstdio.h"
 #include "zlib.h"
-#include <asm/processor.h>
 
-extern char _start[], _end[];
+/* Passed from the linker */
+extern char __image_begin, __image_end;
+extern char __ramdisk_begin[], __ramdisk_end;
+extern char _start, _end;
+
 extern char *claim(unsigned, unsigned, unsigned);
 extern char image_data[], initrd_data[];
 extern int initrd_len, image_len;
@@ -50,18 +56,21 @@
     
     printf("coffboot starting: loaded at 0x%p\n", &_start);
     setup_bats(RAM_START);
-    if (initrd_len) {
-	initrd_size = initrd_len;
+
+    initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin);
+    if (initrd_size) {
 	initrd_start = (RAM_END - initrd_size) & ~0xFFF;
 	a1 = initrd_start;
 	a2 = initrd_size;
-	claim(initrd_start - RAM_START, RAM_END - initrd_start, 0);
-	printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n",
-	       initrd_start, initrd_data, initrd_size);
-	memcpy((char *)initrd_start, initrd_data, initrd_size);
-    }
-    im = image_data;
-    len = image_len;
+	claim(initrd_start, RAM_END - initrd_start, 0);
+	printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
+	       initrd_start, (char *)(&__ramdisk_begin), initrd_size);
+	memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size);
+    } else
+	a2 = 0xdeadbeef;
+
+    im = (char *)(&__image_begin);
+    len = (char *)(&__image_end) - (char *)(&__image_begin);
     /* claim 4MB starting at 0 */
     claim(0, PROG_SIZE, 0);
     dst = (void *) RAM_START;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)