Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42252
b: refs/heads/master
c: f79e083
h: refs/heads/master
v: v3
  • Loading branch information
David Gibson authored and Paul Mackerras committed Dec 4, 2006
1 parent 3cc56a9 commit e2ed69d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3e00a5aec3d6af687e37f4e7482f5c7ecdcabd0b
refs/heads/master: f79e083c2fab601a1c382282344f5a251557dbac
21 changes: 14 additions & 7 deletions trunk/arch/powerpc/boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static int is_elf32(void *hdr)
return 1;
}

static void prep_kernel(unsigned long *a1, unsigned long *a2)
static void prep_kernel(unsigned long a1, unsigned long a2)
{
int len;

Expand Down Expand Up @@ -205,11 +205,14 @@ static void prep_kernel(unsigned long *a1, unsigned long *a2)
}

/*
* Now we try to alloc memory for the initrd (and copy it there)
* Now find the initrd
*
* First see if we have an image attached to us. If so
* allocate memory for it and copy it there.
*/
initrd.size = (unsigned long)(_initrd_end - _initrd_start);
initrd.memsize = initrd.size;
if ( initrd.size > 0 ) {
if (initrd.size > 0) {
printf("Allocating 0x%lx bytes for initrd ...\n\r",
initrd.size);
initrd.addr = (unsigned long)malloc((u32)initrd.size);
Expand All @@ -218,15 +221,19 @@ static void prep_kernel(unsigned long *a1, unsigned long *a2)
"ramdisk !\n\r");
exit();
}
*a1 = initrd.addr;
*a2 = initrd.size;
printf("initial ramdisk moving 0x%lx <- 0x%lx "
"(0x%lx bytes)\n\r", initrd.addr,
(unsigned long)_initrd_start, initrd.size);
memmove((void *)initrd.addr, (void *)_initrd_start,
initrd.size);
printf("initrd head: 0x%lx\n\r",
*((unsigned long *)initrd.addr));
} else if (a2 != 0) {
/* Otherwise, see if yaboot or another loader gave us an initrd */
initrd.addr = a1;
initrd.memsize = initrd.size = a2;
printf("Using loader supplied initrd at 0x%lx (0x%lx bytes)\n\r",
initrd.addr, initrd.size);
}

/* Eventually gunzip the kernel */
Expand Down Expand Up @@ -307,7 +314,7 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r",
_start, sp);

prep_kernel(&a1, &a2);
prep_kernel(a1, a2);

/* If cmdline came from zimage wrapper or if we can edit the one
* in the dt, print it out and edit it, if possible.
Expand All @@ -331,7 +338,7 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
}
else
/* XXX initrd addr/size should be passed in properties */
kentry(a1, a2, promptr);
kentry(initrd.addr, initrd.size, promptr);

/* console closed so printf below may not work */
printf("Error: Linux kernel returned to zImage boot wrapper!\n\r");
Expand Down

0 comments on commit e2ed69d

Please sign in to comment.