]> git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_bootm.c
Fix typo in MPC5XXX code (pointed out by Victor Wren)
[people/ms/u-boot.git] / common / cmd_bootm.c
1 /*
2 * (C) Copyright 2000-2002
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
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (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
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24 /*
25 * Boot support
26 */
27 #include <common.h>
28 #include <watchdog.h>
29 #include <command.h>
30 #include <image.h>
31 #include <malloc.h>
32 #include <zlib.h>
33 #include <bzlib.h>
34 #include <environment.h>
35 #include <asm/byteorder.h>
36
37 /*cmd_boot.c*/
38 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
39
40 #if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
41 #include <rtc.h>
42 #endif
43
44 #ifdef CFG_HUSH_PARSER
45 #include <hush.h>
46 #endif
47
48 #ifdef CONFIG_SHOW_BOOT_PROGRESS
49 # include <status_led.h>
50 # define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
51 #else
52 # define SHOW_BOOT_PROGRESS(arg)
53 #endif
54
55 #ifdef CFG_INIT_RAM_LOCK
56 #include <asm/cache.h>
57 #endif
58
59 #ifdef CONFIG_LOGBUFFER
60 #include <logbuff.h>
61 #endif
62
63 #ifdef CONFIG_HAS_DATAFLASH
64 #include <dataflash.h>
65 #endif
66
67 /*
68 * Some systems (for example LWMON) have very short watchdog periods;
69 * we must make sure to split long operations like memmove() or
70 * crc32() into reasonable chunks.
71 */
72 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
73 # define CHUNKSZ (64 * 1024)
74 #endif
75
76 int gunzip (void *, int, unsigned char *, int *);
77
78 static void *zalloc(void *, unsigned, unsigned);
79 static void zfree(void *, void *, unsigned);
80
81 #if (CONFIG_COMMANDS & CFG_CMD_IMI)
82 static int image_info (unsigned long addr);
83 #endif
84
85 #if (CONFIG_COMMANDS & CFG_CMD_IMLS)
86 #include <flash.h>
87 extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
88 static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
89 #endif
90
91 static void print_type (image_header_t *hdr);
92
93 #ifdef __I386__
94 image_header_t *fake_header(image_header_t *hdr, void *ptr, int size);
95 #endif
96
97 /*
98 * Continue booting an OS image; caller already has:
99 * - copied image header to global variable `header'
100 * - checked header magic number, checksums (both header & image),
101 * - verified image architecture (PPC) and type (KERNEL or MULTI),
102 * - loaded (first part of) image to header load address,
103 * - disabled interrupts.
104 */
105 typedef void boot_os_Fcn (cmd_tbl_t *cmdtp, int flag,
106 int argc, char *argv[],
107 ulong addr, /* of image to boot */
108 ulong *len_ptr, /* multi-file image length table */
109 int verify); /* getenv("verify")[0] != 'n' */
110
111 #ifdef DEBUG
112 extern int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
113 #endif
114
115 #ifdef CONFIG_PPC
116 static boot_os_Fcn do_bootm_linux;
117 #else
118 extern boot_os_Fcn do_bootm_linux;
119 #endif
120 #ifdef CONFIG_SILENT_CONSOLE
121 static void fixup_silent_linux (void);
122 #endif
123 static boot_os_Fcn do_bootm_netbsd;
124 static boot_os_Fcn do_bootm_rtems;
125 #if (CONFIG_COMMANDS & CFG_CMD_ELF)
126 static boot_os_Fcn do_bootm_vxworks;
127 static boot_os_Fcn do_bootm_qnxelf;
128 int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
129 int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
130 #endif /* CFG_CMD_ELF */
131 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
132 static boot_os_Fcn do_bootm_artos;
133 #endif
134 #ifdef CONFIG_LYNXKDI
135 static boot_os_Fcn do_bootm_lynxkdi;
136 extern void lynxkdi_boot( image_header_t * );
137 #endif
138
139 image_header_t header;
140
141 ulong load_addr = CFG_LOAD_ADDR; /* Default Load Address */
142
143 int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
144 {
145 ulong iflag;
146 ulong addr;
147 ulong data, len, checksum;
148 ulong *len_ptr;
149 uint unc_len = 0x400000;
150 int i, verify;
151 char *name, *s;
152 int (*appl)(int, char *[]);
153 image_header_t *hdr = &header;
154
155 s = getenv ("verify");
156 verify = (s && (*s == 'n')) ? 0 : 1;
157
158 if (argc < 2) {
159 addr = load_addr;
160 } else {
161 addr = simple_strtoul(argv[1], NULL, 16);
162 }
163
164 SHOW_BOOT_PROGRESS (1);
165 printf ("## Booting image at %08lx ...\n", addr);
166
167 /* Copy header so we can blank CRC field for re-calculation */
168 #ifdef CONFIG_HAS_DATAFLASH
169 if (addr_dataflash(addr)){
170 read_dataflash(addr, sizeof(image_header_t), (char *)&header);
171 } else
172 #endif
173 memmove (&header, (char *)addr, sizeof(image_header_t));
174
175 if (ntohl(hdr->ih_magic) != IH_MAGIC) {
176 #ifdef __I386__ /* correct image format not implemented yet - fake it */
177 if (fake_header(hdr, (void*)addr, -1) != NULL) {
178 /* to compensate for the addition below */
179 addr -= sizeof(image_header_t);
180 /* turnof verify,
181 * fake_header() does not fake the data crc
182 */
183 verify = 0;
184 } else
185 #endif /* __I386__ */
186 {
187 printf ("Bad Magic Number\n");
188 SHOW_BOOT_PROGRESS (-1);
189 return 1;
190 }
191 }
192 SHOW_BOOT_PROGRESS (2);
193
194 data = (ulong)&header;
195 len = sizeof(image_header_t);
196
197 checksum = ntohl(hdr->ih_hcrc);
198 hdr->ih_hcrc = 0;
199
200 if (crc32 (0, (char *)data, len) != checksum) {
201 printf ("Bad Header Checksum\n");
202 SHOW_BOOT_PROGRESS (-2);
203 return 1;
204 }
205 SHOW_BOOT_PROGRESS (3);
206
207 /* for multi-file images we need the data part, too */
208 print_image_hdr ((image_header_t *)addr);
209
210 data = addr + sizeof(image_header_t);
211 len = ntohl(hdr->ih_size);
212
213 #ifdef CONFIG_HAS_DATAFLASH
214 if (addr_dataflash(addr)){
215 read_dataflash(data, len, (char *)CFG_LOAD_ADDR);
216 data = CFG_LOAD_ADDR;
217 }
218 #endif
219
220 if (verify) {
221 printf (" Verifying Checksum ... ");
222 if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
223 printf ("Bad Data CRC\n");
224 SHOW_BOOT_PROGRESS (-3);
225 return 1;
226 }
227 printf ("OK\n");
228 }
229 SHOW_BOOT_PROGRESS (4);
230
231 len_ptr = (ulong *)data;
232
233 #if defined(__PPC__)
234 if (hdr->ih_arch != IH_CPU_PPC)
235 #elif defined(__ARM__)
236 if (hdr->ih_arch != IH_CPU_ARM)
237 #elif defined(__I386__)
238 if (hdr->ih_arch != IH_CPU_I386)
239 #elif defined(__mips__)
240 if (hdr->ih_arch != IH_CPU_MIPS)
241 #elif defined(__nios__)
242 if (hdr->ih_arch != IH_CPU_NIOS)
243 #else
244 # error Unknown CPU type
245 #endif
246 {
247 printf ("Unsupported Architecture 0x%x\n", hdr->ih_arch);
248 SHOW_BOOT_PROGRESS (-4);
249 return 1;
250 }
251 SHOW_BOOT_PROGRESS (5);
252
253 switch (hdr->ih_type) {
254 case IH_TYPE_STANDALONE:
255 name = "Standalone Application";
256 /* A second argument overwrites the load address */
257 if (argc > 2) {
258 hdr->ih_load = simple_strtoul(argv[2], NULL, 16);
259 }
260 break;
261 case IH_TYPE_KERNEL:
262 name = "Kernel Image";
263 break;
264 case IH_TYPE_MULTI:
265 name = "Multi-File Image";
266 len = ntohl(len_ptr[0]);
267 /* OS kernel is always the first image */
268 data += 8; /* kernel_len + terminator */
269 for (i=1; len_ptr[i]; ++i)
270 data += 4;
271 break;
272 default: printf ("Wrong Image Type for %s command\n", cmdtp->name);
273 SHOW_BOOT_PROGRESS (-5);
274 return 1;
275 }
276 SHOW_BOOT_PROGRESS (6);
277
278 /*
279 * We have reached the point of no return: we are going to
280 * overwrite all exception vector code, so we cannot easily
281 * recover from any failures any more...
282 */
283
284 iflag = disable_interrupts();
285
286 #ifdef CONFIG_AMIGAONEG3SE
287 /*
288 * We've possible left the caches enabled during
289 * bios emulation, so turn them off again
290 */
291 icache_disable();
292 invalidate_l1_instruction_cache();
293 flush_data_cache();
294 dcache_disable();
295 #endif
296
297 switch (hdr->ih_comp) {
298 case IH_COMP_NONE:
299 if(ntohl(hdr->ih_load) == addr) {
300 printf (" XIP %s ... ", name);
301 } else {
302 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
303 size_t l = len;
304 void *to = (void *)ntohl(hdr->ih_load);
305 void *from = (void *)data;
306
307 printf (" Loading %s ... ", name);
308
309 while (l > 0) {
310 size_t tail = (l > CHUNKSZ) ? CHUNKSZ : l;
311 WATCHDOG_RESET();
312 memmove (to, from, tail);
313 to += tail;
314 from += tail;
315 l -= tail;
316 }
317 #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
318 memmove ((void *) ntohl(hdr->ih_load), (uchar *)data, len);
319 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
320 }
321 break;
322 case IH_COMP_GZIP:
323 printf (" Uncompressing %s ... ", name);
324 if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
325 (uchar *)data, (int *)&len) != 0) {
326 printf ("GUNZIP ERROR - must RESET board to recover\n");
327 SHOW_BOOT_PROGRESS (-6);
328 do_reset (cmdtp, flag, argc, argv);
329 }
330 break;
331 #ifdef CONFIG_BZIP2
332 case IH_COMP_BZIP2:
333 printf (" Uncompressing %s ... ", name);
334 i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
335 &unc_len, (char *)data, len, 0, 0);
336 if (i != BZ_OK) {
337 printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
338 SHOW_BOOT_PROGRESS (-6);
339 udelay(100000);
340 do_reset (cmdtp, flag, argc, argv);
341 }
342 break;
343 #endif /* CONFIG_BZIP2 */
344 default:
345 if (iflag)
346 enable_interrupts();
347 printf ("Unimplemented compression type %d\n", hdr->ih_comp);
348 SHOW_BOOT_PROGRESS (-7);
349 return 1;
350 }
351 printf ("OK\n");
352 SHOW_BOOT_PROGRESS (7);
353
354 switch (hdr->ih_type) {
355 case IH_TYPE_STANDALONE:
356 if (iflag)
357 enable_interrupts();
358
359 /* load (and uncompress), but don't start if "autostart"
360 * is set to "no"
361 */
362 if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0)) {
363 char buf[32];
364 sprintf(buf, "%lX", len);
365 setenv("filesize", buf);
366 return 0;
367 }
368 appl = (int (*)(int, char *[]))ntohl(hdr->ih_ep);
369 (*appl)(argc-1, &argv[1]);
370 return 0;
371 case IH_TYPE_KERNEL:
372 case IH_TYPE_MULTI:
373 /* handled below */
374 break;
375 default:
376 if (iflag)
377 enable_interrupts();
378 printf ("Can't boot image type %d\n", hdr->ih_type);
379 SHOW_BOOT_PROGRESS (-8);
380 return 1;
381 }
382 SHOW_BOOT_PROGRESS (8);
383
384 switch (hdr->ih_os) {
385 default: /* handled by (original) Linux case */
386 case IH_OS_LINUX:
387 #ifdef CONFIG_SILENT_CONSOLE
388 fixup_silent_linux();
389 #endif
390 do_bootm_linux (cmdtp, flag, argc, argv,
391 addr, len_ptr, verify);
392 break;
393 case IH_OS_NETBSD:
394 do_bootm_netbsd (cmdtp, flag, argc, argv,
395 addr, len_ptr, verify);
396 break;
397
398 #ifdef CONFIG_LYNXKDI
399 case IH_OS_LYNXOS:
400 do_bootm_lynxkdi (cmdtp, flag, argc, argv,
401 addr, len_ptr, verify);
402 break;
403 #endif
404
405 case IH_OS_RTEMS:
406 do_bootm_rtems (cmdtp, flag, argc, argv,
407 addr, len_ptr, verify);
408 break;
409
410 #if (CONFIG_COMMANDS & CFG_CMD_ELF)
411 case IH_OS_VXWORKS:
412 do_bootm_vxworks (cmdtp, flag, argc, argv,
413 addr, len_ptr, verify);
414 break;
415 case IH_OS_QNX:
416 do_bootm_qnxelf (cmdtp, flag, argc, argv,
417 addr, len_ptr, verify);
418 break;
419 #endif /* CFG_CMD_ELF */
420 #ifdef CONFIG_ARTOS
421 case IH_OS_ARTOS:
422 do_bootm_artos (cmdtp, flag, argc, argv,
423 addr, len_ptr, verify);
424 break;
425 #endif
426 }
427
428 SHOW_BOOT_PROGRESS (-9);
429 #ifdef DEBUG
430 printf ("\n## Control returned to monitor - resetting...\n");
431 do_reset (cmdtp, flag, argc, argv);
432 #endif
433 return 1;
434 }
435
436 U_BOOT_CMD(
437 bootm, CFG_MAXARGS, 1, do_bootm,
438 "bootm - boot application image from memory\n",
439 "[addr [arg ...]]\n - boot application image stored in memory\n"
440 " passing arguments 'arg ...'; when booting a Linux kernel,\n"
441 " 'arg' can be the address of an initrd image\n"
442 );
443
444 #ifdef CONFIG_SILENT_CONSOLE
445 static void
446 fixup_silent_linux ()
447 {
448 DECLARE_GLOBAL_DATA_PTR;
449 char buf[256], *start, *end;
450 char *cmdline = getenv ("bootargs");
451
452 /* Only fix cmdline when requested */
453 if (!(gd->flags & GD_FLG_SILENT))
454 return;
455
456 debug ("before silent fix-up: %s\n", cmdline);
457 if (cmdline) {
458 if ((start = strstr (cmdline, "console=")) != NULL) {
459 end = strchr (start, ' ');
460 strncpy (buf, cmdline, (start - cmdline + 8));
461 if (end)
462 strcpy (buf + (start - cmdline + 8), end);
463 else
464 buf[start - cmdline + 8] = '\0';
465 } else {
466 strcpy (buf, cmdline);
467 strcat (buf, " console=");
468 }
469 } else {
470 strcpy (buf, "console=");
471 }
472
473 setenv ("bootargs", buf);
474 debug ("after silent fix-up: %s\n", buf);
475 }
476 #endif /* CONFIG_SILENT_CONSOLE */
477
478 #ifdef CONFIG_PPC
479 static void
480 do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
481 int argc, char *argv[],
482 ulong addr,
483 ulong *len_ptr,
484 int verify)
485 {
486 DECLARE_GLOBAL_DATA_PTR;
487
488 ulong sp;
489 ulong len, checksum;
490 ulong initrd_start, initrd_end;
491 ulong cmd_start, cmd_end;
492 ulong initrd_high;
493 ulong data;
494 int initrd_copy_to_ram = 1;
495 char *cmdline;
496 char *s;
497 bd_t *kbd;
498 void (*kernel)(bd_t *, ulong, ulong, ulong, ulong);
499 image_header_t *hdr = &header;
500
501 if ((s = getenv ("initrd_high")) != NULL) {
502 /* a value of "no" or a similar string will act like 0,
503 * turning the "load high" feature off. This is intentional.
504 */
505 initrd_high = simple_strtoul(s, NULL, 16);
506 if (initrd_high == ~0)
507 initrd_copy_to_ram = 0;
508 } else { /* not set, no restrictions to load high */
509 initrd_high = ~0;
510 }
511
512 #ifdef CONFIG_LOGBUFFER
513 kbd=gd->bd;
514 /* Prevent initrd from overwriting logbuffer */
515 if (initrd_high < (kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD))
516 initrd_high = kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD;
517 debug ("## Logbuffer at 0x%08lX ", kbd->bi_memsize-LOGBUFF_LEN);
518 #endif
519
520 /*
521 * Booting a (Linux) kernel image
522 *
523 * Allocate space for command line and board info - the
524 * address should be as high as possible within the reach of
525 * the kernel (see CFG_BOOTMAPSZ settings), but in unused
526 * memory, which means far enough below the current stack
527 * pointer.
528 */
529
530 asm( "mr %0,1": "=r"(sp) : );
531
532 debug ("## Current stack ends at 0x%08lX ", sp);
533
534 sp -= 2048; /* just to be sure */
535 if (sp > CFG_BOOTMAPSZ)
536 sp = CFG_BOOTMAPSZ;
537 sp &= ~0xF;
538
539 debug ("=> set upper limit to 0x%08lX\n", sp);
540
541 cmdline = (char *)((sp - CFG_BARGSIZE) & ~0xF);
542 kbd = (bd_t *)(((ulong)cmdline - sizeof(bd_t)) & ~0xF);
543
544 if ((s = getenv("bootargs")) == NULL)
545 s = "";
546
547 strcpy (cmdline, s);
548
549 cmd_start = (ulong)&cmdline[0];
550 cmd_end = cmd_start + strlen(cmdline);
551
552 *kbd = *(gd->bd);
553
554 #ifdef DEBUG
555 printf ("## cmdline at 0x%08lX ... 0x%08lX\n", cmd_start, cmd_end);
556
557 do_bdinfo (NULL, 0, 0, NULL);
558 #endif
559
560 if ((s = getenv ("clocks_in_mhz")) != NULL) {
561 /* convert all clock information to MHz */
562 kbd->bi_intfreq /= 1000000L;
563 kbd->bi_busfreq /= 1000000L;
564 #if defined(CONFIG_8260) || defined(CONFIG_MPC8560)
565 kbd->bi_cpmfreq /= 1000000L;
566 kbd->bi_brgfreq /= 1000000L;
567 kbd->bi_sccfreq /= 1000000L;
568 kbd->bi_vco /= 1000000L;
569 #endif /* CONFIG_8260 */
570 #if defined(CONFIG_MPC5XXX)
571 kbd->bi_ipbfreq /= 1000000L;
572 kbd->bi_pcifreq /= 1000000L;
573 #endif /* CONFIG_MPC5XXX */
574 }
575
576 kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))hdr->ih_ep;
577
578 /*
579 * Check if there is an initrd image
580 */
581 if (argc >= 3) {
582 SHOW_BOOT_PROGRESS (9);
583
584 addr = simple_strtoul(argv[2], NULL, 16);
585
586 printf ("## Loading RAMDisk Image at %08lx ...\n", addr);
587
588 /* Copy header so we can blank CRC field for re-calculation */
589 memmove (&header, (char *)addr, sizeof(image_header_t));
590
591 if (hdr->ih_magic != IH_MAGIC) {
592 printf ("Bad Magic Number\n");
593 SHOW_BOOT_PROGRESS (-10);
594 do_reset (cmdtp, flag, argc, argv);
595 }
596
597 data = (ulong)&header;
598 len = sizeof(image_header_t);
599
600 checksum = hdr->ih_hcrc;
601 hdr->ih_hcrc = 0;
602
603 if (crc32 (0, (char *)data, len) != checksum) {
604 printf ("Bad Header Checksum\n");
605 SHOW_BOOT_PROGRESS (-11);
606 do_reset (cmdtp, flag, argc, argv);
607 }
608
609 SHOW_BOOT_PROGRESS (10);
610
611 print_image_hdr (hdr);
612
613 data = addr + sizeof(image_header_t);
614 len = hdr->ih_size;
615
616 if (verify) {
617 ulong csum = 0;
618 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
619 ulong cdata = data, edata = cdata + len;
620 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
621
622 printf (" Verifying Checksum ... ");
623
624 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
625
626 while (cdata < edata) {
627 ulong chunk = edata - cdata;
628
629 if (chunk > CHUNKSZ)
630 chunk = CHUNKSZ;
631 csum = crc32 (csum, (char *)cdata, chunk);
632 cdata += chunk;
633
634 WATCHDOG_RESET();
635 }
636 #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
637 csum = crc32 (0, (char *)data, len);
638 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
639
640 if (csum != hdr->ih_dcrc) {
641 printf ("Bad Data CRC\n");
642 SHOW_BOOT_PROGRESS (-12);
643 do_reset (cmdtp, flag, argc, argv);
644 }
645 printf ("OK\n");
646 }
647
648 SHOW_BOOT_PROGRESS (11);
649
650 if ((hdr->ih_os != IH_OS_LINUX) ||
651 (hdr->ih_arch != IH_CPU_PPC) ||
652 (hdr->ih_type != IH_TYPE_RAMDISK) ) {
653 printf ("No Linux PPC Ramdisk Image\n");
654 SHOW_BOOT_PROGRESS (-13);
655 do_reset (cmdtp, flag, argc, argv);
656 }
657
658 /*
659 * Now check if we have a multifile image
660 */
661 } else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1])) {
662 u_long tail = ntohl(len_ptr[0]) % 4;
663 int i;
664
665 SHOW_BOOT_PROGRESS (13);
666
667 /* skip kernel length and terminator */
668 data = (ulong)(&len_ptr[2]);
669 /* skip any additional image length fields */
670 for (i=1; len_ptr[i]; ++i)
671 data += 4;
672 /* add kernel length, and align */
673 data += ntohl(len_ptr[0]);
674 if (tail) {
675 data += 4 - tail;
676 }
677
678 len = ntohl(len_ptr[1]);
679
680 } else {
681 /*
682 * no initrd image
683 */
684 SHOW_BOOT_PROGRESS (14);
685
686 len = data = 0;
687 }
688
689 if (!data) {
690 debug ("No initrd\n");
691 }
692
693 if (data) {
694 if (!initrd_copy_to_ram) { /* zero-copy ramdisk support */
695 initrd_start = data;
696 initrd_end = initrd_start + len;
697 } else {
698 initrd_start = (ulong)kbd - len;
699 initrd_start &= ~(4096 - 1); /* align on page */
700
701 if (initrd_high) {
702 ulong nsp;
703
704 /*
705 * the inital ramdisk does not need to be within
706 * CFG_BOOTMAPSZ as it is not accessed until after
707 * the mm system is initialised.
708 *
709 * do the stack bottom calculation again and see if
710 * the initrd will fit just below the monitor stack
711 * bottom without overwriting the area allocated
712 * above for command line args and board info.
713 */
714 asm( "mr %0,1": "=r"(nsp) : );
715 nsp -= 2048; /* just to be sure */
716 nsp &= ~0xF;
717 if (nsp > initrd_high) /* limit as specified */
718 nsp = initrd_high;
719 nsp -= len;
720 nsp &= ~(4096 - 1); /* align on page */
721 if (nsp >= sp)
722 initrd_start = nsp;
723 }
724
725 SHOW_BOOT_PROGRESS (12);
726
727 debug ("## initrd at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
728 data, data + len - 1, len, len);
729
730 initrd_end = initrd_start + len;
731 printf (" Loading Ramdisk to %08lx, end %08lx ... ",
732 initrd_start, initrd_end);
733 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
734 {
735 size_t l = len;
736 void *to = (void *)initrd_start;
737 void *from = (void *)data;
738
739 while (l > 0) {
740 size_t tail = (l > CHUNKSZ) ? CHUNKSZ : l;
741 WATCHDOG_RESET();
742 memmove (to, from, tail);
743 to += tail;
744 from += tail;
745 l -= tail;
746 }
747 }
748 #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
749 memmove ((void *)initrd_start, (void *)data, len);
750 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
751 printf ("OK\n");
752 }
753 } else {
754 initrd_start = 0;
755 initrd_end = 0;
756 }
757
758
759 debug ("## Transferring control to Linux (at address %08lx) ...\n",
760 (ulong)kernel);
761
762 SHOW_BOOT_PROGRESS (15);
763
764 #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
765 unlock_ram_in_cache();
766 #endif
767 /*
768 * Linux Kernel Parameters:
769 * r3: ptr to board info data
770 * r4: initrd_start or 0 if no initrd
771 * r5: initrd_end - unused if r4 is 0
772 * r6: Start of command line string
773 * r7: End of command line string
774 */
775 (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
776 }
777 #endif /* CONFIG_PPC */
778
779 static void
780 do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
781 int argc, char *argv[],
782 ulong addr,
783 ulong *len_ptr,
784 int verify)
785 {
786 DECLARE_GLOBAL_DATA_PTR;
787
788 image_header_t *hdr = &header;
789
790 void (*loader)(bd_t *, image_header_t *, char *, char *);
791 image_header_t *img_addr;
792 char *consdev;
793 char *cmdline;
794
795
796 /*
797 * Booting a (NetBSD) kernel image
798 *
799 * This process is pretty similar to a standalone application:
800 * The (first part of an multi-) image must be a stage-2 loader,
801 * which in turn is responsible for loading & invoking the actual
802 * kernel. The only differences are the parameters being passed:
803 * besides the board info strucure, the loader expects a command
804 * line, the name of the console device, and (optionally) the
805 * address of the original image header.
806 */
807
808 img_addr = 0;
809 if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1]))
810 img_addr = (image_header_t *) addr;
811
812
813 consdev = "";
814 #if defined (CONFIG_8xx_CONS_SMC1)
815 consdev = "smc1";
816 #elif defined (CONFIG_8xx_CONS_SMC2)
817 consdev = "smc2";
818 #elif defined (CONFIG_8xx_CONS_SCC2)
819 consdev = "scc2";
820 #elif defined (CONFIG_8xx_CONS_SCC3)
821 consdev = "scc3";
822 #endif
823
824 if (argc > 2) {
825 ulong len;
826 int i;
827
828 for (i=2, len=0 ; i<argc ; i+=1)
829 len += strlen (argv[i]) + 1;
830 cmdline = malloc (len);
831
832 for (i=2, len=0 ; i<argc ; i+=1) {
833 if (i > 2)
834 cmdline[len++] = ' ';
835 strcpy (&cmdline[len], argv[i]);
836 len += strlen (argv[i]);
837 }
838 } else if ((cmdline = getenv("bootargs")) == NULL) {
839 cmdline = "";
840 }
841
842 loader = (void (*)(bd_t *, image_header_t *, char *, char *)) hdr->ih_ep;
843
844 printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
845 (ulong)loader);
846
847 SHOW_BOOT_PROGRESS (15);
848
849 /*
850 * NetBSD Stage-2 Loader Parameters:
851 * r3: ptr to board info data
852 * r4: image address
853 * r5: console device
854 * r6: boot args string
855 */
856 (*loader) (gd->bd, img_addr, consdev, cmdline);
857 }
858
859 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
860
861 /* Function that returns a character from the environment */
862 extern uchar (*env_get_char)(int);
863
864 static void
865 do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
866 int argc, char *argv[],
867 ulong addr,
868 ulong *len_ptr,
869 int verify)
870 {
871 DECLARE_GLOBAL_DATA_PTR;
872 ulong top;
873 char *s, *cmdline;
874 char **fwenv, **ss;
875 int i, j, nxt, len, envno, envsz;
876 bd_t *kbd;
877 void (*entry)(bd_t *bd, char *cmdline, char **fwenv, ulong top);
878 image_header_t *hdr = &header;
879
880 /*
881 * Booting an ARTOS kernel image + application
882 */
883
884 /* this used to be the top of memory, but was wrong... */
885 #ifdef CONFIG_PPC
886 /* get stack pointer */
887 asm volatile ("mr %0,1" : "=r"(top) );
888 #endif
889 debug ("## Current stack ends at 0x%08lX ", top);
890
891 top -= 2048; /* just to be sure */
892 if (top > CFG_BOOTMAPSZ)
893 top = CFG_BOOTMAPSZ;
894 top &= ~0xF;
895
896 debug ("=> set upper limit to 0x%08lX\n", top);
897
898 /* first check the artos specific boot args, then the linux args*/
899 if ((s = getenv("abootargs")) == NULL && (s = getenv("bootargs")) == NULL)
900 s = "";
901
902 /* get length of cmdline, and place it */
903 len = strlen(s);
904 top = (top - (len + 1)) & ~0xF;
905 cmdline = (char *)top;
906 debug ("## cmdline at 0x%08lX ", top);
907 strcpy(cmdline, s);
908
909 /* copy bdinfo */
910 top = (top - sizeof(bd_t)) & ~0xF;
911 debug ("## bd at 0x%08lX ", top);
912 kbd = (bd_t *)top;
913 memcpy(kbd, gd->bd, sizeof(bd_t));
914
915 /* first find number of env entries, and their size */
916 envno = 0;
917 envsz = 0;
918 for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
919 for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
920 ;
921 envno++;
922 envsz += (nxt - i) + 1; /* plus trailing zero */
923 }
924 envno++; /* plus the terminating zero */
925 debug ("## %u envvars total size %u ", envno, envsz);
926
927 top = (top - sizeof(char **)*envno) & ~0xF;
928 fwenv = (char **)top;
929 debug ("## fwenv at 0x%08lX ", top);
930
931 top = (top - envsz) & ~0xF;
932 s = (char *)top;
933 ss = fwenv;
934
935 /* now copy them */
936 for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
937 for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
938 ;
939 *ss++ = s;
940 for (j = i; j < nxt; ++j)
941 *s++ = env_get_char(j);
942 *s++ = '\0';
943 }
944 *ss++ = NULL; /* terminate */
945
946 entry = (void (*)(bd_t *, char *, char **, ulong))ntohl(hdr->ih_ep);
947 (*entry)(kbd, cmdline, fwenv, top);
948 }
949 #endif
950
951
952 #if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
953 int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
954 {
955 int rcode = 0;
956 #ifndef CFG_HUSH_PARSER
957 if (run_command (getenv ("bootcmd"), flag) < 0) rcode = 1;
958 #else
959 if (parse_string_outer(getenv("bootcmd"),
960 FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0 ) rcode = 1;
961 #endif
962 return rcode;
963 }
964
965 U_BOOT_CMD(
966 boot, 1, 1, do_bootd,
967 "boot - boot default, i.e., run 'bootcmd'\n",
968 NULL
969 );
970
971 /* keep old command name "bootd" for backward compatibility */
972 U_BOOT_CMD(
973 bootd, 1, 1, do_bootd,
974 "bootd - boot default, i.e., run 'bootcmd'\n",
975 NULL
976 );
977
978 #endif
979
980 #if (CONFIG_COMMANDS & CFG_CMD_IMI)
981 int do_iminfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
982 {
983 int arg;
984 ulong addr;
985 int rcode=0;
986
987 if (argc < 2) {
988 return image_info (load_addr);
989 }
990
991 for (arg=1; arg <argc; ++arg) {
992 addr = simple_strtoul(argv[arg], NULL, 16);
993 if (image_info (addr) != 0) rcode = 1;
994 }
995 return rcode;
996 }
997
998 static int image_info (ulong addr)
999 {
1000 ulong data, len, checksum;
1001 image_header_t *hdr = &header;
1002
1003 printf ("\n## Checking Image at %08lx ...\n", addr);
1004
1005 /* Copy header so we can blank CRC field for re-calculation */
1006 memmove (&header, (char *)addr, sizeof(image_header_t));
1007
1008 if (ntohl(hdr->ih_magic) != IH_MAGIC) {
1009 printf (" Bad Magic Number\n");
1010 return 1;
1011 }
1012
1013 data = (ulong)&header;
1014 len = sizeof(image_header_t);
1015
1016 checksum = ntohl(hdr->ih_hcrc);
1017 hdr->ih_hcrc = 0;
1018
1019 if (crc32 (0, (char *)data, len) != checksum) {
1020 printf (" Bad Header Checksum\n");
1021 return 1;
1022 }
1023
1024 /* for multi-file images we need the data part, too */
1025 print_image_hdr ((image_header_t *)addr);
1026
1027 data = addr + sizeof(image_header_t);
1028 len = ntohl(hdr->ih_size);
1029
1030 printf (" Verifying Checksum ... ");
1031 if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
1032 printf (" Bad Data CRC\n");
1033 return 1;
1034 }
1035 printf ("OK\n");
1036 return 0;
1037 }
1038
1039 U_BOOT_CMD(
1040 iminfo, CFG_MAXARGS, 1, do_iminfo,
1041 "iminfo - print header information for application image\n",
1042 "addr [addr ...]\n"
1043 " - print header information for application image starting at\n"
1044 " address 'addr' in memory; this includes verification of the\n"
1045 " image contents (magic number, header and payload checksums)\n"
1046 );
1047
1048 #endif /* CFG_CMD_IMI */
1049
1050 #if (CONFIG_COMMANDS & CFG_CMD_IMLS)
1051 /*-----------------------------------------------------------------------
1052 * List all images found in flash.
1053 */
1054 int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1055 {
1056 flash_info_t *info;
1057 int i, j;
1058 image_header_t *hdr;
1059 ulong data, len, checksum;
1060
1061 for (i=0, info=&flash_info[0]; i<CFG_MAX_FLASH_BANKS; ++i, ++info) {
1062 if (info->flash_id == FLASH_UNKNOWN)
1063 goto next_bank;
1064 for (j=0; j<CFG_MAX_FLASH_SECT; ++j) {
1065
1066 if (!(hdr=(image_header_t *)info->start[j]) ||
1067 (ntohl(hdr->ih_magic) != IH_MAGIC))
1068 goto next_sector;
1069
1070 /* Copy header so we can blank CRC field for re-calculation */
1071 memmove (&header, (char *)hdr, sizeof(image_header_t));
1072
1073 checksum = ntohl(header.ih_hcrc);
1074 header.ih_hcrc = 0;
1075
1076 if (crc32 (0, (char *)&header, sizeof(image_header_t))
1077 != checksum)
1078 goto next_sector;
1079
1080 printf ("Image at %08lX:\n", (ulong)hdr);
1081 print_image_hdr( hdr );
1082
1083 data = (ulong)hdr + sizeof(image_header_t);
1084 len = ntohl(hdr->ih_size);
1085
1086 printf (" Verifying Checksum ... ");
1087 if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
1088 printf (" Bad Data CRC\n");
1089 }
1090 printf ("OK\n");
1091 next_sector: ;
1092 }
1093 next_bank: ;
1094 }
1095
1096 return (0);
1097 }
1098
1099 U_BOOT_CMD(
1100 imls, 1, 1, do_imls,
1101 "imls - list all images found in flash\n",
1102 "\n"
1103 " - Prints information about all images found at sector\n"
1104 " boundaries in flash.\n"
1105 );
1106 #endif /* CFG_CMD_IMLS */
1107
1108 void
1109 print_image_hdr (image_header_t *hdr)
1110 {
1111 #if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
1112 time_t timestamp = (time_t)ntohl(hdr->ih_time);
1113 struct rtc_time tm;
1114 #endif
1115
1116 printf (" Image Name: %.*s\n", IH_NMLEN, hdr->ih_name);
1117 #if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
1118 to_tm (timestamp, &tm);
1119 printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
1120 tm.tm_year, tm.tm_mon, tm.tm_mday,
1121 tm.tm_hour, tm.tm_min, tm.tm_sec);
1122 #endif /* CFG_CMD_DATE, CONFIG_TIMESTAMP */
1123 printf (" Image Type: "); print_type(hdr); printf ("\n");
1124 printf (" Data Size: %d Bytes = ", ntohl(hdr->ih_size));
1125 print_size (ntohl(hdr->ih_size), "\n");
1126 printf (" Load Address: %08x\n", ntohl(hdr->ih_load));
1127 printf (" Entry Point: %08x\n", ntohl(hdr->ih_ep));
1128
1129 if (hdr->ih_type == IH_TYPE_MULTI) {
1130 int i;
1131 ulong len;
1132 ulong *len_ptr = (ulong *)((ulong)hdr + sizeof(image_header_t));
1133
1134 printf (" Contents:\n");
1135 for (i=0; (len = ntohl(*len_ptr)); ++i, ++len_ptr) {
1136 printf (" Image %d: %8ld Bytes = ", i, len);
1137 print_size (len, "\n");
1138 }
1139 }
1140 }
1141
1142
1143 static void
1144 print_type (image_header_t *hdr)
1145 {
1146 char *os, *arch, *type, *comp;
1147
1148 switch (hdr->ih_os) {
1149 case IH_OS_INVALID: os = "Invalid OS"; break;
1150 case IH_OS_NETBSD: os = "NetBSD"; break;
1151 case IH_OS_LINUX: os = "Linux"; break;
1152 case IH_OS_VXWORKS: os = "VxWorks"; break;
1153 case IH_OS_QNX: os = "QNX"; break;
1154 case IH_OS_U_BOOT: os = "U-Boot"; break;
1155 case IH_OS_RTEMS: os = "RTEMS"; break;
1156 #ifdef CONFIG_ARTOS
1157 case IH_OS_ARTOS: os = "ARTOS"; break;
1158 #endif
1159 #ifdef CONFIG_LYNXKDI
1160 case IH_OS_LYNXOS: os = "LynxOS"; break;
1161 #endif
1162 default: os = "Unknown OS"; break;
1163 }
1164
1165 switch (hdr->ih_arch) {
1166 case IH_CPU_INVALID: arch = "Invalid CPU"; break;
1167 case IH_CPU_ALPHA: arch = "Alpha"; break;
1168 case IH_CPU_ARM: arch = "ARM"; break;
1169 case IH_CPU_I386: arch = "Intel x86"; break;
1170 case IH_CPU_IA64: arch = "IA64"; break;
1171 case IH_CPU_MIPS: arch = "MIPS"; break;
1172 case IH_CPU_MIPS64: arch = "MIPS 64 Bit"; break;
1173 case IH_CPU_PPC: arch = "PowerPC"; break;
1174 case IH_CPU_S390: arch = "IBM S390"; break;
1175 case IH_CPU_SH: arch = "SuperH"; break;
1176 case IH_CPU_SPARC: arch = "SPARC"; break;
1177 case IH_CPU_SPARC64: arch = "SPARC 64 Bit"; break;
1178 case IH_CPU_M68K: arch = "M68K"; break;
1179 default: arch = "Unknown Architecture"; break;
1180 }
1181
1182 switch (hdr->ih_type) {
1183 case IH_TYPE_INVALID: type = "Invalid Image"; break;
1184 case IH_TYPE_STANDALONE:type = "Standalone Program"; break;
1185 case IH_TYPE_KERNEL: type = "Kernel Image"; break;
1186 case IH_TYPE_RAMDISK: type = "RAMDisk Image"; break;
1187 case IH_TYPE_MULTI: type = "Multi-File Image"; break;
1188 case IH_TYPE_FIRMWARE: type = "Firmware"; break;
1189 case IH_TYPE_SCRIPT: type = "Script"; break;
1190 default: type = "Unknown Image"; break;
1191 }
1192
1193 switch (hdr->ih_comp) {
1194 case IH_COMP_NONE: comp = "uncompressed"; break;
1195 case IH_COMP_GZIP: comp = "gzip compressed"; break;
1196 case IH_COMP_BZIP2: comp = "bzip2 compressed"; break;
1197 default: comp = "unknown compression"; break;
1198 }
1199
1200 printf ("%s %s %s (%s)", arch, os, type, comp);
1201 }
1202
1203 #define ZALLOC_ALIGNMENT 16
1204
1205 static void *zalloc(void *x, unsigned items, unsigned size)
1206 {
1207 void *p;
1208
1209 size *= items;
1210 size = (size + ZALLOC_ALIGNMENT - 1) & ~(ZALLOC_ALIGNMENT - 1);
1211
1212 p = malloc (size);
1213
1214 return (p);
1215 }
1216
1217 static void zfree(void *x, void *addr, unsigned nb)
1218 {
1219 free (addr);
1220 }
1221
1222 #define HEAD_CRC 2
1223 #define EXTRA_FIELD 4
1224 #define ORIG_NAME 8
1225 #define COMMENT 0x10
1226 #define RESERVED 0xe0
1227
1228 #define DEFLATED 8
1229
1230 int gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
1231 {
1232 z_stream s;
1233 int r, i, flags;
1234
1235 /* skip header */
1236 i = 10;
1237 flags = src[3];
1238 if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
1239 printf ("Error: Bad gzipped data\n");
1240 return (-1);
1241 }
1242 if ((flags & EXTRA_FIELD) != 0)
1243 i = 12 + src[10] + (src[11] << 8);
1244 if ((flags & ORIG_NAME) != 0)
1245 while (src[i++] != 0)
1246 ;
1247 if ((flags & COMMENT) != 0)
1248 while (src[i++] != 0)
1249 ;
1250 if ((flags & HEAD_CRC) != 0)
1251 i += 2;
1252 if (i >= *lenp) {
1253 printf ("Error: gunzip out of data in header\n");
1254 return (-1);
1255 }
1256
1257 s.zalloc = zalloc;
1258 s.zfree = zfree;
1259 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
1260 s.outcb = (cb_func)WATCHDOG_RESET;
1261 #else
1262 s.outcb = Z_NULL;
1263 #endif /* CONFIG_HW_WATCHDOG */
1264
1265 r = inflateInit2(&s, -MAX_WBITS);
1266 if (r != Z_OK) {
1267 printf ("Error: inflateInit2() returned %d\n", r);
1268 return (-1);
1269 }
1270 s.next_in = src + i;
1271 s.avail_in = *lenp - i;
1272 s.next_out = dst;
1273 s.avail_out = dstlen;
1274 r = inflate(&s, Z_FINISH);
1275 if (r != Z_OK && r != Z_STREAM_END) {
1276 printf ("Error: inflate() returned %d\n", r);
1277 return (-1);
1278 }
1279 *lenp = s.next_out - (unsigned char *) dst;
1280 inflateEnd(&s);
1281
1282 return (0);
1283 }
1284
1285 #ifdef CONFIG_BZIP2
1286 void bz_internal_error(int errcode)
1287 {
1288 printf ("BZIP2 internal error %d\n", errcode);
1289 }
1290 #endif /* CONFIG_BZIP2 */
1291
1292 static void
1293 do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
1294 ulong addr, ulong *len_ptr, int verify)
1295 {
1296 DECLARE_GLOBAL_DATA_PTR;
1297 image_header_t *hdr = &header;
1298 void (*entry_point)(bd_t *);
1299
1300 entry_point = (void (*)(bd_t *)) hdr->ih_ep;
1301
1302 printf ("## Transferring control to RTEMS (at address %08lx) ...\n",
1303 (ulong)entry_point);
1304
1305 SHOW_BOOT_PROGRESS (15);
1306
1307 /*
1308 * RTEMS Parameters:
1309 * r3: ptr to board info data
1310 */
1311
1312 (*entry_point ) ( gd->bd );
1313 }
1314
1315 #if (CONFIG_COMMANDS & CFG_CMD_ELF)
1316 static void
1317 do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
1318 ulong addr, ulong *len_ptr, int verify)
1319 {
1320 image_header_t *hdr = &header;
1321 char str[80];
1322
1323 sprintf(str, "%x", hdr->ih_ep); /* write entry-point into string */
1324 setenv("loadaddr", str);
1325 do_bootvx(cmdtp, 0, 0, NULL);
1326 }
1327
1328 static void
1329 do_bootm_qnxelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
1330 ulong addr, ulong *len_ptr, int verify)
1331 {
1332 image_header_t *hdr = &header;
1333 char *local_args[2];
1334 char str[16];
1335
1336 sprintf(str, "%x", hdr->ih_ep); /* write entry-point into string */
1337 local_args[0] = argv[0];
1338 local_args[1] = str; /* and provide it via the arguments */
1339 do_bootelf(cmdtp, 0, 2, local_args);
1340 }
1341 #endif /* CFG_CMD_ELF */
1342
1343 #ifdef CONFIG_LYNXKDI
1344 static void
1345 do_bootm_lynxkdi (cmd_tbl_t *cmdtp, int flag,
1346 int argc, char *argv[],
1347 ulong addr,
1348 ulong *len_ptr,
1349 int verify)
1350 {
1351 lynxkdi_boot( &header );
1352 }
1353
1354 #endif /* CONFIG_LYNXKDI */