Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) Paul Mackerras 1997. |
| 3 | * |
| 4 | * Updates for PPC64 by Todd Inglett, Dave Engebretsen & Peter Bergner. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
Olaf Hering | decd300 | 2005-08-08 13:24:38 +1000 | [diff] [blame] | 11 | #include <stdarg.h> |
| 12 | #include <stddef.h> |
| 13 | #include "elf.h" |
| 14 | #include "page.h" |
| 15 | #include "string.h" |
| 16 | #include "stdio.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include "zlib.h" |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 18 | #include "ops.h" |
| 19 | #include "flatdevtree.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Olaf Hering | decd300 | 2005-08-08 13:24:38 +1000 | [diff] [blame] | 21 | extern void flush_cache(void *, unsigned long); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | extern char _start[]; |
Olaf Hering | 9b0cbe9 | 2005-10-28 17:46:45 -0700 | [diff] [blame] | 24 | extern char __bss_start[]; |
Mark Bellon | 3cc747e | 2005-09-06 15:50:02 -0700 | [diff] [blame] | 25 | extern char _end[]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | extern char _vmlinux_start[]; |
| 27 | extern char _vmlinux_end[]; |
| 28 | extern char _initrd_start[]; |
| 29 | extern char _initrd_end[]; |
Mark A. Greer | c888554 | 2006-10-16 13:49:27 -0700 | [diff] [blame] | 30 | extern char _dtb_start[]; |
| 31 | extern char _dtb_end[]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
| 33 | struct addr_range { |
| 34 | unsigned long addr; |
| 35 | unsigned long size; |
| 36 | unsigned long memsize; |
| 37 | }; |
Olaf Hering | afbe8c4 | 2005-10-28 17:46:47 -0700 | [diff] [blame] | 38 | static struct addr_range vmlinux; |
| 39 | static struct addr_range vmlinuz; |
| 40 | static struct addr_range initrd; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 42 | static unsigned long elfoffset; |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 43 | static int is_64bit; |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 44 | |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 45 | /* scratch space for gunzip; 46912 is from zlib_inflate_workspacesize() */ |
| 46 | static char scratch[46912]; |
Olaf Hering | 8a76baf | 2005-10-28 17:46:40 -0700 | [diff] [blame] | 47 | static char elfheader[256]; |
Olaf Hering | 7054036 | 2005-10-28 17:46:38 -0700 | [diff] [blame] | 48 | |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 49 | typedef void (*kernel_entry_t)(unsigned long, unsigned long, void *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | #undef DEBUG |
| 52 | |
Olaf Hering | 6bcc20b | 2005-10-28 17:46:41 -0700 | [diff] [blame] | 53 | #define HEAD_CRC 2 |
| 54 | #define EXTRA_FIELD 4 |
| 55 | #define ORIG_NAME 8 |
| 56 | #define COMMENT 0x10 |
| 57 | #define RESERVED 0xe0 |
| 58 | |
| 59 | static void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) |
| 60 | { |
| 61 | z_stream s; |
| 62 | int r, i, flags; |
| 63 | |
| 64 | /* skip header */ |
| 65 | i = 10; |
| 66 | flags = src[3]; |
| 67 | if (src[2] != Z_DEFLATED || (flags & RESERVED) != 0) { |
| 68 | printf("bad gzipped data\n\r"); |
| 69 | exit(); |
| 70 | } |
| 71 | if ((flags & EXTRA_FIELD) != 0) |
| 72 | i = 12 + src[10] + (src[11] << 8); |
| 73 | if ((flags & ORIG_NAME) != 0) |
| 74 | while (src[i++] != 0) |
| 75 | ; |
| 76 | if ((flags & COMMENT) != 0) |
| 77 | while (src[i++] != 0) |
| 78 | ; |
| 79 | if ((flags & HEAD_CRC) != 0) |
| 80 | i += 2; |
| 81 | if (i >= *lenp) { |
| 82 | printf("gunzip: ran out of data in header\n\r"); |
| 83 | exit(); |
| 84 | } |
| 85 | |
| 86 | if (zlib_inflate_workspacesize() > sizeof(scratch)) { |
| 87 | printf("gunzip needs more mem\n"); |
| 88 | exit(); |
| 89 | } |
| 90 | memset(&s, 0, sizeof(s)); |
| 91 | s.workspace = scratch; |
| 92 | r = zlib_inflateInit2(&s, -MAX_WBITS); |
| 93 | if (r != Z_OK) { |
| 94 | printf("inflateInit2 returned %d\n\r", r); |
| 95 | exit(); |
| 96 | } |
| 97 | s.next_in = src + i; |
| 98 | s.avail_in = *lenp - i; |
| 99 | s.next_out = dst; |
| 100 | s.avail_out = dstlen; |
| 101 | r = zlib_inflate(&s, Z_FULL_FLUSH); |
| 102 | if (r != Z_OK && r != Z_STREAM_END) { |
| 103 | printf("inflate returned %d msg: %s\n\r", r, s.msg); |
| 104 | exit(); |
| 105 | } |
| 106 | *lenp = s.next_out - (unsigned char *) dst; |
| 107 | zlib_inflateEnd(&s); |
| 108 | } |
| 109 | |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 110 | static int is_elf64(void *hdr) |
| 111 | { |
| 112 | Elf64_Ehdr *elf64 = hdr; |
| 113 | Elf64_Phdr *elf64ph; |
| 114 | unsigned int i; |
| 115 | |
| 116 | if (!(elf64->e_ident[EI_MAG0] == ELFMAG0 && |
| 117 | elf64->e_ident[EI_MAG1] == ELFMAG1 && |
| 118 | elf64->e_ident[EI_MAG2] == ELFMAG2 && |
| 119 | elf64->e_ident[EI_MAG3] == ELFMAG3 && |
| 120 | elf64->e_ident[EI_CLASS] == ELFCLASS64 && |
| 121 | elf64->e_ident[EI_DATA] == ELFDATA2MSB && |
| 122 | elf64->e_type == ET_EXEC && |
| 123 | elf64->e_machine == EM_PPC64)) |
| 124 | return 0; |
| 125 | |
| 126 | elf64ph = (Elf64_Phdr *)((unsigned long)elf64 + |
| 127 | (unsigned long)elf64->e_phoff); |
| 128 | for (i = 0; i < (unsigned int)elf64->e_phnum; i++, elf64ph++) |
Olaf Hering | 158daa4 | 2006-01-30 14:28:03 +0100 | [diff] [blame] | 129 | if (elf64ph->p_type == PT_LOAD) |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 130 | break; |
| 131 | if (i >= (unsigned int)elf64->e_phnum) |
| 132 | return 0; |
| 133 | |
| 134 | elfoffset = (unsigned long)elf64ph->p_offset; |
| 135 | vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset; |
| 136 | vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset; |
Paul Mackerras | 66a45dd | 2006-01-14 15:04:06 +1100 | [diff] [blame] | 137 | |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 138 | is_64bit = 1; |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 139 | return 1; |
| 140 | } |
| 141 | |
| 142 | static int is_elf32(void *hdr) |
| 143 | { |
| 144 | Elf32_Ehdr *elf32 = hdr; |
| 145 | Elf32_Phdr *elf32ph; |
| 146 | unsigned int i; |
| 147 | |
| 148 | if (!(elf32->e_ident[EI_MAG0] == ELFMAG0 && |
| 149 | elf32->e_ident[EI_MAG1] == ELFMAG1 && |
| 150 | elf32->e_ident[EI_MAG2] == ELFMAG2 && |
| 151 | elf32->e_ident[EI_MAG3] == ELFMAG3 && |
| 152 | elf32->e_ident[EI_CLASS] == ELFCLASS32 && |
| 153 | elf32->e_ident[EI_DATA] == ELFDATA2MSB && |
| 154 | elf32->e_type == ET_EXEC && |
| 155 | elf32->e_machine == EM_PPC)) |
| 156 | return 0; |
| 157 | |
| 158 | elf32 = (Elf32_Ehdr *)elfheader; |
| 159 | elf32ph = (Elf32_Phdr *) ((unsigned long)elf32 + elf32->e_phoff); |
| 160 | for (i = 0; i < elf32->e_phnum; i++, elf32ph++) |
Olaf Hering | 158daa4 | 2006-01-30 14:28:03 +0100 | [diff] [blame] | 161 | if (elf32ph->p_type == PT_LOAD) |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 162 | break; |
| 163 | if (i >= elf32->e_phnum) |
| 164 | return 0; |
| 165 | |
| 166 | elfoffset = elf32ph->p_offset; |
| 167 | vmlinux.size = elf32ph->p_filesz + elf32ph->p_offset; |
| 168 | vmlinux.memsize = elf32ph->p_memsz + elf32ph->p_offset; |
| 169 | return 1; |
| 170 | } |
| 171 | |
David Gibson | f79e083 | 2006-11-16 15:31:32 +1100 | [diff] [blame] | 172 | static void prep_kernel(unsigned long a1, unsigned long a2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | { |
Olaf Hering | 8a76baf | 2005-10-28 17:46:40 -0700 | [diff] [blame] | 174 | int len; |
Paul Mackerras | 66a45dd | 2006-01-14 15:04:06 +1100 | [diff] [blame] | 175 | |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 176 | vmlinuz.addr = (unsigned long)_vmlinux_start; |
| 177 | vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); |
| 178 | |
| 179 | /* gunzip the ELF header of the kernel */ |
| 180 | if (*(unsigned short *)vmlinuz.addr == 0x1f8b) { |
| 181 | len = vmlinuz.size; |
| 182 | gunzip(elfheader, sizeof(elfheader), |
| 183 | (unsigned char *)vmlinuz.addr, &len); |
| 184 | } else |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 185 | memcpy(elfheader, (const void *)vmlinuz.addr, |
| 186 | sizeof(elfheader)); |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 187 | |
| 188 | if (!is_elf64(elfheader) && !is_elf32(elfheader)) { |
| 189 | printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r"); |
| 190 | exit(); |
| 191 | } |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 192 | if (platform_ops.image_hdr) |
| 193 | platform_ops.image_hdr(elfheader); |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 194 | |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 195 | /* We need to alloc the memsize plus the file offset since gzip |
Benjamin Herrenschmidt | c8e3c8b | 2005-11-07 00:57:58 -0800 | [diff] [blame] | 196 | * will expand the header (file offset), then the kernel, then |
| 197 | * possible rubbish we don't care about. But the kernel bss must |
| 198 | * be claimed (it will be zero'd by the kernel itself) |
| 199 | */ |
Olaf Hering | 8a76baf | 2005-10-28 17:46:40 -0700 | [diff] [blame] | 200 | printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux.memsize); |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 201 | vmlinux.addr = (unsigned long)malloc(vmlinux.memsize); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | if (vmlinux.addr == 0) { |
| 203 | printf("Can't allocate memory for kernel image !\n\r"); |
| 204 | exit(); |
| 205 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | |
| 207 | /* |
David Gibson | f79e083 | 2006-11-16 15:31:32 +1100 | [diff] [blame] | 208 | * Now find the initrd |
| 209 | * |
| 210 | * First see if we have an image attached to us. If so |
| 211 | * allocate memory for it and copy it there. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | */ |
| 213 | initrd.size = (unsigned long)(_initrd_end - _initrd_start); |
| 214 | initrd.memsize = initrd.size; |
David Gibson | f79e083 | 2006-11-16 15:31:32 +1100 | [diff] [blame] | 215 | if (initrd.size > 0) { |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 216 | printf("Allocating 0x%lx bytes for initrd ...\n\r", |
| 217 | initrd.size); |
| 218 | initrd.addr = (unsigned long)malloc((u32)initrd.size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | if (initrd.addr == 0) { |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 220 | printf("Can't allocate memory for initial " |
| 221 | "ramdisk !\n\r"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | exit(); |
| 223 | } |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 224 | printf("initial ramdisk moving 0x%lx <- 0x%lx " |
| 225 | "(0x%lx bytes)\n\r", initrd.addr, |
| 226 | (unsigned long)_initrd_start, initrd.size); |
| 227 | memmove((void *)initrd.addr, (void *)_initrd_start, |
| 228 | initrd.size); |
| 229 | printf("initrd head: 0x%lx\n\r", |
| 230 | *((unsigned long *)initrd.addr)); |
David Gibson | f79e083 | 2006-11-16 15:31:32 +1100 | [diff] [blame] | 231 | } else if (a2 != 0) { |
| 232 | /* Otherwise, see if yaboot or another loader gave us an initrd */ |
| 233 | initrd.addr = a1; |
| 234 | initrd.memsize = initrd.size = a2; |
| 235 | printf("Using loader supplied initrd at 0x%lx (0x%lx bytes)\n\r", |
| 236 | initrd.addr, initrd.size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | /* Eventually gunzip the kernel */ |
| 240 | if (*(unsigned short *)vmlinuz.addr == 0x1f8b) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | printf("gunzipping (0x%lx <- 0x%lx:0x%0lx)...", |
| 242 | vmlinux.addr, vmlinuz.addr, vmlinuz.addr+vmlinuz.size); |
| 243 | len = vmlinuz.size; |
Olaf Hering | 8a76baf | 2005-10-28 17:46:40 -0700 | [diff] [blame] | 244 | gunzip((void *)vmlinux.addr, vmlinux.memsize, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | (unsigned char *)vmlinuz.addr, &len); |
| 246 | printf("done 0x%lx bytes\n\r", len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | } else { |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 248 | memmove((void *)vmlinux.addr,(void *)vmlinuz.addr, |
| 249 | vmlinuz.size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | /* Skip over the ELF header */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | #ifdef DEBUG |
| 254 | printf("... skipping 0x%lx bytes of ELF header\n\r", |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 255 | elfoffset); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | #endif |
Paul Mackerras | 94b212c | 2005-11-16 13:38:21 +1100 | [diff] [blame] | 257 | vmlinux.addr += elfoffset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | |
| 259 | flush_cache((void *)vmlinux.addr, vmlinux.size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | } |
| 261 | |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 262 | /* A buffer that may be edited by tools operating on a zImage binary so as to |
| 263 | * edit the command line passed to vmlinux (by setting /chosen/bootargs). |
| 264 | * The buffer is put in it's own section so that tools may locate it easier. |
| 265 | */ |
| 266 | static char builtin_cmdline[COMMAND_LINE_SIZE] |
| 267 | __attribute__((__section__("__builtin_cmdline"))); |
| 268 | |
| 269 | static void get_cmdline(char *buf, int size) |
| 270 | { |
| 271 | void *devp; |
| 272 | int len = strlen(builtin_cmdline); |
| 273 | |
| 274 | buf[0] = '\0'; |
| 275 | |
| 276 | if (len > 0) { /* builtin_cmdline overrides dt's /chosen/bootargs */ |
| 277 | len = min(len, size-1); |
| 278 | strncpy(buf, builtin_cmdline, len); |
| 279 | buf[len] = '\0'; |
| 280 | } |
| 281 | else if ((devp = finddevice("/chosen"))) |
| 282 | getprop(devp, "bootargs", buf, size); |
| 283 | } |
| 284 | |
| 285 | static void set_cmdline(char *buf) |
| 286 | { |
| 287 | void *devp; |
| 288 | |
| 289 | if ((devp = finddevice("/chosen"))) |
| 290 | setprop(devp, "bootargs", buf, strlen(buf) + 1); |
| 291 | } |
| 292 | |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 293 | struct platform_ops platform_ops; |
| 294 | struct dt_ops dt_ops; |
| 295 | struct console_ops console_ops; |
| 296 | |
| 297 | void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) |
| 298 | { |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 299 | kernel_entry_t kentry; |
| 300 | char cmdline[COMMAND_LINE_SIZE]; |
David Gibson | 35af89e | 2006-11-21 11:37:37 +1100 | [diff] [blame] | 301 | unsigned long ft_addr = 0; |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 302 | |
| 303 | memset(__bss_start, 0, _end - __bss_start); |
| 304 | memset(&platform_ops, 0, sizeof(platform_ops)); |
| 305 | memset(&dt_ops, 0, sizeof(dt_ops)); |
| 306 | memset(&console_ops, 0, sizeof(console_ops)); |
| 307 | |
Mark A. Greer | c888554 | 2006-10-16 13:49:27 -0700 | [diff] [blame] | 308 | if (platform_init(promptr, _dtb_start, _dtb_end)) |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 309 | exit(); |
| 310 | if (console_ops.open && (console_ops.open() < 0)) |
| 311 | exit(); |
| 312 | if (platform_ops.fixups) |
| 313 | platform_ops.fixups(); |
| 314 | |
| 315 | printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", |
| 316 | _start, sp); |
| 317 | |
David Gibson | f79e083 | 2006-11-16 15:31:32 +1100 | [diff] [blame] | 318 | prep_kernel(a1, a2); |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 319 | |
| 320 | /* If cmdline came from zimage wrapper or if we can edit the one |
| 321 | * in the dt, print it out and edit it, if possible. |
| 322 | */ |
| 323 | if ((strlen(builtin_cmdline) > 0) || console_ops.edit_cmdline) { |
| 324 | get_cmdline(cmdline, COMMAND_LINE_SIZE); |
| 325 | printf("\n\rLinux/PowerPC load: %s", cmdline); |
| 326 | if (console_ops.edit_cmdline) |
| 327 | console_ops.edit_cmdline(cmdline, COMMAND_LINE_SIZE); |
| 328 | printf("\n\r"); |
| 329 | set_cmdline(cmdline); |
| 330 | } |
| 331 | |
David Gibson | 35af89e | 2006-11-21 11:37:37 +1100 | [diff] [blame] | 332 | printf("Finalizing device tree..."); |
| 333 | if (dt_ops.finalize) |
| 334 | ft_addr = dt_ops.finalize(); |
| 335 | if (ft_addr) |
| 336 | printf(" flat tree at 0x%lx\n\r", ft_addr); |
| 337 | else |
| 338 | printf(" using OF tree (promptr=%p)\n\r", promptr); |
| 339 | |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 340 | if (console_ops.close) |
| 341 | console_ops.close(); |
| 342 | |
| 343 | kentry = (kernel_entry_t) vmlinux.addr; |
David Gibson | 35af89e | 2006-11-21 11:37:37 +1100 | [diff] [blame] | 344 | if (ft_addr) |
| 345 | kentry(ft_addr, 0, NULL); |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 346 | else |
| 347 | /* XXX initrd addr/size should be passed in properties */ |
David Gibson | f79e083 | 2006-11-16 15:31:32 +1100 | [diff] [blame] | 348 | kentry(initrd.addr, initrd.size, promptr); |
Mark A. Greer | b2c5f61 | 2006-09-19 14:05:08 +1000 | [diff] [blame] | 349 | |
| 350 | /* console closed so printf below may not work */ |
| 351 | printf("Error: Linux kernel returned to zImage boot wrapper!\n\r"); |
| 352 | exit(); |
| 353 | } |