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

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

diff -urN linux-2.4.18/arch/ppc/boot/pmac/chrpmain.c linux-2.4.19/arch/ppc/boot/pmac/chrpmain.c
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.chrpmain.c 1.16 07/27/01 20:24:18 trini
+ * BK Id: SCCS/s.chrpmain.c 1.18 01/11/02 10:46:07 trini
  */
 /*
  * Copyright (C) Paul Mackerras 1997.
@@ -10,15 +10,17 @@
  * 2 of the License, or (at your option) any later version.
  */
 #include "nonstdio.h"
-#include "zlib.h"
 #include <asm/processor.h>
+#include <asm/page.h>
+
+/* Passed from the linker */
+extern char __image_begin, __image_end;
+extern char __ramdisk_begin[], __ramdisk_end;
+extern char _start, _end;
 
-extern char _end[];
-extern char image_data[], initrd_data[];
-extern int image_len, initrd_len;
 extern int getprop(void *, const char *, void *, int);
 extern unsigned int heap_max;
-extern void *claim(unsigned int, unsigned int, unsigned int);
+extern void *claim(unsigned int virt, unsigned int size, unsigned int align);
 extern void *finddevice(const char *);
 extern void flush_cache(void *start, unsigned int len);
 extern void gunzip(void *, int, unsigned char *, int *);
@@ -45,21 +47,23 @@
     void *dst;
     unsigned char *im;
     unsigned initrd_start, initrd_size;
-    extern char _start;
     
     printf("chrpboot starting: loaded at 0x%p\n", &_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_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;
+	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 3MB starting at PROG_START */
     claim(PROG_START, PROG_SIZE, 0);
     dst = (void *) PROG_START;

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