aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/boot/main.c')
-rw-r--r--arch/powerpc/boot/main.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index d872b758ef14..df9e95a84015 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -118,10 +118,9 @@ static struct addr_range prep_kernel(void)
118 gunzip_start(&gzstate, vmlinuz_addr, vmlinuz_size); 118 gunzip_start(&gzstate, vmlinuz_addr, vmlinuz_size);
119 gunzip_exactly(&gzstate, elfheader, sizeof(elfheader)); 119 gunzip_exactly(&gzstate, elfheader, sizeof(elfheader));
120 120
121 if (!parse_elf64(elfheader, &ei) && !parse_elf32(elfheader, &ei)) { 121 if (!parse_elf64(elfheader, &ei) && !parse_elf32(elfheader, &ei))
122 printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r"); 122 fatal("Error: not a valid PPC32 or PPC64 ELF file!\n\r");
123 exit(); 123
124 }
125 if (platform_ops.image_hdr) 124 if (platform_ops.image_hdr)
126 platform_ops.image_hdr(elfheader); 125 platform_ops.image_hdr(elfheader);
127 126
@@ -135,11 +134,9 @@ static struct addr_range prep_kernel(void)
135 if (platform_ops.vmlinux_alloc) { 134 if (platform_ops.vmlinux_alloc) {
136 addr = platform_ops.vmlinux_alloc(ei.memsize); 135 addr = platform_ops.vmlinux_alloc(ei.memsize);
137 } else { 136 } else {
138 if ((unsigned long)_start < ei.memsize) { 137 if ((unsigned long)_start < ei.memsize)
139 printf("Insufficient memory for kernel at address 0!" 138 fatal("Insufficient memory for kernel at address 0!"
140 " (_start=%lx)\n\r", _start); 139 " (_start=%lx)\n\r", _start);
141 exit();
142 }
143 } 140 }
144 141
145 /* Finally, gunzip the kernel */ 142 /* Finally, gunzip the kernel */
@@ -189,11 +186,9 @@ static struct addr_range prep_initrd(struct addr_range vmlinux,
189 printf("Allocating 0x%lx bytes for initrd ...\n\r", 186 printf("Allocating 0x%lx bytes for initrd ...\n\r",
190 initrd_size); 187 initrd_size);
191 initrd_addr = (unsigned long)malloc(initrd_size); 188 initrd_addr = (unsigned long)malloc(initrd_size);
192 if (! initrd_addr) { 189 if (! initrd_addr)
193 printf("Can't allocate memory for initial " 190 fatal("Can't allocate memory for initial "
194 "ramdisk !\n\r"); 191 "ramdisk !\n\r");
195 exit();
196 }
197 printf("Relocating initrd 0x%p <- 0x%p (0x%lx bytes)\n\r", 192 printf("Relocating initrd 0x%p <- 0x%p (0x%lx bytes)\n\r",
198 initrd_addr, old_addr, initrd_size); 193 initrd_addr, old_addr, initrd_size);
199 memmove((void *)initrd_addr, old_addr, initrd_size); 194 memmove((void *)initrd_addr, old_addr, initrd_size);
@@ -203,10 +198,8 @@ static struct addr_range prep_initrd(struct addr_range vmlinux,
203 198
204 /* Tell the kernel initrd address via device tree */ 199 /* Tell the kernel initrd address via device tree */
205 devp = finddevice("/chosen"); 200 devp = finddevice("/chosen");
206 if (! devp) { 201 if (! devp)
207 printf("Device tree has no chosen node!\n\r"); 202 fatal("Device tree has no chosen node!\n\r");
208 exit();
209 }
210 203
211 initrd_start = (u32)initrd_addr; 204 initrd_start = (u32)initrd_addr;
212 initrd_end = (u32)initrd_addr + initrd_size; 205 initrd_end = (u32)initrd_addr + initrd_size;
@@ -303,7 +296,6 @@ void start(void *sp)
303 kentry((unsigned long)initrd.addr, initrd.size, 296 kentry((unsigned long)initrd.addr, initrd.size,
304 loader_info.promptr); 297 loader_info.promptr);
305 298
306 /* console closed so printf below may not work */ 299 /* console closed so printf in fatal below may not work */
307 printf("Error: Linux kernel returned to zImage boot wrapper!\n\r"); 300 fatal("Error: Linux kernel returned to zImage boot wrapper!\n\r");
308 exit();
309} 301}