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>
37 #include <asm/byteorder.h>
39 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
43 #ifdef CFG_HUSH_PARSER
47 #ifdef CONFIG_HAS_DATAFLASH
48 #include <dataflash.h>
51 DECLARE_GLOBAL_DATA_PTR;
53 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
55 #define CFG_BOOTM_LEN 0x800000 /* use 8MByte as default max gunzip size */
59 extern void bz_internal_error(int);
62 #if defined(CONFIG_CMD_IMI)
63 static int image_info (unsigned long addr);
66 #if defined(CONFIG_CMD_IMLS)
68 extern flash_info_t flash_info[]; /* info for FLASH chips */
69 static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
72 #ifdef CONFIG_SILENT_CONSOLE
73 static void fixup_silent_linux (void);
76 static void print_type (image_header_t *hdr);
77 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
80 * Continue booting an OS image; caller already has:
81 * - copied image header to global variable `header'
82 * - checked header magic number, checksums (both header & image),
83 * - verified image architecture (PPC) and type (KERNEL or MULTI),
84 * - loaded (first part of) image to header load address,
85 * - disabled interrupts.
87 typedef void boot_os_fn (cmd_tbl_t *cmdtp, int flag,
88 int argc, char *argv[],
89 image_header_t *hdr, /* of image to boot */
90 int verify); /* getenv("verify")[0] != 'n' */
92 extern boot_os_fn do_bootm_linux;
93 static boot_os_fn do_bootm_netbsd;
94 #if defined(CONFIG_LYNXKDI)
95 static boot_os_fn do_bootm_lynxkdi;
96 extern void lynxkdi_boot (image_header_t *);
98 static boot_os_fn do_bootm_rtems;
99 #if defined(CONFIG_CMD_ELF)
100 static boot_os_fn do_bootm_vxworks;
101 static boot_os_fn do_bootm_qnxelf;
102 int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
103 int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
105 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
106 extern uchar (*env_get_char)(int); /* Returns a character from the environment */
107 static boot_os_fn do_bootm_artos;
110 ulong load_addr = CFG_LOAD_ADDR; /* Default Load Address */
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[])
120 int (*appl)(int, char *[]);
121 uint unc_len = CFG_BOOTM_LEN;
122 int verify = getenv_verify();
126 ulong os_data, os_len;
128 ulong image_start, image_end;
129 ulong load_start, load_end;
133 img_addr = load_addr;
135 img_addr = simple_strtoul(argv[1], NULL, 16);
138 show_boot_progress (1);
139 printf ("## Booting image at %08lx ...\n", img_addr);
141 #ifdef CONFIG_HAS_DATAFLASH
142 if (addr_dataflash (img_addr)){
143 hdr = (image_header_t *)CFG_LOAD_ADDR;
144 read_dataflash (img_addr, image_get_header_size (), (char *)hdr);
147 hdr = (image_header_t *)img_addr;
149 if (!image_check_magic(hdr)) {
150 puts ("Bad Magic Number\n");
151 show_boot_progress (-1);
154 show_boot_progress (2);
156 if (!image_check_hcrc (hdr)) {
157 puts ("Bad Header Checksum\n");
158 show_boot_progress (-2);
161 show_boot_progress (3);
163 #ifdef CONFIG_HAS_DATAFLASH
164 if (addr_dataflash (img_addr))
165 read_dataflash (img_addr + image_get_header_size (),
166 image_get_data_size (hdr),
167 (char *)image_get_data (hdr));
170 /* uImage is in a system RAM, pointed to by hdr */
171 print_image_hdr (hdr);
174 puts (" Verifying Checksum ... ");
175 if (!image_check_dcrc (hdr)) {
176 printf ("Bad Data CRC\n");
177 show_boot_progress (-3);
182 show_boot_progress (4);
184 if (!image_check_target_arch (hdr)) {
185 printf ("Unsupported Architecture 0x%x\n", image_get_arch (hdr));
186 show_boot_progress (-4);
189 show_boot_progress (5);
191 switch (image_get_type (hdr)) {
192 case IH_TYPE_STANDALONE:
193 name = "Standalone Application";
194 /* A second argument overwrites the load address */
196 image_set_load (hdr, simple_strtoul (argv[2], NULL, 16));
200 name = "Kernel Image";
201 os_data = image_get_data (hdr);
202 os_len = image_get_data_size (hdr);
205 name = "Multi-File Image";
206 image_multi_getimg (hdr, 0, &os_data, &os_len);
209 printf ("Wrong Image Type for %s command\n", cmdtp->name);
210 show_boot_progress (-5);
213 show_boot_progress (6);
216 * We have reached the point of no return: we are going to
217 * overwrite all exception vector code, so we cannot easily
218 * recover from any failures any more...
220 iflag = disable_interrupts();
222 #ifdef CONFIG_AMIGAONEG3SE
224 * We've possible left the caches enabled during
225 * bios emulation, so turn them off again
228 invalidate_l1_instruction_cache();
233 image_start = (ulong)hdr;
234 image_end = image_get_image_end (hdr);
235 load_start = image_get_load (hdr);
238 switch (image_get_comp (hdr)) {
240 if (image_get_load (hdr) == img_addr) {
241 printf (" XIP %s ... ", name);
243 printf (" Loading %s ... ", name);
245 memmove_wd ((void *)image_get_load (hdr),
246 (void *)os_data, os_len, CHUNKSZ);
248 load_end = load_start + os_len;
253 printf (" Uncompressing %s ... ", name);
254 if (gunzip ((void *)image_get_load (hdr), unc_len,
255 (uchar *)os_data, &os_len) != 0) {
256 puts ("GUNZIP ERROR - must RESET board to recover\n");
257 show_boot_progress (-6);
258 do_reset (cmdtp, flag, argc, argv);
261 load_end = load_start + os_len;
265 printf (" Uncompressing %s ... ", name);
267 * If we've got less than 4 MB of malloc() space,
268 * use slower decompression algorithm which requires
269 * at most 2300 KB of memory.
271 int i = BZ2_bzBuffToBuffDecompress ((char*)image_get_load (hdr),
272 &unc_len, (char *)os_data, os_len,
273 CFG_MALLOC_LEN < (4096 * 1024), 0);
275 printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
276 show_boot_progress (-6);
277 do_reset (cmdtp, flag, argc, argv);
280 load_end = load_start + unc_len;
282 #endif /* CONFIG_BZIP2 */
286 printf ("Unimplemented compression type %d\n", image_get_comp (hdr));
287 show_boot_progress (-7);
291 show_boot_progress (7);
293 if ((load_start < image_end) && (load_end > image_start)) {
294 debug ("image_start = 0x%lX, image_end = 0x%lx\n", image_start, image_end);
295 debug ("load_start = 0x%lx, load_end = 0x%lx\n", load_start, load_end);
297 puts ("ERROR: image overwritten - must RESET the board to recover.\n");
298 do_reset (cmdtp, flag, argc, argv);
301 switch (image_get_type (hdr)) {
302 case IH_TYPE_STANDALONE:
306 /* load (and uncompress), but don't start if "autostart"
309 if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0)) {
311 sprintf(buf, "%lX", image_get_data_size(hdr));
312 setenv("filesize", buf);
315 appl = (int (*)(int, char *[]))image_get_ep (hdr);
316 (*appl)(argc-1, &argv[1]);
325 printf ("Can't boot image type %d\n", image_get_type (hdr));
326 show_boot_progress (-8);
329 show_boot_progress (8);
331 switch (image_get_os (hdr)) {
332 default: /* handled by (original) Linux case */
334 #ifdef CONFIG_SILENT_CONSOLE
335 fixup_silent_linux();
337 do_bootm_linux (cmdtp, flag, argc, argv, hdr, verify);
341 do_bootm_netbsd (cmdtp, flag, argc, argv, hdr, verify);
344 #ifdef CONFIG_LYNXKDI
346 do_bootm_lynxkdi (cmdtp, flag, argc, argv, hdr, verify);
351 do_bootm_rtems (cmdtp, flag, argc, argv, hdr, verify);
354 #if defined(CONFIG_CMD_ELF)
356 do_bootm_vxworks (cmdtp, flag, argc, argv, hdr, verify);
360 do_bootm_qnxelf (cmdtp, flag, argc, argv, hdr, verify);
366 do_bootm_artos (cmdtp, flag, argc, argv, hdr, verify);
371 show_boot_progress (-9);
373 puts ("\n## Control returned to monitor - resetting...\n");
374 do_reset (cmdtp, flag, argc, argv);
380 bootm, CFG_MAXARGS, 1, do_bootm,
381 "bootm - boot application image from memory\n",
382 "[addr [arg ...]]\n - boot application image stored in memory\n"
383 "\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
384 "\t'arg' can be the address of an initrd image\n"
385 #if defined(CONFIG_OF_LIBFDT)
386 "\tWhen booting a Linux kernel which requires a flat device-tree\n"
387 "\ta third argument is required which is the address of the\n"
388 "\tdevice-tree blob. To boot that kernel without an initrd image,\n"
389 "\tuse a '-' for the second argument. If you do not pass a third\n"
390 "\ta bd_info struct will be passed instead\n"
394 /*******************************************************************/
395 /* bootd - boot default image */
396 /*******************************************************************/
397 #if defined(CONFIG_CMD_BOOTD)
398 int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
402 #ifndef CFG_HUSH_PARSER
403 if (run_command (getenv ("bootcmd"), flag) < 0)
406 if (parse_string_outer (getenv ("bootcmd"),
407 FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0)
414 boot, 1, 1, do_bootd,
415 "boot - boot default, i.e., run 'bootcmd'\n",
419 /* keep old command name "bootd" for backward compatibility */
421 bootd, 1, 1, do_bootd,
422 "bootd - boot default, i.e., run 'bootcmd'\n",
429 /*******************************************************************/
430 /* iminfo - print header info for a requested image */
431 /*******************************************************************/
432 #if defined(CONFIG_CMD_IMI)
433 int do_iminfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
440 return image_info (load_addr);
443 for (arg = 1; arg < argc; ++arg) {
444 addr = simple_strtoul (argv[arg], NULL, 16);
445 if (image_info (addr) != 0)
451 static int image_info (ulong addr)
453 image_header_t *hdr = (image_header_t *)addr;
455 printf ("\n## Checking Image at %08lx ...\n", addr);
457 if (!image_check_magic (hdr)) {
458 puts (" Bad Magic Number\n");
462 if (!image_check_hcrc (hdr)) {
463 puts (" Bad Header Checksum\n");
467 print_image_hdr (hdr);
469 puts (" Verifying Checksum ... ");
470 if (!image_check_dcrc (hdr)) {
471 puts (" Bad Data CRC\n");
479 iminfo, CFG_MAXARGS, 1, do_iminfo,
480 "iminfo - print header information for application image\n",
482 " - print header information for application image starting at\n"
483 " address 'addr' in memory; this includes verification of the\n"
484 " image contents (magic number, header and payload checksums)\n"
489 /*******************************************************************/
490 /* imls - list all images found in flash */
491 /*******************************************************************/
492 #if defined(CONFIG_CMD_IMLS)
493 int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
499 for (i = 0, info = &flash_info[0];
500 i < CFG_MAX_FLASH_BANKS; ++i, ++info) {
502 if (info->flash_id == FLASH_UNKNOWN)
504 for (j = 0; j < info->sector_count; ++j) {
506 hdr = (image_header_t *)info->start[j];
508 if (!hdr || !image_check_magic (hdr))
511 if (!image_check_hcrc (hdr))
514 printf ("Image at %08lX:\n", (ulong)hdr);
515 print_image_hdr (hdr);
517 puts (" Verifying Checksum ... ");
518 if (!image_check_dcrc (hdr)) {
519 puts ("Bad Data CRC\n");
533 "imls - list all images found in flash\n",
535 " - Prints information about all images found at sector\n"
536 " boundaries in flash.\n"
540 /*******************************************************************/
542 /*******************************************************************/
543 void print_image_hdr (image_header_t *hdr)
545 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
546 time_t timestamp = (time_t)image_get_time (hdr);
550 printf (" Image Name: %.*s\n", IH_NMLEN, image_get_name (hdr));
552 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
553 to_tm (timestamp, &tm);
554 printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
555 tm.tm_year, tm.tm_mon, tm.tm_mday,
556 tm.tm_hour, tm.tm_min, tm.tm_sec);
558 puts (" Image Type: ");
561 printf ("\n Data Size: %d Bytes = ", image_get_data_size (hdr));
562 print_size (image_get_data_size (hdr), "\n");
563 printf (" Load Address: %08x\n"
564 " Entry Point: %08x\n",
565 image_get_load (hdr), image_get_ep (hdr));
567 if (image_check_type (hdr, IH_TYPE_MULTI)) {
570 ulong count = image_multi_count (hdr);
572 puts (" Contents:\n");
573 for (i = 0; i < count; i++) {
574 image_multi_getimg (hdr, i, &data, &len);
575 printf (" Image %d: %8ld Bytes = ", i, len);
576 print_size (len, "\n");
581 static void print_type (image_header_t *hdr)
583 char *os, *arch, *type, *comp;
585 switch (image_get_os (hdr)) {
586 case IH_OS_INVALID: os = "Invalid OS"; break;
587 case IH_OS_NETBSD: os = "NetBSD"; break;
588 case IH_OS_LINUX: os = "Linux"; break;
589 case IH_OS_VXWORKS: os = "VxWorks"; break;
590 case IH_OS_QNX: os = "QNX"; break;
591 case IH_OS_U_BOOT: os = "U-Boot"; break;
592 case IH_OS_RTEMS: os = "RTEMS"; break;
594 case IH_OS_ARTOS: os = "ARTOS"; break;
596 #ifdef CONFIG_LYNXKDI
597 case IH_OS_LYNXOS: os = "LynxOS"; break;
599 default: os = "Unknown OS"; break;
602 switch (image_get_arch (hdr)) {
603 case IH_ARCH_INVALID: arch = "Invalid CPU"; break;
604 case IH_ARCH_ALPHA: arch = "Alpha"; break;
605 case IH_ARCH_ARM: arch = "ARM"; break;
606 case IH_ARCH_AVR32: arch = "AVR32"; break;
607 case IH_ARCH_BLACKFIN: arch = "Blackfin"; break;
608 case IH_ARCH_I386: arch = "Intel x86"; break;
609 case IH_ARCH_IA64: arch = "IA64"; break;
610 case IH_ARCH_M68K: arch = "M68K"; break;
611 case IH_ARCH_MICROBLAZE:arch = "Microblaze"; break;
612 case IH_ARCH_MIPS64: arch = "MIPS 64 Bit"; break;
613 case IH_ARCH_MIPS: arch = "MIPS"; break;
614 case IH_ARCH_NIOS2: arch = "Nios-II"; break;
615 case IH_ARCH_NIOS: arch = "Nios"; break;
616 case IH_ARCH_PPC: arch = "PowerPC"; break;
617 case IH_ARCH_S390: arch = "IBM S390"; break;
618 case IH_ARCH_SH: arch = "SuperH"; break;
619 case IH_ARCH_SPARC64: arch = "SPARC 64 Bit"; break;
620 case IH_ARCH_SPARC: arch = "SPARC"; break;
621 default: arch = "Unknown Architecture"; break;
624 switch (image_get_type (hdr)) {
625 case IH_TYPE_INVALID: type = "Invalid Image"; break;
626 case IH_TYPE_STANDALONE:type = "Standalone Program"; break;
627 case IH_TYPE_KERNEL: type = "Kernel Image"; break;
628 case IH_TYPE_RAMDISK: type = "RAMDisk Image"; break;
629 case IH_TYPE_MULTI: type = "Multi-File Image"; break;
630 case IH_TYPE_FIRMWARE: type = "Firmware"; break;
631 case IH_TYPE_SCRIPT: type = "Script"; break;
632 case IH_TYPE_FLATDT: type = "Flat Device Tree"; break;
633 default: type = "Unknown Image"; break;
636 switch (image_get_comp (hdr)) {
637 case IH_COMP_NONE: comp = "uncompressed"; break;
638 case IH_COMP_GZIP: comp = "gzip compressed"; break;
639 case IH_COMP_BZIP2: comp = "bzip2 compressed"; break;
640 default: comp = "unknown compression"; break;
643 printf ("%s %s %s (%s)", arch, os, type, comp);
646 #ifdef CONFIG_SILENT_CONSOLE
647 static void fixup_silent_linux ()
649 char buf[256], *start, *end;
650 char *cmdline = getenv ("bootargs");
652 /* Only fix cmdline when requested */
653 if (!(gd->flags & GD_FLG_SILENT))
656 debug ("before silent fix-up: %s\n", cmdline);
658 if ((start = strstr (cmdline, "console=")) != NULL) {
659 end = strchr (start, ' ');
660 strncpy (buf, cmdline, (start - cmdline + 8));
662 strcpy (buf + (start - cmdline + 8), end);
664 buf[start - cmdline + 8] = '\0';
666 strcpy (buf, cmdline);
667 strcat (buf, " console=");
670 strcpy (buf, "console=");
673 setenv ("bootargs", buf);
674 debug ("after silent fix-up: %s\n", buf);
676 #endif /* CONFIG_SILENT_CONSOLE */
679 /*******************************************************************/
680 /* OS booting routines */
681 /*******************************************************************/
683 static void do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
684 int argc, char *argv[],
685 image_header_t *hdr, int verify)
687 void (*loader)(bd_t *, image_header_t *, char *, char *);
688 image_header_t *img_addr;
689 ulong kernel_data, kernel_len;
694 * Booting a (NetBSD) kernel image
696 * This process is pretty similar to a standalone application:
697 * The (first part of an multi-) image must be a stage-2 loader,
698 * which in turn is responsible for loading & invoking the actual
699 * kernel. The only differences are the parameters being passed:
700 * besides the board info strucure, the loader expects a command
701 * line, the name of the console device, and (optionally) the
702 * address of the original image header.
706 if (image_check_type (hdr, IH_TYPE_MULTI)) {
707 image_multi_getimg (hdr, 1, &kernel_data, &kernel_len);
713 #if defined (CONFIG_8xx_CONS_SMC1)
715 #elif defined (CONFIG_8xx_CONS_SMC2)
717 #elif defined (CONFIG_8xx_CONS_SCC2)
719 #elif defined (CONFIG_8xx_CONS_SCC3)
727 for (i = 2, len = 0; i < argc; i += 1)
728 len += strlen (argv[i]) + 1;
729 cmdline = malloc (len);
731 for (i = 2, len = 0; i < argc; i += 1) {
733 cmdline[len++] = ' ';
734 strcpy (&cmdline[len], argv[i]);
735 len += strlen (argv[i]);
737 } else if ((cmdline = getenv ("bootargs")) == NULL) {
741 loader = (void (*)(bd_t *, image_header_t *, char *, char *))image_get_ep (hdr);
743 printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
746 show_boot_progress (15);
749 * NetBSD Stage-2 Loader Parameters:
750 * r3: ptr to board info data
753 * r6: boot args string
755 (*loader) (gd->bd, img_addr, consdev, cmdline);
758 #ifdef CONFIG_LYNXKDI
759 static void do_bootm_lynxkdi (cmd_tbl_t *cmdtp, int flag,
760 int argc, char *argv[],
761 image_header_t *hdr, int verify)
765 #endif /* CONFIG_LYNXKDI */
767 static void do_bootm_rtems (cmd_tbl_t *cmdtp, int flag,
768 int argc, char *argv[],
769 image_header_t *hdr, int verify)
771 void (*entry_point)(bd_t *);
773 entry_point = (void (*)(bd_t *))image_get_ep (hdr);
775 printf ("## Transferring control to RTEMS (at address %08lx) ...\n",
778 show_boot_progress (15);
782 * r3: ptr to board info data
784 (*entry_point)(gd->bd);
787 #if defined(CONFIG_CMD_ELF)
788 static void do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag,
789 int argc, char *argv[],
790 image_header_t *hdr, int verify)
794 sprintf(str, "%x", image_get_ep (hdr)); /* write entry-point into string */
795 setenv("loadaddr", str);
796 do_bootvx(cmdtp, 0, 0, NULL);
799 static void do_bootm_qnxelf(cmd_tbl_t *cmdtp, int flag,
800 int argc, char *argv[],
801 image_header_t *hdr, int verify)
806 sprintf(str, "%x", image_get_ep (hdr)); /* write entry-point into string */
807 local_args[0] = argv[0];
808 local_args[1] = str; /* and provide it via the arguments */
809 do_bootelf(cmdtp, 0, 2, local_args);
813 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
814 static void do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
815 int argc, char *argv[],
816 image_header_t *hdr, int verify)
821 int i, j, nxt, len, envno, envsz;
823 void (*entry)(bd_t *bd, char *cmdline, char **fwenv, ulong top);
826 * Booting an ARTOS kernel image + application
829 /* this used to be the top of memory, but was wrong... */
831 /* get stack pointer */
832 asm volatile ("mr %0,1" : "=r"(top) );
834 debug ("## Current stack ends at 0x%08lX ", top);
836 top -= 2048; /* just to be sure */
837 if (top > CFG_BOOTMAPSZ)
841 debug ("=> set upper limit to 0x%08lX\n", top);
843 /* first check the artos specific boot args, then the linux args*/
844 if ((s = getenv( "abootargs")) == NULL && (s = getenv ("bootargs")) == NULL)
847 /* get length of cmdline, and place it */
849 top = (top - (len + 1)) & ~0xF;
850 cmdline = (char *)top;
851 debug ("## cmdline at 0x%08lX ", top);
855 top = (top - sizeof (bd_t)) & ~0xF;
856 debug ("## bd at 0x%08lX ", top);
858 memcpy (kbd, gd->bd, sizeof (bd_t));
860 /* first find number of env entries, and their size */
863 for (i = 0; env_get_char (i) != '\0'; i = nxt + 1) {
864 for (nxt = i; env_get_char (nxt) != '\0'; ++nxt)
867 envsz += (nxt - i) + 1; /* plus trailing zero */
869 envno++; /* plus the terminating zero */
870 debug ("## %u envvars total size %u ", envno, envsz);
872 top = (top - sizeof (char **) * envno) & ~0xF;
873 fwenv = (char **)top;
874 debug ("## fwenv at 0x%08lX ", top);
876 top = (top - envsz) & ~0xF;
881 for (i = 0; env_get_char (i) != '\0'; i = nxt + 1) {
882 for (nxt = i; env_get_char (nxt) != '\0'; ++nxt)
885 for (j = i; j < nxt; ++j)
886 *s++ = env_get_char (j);
889 *ss++ = NULL; /* terminate */
891 entry = (void (*)(bd_t *, char *, char **, ulong))image_get_ep (hdr);
892 (*entry) (kbd, cmdline, fwenv, top);