Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116933
b: refs/heads/master
c: c10c178
h: refs/heads/master
i:
  116931: 3be2343
v: v3
  • Loading branch information
Sebastian Siewior authored and Benjamin Herrenschmidt committed Oct 21, 2008
1 parent b37059d commit 20f667c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 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: c1075fb7ec62b7ac0ac6baee2ceeb77270206aef
refs/heads/master: c10c178a92b032ea3dd7259dcbbd1b9331c05c41
16 changes: 8 additions & 8 deletions trunk/arch/powerpc/boot/libfdt-wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ static unsigned long fdt_wrapper_finalize(void)
void fdt_init(void *blob)
{
int err;
int bufsize;

dt_ops.finddevice = fdt_wrapper_finddevice;
dt_ops.getprop = fdt_wrapper_getprop;
Expand All @@ -178,16 +179,15 @@ void fdt_init(void *blob)

/* Make sure the dt blob is the right version and so forth */
fdt = blob;
err = fdt_open_into(fdt, fdt, fdt_totalsize(blob));
if (err == -FDT_ERR_NOSPACE) {
int bufsize = fdt_totalsize(fdt) + 4;
buf = malloc(bufsize);
err = fdt_open_into(fdt, buf, bufsize);
}
bufsize = fdt_totalsize(fdt) + 4;
buf = malloc(bufsize);
if(!buf)
fatal("malloc failed. can't relocate the device tree\n\r");

err = fdt_open_into(fdt, buf, bufsize);

if (err != 0)
fatal("fdt_init(): %s\n\r", fdt_strerror(err));

if (buf)
fdt = buf;
fdt = buf;
}
14 changes: 12 additions & 2 deletions trunk/arch/powerpc/boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,19 @@ static struct addr_range prep_kernel(void)
if (platform_ops.vmlinux_alloc) {
addr = platform_ops.vmlinux_alloc(ei.memsize);
} else {
if ((unsigned long)_start < ei.memsize)
/*
* Check if the kernel image (without bss) would overwrite the
* bootwrapper. The device tree has been moved in fdt_init()
* to an area allocated with malloc() (somewhere past _end).
*/
if ((unsigned long)_start < ei.loadsize)
fatal("Insufficient memory for kernel at address 0!"
" (_start=%p)\n\r", _start);
" (_start=%p, uncomressed size=%08x)\n\r",
_start, ei.loadsize);

if ((unsigned long)_end < ei.memsize)
fatal("The final kernel image would overwrite the "
"device tree\n\r");
}

/* Finally, gunzip the kernel */
Expand Down

0 comments on commit 20f667c

Please sign in to comment.