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,
36 #include <environment.h>
38 #include <asm/byteorder.h>
40 #ifdef CFG_HUSH_PARSER
44 DECLARE_GLOBAL_DATA_PTR;
46 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
48 #define CFG_BOOTM_LEN 0x800000 /* use 8MByte as default max gunzip size */
52 extern void bz_internal_error(int);
55 #if defined(CONFIG_CMD_IMI)
56 static int image_info (unsigned long addr);
59 #if defined(CONFIG_CMD_IMLS)
61 extern flash_info_t flash_info[]; /* info for FLASH chips */
62 static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
65 #ifdef CONFIG_SILENT_CONSOLE
66 static void fixup_silent_linux (void);
69 static void *get_kernel (cmd_tbl_t *cmdtp, int flag,int argc, char *argv[],
70 bootm_headers_t *images, ulong *os_data, ulong *os_len);
71 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
74 * Continue booting an OS image; caller already has:
75 * - copied image header to global variable `header'
76 * - checked header magic number, checksums (both header & image),
77 * - verified image architecture (PPC) and type (KERNEL or MULTI),
78 * - loaded (first part of) image to header load address,
79 * - disabled interrupts.
81 typedef void boot_os_fn (cmd_tbl_t *cmdtp, int flag,
82 int argc, char *argv[],
83 bootm_headers_t *images); /* pointers to os/initrd/fdt */
85 extern boot_os_fn do_bootm_linux;
86 static boot_os_fn do_bootm_netbsd;
87 #if defined(CONFIG_LYNXKDI)
88 static boot_os_fn do_bootm_lynxkdi;
89 extern void lynxkdi_boot (image_header_t *);
91 static boot_os_fn do_bootm_rtems;
92 #if defined(CONFIG_CMD_ELF)
93 static boot_os_fn do_bootm_vxworks;
94 static boot_os_fn do_bootm_qnxelf;
95 int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
96 int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
98 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
99 extern uchar (*env_get_char)(int); /* Returns a character from the environment */
100 static boot_os_fn do_bootm_artos;
103 ulong load_addr = CFG_LOAD_ADDR; /* Default Load Address */
104 static bootm_headers_t images; /* pointers to os/initrd/fdt images */
106 void __board_lmb_reserve(struct lmb *lmb)
108 /* please define platform specific board_lmb_reserve() */
110 void board_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias("__board_lmb_reserve")));
113 /*******************************************************************/
114 /* bootm - boot application image from image in memory */
115 /*******************************************************************/
116 int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
119 const char *type_name;
120 uint unc_len = CFG_BOOTM_LEN;
121 uint8_t comp, type, os;
124 ulong os_data, os_len;
125 ulong image_start, image_end;
126 ulong load_start, load_end;
127 ulong mem_start, mem_size;
131 memset ((void *)&images, 0, sizeof (images));
132 images.verify = getenv_verify();
133 images.autostart = getenv_autostart();
138 mem_start = getenv_bootm_low();
139 mem_size = getenv_bootm_size();
141 lmb_add(&lmb, mem_start, mem_size);
143 board_lmb_reserve(&lmb);
145 /* get kernel image header, start address and length */
146 os_hdr = get_kernel (cmdtp, flag, argc, argv,
147 &images, &os_data, &os_len);
151 show_boot_progress (6);
153 /* get image parameters */
154 switch (gen_image_get_format (os_hdr)) {
155 case IMAGE_FORMAT_LEGACY:
156 type = image_get_type (os_hdr);
157 comp = image_get_comp (os_hdr);
158 os = image_get_os (os_hdr);
160 image_end = image_get_image_end (os_hdr);
161 load_start = image_get_load (os_hdr);
163 #if defined(CONFIG_FIT)
164 case IMAGE_FORMAT_FIT:
165 fit_unsupported ("bootm");
169 puts ("ERROR: unknown image format type!\n");
173 image_start = (ulong)os_hdr;
175 type_name = image_get_type_name (type);
178 * We have reached the point of no return: we are going to
179 * overwrite all exception vector code, so we cannot easily
180 * recover from any failures any more...
182 iflag = disable_interrupts();
184 #ifdef CONFIG_AMIGAONEG3SE
186 * We've possible left the caches enabled during
187 * bios emulation, so turn them off again
190 invalidate_l1_instruction_cache();
197 if (load_start == (ulong)os_hdr) {
198 printf (" XIP %s ... ", type_name);
200 printf (" Loading %s ... ", type_name);
202 memmove_wd ((void *)load_start,
203 (void *)os_data, os_len, CHUNKSZ);
205 load_end = load_start + os_len;
210 printf (" Uncompressing %s ... ", type_name);
211 if (gunzip ((void *)load_start, unc_len,
212 (uchar *)os_data, &os_len) != 0) {
213 puts ("GUNZIP ERROR - must RESET board to recover\n");
214 show_boot_progress (-6);
215 do_reset (cmdtp, flag, argc, argv);
218 load_end = load_start + os_len;
222 printf (" Uncompressing %s ... ", type_name);
224 * If we've got less than 4 MB of malloc() space,
225 * use slower decompression algorithm which requires
226 * at most 2300 KB of memory.
228 int i = BZ2_bzBuffToBuffDecompress ((char*)load_start,
229 &unc_len, (char *)os_data, os_len,
230 CFG_MALLOC_LEN < (4096 * 1024), 0);
232 printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
233 show_boot_progress (-6);
234 do_reset (cmdtp, flag, argc, argv);
237 load_end = load_start + unc_len;
239 #endif /* CONFIG_BZIP2 */
243 printf ("Unimplemented compression type %d\n", comp);
244 show_boot_progress (-7);
248 debug (" kernel loaded at 0x%08lx, end = 0x%08lx\n", load_start, load_end);
249 show_boot_progress (7);
251 if ((load_start < image_end) && (load_end > image_start)) {
252 debug ("image_start = 0x%lX, image_end = 0x%lx\n", image_start, image_end);
253 debug ("load_start = 0x%lx, load_end = 0x%lx\n", load_start, load_end);
255 puts ("ERROR: image overwritten - must RESET the board to recover.\n");
256 do_reset (cmdtp, flag, argc, argv);
259 show_boot_progress (8);
261 lmb_reserve(&lmb, load_start, (load_end - load_start));
264 default: /* handled by (original) Linux case */
266 #ifdef CONFIG_SILENT_CONSOLE
267 fixup_silent_linux();
269 do_bootm_linux (cmdtp, flag, argc, argv, &images);
273 do_bootm_netbsd (cmdtp, flag, argc, argv, &images);
276 #ifdef CONFIG_LYNXKDI
278 do_bootm_lynxkdi (cmdtp, flag, argc, argv, &images);
283 do_bootm_rtems (cmdtp, flag, argc, argv, &images);
286 #if defined(CONFIG_CMD_ELF)
288 do_bootm_vxworks (cmdtp, flag, argc, argv, &images);
292 do_bootm_qnxelf (cmdtp, flag, argc, argv, &images);
298 do_bootm_artos (cmdtp, flag, argc, argv, &images);
303 show_boot_progress (-9);
305 puts ("\n## Control returned to monitor - resetting...\n");
306 do_reset (cmdtp, flag, argc, argv);
312 * get_kernel - find kernel image
313 * @os_data: pointer to a ulong variable, will hold os data start address
314 * @os_len: pointer to a ulong variable, will hold os data length
316 * get_kernel() tries to find a kernel image, verifies its integrity
317 * and locates kernel data.
320 * pointer to image header if valid image was found, plus kernel start
321 * address and length, otherwise NULL
323 static image_header_t *image_get_kernel (ulong img_addr, int verify)
325 image_header_t *hdr = (image_header_t *)img_addr;
327 if (!image_check_magic(hdr)) {
328 puts ("Bad Magic Number\n");
329 show_boot_progress (-1);
332 show_boot_progress (2);
334 if (!image_check_hcrc (hdr)) {
335 puts ("Bad Header Checksum\n");
336 show_boot_progress (-2);
340 show_boot_progress (3);
341 image_print_contents (hdr);
344 puts (" Verifying Checksum ... ");
345 if (!image_check_dcrc (hdr)) {
346 printf ("Bad Data CRC\n");
347 show_boot_progress (-3);
352 show_boot_progress (4);
354 if (!image_check_target_arch (hdr)) {
355 printf ("Unsupported Architecture 0x%x\n", image_get_arch (hdr));
356 show_boot_progress (-4);
363 * get_kernel - find kernel image
364 * @os_data: pointer to a ulong variable, will hold os data start address
365 * @os_len: pointer to a ulong variable, will hold os data length
367 * get_kernel() tries to find a kernel image, verifies its integrity
368 * and locates kernel data.
371 * pointer to image header if valid image was found, plus kernel start
372 * address and length, otherwise NULL
374 static void *get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
375 bootm_headers_t *images, ulong *os_data, ulong *os_len)
379 #if defined(CONFIG_FIT)
381 const char *fit_uname_config = NULL;
382 const char *fit_uname_kernel = NULL;
385 /* find out kernel image address */
387 img_addr = load_addr;
388 debug ("* kernel: default image load address = 0x%08lx\n",
390 #if defined(CONFIG_FIT)
391 } else if (fit_parse_conf (argv[1], load_addr, &img_addr,
392 &fit_uname_config)) {
393 debug ("* kernel: config '%s' from image at 0x%08lx\n",
394 fit_uname_config, img_addr);
395 } else if (fit_parse_subimage (argv[1], load_addr, &img_addr,
396 &fit_uname_kernel)) {
397 debug ("* kernel: subimage '%s' from image at 0x%08lx\n",
398 fit_uname_kernel, img_addr);
401 img_addr = simple_strtoul(argv[1], NULL, 16);
402 debug ("* kernel: cmdline image address = 0x%08lx\n", img_addr);
405 show_boot_progress (1);
406 printf ("## Booting kernel image at %08lx ...\n", img_addr);
408 /* copy from dataflash if needed */
409 img_addr = gen_get_image (img_addr);
411 /* check image type, for FIT images get FIT kernel node */
412 switch (gen_image_get_format ((void *)img_addr)) {
413 case IMAGE_FORMAT_LEGACY:
415 debug ("* kernel: legacy format image\n");
416 hdr = image_get_kernel (img_addr, images->verify);
419 show_boot_progress (5);
421 switch (image_get_type (hdr)) {
423 *os_data = image_get_data (hdr);
424 *os_len = image_get_data_size (hdr);
427 image_multi_getimg (hdr, 0, os_data, os_len);
430 printf ("Wrong Image Type for %s command\n", cmdtp->name);
431 show_boot_progress (-5);
434 images->legacy_hdr_os = hdr;
435 images->legacy_hdr_valid = 1;
438 #if defined(CONFIG_FIT)
439 case IMAGE_FORMAT_FIT:
440 fit_hdr = (void *)img_addr;
441 debug ("* kernel: FIT format image\n");
442 fit_unsupported ("kernel");
446 printf ("Wrong Image Format for %s command\n", cmdtp->name);
450 debug (" kernel data at 0x%08lx, end = 0x%08lx\n",
451 *os_data, *os_data + *os_len);
453 return (void *)img_addr;
457 bootm, CFG_MAXARGS, 1, do_bootm,
458 "bootm - boot application image from memory\n",
459 "[addr [arg ...]]\n - boot application image stored in memory\n"
460 "\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
461 "\t'arg' can be the address of an initrd image\n"
462 #if defined(CONFIG_OF_LIBFDT)
463 "\tWhen booting a Linux kernel which requires a flat device-tree\n"
464 "\ta third argument is required which is the address of the\n"
465 "\tdevice-tree blob. To boot that kernel without an initrd image,\n"
466 "\tuse a '-' for the second argument. If you do not pass a third\n"
467 "\ta bd_info struct will be passed instead\n"
471 /*******************************************************************/
472 /* bootd - boot default image */
473 /*******************************************************************/
474 #if defined(CONFIG_CMD_BOOTD)
475 int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
479 #ifndef CFG_HUSH_PARSER
480 if (run_command (getenv ("bootcmd"), flag) < 0)
483 if (parse_string_outer (getenv ("bootcmd"),
484 FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0)
491 boot, 1, 1, do_bootd,
492 "boot - boot default, i.e., run 'bootcmd'\n",
496 /* keep old command name "bootd" for backward compatibility */
498 bootd, 1, 1, do_bootd,
499 "bootd - boot default, i.e., run 'bootcmd'\n",
506 /*******************************************************************/
507 /* iminfo - print header info for a requested image */
508 /*******************************************************************/
509 #if defined(CONFIG_CMD_IMI)
510 int do_iminfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
517 return image_info (load_addr);
520 for (arg = 1; arg < argc; ++arg) {
521 addr = simple_strtoul (argv[arg], NULL, 16);
522 if (image_info (addr) != 0)
528 static int image_info (ulong addr)
530 void *hdr = (void *)addr;
532 printf ("\n## Checking Image at %08lx ...\n", addr);
534 switch (gen_image_get_format (hdr)) {
535 case IMAGE_FORMAT_LEGACY:
536 puts (" Legacy image found\n");
537 if (!image_check_magic (hdr)) {
538 puts (" Bad Magic Number\n");
542 if (!image_check_hcrc (hdr)) {
543 puts (" Bad Header Checksum\n");
547 image_print_contents (hdr);
549 puts (" Verifying Checksum ... ");
550 if (!image_check_dcrc (hdr)) {
551 puts (" Bad Data CRC\n");
556 #if defined(CONFIG_FIT)
557 case IMAGE_FORMAT_FIT:
558 puts (" FIT image found\n");
559 fit_unsupported ("iminfo");
563 puts ("Unknown image format!\n");
571 iminfo, CFG_MAXARGS, 1, do_iminfo,
572 "iminfo - print header information for application image\n",
574 " - print header information for application image starting at\n"
575 " address 'addr' in memory; this includes verification of the\n"
576 " image contents (magic number, header and payload checksums)\n"
581 /*******************************************************************/
582 /* imls - list all images found in flash */
583 /*******************************************************************/
584 #if defined(CONFIG_CMD_IMLS)
585 int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
591 for (i = 0, info = &flash_info[0];
592 i < CFG_MAX_FLASH_BANKS; ++i, ++info) {
594 if (info->flash_id == FLASH_UNKNOWN)
596 for (j = 0; j < info->sector_count; ++j) {
598 hdr = (void *)info->start[j];
602 switch (gen_image_get_format (hdr)) {
603 case IMAGE_FORMAT_LEGACY:
604 if (!image_check_magic (hdr))
607 if (!image_check_hcrc (hdr))
610 printf ("Legacy Image at %08lX:\n", (ulong)hdr);
611 image_print_contents (hdr);
613 puts (" Verifying Checksum ... ");
614 if (!image_check_dcrc (hdr)) {
615 puts ("Bad Data CRC\n");
620 #if defined(CONFIG_FIT)
621 case IMAGE_FORMAT_FIT:
622 printf ("FIT Image at %08lX:\n", (ulong)hdr);
623 fit_unsupported ("imls");
640 "imls - list all images found in flash\n",
642 " - Prints information about all images found at sector\n"
643 " boundaries in flash.\n"
647 /*******************************************************************/
648 /* helper routines */
649 /*******************************************************************/
650 #ifdef CONFIG_SILENT_CONSOLE
651 static void fixup_silent_linux ()
653 char buf[256], *start, *end;
654 char *cmdline = getenv ("bootargs");
656 /* Only fix cmdline when requested */
657 if (!(gd->flags & GD_FLG_SILENT))
660 debug ("before silent fix-up: %s\n", cmdline);
662 if ((start = strstr (cmdline, "console=")) != NULL) {
663 end = strchr (start, ' ');
664 strncpy (buf, cmdline, (start - cmdline + 8));
666 strcpy (buf + (start - cmdline + 8), end);
668 buf[start - cmdline + 8] = '\0';
670 strcpy (buf, cmdline);
671 strcat (buf, " console=");
674 strcpy (buf, "console=");
677 setenv ("bootargs", buf);
678 debug ("after silent fix-up: %s\n", buf);
680 #endif /* CONFIG_SILENT_CONSOLE */
683 /*******************************************************************/
684 /* OS booting routines */
685 /*******************************************************************/
687 static void do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
688 int argc, char *argv[],
689 bootm_headers_t *images)
691 void (*loader)(bd_t *, image_header_t *, char *, char *);
692 image_header_t *os_hdr, *hdr;
693 ulong kernel_data, kernel_len;
697 #if defined(CONFIG_FIT)
698 if (!images->legacy_hdr_valid) {
699 fit_unsupported_reset ("NetBSD");
700 do_reset (cmdtp, flag, argc, argv);
703 hdr = images->legacy_hdr_os;
706 * Booting a (NetBSD) kernel image
708 * This process is pretty similar to a standalone application:
709 * The (first part of an multi-) image must be a stage-2 loader,
710 * which in turn is responsible for loading & invoking the actual
711 * kernel. The only differences are the parameters being passed:
712 * besides the board info strucure, the loader expects a command
713 * line, the name of the console device, and (optionally) the
714 * address of the original image header.
717 if (image_check_type (hdr, IH_TYPE_MULTI)) {
718 image_multi_getimg (hdr, 1, &kernel_data, &kernel_len);
724 #if defined (CONFIG_8xx_CONS_SMC1)
726 #elif defined (CONFIG_8xx_CONS_SMC2)
728 #elif defined (CONFIG_8xx_CONS_SCC2)
730 #elif defined (CONFIG_8xx_CONS_SCC3)
738 for (i = 2, len = 0; i < argc; i += 1)
739 len += strlen (argv[i]) + 1;
740 cmdline = malloc (len);
742 for (i = 2, len = 0; i < argc; i += 1) {
744 cmdline[len++] = ' ';
745 strcpy (&cmdline[len], argv[i]);
746 len += strlen (argv[i]);
748 } else if ((cmdline = getenv ("bootargs")) == NULL) {
752 loader = (void (*)(bd_t *, image_header_t *, char *, char *))image_get_ep (hdr);
754 printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
757 show_boot_progress (15);
760 * NetBSD Stage-2 Loader Parameters:
761 * r3: ptr to board info data
764 * r6: boot args string
766 (*loader) (gd->bd, os_hdr, consdev, cmdline);
769 #ifdef CONFIG_LYNXKDI
770 static void do_bootm_lynxkdi (cmd_tbl_t *cmdtp, int flag,
771 int argc, char *argv[],
772 bootm_headers_t *images)
774 image_header_t *hdr = images->legacy_hdr_os;
776 #if defined(CONFIG_FIT)
777 if (!images->legacy_hdr_valid) {
778 fit_unsupported_reset ("Lynx");
779 do_reset (cmdtp, flag, argc, argv);
783 lynxkdi_boot ((image_header_t *)hdr);
785 #endif /* CONFIG_LYNXKDI */
787 static void do_bootm_rtems (cmd_tbl_t *cmdtp, int flag,
788 int argc, char *argv[],
789 bootm_headers_t *images)
791 image_header_t *hdr = images->legacy_hdr_os;
792 void (*entry_point)(bd_t *);
794 #if defined(CONFIG_FIT)
795 if (!images->legacy_hdr_valid) {
796 fit_unsupported_reset ("RTEMS");
797 do_reset (cmdtp, flag, argc, argv);
801 entry_point = (void (*)(bd_t *))image_get_ep (hdr);
803 printf ("## Transferring control to RTEMS (at address %08lx) ...\n",
806 show_boot_progress (15);
810 * r3: ptr to board info data
812 (*entry_point)(gd->bd);
815 #if defined(CONFIG_CMD_ELF)
816 static void do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag,
817 int argc, char *argv[],
818 bootm_headers_t *images)
821 image_header_t *hdr = images->legacy_hdr_os;
823 #if defined(CONFIG_FIT)
825 fit_unsupported_reset ("VxWorks");
826 do_reset (cmdtp, flag, argc, argv);
830 sprintf(str, "%x", image_get_ep (hdr)); /* write entry-point into string */
831 setenv("loadaddr", str);
832 do_bootvx(cmdtp, 0, 0, NULL);
835 static void do_bootm_qnxelf(cmd_tbl_t *cmdtp, int flag,
836 int argc, char *argv[],
837 bootm_headers_t *images)
841 image_header_t *hdr = images->legacy_hdr_os;
843 #if defined(CONFIG_FIT)
844 if (!images->legacy_hdr_valid) {
845 fit_unsupported_reset ("QNX");
846 do_reset (cmdtp, flag, argc, argv);
850 sprintf(str, "%x", image_get_ep (hdr)); /* write entry-point into string */
851 local_args[0] = argv[0];
852 local_args[1] = str; /* and provide it via the arguments */
853 do_bootelf(cmdtp, 0, 2, local_args);
857 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
858 static void do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
859 int argc, char *argv[],
860 bootm_headers_t *images)
865 int i, j, nxt, len, envno, envsz;
867 void (*entry)(bd_t *bd, char *cmdline, char **fwenv, ulong top);
868 image_header_t *hdr = images->legacy_hdr_os;
870 #if defined(CONFIG_FIT)
871 if (!images->legacy_hdr_valid) {
872 fit_unsupported_reset ("ARTOS");
873 do_reset (cmdtp, flag, argc, argv);
878 * Booting an ARTOS kernel image + application
881 /* this used to be the top of memory, but was wrong... */
883 /* get stack pointer */
884 asm volatile ("mr %0,1" : "=r"(top) );
886 debug ("## Current stack ends at 0x%08lX ", top);
888 top -= 2048; /* just to be sure */
889 if (top > CFG_BOOTMAPSZ)
893 debug ("=> set upper limit to 0x%08lX\n", top);
895 /* first check the artos specific boot args, then the linux args*/
896 if ((s = getenv( "abootargs")) == NULL && (s = getenv ("bootargs")) == NULL)
899 /* get length of cmdline, and place it */
901 top = (top - (len + 1)) & ~0xF;
902 cmdline = (char *)top;
903 debug ("## cmdline at 0x%08lX ", top);
907 top = (top - sizeof (bd_t)) & ~0xF;
908 debug ("## bd at 0x%08lX ", top);
910 memcpy (kbd, gd->bd, sizeof (bd_t));
912 /* first find number of env entries, and their size */
915 for (i = 0; env_get_char (i) != '\0'; i = nxt + 1) {
916 for (nxt = i; env_get_char (nxt) != '\0'; ++nxt)
919 envsz += (nxt - i) + 1; /* plus trailing zero */
921 envno++; /* plus the terminating zero */
922 debug ("## %u envvars total size %u ", envno, envsz);
924 top = (top - sizeof (char **) * envno) & ~0xF;
925 fwenv = (char **)top;
926 debug ("## fwenv at 0x%08lX ", top);
928 top = (top - envsz) & ~0xF;
933 for (i = 0; env_get_char (i) != '\0'; i = nxt + 1) {
934 for (nxt = i; env_get_char (nxt) != '\0'; ++nxt)
937 for (j = i; j < nxt; ++j)
938 *s++ = env_get_char (j);
941 *ss++ = NULL; /* terminate */
943 entry = (void (*)(bd_t *, char *, char **, ulong))image_get_ep (hdr);
944 (*entry) (kbd, cmdline, fwenv, top);