2 * (C) Copyright 2000-2006
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
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.
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.
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,
34 #include <environment.h>
35 #include <asm/byteorder.h>
37 #if defined(CONFIG_OF_LIBFDT)
40 #include <fdt_support.h>
42 #if defined(CONFIG_OF_FLAT_TREE)
46 DECLARE_GLOBAL_DATA_PTR;
49 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
51 #if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
55 #ifdef CFG_HUSH_PARSER
59 #ifdef CONFIG_SHOW_BOOT_PROGRESS
60 # include <status_led.h>
61 # define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
63 # define SHOW_BOOT_PROGRESS(arg)
66 #ifdef CFG_INIT_RAM_LOCK
67 #include <asm/cache.h>
70 #ifdef CONFIG_LOGBUFFER
74 #ifdef CONFIG_HAS_DATAFLASH
75 #include <dataflash.h>
79 * Some systems (for example LWMON) have very short watchdog periods;
80 * we must make sure to split long operations like memmove() or
81 * crc32() into reasonable chunks.
83 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
84 # define CHUNKSZ (64 * 1024)
87 int gunzip (void *, int, unsigned char *, unsigned long *);
89 static void *zalloc(void *, unsigned, unsigned);
90 static void zfree(void *, void *, unsigned);
92 #if (CONFIG_COMMANDS & CFG_CMD_IMI)
93 static int image_info (unsigned long addr);
96 #if (CONFIG_COMMANDS & CFG_CMD_IMLS)
98 extern flash_info_t flash_info[]; /* info for FLASH chips */
99 static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
102 static void print_type (image_header_t *hdr);
105 image_header_t *fake_header(image_header_t *hdr, void *ptr, int size);
109 * Continue booting an OS image; caller already has:
110 * - copied image header to global variable `header'
111 * - checked header magic number, checksums (both header & image),
112 * - verified image architecture (PPC) and type (KERNEL or MULTI),
113 * - loaded (first part of) image to header load address,
114 * - disabled interrupts.
116 typedef void boot_os_Fcn (cmd_tbl_t *cmdtp, int flag,
117 int argc, char *argv[],
118 ulong addr, /* of image to boot */
119 ulong *len_ptr, /* multi-file image length table */
120 int verify); /* getenv("verify")[0] != 'n' */
123 extern int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
127 static boot_os_Fcn do_bootm_linux;
129 extern boot_os_Fcn do_bootm_linux;
131 #ifdef CONFIG_SILENT_CONSOLE
132 static void fixup_silent_linux (void);
134 static boot_os_Fcn do_bootm_netbsd;
135 static boot_os_Fcn do_bootm_rtems;
136 #if (CONFIG_COMMANDS & CFG_CMD_ELF)
137 static boot_os_Fcn do_bootm_vxworks;
138 static boot_os_Fcn do_bootm_qnxelf;
139 int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
140 int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
141 #endif /* CFG_CMD_ELF */
142 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
143 static boot_os_Fcn do_bootm_artos;
145 #ifdef CONFIG_LYNXKDI
146 static boot_os_Fcn do_bootm_lynxkdi;
147 extern void lynxkdi_boot( image_header_t * );
150 #ifndef CFG_BOOTM_LEN
151 #define CFG_BOOTM_LEN 0x800000 /* use 8MByte as default max gunzip size */
154 image_header_t header;
156 ulong load_addr = CFG_LOAD_ADDR; /* Default Load Address */
158 int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
162 ulong data, len, checksum;
164 uint unc_len = CFG_BOOTM_LEN;
167 int (*appl)(int, char *[]);
168 image_header_t *hdr = &header;
170 s = getenv ("verify");
171 verify = (s && (*s == 'n')) ? 0 : 1;
176 addr = simple_strtoul(argv[1], NULL, 16);
179 SHOW_BOOT_PROGRESS (1);
180 printf ("## Booting image at %08lx ...\n", addr);
182 /* Copy header so we can blank CRC field for re-calculation */
183 #ifdef CONFIG_HAS_DATAFLASH
184 if (addr_dataflash(addr)){
185 read_dataflash(addr, sizeof(image_header_t), (char *)&header);
188 memmove (&header, (char *)addr, sizeof(image_header_t));
190 if (ntohl(hdr->ih_magic) != IH_MAGIC) {
191 #ifdef __I386__ /* correct image format not implemented yet - fake it */
192 if (fake_header(hdr, (void*)addr, -1) != NULL) {
193 /* to compensate for the addition below */
194 addr -= sizeof(image_header_t);
196 * fake_header() does not fake the data crc
200 #endif /* __I386__ */
202 puts ("Bad Magic Number\n");
203 SHOW_BOOT_PROGRESS (-1);
207 SHOW_BOOT_PROGRESS (2);
209 data = (ulong)&header;
210 len = sizeof(image_header_t);
212 checksum = ntohl(hdr->ih_hcrc);
215 if (crc32 (0, (uchar *)data, len) != checksum) {
216 puts ("Bad Header Checksum\n");
217 SHOW_BOOT_PROGRESS (-2);
220 SHOW_BOOT_PROGRESS (3);
222 #ifdef CONFIG_HAS_DATAFLASH
223 if (addr_dataflash(addr)){
224 len = ntohl(hdr->ih_size) + sizeof(image_header_t);
225 read_dataflash(addr, len, (char *)CFG_LOAD_ADDR);
226 addr = CFG_LOAD_ADDR;
231 /* for multi-file images we need the data part, too */
232 print_image_hdr ((image_header_t *)addr);
234 data = addr + sizeof(image_header_t);
235 len = ntohl(hdr->ih_size);
238 puts (" Verifying Checksum ... ");
239 if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
240 printf ("Bad Data CRC\n");
241 SHOW_BOOT_PROGRESS (-3);
246 SHOW_BOOT_PROGRESS (4);
248 len_ptr = (ulong *)data;
251 if (hdr->ih_arch != IH_CPU_ARM)
252 #elif defined(__avr32__)
253 if (hdr->ih_arch != IH_CPU_AVR32)
254 #elif defined(__bfin__)
255 if (hdr->ih_arch != IH_CPU_BLACKFIN)
256 #elif defined(__I386__)
257 if (hdr->ih_arch != IH_CPU_I386)
258 #elif defined(__M68K__)
259 if (hdr->ih_arch != IH_CPU_M68K)
260 #elif defined(__microblaze__)
261 if (hdr->ih_arch != IH_CPU_MICROBLAZE)
262 #elif defined(__mips__)
263 if (hdr->ih_arch != IH_CPU_MIPS)
264 #elif defined(__nios__)
265 if (hdr->ih_arch != IH_CPU_NIOS)
266 #elif defined(__nios2__)
267 if (hdr->ih_arch != IH_CPU_NIOS2)
268 #elif defined(__PPC__)
269 if (hdr->ih_arch != IH_CPU_PPC)
270 #elif defined(__sh__)
271 if (hdr->ih_arch != IH_CPU_SH)
273 # error Unknown CPU type
276 printf ("Unsupported Architecture 0x%x\n", hdr->ih_arch);
277 SHOW_BOOT_PROGRESS (-4);
280 SHOW_BOOT_PROGRESS (5);
282 switch (hdr->ih_type) {
283 case IH_TYPE_STANDALONE:
284 name = "Standalone Application";
285 /* A second argument overwrites the load address */
287 hdr->ih_load = htonl(simple_strtoul(argv[2], NULL, 16));
291 name = "Kernel Image";
294 name = "Multi-File Image";
295 len = ntohl(len_ptr[0]);
296 /* OS kernel is always the first image */
297 data += 8; /* kernel_len + terminator */
298 for (i=1; len_ptr[i]; ++i)
301 default: printf ("Wrong Image Type for %s command\n", cmdtp->name);
302 SHOW_BOOT_PROGRESS (-5);
305 SHOW_BOOT_PROGRESS (6);
308 * We have reached the point of no return: we are going to
309 * overwrite all exception vector code, so we cannot easily
310 * recover from any failures any more...
313 iflag = disable_interrupts();
315 #ifdef CONFIG_AMIGAONEG3SE
317 * We've possible left the caches enabled during
318 * bios emulation, so turn them off again
321 invalidate_l1_instruction_cache();
326 switch (hdr->ih_comp) {
328 if(ntohl(hdr->ih_load) == addr) {
329 printf (" XIP %s ... ", name);
331 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
333 void *to = (void *)ntohl(hdr->ih_load);
334 void *from = (void *)data;
336 printf (" Loading %s ... ", name);
339 size_t tail = (l > CHUNKSZ) ? CHUNKSZ : l;
341 memmove (to, from, tail);
346 #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
347 memmove ((void *) ntohl(hdr->ih_load), (uchar *)data, len);
348 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
352 printf (" Uncompressing %s ... ", name);
353 if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
354 (uchar *)data, &len) != 0) {
355 puts ("GUNZIP ERROR - must RESET board to recover\n");
356 SHOW_BOOT_PROGRESS (-6);
357 do_reset (cmdtp, flag, argc, argv);
362 printf (" Uncompressing %s ... ", name);
364 * If we've got less than 4 MB of malloc() space,
365 * use slower decompression algorithm which requires
366 * at most 2300 KB of memory.
368 i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
369 &unc_len, (char *)data, len,
370 CFG_MALLOC_LEN < (4096 * 1024), 0);
372 printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
373 SHOW_BOOT_PROGRESS (-6);
375 do_reset (cmdtp, flag, argc, argv);
378 #endif /* CONFIG_BZIP2 */
382 printf ("Unimplemented compression type %d\n", hdr->ih_comp);
383 SHOW_BOOT_PROGRESS (-7);
387 SHOW_BOOT_PROGRESS (7);
389 switch (hdr->ih_type) {
390 case IH_TYPE_STANDALONE:
394 /* load (and uncompress), but don't start if "autostart"
397 if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0)) {
399 sprintf(buf, "%lX", len);
400 setenv("filesize", buf);
403 appl = (int (*)(int, char *[]))ntohl(hdr->ih_ep);
404 (*appl)(argc-1, &argv[1]);
413 printf ("Can't boot image type %d\n", hdr->ih_type);
414 SHOW_BOOT_PROGRESS (-8);
417 SHOW_BOOT_PROGRESS (8);
419 switch (hdr->ih_os) {
420 default: /* handled by (original) Linux case */
422 #ifdef CONFIG_SILENT_CONSOLE
423 fixup_silent_linux();
425 do_bootm_linux (cmdtp, flag, argc, argv,
426 addr, len_ptr, verify);
429 do_bootm_netbsd (cmdtp, flag, argc, argv,
430 addr, len_ptr, verify);
433 #ifdef CONFIG_LYNXKDI
435 do_bootm_lynxkdi (cmdtp, flag, argc, argv,
436 addr, len_ptr, verify);
441 do_bootm_rtems (cmdtp, flag, argc, argv,
442 addr, len_ptr, verify);
445 #if (CONFIG_COMMANDS & CFG_CMD_ELF)
447 do_bootm_vxworks (cmdtp, flag, argc, argv,
448 addr, len_ptr, verify);
451 do_bootm_qnxelf (cmdtp, flag, argc, argv,
452 addr, len_ptr, verify);
454 #endif /* CFG_CMD_ELF */
457 do_bootm_artos (cmdtp, flag, argc, argv,
458 addr, len_ptr, verify);
463 SHOW_BOOT_PROGRESS (-9);
465 puts ("\n## Control returned to monitor - resetting...\n");
466 do_reset (cmdtp, flag, argc, argv);
472 bootm, CFG_MAXARGS, 1, do_bootm,
473 "bootm - boot application image from memory\n",
474 "[addr [arg ...]]\n - boot application image stored in memory\n"
475 "\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
476 "\t'arg' can be the address of an initrd image\n"
477 #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
478 "\tWhen booting a Linux kernel which requires a flat device-tree\n"
479 "\ta third argument is required which is the address of the of the\n"
480 "\tdevice-tree blob. To boot that kernel without an initrd image,\n"
481 "\tuse a '-' for the second argument. If you do not pass a third\n"
482 "\ta bd_info struct will be passed instead\n"
486 #ifdef CONFIG_SILENT_CONSOLE
488 fixup_silent_linux ()
490 char buf[256], *start, *end;
491 char *cmdline = getenv ("bootargs");
493 /* Only fix cmdline when requested */
494 if (!(gd->flags & GD_FLG_SILENT))
497 debug ("before silent fix-up: %s\n", cmdline);
499 if ((start = strstr (cmdline, "console=")) != NULL) {
500 end = strchr (start, ' ');
501 strncpy (buf, cmdline, (start - cmdline + 8));
503 strcpy (buf + (start - cmdline + 8), end);
505 buf[start - cmdline + 8] = '\0';
507 strcpy (buf, cmdline);
508 strcat (buf, " console=");
511 strcpy (buf, "console=");
514 setenv ("bootargs", buf);
515 debug ("after silent fix-up: %s\n", buf);
517 #endif /* CONFIG_SILENT_CONSOLE */
520 static void __attribute__((noinline))
521 do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
522 int argc, char *argv[],
529 ulong initrd_start, initrd_end;
530 ulong cmd_start, cmd_end;
533 int initrd_copy_to_ram = 1;
537 void (*kernel)(bd_t *, ulong, ulong, ulong, ulong);
538 image_header_t *hdr = &header;
539 #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
540 char *of_flat_tree = NULL;
544 if ((s = getenv ("initrd_high")) != NULL) {
545 /* a value of "no" or a similar string will act like 0,
546 * turning the "load high" feature off. This is intentional.
548 initrd_high = simple_strtoul(s, NULL, 16);
549 if (initrd_high == ~0)
550 initrd_copy_to_ram = 0;
551 } else { /* not set, no restrictions to load high */
555 #ifdef CONFIG_LOGBUFFER
557 /* Prevent initrd from overwriting logbuffer */
558 if (initrd_high < (kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD))
559 initrd_high = kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD;
560 debug ("## Logbuffer at 0x%08lX ", kbd->bi_memsize-LOGBUFF_LEN);
564 * Booting a (Linux) kernel image
566 * Allocate space for command line and board info - the
567 * address should be as high as possible within the reach of
568 * the kernel (see CFG_BOOTMAPSZ settings), but in unused
569 * memory, which means far enough below the current stack
573 asm( "mr %0,1": "=r"(sp) : );
575 debug ("## Current stack ends at 0x%08lX ", sp);
577 sp -= 2048; /* just to be sure */
578 if (sp > CFG_BOOTMAPSZ)
582 debug ("=> set upper limit to 0x%08lX\n", sp);
584 cmdline = (char *)((sp - CFG_BARGSIZE) & ~0xF);
585 kbd = (bd_t *)(((ulong)cmdline - sizeof(bd_t)) & ~0xF);
587 if ((s = getenv("bootargs")) == NULL)
592 cmd_start = (ulong)&cmdline[0];
593 cmd_end = cmd_start + strlen(cmdline);
598 printf ("## cmdline at 0x%08lX ... 0x%08lX\n", cmd_start, cmd_end);
600 do_bdinfo (NULL, 0, 0, NULL);
603 if ((s = getenv ("clocks_in_mhz")) != NULL) {
604 /* convert all clock information to MHz */
605 kbd->bi_intfreq /= 1000000L;
606 kbd->bi_busfreq /= 1000000L;
607 #if defined(CONFIG_MPC8220)
608 kbd->bi_inpfreq /= 1000000L;
609 kbd->bi_pcifreq /= 1000000L;
610 kbd->bi_pevfreq /= 1000000L;
611 kbd->bi_flbfreq /= 1000000L;
612 kbd->bi_vcofreq /= 1000000L;
614 #if defined(CONFIG_CPM2)
615 kbd->bi_cpmfreq /= 1000000L;
616 kbd->bi_brgfreq /= 1000000L;
617 kbd->bi_sccfreq /= 1000000L;
618 kbd->bi_vco /= 1000000L;
620 #if defined(CONFIG_MPC5xxx)
621 kbd->bi_ipbfreq /= 1000000L;
622 kbd->bi_pcifreq /= 1000000L;
623 #endif /* CONFIG_MPC5xxx */
626 kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong)) ntohl(hdr->ih_ep);
629 * Check if there is an initrd image
632 #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
633 /* Look for a '-' which indicates to ignore the ramdisk argument */
634 if (argc >= 3 && strcmp(argv[2], "-") == 0) {
635 debug ("Skipping initrd\n");
641 debug ("Not skipping initrd\n");
642 SHOW_BOOT_PROGRESS (9);
644 addr = simple_strtoul(argv[2], NULL, 16);
646 printf ("## Loading RAMDisk Image at %08lx ...\n", addr);
648 /* Copy header so we can blank CRC field for re-calculation */
649 memmove (&header, (char *)addr, sizeof(image_header_t));
651 if (ntohl(hdr->ih_magic) != IH_MAGIC) {
652 puts ("Bad Magic Number\n");
653 SHOW_BOOT_PROGRESS (-10);
654 do_reset (cmdtp, flag, argc, argv);
657 data = (ulong)&header;
658 len = sizeof(image_header_t);
660 checksum = ntohl(hdr->ih_hcrc);
663 if (crc32 (0, (uchar *)data, len) != checksum) {
664 puts ("Bad Header Checksum\n");
665 SHOW_BOOT_PROGRESS (-11);
666 do_reset (cmdtp, flag, argc, argv);
669 SHOW_BOOT_PROGRESS (10);
671 print_image_hdr (hdr);
673 data = addr + sizeof(image_header_t);
674 len = ntohl(hdr->ih_size);
678 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
679 ulong cdata = data, edata = cdata + len;
680 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
682 puts (" Verifying Checksum ... ");
684 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
686 while (cdata < edata) {
687 ulong chunk = edata - cdata;
691 csum = crc32 (csum, (uchar *)cdata, chunk);
696 #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
697 csum = crc32 (0, (uchar *)data, len);
698 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
700 if (csum != ntohl(hdr->ih_dcrc)) {
701 puts ("Bad Data CRC\n");
702 SHOW_BOOT_PROGRESS (-12);
703 do_reset (cmdtp, flag, argc, argv);
708 SHOW_BOOT_PROGRESS (11);
710 if ((hdr->ih_os != IH_OS_LINUX) ||
711 (hdr->ih_arch != IH_CPU_PPC) ||
712 (hdr->ih_type != IH_TYPE_RAMDISK) ) {
713 puts ("No Linux PPC Ramdisk Image\n");
714 SHOW_BOOT_PROGRESS (-13);
715 do_reset (cmdtp, flag, argc, argv);
719 * Now check if we have a multifile image
721 } else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1])) {
722 u_long tail = ntohl(len_ptr[0]) % 4;
725 SHOW_BOOT_PROGRESS (13);
727 /* skip kernel length and terminator */
728 data = (ulong)(&len_ptr[2]);
729 /* skip any additional image length fields */
730 for (i=1; len_ptr[i]; ++i)
732 /* add kernel length, and align */
733 data += ntohl(len_ptr[0]);
738 len = ntohl(len_ptr[1]);
744 SHOW_BOOT_PROGRESS (14);
749 #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
751 of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16);
752 hdr = (image_header_t *)of_flat_tree;
753 #if defined(CONFIG_OF_LIBFDT)
754 if (fdt_check_header(of_flat_tree) == 0) {
756 if (*(ulong *)of_flat_tree == OF_DT_HEADER) {
759 if (addr2info((ulong)of_flat_tree) != NULL)
760 of_data = (ulong)of_flat_tree;
762 } else if (ntohl(hdr->ih_magic) == IH_MAGIC) {
763 printf("## Flat Device Tree Image at %08lX\n", hdr);
764 print_image_hdr(hdr);
766 if ((ntohl(hdr->ih_load) < ((unsigned long)hdr + ntohl(hdr->ih_size) + sizeof(hdr))) &&
767 ((ntohl(hdr->ih_load) + ntohl(hdr->ih_size)) > (unsigned long)hdr)) {
768 printf ("ERROR: Load address overwrites Flat Device Tree uImage\n");
772 printf(" Verifying Checksum ... ");
773 memmove (&header, (char *)hdr, sizeof(image_header_t));
774 checksum = ntohl(header.ih_hcrc);
777 if(checksum != crc32(0, (uchar *)&header, sizeof(image_header_t))) {
778 printf("ERROR: Flat Device Tree header checksum is invalid\n");
782 checksum = ntohl(hdr->ih_dcrc);
783 addr = (ulong)((uchar *)(hdr) + sizeof(image_header_t));
785 if(checksum != crc32(0, (uchar *)addr, ntohl(hdr->ih_size))) {
786 printf("ERROR: Flat Device Tree checksum is invalid\n");
791 if (ntohl(hdr->ih_type) != IH_TYPE_FLATDT) {
792 printf ("ERROR: uImage not Flat Device Tree type\n");
795 if (ntohl(hdr->ih_comp) != IH_COMP_NONE) {
796 printf("ERROR: uImage is not uncompressed\n");
799 #if defined(CONFIG_OF_LIBFDT)
800 if (fdt_check_header(of_flat_tree + sizeof(image_header_t)) == 0) {
802 if (*((ulong *)(of_flat_tree + sizeof(image_header_t))) != OF_DT_HEADER) {
804 printf ("ERROR: uImage data is not a flat device tree\n");
808 memmove((void *)ntohl(hdr->ih_load),
809 (void *)(of_flat_tree + sizeof(image_header_t)),
810 ntohl(hdr->ih_size));
811 of_flat_tree = (char *)ntohl(hdr->ih_load);
813 printf ("Did not find a flat flat device tree at address %08lX\n", of_flat_tree);
816 printf (" Booting using flat device tree at 0x%x\n",
818 } else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1]) && (len_ptr[2])) {
819 u_long tail = ntohl(len_ptr[0]) % 4;
822 /* skip kernel length, initrd length, and terminator */
823 of_data = (ulong)(&len_ptr[3]);
824 /* skip any additional image length fields */
825 for (i=2; len_ptr[i]; ++i)
827 /* add kernel length, and align */
828 of_data += ntohl(len_ptr[0]);
833 /* add initrd length, and align */
834 tail = ntohl(len_ptr[1]) % 4;
835 of_data += ntohl(len_ptr[1]);
840 #if defined(CONFIG_OF_LIBFDT)
841 if (fdt_check_header((void *)of_data) != 0) {
843 if (((struct boot_param_header *)of_data)->magic != OF_DT_HEADER) {
845 printf ("ERROR: image is not a flat device tree\n");
849 #if defined(CONFIG_OF_LIBFDT)
850 if (be32_to_cpu(fdt_totalsize(of_data)) != ntohl(len_ptr[2])) {
852 if (((struct boot_param_header *)of_data)->totalsize != ntohl(len_ptr[2])) {
854 printf ("ERROR: flat device tree size does not agree with image\n");
860 debug ("No initrd\n");
864 if (!initrd_copy_to_ram) { /* zero-copy ramdisk support */
866 initrd_end = initrd_start + len;
868 initrd_start = (ulong)kbd - len;
869 initrd_start &= ~(4096 - 1); /* align on page */
875 * the inital ramdisk does not need to be within
876 * CFG_BOOTMAPSZ as it is not accessed until after
877 * the mm system is initialised.
879 * do the stack bottom calculation again and see if
880 * the initrd will fit just below the monitor stack
881 * bottom without overwriting the area allocated
882 * above for command line args and board info.
884 asm( "mr %0,1": "=r"(nsp) : );
885 nsp -= 2048; /* just to be sure */
887 if (nsp > initrd_high) /* limit as specified */
890 nsp &= ~(4096 - 1); /* align on page */
895 SHOW_BOOT_PROGRESS (12);
897 debug ("## initrd at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
898 data, data + len - 1, len, len);
900 initrd_end = initrd_start + len;
901 printf (" Loading Ramdisk to %08lx, end %08lx ... ",
902 initrd_start, initrd_end);
903 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
906 void *to = (void *)initrd_start;
907 void *from = (void *)data;
910 size_t tail = (l > CHUNKSZ) ? CHUNKSZ : l;
912 memmove (to, from, tail);
918 #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
919 memmove ((void *)initrd_start, (void *)data, len);
920 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
928 debug ("## Transferring control to Linux (at address %08lx) ...\n",
931 SHOW_BOOT_PROGRESS (15);
933 #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
934 unlock_ram_in_cache();
937 #if defined(CONFIG_OF_LIBFDT)
938 /* move of_flat_tree if needed */
941 ulong of_start, of_len;
943 of_len = be32_to_cpu(fdt_totalsize(of_data));
944 /* position on a 4K boundary before the initrd/kbd */
946 of_start = initrd_start - of_len;
948 of_start = (ulong)kbd - of_len;
949 of_start &= ~(4096 - 1); /* align on page */
950 debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
951 of_data, of_data + of_len - 1, of_len, of_len);
953 of_flat_tree = (char *)of_start;
954 printf (" Loading Device Tree to %08lx, end %08lx ... ",
955 of_start, of_start + of_len - 1);
956 err = fdt_open_into((void *)of_start, (void *)of_data, of_len);
958 printf ("libfdt: %s " __FILE__ " %d\n", fdt_strerror(err), __LINE__);
961 * Add the chosen node if it doesn't exist, add the env and bd_t
962 * if the user wants it (the logic is in the subroutines).
964 if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
965 printf("Failed creating the /chosen node (0x%08X), aborting.\n", of_flat_tree);
968 #ifdef CONFIG_OF_HAS_UBOOT_ENV
969 if (fdt_env(of_flat_tree) < 0) {
970 printf("Failed creating the /u-boot-env node, aborting.\n");
974 #ifdef CONFIG_OF_HAS_BD_T
975 if (fdt_bd_t(of_flat_tree) < 0) {
976 printf("Failed creating the /bd_t node, aborting.\n");
982 #if defined(CONFIG_OF_FLAT_TREE)
983 /* move of_flat_tree if needed */
985 ulong of_start, of_len;
986 of_len = ((struct boot_param_header *)of_data)->totalsize;
987 /* provide extra 8k pad */
989 of_start = initrd_start - of_len - 8192;
991 of_start = (ulong)kbd - of_len - 8192;
992 of_start &= ~(4096 - 1); /* align on page */
993 debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
994 of_data, of_data + of_len - 1, of_len, of_len);
996 of_flat_tree = (char *)of_start;
997 printf (" Loading Device Tree to %08lx, end %08lx ... ",
998 of_start, of_start + of_len - 1);
999 memmove ((void *)of_start, (void *)of_data, of_len);
1004 * Linux Kernel Parameters (passing board info data):
1005 * r3: ptr to board info data
1006 * r4: initrd_start or 0 if no initrd
1007 * r5: initrd_end - unused if r4 is 0
1008 * r6: Start of command line string
1009 * r7: End of command line string
1011 #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
1012 if (!of_flat_tree) /* no device tree; boot old style */
1014 (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
1015 /* does not return */
1017 #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
1019 * Linux Kernel Parameters (passing device tree):
1020 * r3: ptr to OF flat tree, followed by the board info data
1021 * r4: physical pointer to the kernel itself
1026 #if defined(CONFIG_OF_FLAT_TREE)
1027 ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
1028 /* ft_dump_blob(of_flat_tree); */
1030 #if defined(CONFIG_OF_LIBFDT)
1031 if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
1032 printf("Failed creating the /chosen node (0x%08X), aborting.\n", of_flat_tree);
1035 #ifdef CONFIG_OF_HAS_UBOOT_ENV
1036 if (fdt_env(of_flat_tree) < 0) {
1037 printf("Failed creating the /u-boot-env node, aborting.\n");
1041 #ifdef CONFIG_OF_HAS_BD_T
1042 if (fdt_bd_t(of_flat_tree) < 0) {
1043 printf("Failed creating the /bd_t node, aborting.\n");
1047 #endif /* if defined(CONFIG_OF_LIBFDT) */
1049 (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
1052 #endif /* CONFIG_PPC */
1055 do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
1056 int argc, char *argv[],
1061 image_header_t *hdr = &header;
1063 void (*loader)(bd_t *, image_header_t *, char *, char *);
1064 image_header_t *img_addr;
1070 * Booting a (NetBSD) kernel image
1072 * This process is pretty similar to a standalone application:
1073 * The (first part of an multi-) image must be a stage-2 loader,
1074 * which in turn is responsible for loading & invoking the actual
1075 * kernel. The only differences are the parameters being passed:
1076 * besides the board info strucure, the loader expects a command
1077 * line, the name of the console device, and (optionally) the
1078 * address of the original image header.
1082 if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1]))
1083 img_addr = (image_header_t *) addr;
1087 #if defined (CONFIG_8xx_CONS_SMC1)
1089 #elif defined (CONFIG_8xx_CONS_SMC2)
1091 #elif defined (CONFIG_8xx_CONS_SCC2)
1093 #elif defined (CONFIG_8xx_CONS_SCC3)
1101 for (i=2, len=0 ; i<argc ; i+=1)
1102 len += strlen (argv[i]) + 1;
1103 cmdline = malloc (len);
1105 for (i=2, len=0 ; i<argc ; i+=1) {
1107 cmdline[len++] = ' ';
1108 strcpy (&cmdline[len], argv[i]);
1109 len += strlen (argv[i]);
1111 } else if ((cmdline = getenv("bootargs")) == NULL) {
1115 loader = (void (*)(bd_t *, image_header_t *, char *, char *)) ntohl(hdr->ih_ep);
1117 printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
1120 SHOW_BOOT_PROGRESS (15);
1123 * NetBSD Stage-2 Loader Parameters:
1124 * r3: ptr to board info data
1126 * r5: console device
1127 * r6: boot args string
1129 (*loader) (gd->bd, img_addr, consdev, cmdline);
1132 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
1134 /* Function that returns a character from the environment */
1135 extern uchar (*env_get_char)(int);
1138 do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
1139 int argc, char *argv[],
1147 int i, j, nxt, len, envno, envsz;
1149 void (*entry)(bd_t *bd, char *cmdline, char **fwenv, ulong top);
1150 image_header_t *hdr = &header;
1153 * Booting an ARTOS kernel image + application
1156 /* this used to be the top of memory, but was wrong... */
1158 /* get stack pointer */
1159 asm volatile ("mr %0,1" : "=r"(top) );
1161 debug ("## Current stack ends at 0x%08lX ", top);
1163 top -= 2048; /* just to be sure */
1164 if (top > CFG_BOOTMAPSZ)
1165 top = CFG_BOOTMAPSZ;
1168 debug ("=> set upper limit to 0x%08lX\n", top);
1170 /* first check the artos specific boot args, then the linux args*/
1171 if ((s = getenv("abootargs")) == NULL && (s = getenv("bootargs")) == NULL)
1174 /* get length of cmdline, and place it */
1176 top = (top - (len + 1)) & ~0xF;
1177 cmdline = (char *)top;
1178 debug ("## cmdline at 0x%08lX ", top);
1182 top = (top - sizeof(bd_t)) & ~0xF;
1183 debug ("## bd at 0x%08lX ", top);
1185 memcpy(kbd, gd->bd, sizeof(bd_t));
1187 /* first find number of env entries, and their size */
1190 for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
1191 for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
1194 envsz += (nxt - i) + 1; /* plus trailing zero */
1196 envno++; /* plus the terminating zero */
1197 debug ("## %u envvars total size %u ", envno, envsz);
1199 top = (top - sizeof(char **)*envno) & ~0xF;
1200 fwenv = (char **)top;
1201 debug ("## fwenv at 0x%08lX ", top);
1203 top = (top - envsz) & ~0xF;
1208 for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
1209 for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
1212 for (j = i; j < nxt; ++j)
1213 *s++ = env_get_char(j);
1216 *ss++ = NULL; /* terminate */
1218 entry = (void (*)(bd_t *, char *, char **, ulong))ntohl(hdr->ih_ep);
1219 (*entry)(kbd, cmdline, fwenv, top);
1224 #if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
1225 int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1228 #ifndef CFG_HUSH_PARSER
1229 if (run_command (getenv ("bootcmd"), flag) < 0) rcode = 1;
1231 if (parse_string_outer(getenv("bootcmd"),
1232 FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0 ) rcode = 1;
1238 boot, 1, 1, do_bootd,
1239 "boot - boot default, i.e., run 'bootcmd'\n",
1243 /* keep old command name "bootd" for backward compatibility */
1245 bootd, 1, 1, do_bootd,
1246 "bootd - boot default, i.e., run 'bootcmd'\n",
1252 #if (CONFIG_COMMANDS & CFG_CMD_IMI)
1253 int do_iminfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1260 return image_info (load_addr);
1263 for (arg=1; arg <argc; ++arg) {
1264 addr = simple_strtoul(argv[arg], NULL, 16);
1265 if (image_info (addr) != 0) rcode = 1;
1270 static int image_info (ulong addr)
1272 ulong data, len, checksum;
1273 image_header_t *hdr = &header;
1275 printf ("\n## Checking Image at %08lx ...\n", addr);
1277 /* Copy header so we can blank CRC field for re-calculation */
1278 memmove (&header, (char *)addr, sizeof(image_header_t));
1280 if (ntohl(hdr->ih_magic) != IH_MAGIC) {
1281 puts (" Bad Magic Number\n");
1285 data = (ulong)&header;
1286 len = sizeof(image_header_t);
1288 checksum = ntohl(hdr->ih_hcrc);
1291 if (crc32 (0, (uchar *)data, len) != checksum) {
1292 puts (" Bad Header Checksum\n");
1296 /* for multi-file images we need the data part, too */
1297 print_image_hdr ((image_header_t *)addr);
1299 data = addr + sizeof(image_header_t);
1300 len = ntohl(hdr->ih_size);
1302 puts (" Verifying Checksum ... ");
1303 if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
1304 puts (" Bad Data CRC\n");
1312 iminfo, CFG_MAXARGS, 1, do_iminfo,
1313 "iminfo - print header information for application image\n",
1315 " - print header information for application image starting at\n"
1316 " address 'addr' in memory; this includes verification of the\n"
1317 " image contents (magic number, header and payload checksums)\n"
1320 #endif /* CFG_CMD_IMI */
1322 #if (CONFIG_COMMANDS & CFG_CMD_IMLS)
1323 /*-----------------------------------------------------------------------
1324 * List all images found in flash.
1326 int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1330 image_header_t *hdr;
1331 ulong data, len, checksum;
1333 for (i=0, info=&flash_info[0]; i<CFG_MAX_FLASH_BANKS; ++i, ++info) {
1334 if (info->flash_id == FLASH_UNKNOWN)
1336 for (j=0; j<info->sector_count; ++j) {
1338 if (!(hdr=(image_header_t *)info->start[j]) ||
1339 (ntohl(hdr->ih_magic) != IH_MAGIC))
1342 /* Copy header so we can blank CRC field for re-calculation */
1343 memmove (&header, (char *)hdr, sizeof(image_header_t));
1345 checksum = ntohl(header.ih_hcrc);
1348 if (crc32 (0, (uchar *)&header, sizeof(image_header_t))
1352 printf ("Image at %08lX:\n", (ulong)hdr);
1353 print_image_hdr( hdr );
1355 data = (ulong)hdr + sizeof(image_header_t);
1356 len = ntohl(hdr->ih_size);
1358 puts (" Verifying Checksum ... ");
1359 if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
1360 puts (" Bad Data CRC\n");
1372 imls, 1, 1, do_imls,
1373 "imls - list all images found in flash\n",
1375 " - Prints information about all images found at sector\n"
1376 " boundaries in flash.\n"
1378 #endif /* CFG_CMD_IMLS */
1381 print_image_hdr (image_header_t *hdr)
1383 #if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
1384 time_t timestamp = (time_t)ntohl(hdr->ih_time);
1388 printf (" Image Name: %.*s\n", IH_NMLEN, hdr->ih_name);
1389 #if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP)
1390 to_tm (timestamp, &tm);
1391 printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
1392 tm.tm_year, tm.tm_mon, tm.tm_mday,
1393 tm.tm_hour, tm.tm_min, tm.tm_sec);
1394 #endif /* CFG_CMD_DATE, CONFIG_TIMESTAMP */
1395 puts (" Image Type: "); print_type(hdr);
1396 printf ("\n Data Size: %d Bytes = ", ntohl(hdr->ih_size));
1397 print_size (ntohl(hdr->ih_size), "\n");
1398 printf (" Load Address: %08x\n"
1399 " Entry Point: %08x\n",
1400 ntohl(hdr->ih_load), ntohl(hdr->ih_ep));
1402 if (hdr->ih_type == IH_TYPE_MULTI) {
1405 ulong *len_ptr = (ulong *)((ulong)hdr + sizeof(image_header_t));
1407 puts (" Contents:\n");
1408 for (i=0; (len = ntohl(*len_ptr)); ++i, ++len_ptr) {
1409 printf (" Image %d: %8ld Bytes = ", i, len);
1410 print_size (len, "\n");
1417 print_type (image_header_t *hdr)
1419 char *os, *arch, *type, *comp;
1421 switch (hdr->ih_os) {
1422 case IH_OS_INVALID: os = "Invalid OS"; break;
1423 case IH_OS_NETBSD: os = "NetBSD"; break;
1424 case IH_OS_LINUX: os = "Linux"; break;
1425 case IH_OS_VXWORKS: os = "VxWorks"; break;
1426 case IH_OS_QNX: os = "QNX"; break;
1427 case IH_OS_U_BOOT: os = "U-Boot"; break;
1428 case IH_OS_RTEMS: os = "RTEMS"; break;
1430 case IH_OS_ARTOS: os = "ARTOS"; break;
1432 #ifdef CONFIG_LYNXKDI
1433 case IH_OS_LYNXOS: os = "LynxOS"; break;
1435 default: os = "Unknown OS"; break;
1438 switch (hdr->ih_arch) {
1439 case IH_CPU_INVALID: arch = "Invalid CPU"; break;
1440 case IH_CPU_ALPHA: arch = "Alpha"; break;
1441 case IH_CPU_ARM: arch = "ARM"; break;
1442 case IH_CPU_AVR32: arch = "AVR32"; break;
1443 case IH_CPU_BLACKFIN: arch = "Blackfin"; break;
1444 case IH_CPU_I386: arch = "Intel x86"; break;
1445 case IH_CPU_IA64: arch = "IA64"; break;
1446 case IH_CPU_M68K: arch = "M68K"; break;
1447 case IH_CPU_MICROBLAZE: arch = "Microblaze"; break;
1448 case IH_CPU_MIPS64: arch = "MIPS 64 Bit"; break;
1449 case IH_CPU_MIPS: arch = "MIPS"; break;
1450 case IH_CPU_NIOS2: arch = "Nios-II"; break;
1451 case IH_CPU_NIOS: arch = "Nios"; break;
1452 case IH_CPU_PPC: arch = "PowerPC"; break;
1453 case IH_CPU_S390: arch = "IBM S390"; break;
1454 case IH_CPU_SH: arch = "SuperH"; break;
1455 case IH_CPU_SPARC64: arch = "SPARC 64 Bit"; break;
1456 case IH_CPU_SPARC: arch = "SPARC"; break;
1457 default: arch = "Unknown Architecture"; break;
1460 switch (hdr->ih_type) {
1461 case IH_TYPE_INVALID: type = "Invalid Image"; break;
1462 case IH_TYPE_STANDALONE:type = "Standalone Program"; break;
1463 case IH_TYPE_KERNEL: type = "Kernel Image"; break;
1464 case IH_TYPE_RAMDISK: type = "RAMDisk Image"; break;
1465 case IH_TYPE_MULTI: type = "Multi-File Image"; break;
1466 case IH_TYPE_FIRMWARE: type = "Firmware"; break;
1467 case IH_TYPE_SCRIPT: type = "Script"; break;
1468 case IH_TYPE_FLATDT: type = "Flat Device Tree"; break;
1469 default: type = "Unknown Image"; break;
1472 switch (hdr->ih_comp) {
1473 case IH_COMP_NONE: comp = "uncompressed"; break;
1474 case IH_COMP_GZIP: comp = "gzip compressed"; break;
1475 case IH_COMP_BZIP2: comp = "bzip2 compressed"; break;
1476 default: comp = "unknown compression"; break;
1479 printf ("%s %s %s (%s)", arch, os, type, comp);
1482 #define ZALLOC_ALIGNMENT 16
1484 static void *zalloc(void *x, unsigned items, unsigned size)
1489 size = (size + ZALLOC_ALIGNMENT - 1) & ~(ZALLOC_ALIGNMENT - 1);
1496 static void zfree(void *x, void *addr, unsigned nb)
1502 #define EXTRA_FIELD 4
1504 #define COMMENT 0x10
1505 #define RESERVED 0xe0
1509 int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)
1517 if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
1518 puts ("Error: Bad gzipped data\n");
1521 if ((flags & EXTRA_FIELD) != 0)
1522 i = 12 + src[10] + (src[11] << 8);
1523 if ((flags & ORIG_NAME) != 0)
1524 while (src[i++] != 0)
1526 if ((flags & COMMENT) != 0)
1527 while (src[i++] != 0)
1529 if ((flags & HEAD_CRC) != 0)
1532 puts ("Error: gunzip out of data in header\n");
1538 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
1539 s.outcb = (cb_func)WATCHDOG_RESET;
1542 #endif /* CONFIG_HW_WATCHDOG */
1544 r = inflateInit2(&s, -MAX_WBITS);
1546 printf ("Error: inflateInit2() returned %d\n", r);
1549 s.next_in = src + i;
1550 s.avail_in = *lenp - i;
1552 s.avail_out = dstlen;
1553 r = inflate(&s, Z_FINISH);
1554 if (r != Z_OK && r != Z_STREAM_END) {
1555 printf ("Error: inflate() returned %d\n", r);
1558 *lenp = s.next_out - (unsigned char *) dst;
1565 void bz_internal_error(int errcode)
1567 printf ("BZIP2 internal error %d\n", errcode);
1569 #endif /* CONFIG_BZIP2 */
1572 do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
1573 ulong addr, ulong *len_ptr, int verify)
1575 image_header_t *hdr = &header;
1576 void (*entry_point)(bd_t *);
1578 entry_point = (void (*)(bd_t *)) ntohl(hdr->ih_ep);
1580 printf ("## Transferring control to RTEMS (at address %08lx) ...\n",
1581 (ulong)entry_point);
1583 SHOW_BOOT_PROGRESS (15);
1587 * r3: ptr to board info data
1590 (*entry_point ) ( gd->bd );
1593 #if (CONFIG_COMMANDS & CFG_CMD_ELF)
1595 do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
1596 ulong addr, ulong *len_ptr, int verify)
1598 image_header_t *hdr = &header;
1601 sprintf(str, "%x", ntohl(hdr->ih_ep)); /* write entry-point into string */
1602 setenv("loadaddr", str);
1603 do_bootvx(cmdtp, 0, 0, NULL);
1607 do_bootm_qnxelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
1608 ulong addr, ulong *len_ptr, int verify)
1610 image_header_t *hdr = &header;
1611 char *local_args[2];
1614 sprintf(str, "%x", ntohl(hdr->ih_ep)); /* write entry-point into string */
1615 local_args[0] = argv[0];
1616 local_args[1] = str; /* and provide it via the arguments */
1617 do_bootelf(cmdtp, 0, 2, local_args);
1619 #endif /* CFG_CMD_ELF */
1621 #ifdef CONFIG_LYNXKDI
1623 do_bootm_lynxkdi (cmd_tbl_t *cmdtp, int flag,
1624 int argc, char *argv[],
1629 lynxkdi_boot( &header );
1632 #endif /* CONFIG_LYNXKDI */