wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 21 | * |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
| 25 | #include <command.h> |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 26 | #include <image.h> |
| 27 | #include <zlib.h> |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 28 | #include <bzlib.h> |
| 29 | #include <environment.h> |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 30 | #include <asm/byteorder.h> |
| 31 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 32 | DECLARE_GLOBAL_DATA_PTR; |
| 33 | |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 34 | #define PHYSADDR(x) x |
| 35 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 36 | #define LINUX_MAX_ENVS 256 |
| 37 | #define LINUX_MAX_ARGS 256 |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 38 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 39 | #ifdef CONFIG_SHOW_BOOT_PROGRESS |
| 40 | # include <status_led.h> |
| 41 | # define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg) |
| 42 | #else |
| 43 | # define SHOW_BOOT_PROGRESS(arg) |
| 44 | #endif |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 45 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 46 | extern image_header_t header; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 47 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 48 | void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, |
| 49 | int argc, char *argv[], |
| 50 | ulong addr, ulong * len_ptr, int verify) |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 51 | { |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 52 | ulong sp; |
| 53 | ulong len, checksum; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 54 | ulong initrd_start, initrd_end; |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 55 | ulong cmd_start, cmd_end; |
| 56 | ulong initrd_high; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 57 | ulong data; |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 58 | int initrd_copy_to_ram = 1; |
| 59 | char *cmdline; |
| 60 | char *s; |
| 61 | bd_t *kbd; |
| 62 | void (*kernel) (bd_t *, ulong, ulong, ulong, ulong); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 63 | image_header_t *hdr = &header; |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 64 | |
| 65 | if ((s = getenv("initrd_high")) != NULL) { |
| 66 | /* a value of "no" or a similar string will act like 0, |
| 67 | * turning the "load high" feature off. This is intentional. |
| 68 | */ |
| 69 | initrd_high = simple_strtoul(s, NULL, 16); |
| 70 | if (initrd_high == ~0) |
| 71 | initrd_copy_to_ram = 0; |
| 72 | } else { /* not set, no restrictions to load high */ |
| 73 | initrd_high = ~0; |
| 74 | } |
| 75 | |
| 76 | #ifdef CONFIG_LOGBUFFER |
| 77 | kbd = gd->bd; |
| 78 | /* Prevent initrd from overwriting logbuffer */ |
| 79 | if (initrd_high < (kbd->bi_memsize - LOGBUFF_LEN - LOGBUFF_OVERHEAD)) |
| 80 | initrd_high = kbd->bi_memsize - LOGBUFF_LEN - LOGBUFF_OVERHEAD; |
| 81 | debug("## Logbuffer at 0x%08lX ", kbd->bi_memsize - LOGBUFF_LEN); |
| 82 | #endif |
| 83 | |
| 84 | /* |
| 85 | * Booting a (Linux) kernel image |
| 86 | * |
| 87 | * Allocate space for command line and board info - the |
| 88 | * address should be as high as possible within the reach of |
| 89 | * the kernel (see CFG_BOOTMAPSZ settings), but in unused |
| 90 | * memory, which means far enough below the current stack |
| 91 | * pointer. |
| 92 | */ |
| 93 | asm("movel %%a7, %%d0\n" |
| 94 | "movel %%d0, %0\n": "=d"(sp): :"%d0"); |
Stefan Roese | fe9dae6 | 2007-08-18 14:33:02 +0200 | [diff] [blame] | 95 | |
| 96 | debug("## Current stack ends at 0x%08lX ", sp); |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 97 | |
| 98 | sp -= 2048; /* just to be sure */ |
| 99 | if (sp > CFG_BOOTMAPSZ) |
| 100 | sp = CFG_BOOTMAPSZ; |
| 101 | sp &= ~0xF; |
| 102 | |
| 103 | debug("=> set upper limit to 0x%08lX\n", sp); |
| 104 | |
| 105 | cmdline = (char *)((sp - CFG_BARGSIZE) & ~0xF); |
| 106 | kbd = (bd_t *) (((ulong) cmdline - sizeof(bd_t)) & ~0xF); |
| 107 | |
| 108 | if ((s = getenv("bootargs")) == NULL) |
| 109 | s = ""; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 110 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 111 | strcpy(cmdline, s); |
| 112 | |
| 113 | cmd_start = (ulong) & cmdline[0]; |
| 114 | cmd_end = cmd_start + strlen(cmdline); |
| 115 | |
| 116 | *kbd = *(gd->bd); |
| 117 | |
| 118 | #ifdef DEBUG |
| 119 | printf("## cmdline at 0x%08lX ... 0x%08lX\n", cmd_start, cmd_end); |
| 120 | |
| 121 | do_bdinfo(NULL, 0, 0, NULL); |
| 122 | #endif |
| 123 | |
| 124 | if ((s = getenv("clocks_in_mhz")) != NULL) { |
| 125 | /* convert all clock information to MHz */ |
| 126 | kbd->bi_intfreq /= 1000000L; |
| 127 | kbd->bi_busfreq /= 1000000L; |
| 128 | } |
| 129 | |
| 130 | kernel = |
| 131 | (void (*)(bd_t *, ulong, ulong, ulong, ulong))ntohl(hdr->ih_ep); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 132 | |
| 133 | /* |
| 134 | * Check if there is an initrd image |
| 135 | */ |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 136 | |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 137 | if (argc >= 3) { |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 138 | debug("Not skipping initrd\n"); |
| 139 | SHOW_BOOT_PROGRESS(9); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 140 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 141 | addr = simple_strtoul(argv[2], NULL, 16); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 142 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 143 | printf("## Loading RAMDisk Image at %08lx ...\n", addr); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 144 | |
| 145 | /* Copy header so we can blank CRC field for re-calculation */ |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 146 | memmove(&header, (char *)addr, sizeof(image_header_t)); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 147 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 148 | if (ntohl(hdr->ih_magic) != IH_MAGIC) { |
| 149 | puts("Bad Magic Number\n"); |
| 150 | SHOW_BOOT_PROGRESS(-10); |
| 151 | do_reset(cmdtp, flag, argc, argv); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | data = (ulong) & header; |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 155 | len = sizeof(image_header_t); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 156 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 157 | checksum = ntohl(hdr->ih_hcrc); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 158 | hdr->ih_hcrc = 0; |
| 159 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 160 | if (crc32(0, (uchar *) data, len) != checksum) { |
| 161 | puts("Bad Header Checksum\n"); |
| 162 | SHOW_BOOT_PROGRESS(-11); |
| 163 | do_reset(cmdtp, flag, argc, argv); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 164 | } |
| 165 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 166 | SHOW_BOOT_PROGRESS(10); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 167 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 168 | print_image_hdr(hdr); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 169 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 170 | data = addr + sizeof(image_header_t); |
| 171 | len = ntohl(hdr->ih_size); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 172 | |
| 173 | if (verify) { |
| 174 | ulong csum = 0; |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 175 | #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) |
| 176 | ulong cdata = data, edata = cdata + len; |
| 177 | #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */ |
| 178 | |
| 179 | puts(" Verifying Checksum ... "); |
| 180 | |
| 181 | #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 182 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 183 | while (cdata < edata) { |
| 184 | ulong chunk = edata - cdata; |
| 185 | |
| 186 | if (chunk > CHUNKSZ) |
| 187 | chunk = CHUNKSZ; |
| 188 | csum = crc32(csum, (uchar *) cdata, chunk); |
| 189 | cdata += chunk; |
| 190 | |
| 191 | WATCHDOG_RESET(); |
| 192 | } |
| 193 | #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */ |
| 194 | csum = crc32(0, (uchar *) data, len); |
| 195 | #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */ |
| 196 | |
| 197 | if (csum != ntohl(hdr->ih_dcrc)) { |
| 198 | puts("Bad Data CRC\n"); |
| 199 | SHOW_BOOT_PROGRESS(-12); |
| 200 | do_reset(cmdtp, flag, argc, argv); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 201 | } |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 202 | puts("OK\n"); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 203 | } |
| 204 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 205 | SHOW_BOOT_PROGRESS(11); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 206 | |
| 207 | if ((hdr->ih_os != IH_OS_LINUX) || |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 208 | (hdr->ih_arch != IH_CPU_M68K) || |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 209 | (hdr->ih_type != IH_TYPE_RAMDISK)) { |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 210 | puts("No Linux ColdFire Ramdisk Image\n"); |
| 211 | SHOW_BOOT_PROGRESS(-13); |
| 212 | do_reset(cmdtp, flag, argc, argv); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | /* |
| 216 | * Now check if we have a multifile image |
| 217 | */ |
| 218 | } else if ((hdr->ih_type == IH_TYPE_MULTI) && (len_ptr[1])) { |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 219 | u_long tail = ntohl(len_ptr[0]) % 4; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 220 | int i; |
| 221 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 222 | SHOW_BOOT_PROGRESS(13); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 223 | |
| 224 | /* skip kernel length and terminator */ |
| 225 | data = (ulong) (&len_ptr[2]); |
| 226 | /* skip any additional image length fields */ |
| 227 | for (i = 1; len_ptr[i]; ++i) |
| 228 | data += 4; |
| 229 | /* add kernel length, and align */ |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 230 | data += ntohl(len_ptr[0]); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 231 | if (tail) { |
| 232 | data += 4 - tail; |
| 233 | } |
| 234 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 235 | len = ntohl(len_ptr[1]); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 236 | |
| 237 | } else { |
| 238 | /* |
| 239 | * no initrd image |
| 240 | */ |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 241 | SHOW_BOOT_PROGRESS(14); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 242 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 243 | len = data = 0; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 244 | } |
| 245 | |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 246 | if (!data) { |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 247 | debug("No initrd\n"); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 248 | } |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 249 | |
| 250 | if (data) { |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 251 | if (!initrd_copy_to_ram) { /* zero-copy ramdisk support */ |
| 252 | initrd_start = data; |
| 253 | initrd_end = initrd_start + len; |
| 254 | } else { |
| 255 | initrd_start = (ulong) kbd - len; |
| 256 | initrd_start &= ~(4096 - 1); /* align on page */ |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 257 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 258 | if (initrd_high) { |
| 259 | ulong nsp; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 260 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 261 | /* |
| 262 | * the inital ramdisk does not need to be within |
| 263 | * CFG_BOOTMAPSZ as it is not accessed until after |
| 264 | * the mm system is initialised. |
| 265 | * |
| 266 | * do the stack bottom calculation again and see if |
| 267 | * the initrd will fit just below the monitor stack |
| 268 | * bottom without overwriting the area allocated |
| 269 | * above for command line args and board info. |
| 270 | */ |
| 271 | asm("movel %%a7, %%d0\n" |
| 272 | "movel %%d0, %0\n": "=d"(nsp): :"%d0"); |
Stefan Roese | fe9dae6 | 2007-08-18 14:33:02 +0200 | [diff] [blame] | 273 | |
| 274 | nsp -= 2048; /* just to be sure */ |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 275 | nsp &= ~0xF; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 276 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 277 | if (nsp > initrd_high) /* limit as specified */ |
| 278 | nsp = initrd_high; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 279 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 280 | nsp -= len; |
| 281 | nsp &= ~(4096 - 1); /* align on page */ |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 282 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 283 | if (nsp >= sp) |
| 284 | initrd_start = nsp; |
| 285 | } |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 286 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 287 | SHOW_BOOT_PROGRESS(12); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 288 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 289 | debug |
| 290 | ("## initrd at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n", |
| 291 | data, data + len - 1, len, len); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 292 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 293 | initrd_end = initrd_start + len; |
| 294 | printf(" Loading Ramdisk to %08lx, end %08lx ... ", |
| 295 | initrd_start, initrd_end); |
| 296 | #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) |
| 297 | { |
| 298 | size_t l = len; |
| 299 | void *to = (void *)initrd_start; |
| 300 | void *from = (void *)data; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 301 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 302 | while (l > 0) { |
| 303 | size_t tail = |
| 304 | (l > CHUNKSZ) ? CHUNKSZ : l; |
| 305 | WATCHDOG_RESET(); |
| 306 | memmove(to, from, tail); |
| 307 | to += tail; |
| 308 | from += tail; |
| 309 | l -= tail; |
| 310 | } |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 311 | } |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 312 | #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */ |
| 313 | memmove((void *)initrd_start, (void *)data, len); |
| 314 | #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */ |
| 315 | puts("OK\n"); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 316 | } |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 317 | } else { |
| 318 | initrd_start = 0; |
| 319 | initrd_end = 0; |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 320 | } |
| 321 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 322 | debug("## Transferring control to Linux (at address %08lx) ...\n", |
| 323 | (ulong) kernel); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 324 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 325 | SHOW_BOOT_PROGRESS(15); |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 326 | |
TsiChungLiew | fc3ca3b6 | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 327 | /* |
| 328 | * Linux Kernel Parameters (passing board info data): |
| 329 | * r3: ptr to board info data |
| 330 | * r4: initrd_start or 0 if no initrd |
| 331 | * r5: initrd_end - unused if r4 is 0 |
| 332 | * r6: Start of command line string |
| 333 | * r7: End of command line string |
| 334 | */ |
| 335 | (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); |
| 336 | /* does not return */ |
wdenk | abf7a7c | 2003-12-08 01:34:36 +0000 | [diff] [blame] | 337 | } |