44 fatal(
"Error: not a valid PPC32 or PPC64 ELF file!\n\r");
54 printf(
"Allocating 0x%lx bytes for kernel ...\n\r", ei.
memsize);
64 if ((
unsigned long)_start < ei.
loadsize)
65 fatal(
"Insufficient memory for kernel at address 0!"
66 " (_start=%p, uncompressed size=%08lx)\n\r",
69 if ((
unsigned long)_end < ei.
memsize)
70 fatal(
"The final kernel image would overwrite the "
75 printf(
"gunzipping (0x%p <- 0x%p:0x%p)...",
addr,
76 vmlinuz_addr, vmlinuz_addr+vmlinuz_size);
81 fatal(
"ran out of data! only got 0x%x of 0x%lx bytes.\n\r",
83 printf(
"done 0x%x bytes\n\r", len);
91 unsigned long initrd_addr,
92 unsigned long initrd_size)
96 if (_initrd_end > _initrd_start) {
97 printf(
"Attached initrd image at 0x%p-0x%p\n\r",
98 _initrd_start, _initrd_end);
99 initrd_addr = (
unsigned long)_initrd_start;
101 }
else if (initrd_size > 0) {
102 printf(
"Using loader supplied ramdisk at 0x%lx-0x%lx\n\r",
103 initrd_addr, initrd_addr + initrd_size);
115 if (initrd_addr < vmlinux.size) {
116 void *old_addr = (
void *)initrd_addr;
118 printf(
"Allocating 0x%lx bytes for initrd ...\n\r",
120 initrd_addr = (
unsigned long)
malloc(initrd_size);
122 fatal(
"Can't allocate memory for initial "
124 printf(
"Relocating initrd 0x%lx <- 0x%p (0x%lx bytes)\n\r",
125 initrd_addr, old_addr, initrd_size);
126 memmove((
void *)initrd_addr, old_addr, initrd_size);
129 printf(
"initrd head: 0x%lx\n\r", *((
unsigned long *)initrd_addr));
133 setprop_val(chosen,
"linux,initrd-end", (
u32)(initrd_addr+initrd_size));
135 return (
struct addr_range){(
void *)initrd_addr, initrd_size};
145 static void prep_cmdline(
void *chosen)
157 setprop_str(chosen,
"bootargs",
cmdline);
169 unsigned long ft_addr = 0;
184 printf(
"\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r",
188 chosen = finddevice(
"/chosen");
190 chosen = create_node(
NULL,
"chosen");
192 vmlinux = prep_kernel();
193 initrd = prep_initrd(vmlinux, chosen,
195 prep_cmdline(chosen);
197 printf(
"Finalizing device tree...");
201 printf(
" flat tree at 0x%lx\n\r", ft_addr);
210 kentry(ft_addr, 0,
NULL);
212 kentry((
unsigned long)initrd.
addr, initrd.
size,
216 fatal(
"Error: Linux kernel returned to zImage boot wrapper!\n\r");