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_OF_LIBFDT)
42 #include <fdt_support.h>
43 #elif defined(CONFIG_OF_FLAT_TREE)
47 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
51 #ifdef CFG_HUSH_PARSER
55 #ifdef CONFIG_HAS_DATAFLASH
56 #include <dataflash.h>
59 DECLARE_GLOBAL_DATA_PTR;
61 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
63 #define CFG_BOOTM_LEN 0x800000 /* use 8MByte as default max gunzip size */
67 extern void bz_internal_error(int);
70 #if defined(CONFIG_CMD_IMI)
71 static int image_info (unsigned long addr);
74 #if defined(CONFIG_CMD_IMLS)
76 extern flash_info_t flash_info[]; /* info for FLASH chips */
77 static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
80 #ifdef CONFIG_SILENT_CONSOLE
81 static void fixup_silent_linux (void);
84 static void print_type (image_header_t *hdr);
85 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
88 * Continue booting an OS image; caller already has:
89 * - copied image header to global variable `header'
90 * - checked header magic number, checksums (both header & image),
91 * - verified image architecture (PPC) and type (KERNEL or MULTI),
92 * - loaded (first part of) image to header load address,
93 * - disabled interrupts.
95 typedef void boot_os_fn (cmd_tbl_t *cmdtp, int flag,
96 int argc, char *argv[],
97 ulong addr, /* of image to boot */
98 ulong *len_ptr, /* multi-file image length table */
99 int verify); /* getenv("verify")[0] != 'n' */
101 extern boot_os_fn do_bootm_linux;
102 static boot_os_fn do_bootm_netbsd;
103 #ifdef CONFIG_LYNXKDI
104 static boot_os_fn do_bootm_lynxkdi;
105 extern void lynxkdi_boot (image_header_t *);
107 static boot_os_fn do_bootm_rtems;
108 #if defined(CONFIG_CMD_ELF)
109 static boot_os_fn do_bootm_vxworks;
110 static boot_os_fn do_bootm_qnxelf;
111 int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
112 int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
114 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
115 extern uchar (*env_get_char)(int); /* Returns a character from the environment */
116 static boot_os_fn do_bootm_artos;
119 image_header_t header;
121 ulong load_addr = CFG_LOAD_ADDR; /* Default Load Address */
124 /*******************************************************************/
125 /* bootm - boot application image from image in memory */
126 /*******************************************************************/
127 int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
133 uint unc_len = CFG_BOOTM_LEN;
136 int (*appl)(int, char *[]);
137 image_header_t *hdr = &header;
139 verify = getenv_verify ();
144 addr = simple_strtoul(argv[1], NULL, 16);
147 show_boot_progress (1);
148 printf ("## Booting image at %08lx ...\n", addr);
150 /* Copy header so we can blank CRC field for re-calculation */
151 #ifdef CONFIG_HAS_DATAFLASH
152 if (addr_dataflash(addr)){
153 read_dataflash (addr, image_get_header_size (), (char *)&header);
156 memmove (&header, (char *)addr, image_get_header_size ());
158 if (!image_check_magic(hdr)) {
159 puts ("Bad Magic Number\n");
160 show_boot_progress (-1);
163 show_boot_progress (2);
165 if (!image_check_hcrc (hdr)) {
166 puts ("Bad Header Checksum\n");
167 show_boot_progress (-2);
170 show_boot_progress (3);
172 #ifdef CONFIG_HAS_DATAFLASH
173 if (addr_dataflash(addr)){
174 len = image_get_image_size (hdr);
175 read_dataflash(addr, len, (char *)CFG_LOAD_ADDR);
176 addr = CFG_LOAD_ADDR;
180 /* for multi-file images we need the data part, too */
181 print_image_hdr ((image_header_t *)addr);
183 len = image_get_data_size (hdr);
184 data = addr + image_get_header_size ();
185 len_ptr = (ulong *)data;
188 puts (" Verifying Checksum ... ");
189 if (!image_check_dcrc ((image_header_t *)addr)) {
190 printf ("Bad Data CRC\n");
191 show_boot_progress (-3);
196 show_boot_progress (4);
198 if (!image_check_target_arch (hdr)) {
199 printf ("Unsupported Architecture 0x%x\n", image_get_arch (hdr));
200 show_boot_progress (-4);
203 show_boot_progress (5);
205 switch (image_get_type (hdr)) {
206 case IH_TYPE_STANDALONE:
207 name = "Standalone Application";
208 /* A second argument overwrites the load address */
210 image_set_load (hdr, simple_strtoul (argv[2], NULL, 16));
214 name = "Kernel Image";
217 name = "Multi-File Image";
218 len = image_to_cpu (len_ptr[0]);
219 /* OS kernel is always the first image */
220 data += 8; /* kernel_len + terminator */
221 for (i=1; len_ptr[i]; ++i)
225 printf ("Wrong Image Type for %s command\n", cmdtp->name);
226 show_boot_progress (-5);
229 show_boot_progress (6);
232 * We have reached the point of no return: we are going to
233 * overwrite all exception vector code, so we cannot easily
234 * recover from any failures any more...
236 iflag = disable_interrupts();
238 #ifdef CONFIG_AMIGAONEG3SE
240 * We've possible left the caches enabled during
241 * bios emulation, so turn them off again
244 invalidate_l1_instruction_cache();
249 switch (image_get_comp (hdr)) {
251 if (image_get_load (hdr) == addr) {
252 printf (" XIP %s ... ", name);
254 printf (" Loading %s ... ", name);
256 memmove_wd ((void *)image_get_load (hdr),
257 (void *)data, len, CHUNKSZ);
263 printf (" Uncompressing %s ... ", name);
264 if (gunzip ((void *)image_get_load (hdr), unc_len,
265 (uchar *)data, &len) != 0) {
266 puts ("GUNZIP ERROR - must RESET board to recover\n");
267 show_boot_progress (-6);
268 do_reset (cmdtp, flag, argc, argv);
273 printf (" Uncompressing %s ... ", name);
275 * If we've got less than 4 MB of malloc() space,
276 * use slower decompression algorithm which requires
277 * at most 2300 KB of memory.
279 i = BZ2_bzBuffToBuffDecompress ((char*)image_get_load (hdr),
280 &unc_len, (char *)data, len,
281 CFG_MALLOC_LEN < (4096 * 1024), 0);
283 printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
284 show_boot_progress (-6);
285 do_reset (cmdtp, flag, argc, argv);
288 #endif /* CONFIG_BZIP2 */
292 printf ("Unimplemented compression type %d\n", image_get_comp (hdr));
293 show_boot_progress (-7);
297 show_boot_progress (7);
299 switch (image_get_type (hdr)) {
300 case IH_TYPE_STANDALONE:
304 /* load (and uncompress), but don't start if "autostart"
307 if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0)) {
309 sprintf(buf, "%lX", len);
310 setenv("filesize", buf);
313 appl = (int (*)(int, char *[]))image_get_ep (hdr);
314 (*appl)(argc-1, &argv[1]);
323 printf ("Can't boot image type %d\n", image_get_type (hdr));
324 show_boot_progress (-8);
327 show_boot_progress (8);
329 switch (image_get_os (hdr)) {
330 default: /* handled by (original) Linux case */
332 #ifdef CONFIG_SILENT_CONSOLE
333 fixup_silent_linux();
335 do_bootm_linux (cmdtp, flag, argc, argv,
336 addr, len_ptr, verify);
340 do_bootm_netbsd (cmdtp, flag, argc, argv,
341 addr, len_ptr, verify);
344 #ifdef CONFIG_LYNXKDI
346 do_bootm_lynxkdi (cmdtp, flag, argc, argv,
347 addr, len_ptr, verify);
352 do_bootm_rtems (cmdtp, flag, argc, argv,
353 addr, len_ptr, verify);
356 #if defined(CONFIG_CMD_ELF)
358 do_bootm_vxworks (cmdtp, flag, argc, argv,
359 addr, len_ptr, verify);
362 do_bootm_qnxelf (cmdtp, flag, argc, argv,
363 addr, len_ptr, verify);
369 do_bootm_artos (cmdtp, flag, argc, argv,
370 addr, len_ptr, verify);
375 show_boot_progress (-9);
377 puts ("\n## Control returned to monitor - resetting...\n");
378 do_reset (cmdtp, flag, argc, argv);
384 bootm, CFG_MAXARGS, 1, do_bootm,
385 "bootm - boot application image from memory\n",
386 "[addr [arg ...]]\n - boot application image stored in memory\n"
387 "\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
388 "\t'arg' can be the address of an initrd image\n"
389 #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
390 "\tWhen booting a Linux kernel which requires a flat device-tree\n"
391 "\ta third argument is required which is the address of the\n"
392 "\tdevice-tree blob. To boot that kernel without an initrd image,\n"
393 "\tuse a '-' for the second argument. If you do not pass a third\n"
394 "\ta bd_info struct will be passed instead\n"
398 /*******************************************************************/
399 /* bootd - boot default image */
400 /*******************************************************************/
401 #if defined(CONFIG_CMD_BOOTD)
402 int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
406 #ifndef CFG_HUSH_PARSER
407 if (run_command (getenv ("bootcmd"), flag) < 0)
410 if (parse_string_outer (getenv ("bootcmd"),
411 FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0)
418 boot, 1, 1, do_bootd,
419 "boot - boot default, i.e., run 'bootcmd'\n",
423 /* keep old command name "bootd" for backward compatibility */
425 bootd, 1, 1, do_bootd,
426 "bootd - boot default, i.e., run 'bootcmd'\n",
433 /*******************************************************************/
434 /* iminfo - print header info for a requested image */
435 /*******************************************************************/
436 #if defined(CONFIG_CMD_IMI)
437 int do_iminfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
444 return image_info (load_addr);
447 for (arg = 1; arg < argc; ++arg) {
448 addr = simple_strtoul (argv[arg], NULL, 16);
449 if (image_info (addr) != 0)
455 static int image_info (ulong addr)
457 image_header_t *hdr = (image_header_t *)addr;
459 printf ("\n## Checking Image at %08lx ...\n", addr);
461 if (!image_check_magic (hdr)) {
462 puts (" Bad Magic Number\n");
466 if (!image_check_hcrc (hdr)) {
467 puts (" Bad Header Checksum\n");
471 print_image_hdr (hdr);
473 puts (" Verifying Checksum ... ");
474 if (!image_check_dcrc (hdr)) {
475 puts (" Bad Data CRC\n");
483 iminfo, CFG_MAXARGS, 1, do_iminfo,
484 "iminfo - print header information for application image\n",
486 " - print header information for application image starting at\n"
487 " address 'addr' in memory; this includes verification of the\n"
488 " image contents (magic number, header and payload checksums)\n"
493 /*******************************************************************/
494 /* imls - list all images found in flash */
495 /*******************************************************************/
496 #if defined(CONFIG_CMD_IMLS)
497 int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
503 for (i = 0, info = &flash_info[0];
504 i < CFG_MAX_FLASH_BANKS; ++i, ++info) {
506 if (info->flash_id == FLASH_UNKNOWN)
508 for (j = 0; j < info->sector_count; ++j) {
510 hdr = (image_header_t *)info->start[j];
512 if (!hdr || !image_check_magic (hdr))
515 if (!image_check_hcrc (hdr))
518 printf ("Image at %08lX:\n", (ulong)hdr);
519 print_image_hdr (hdr);
521 puts (" Verifying Checksum ... ");
522 if (!image_check_dcrc (hdr)) {
523 puts ("Bad Data CRC\n");
537 "imls - list all images found in flash\n",
539 " - Prints information about all images found at sector\n"
540 " boundaries in flash.\n"
544 /*******************************************************************/
546 /*******************************************************************/
547 void print_image_hdr (image_header_t *hdr)
549 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
550 time_t timestamp = (time_t)image_get_time (hdr);
554 printf (" Image Name: %.*s\n", IH_NMLEN, image_get_name (hdr));
556 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
557 to_tm (timestamp, &tm);
558 printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
559 tm.tm_year, tm.tm_mon, tm.tm_mday,
560 tm.tm_hour, tm.tm_min, tm.tm_sec);
562 puts (" Image Type: ");
565 printf ("\n Data Size: %d Bytes = ", image_get_data_size (hdr));
566 print_size (image_get_data_size (hdr), "\n");
567 printf (" Load Address: %08x\n"
568 " Entry Point: %08x\n",
569 image_get_load (hdr), image_get_ep (hdr));
571 if (image_check_type (hdr, IH_TYPE_MULTI)) {
574 ulong *len_ptr = (ulong *)((ulong)hdr + image_get_header_size ());
576 puts (" Contents:\n");
577 for (i = 0; (len = image_to_cpu (*len_ptr)); ++i, ++len_ptr) {
578 printf (" Image %d: %8ld Bytes = ", i, len);
579 print_size (len, "\n");
584 static void print_type (image_header_t *hdr)
586 char *os, *arch, *type, *comp;
588 switch (image_get_os (hdr)) {
589 case IH_OS_INVALID: os = "Invalid OS"; break;
590 case IH_OS_NETBSD: os = "NetBSD"; break;
591 case IH_OS_LINUX: os = "Linux"; break;
592 case IH_OS_VXWORKS: os = "VxWorks"; break;
593 case IH_OS_QNX: os = "QNX"; break;
594 case IH_OS_U_BOOT: os = "U-Boot"; break;
595 case IH_OS_RTEMS: os = "RTEMS"; break;
597 case IH_OS_ARTOS: os = "ARTOS"; break;
599 #ifdef CONFIG_LYNXKDI
600 case IH_OS_LYNXOS: os = "LynxOS"; break;
602 default: os = "Unknown OS"; break;
605 switch (image_get_arch (hdr)) {
606 case IH_ARCH_INVALID: arch = "Invalid CPU"; break;
607 case IH_ARCH_ALPHA: arch = "Alpha"; break;
608 case IH_ARCH_ARM: arch = "ARM"; break;
609 case IH_ARCH_AVR32: arch = "AVR32"; break;
610 case IH_ARCH_BLACKFIN: arch = "Blackfin"; break;
611 case IH_ARCH_I386: arch = "Intel x86"; break;
612 case IH_ARCH_IA64: arch = "IA64"; break;
613 case IH_ARCH_M68K: arch = "M68K"; break;
614 case IH_ARCH_MICROBLAZE:arch = "Microblaze"; break;
615 case IH_ARCH_MIPS64: arch = "MIPS 64 Bit"; break;
616 case IH_ARCH_MIPS: arch = "MIPS"; break;
617 case IH_ARCH_NIOS2: arch = "Nios-II"; break;
618 case IH_ARCH_NIOS: arch = "Nios"; break;
619 case IH_ARCH_PPC: arch = "PowerPC"; break;
620 case IH_ARCH_S390: arch = "IBM S390"; break;
621 case IH_ARCH_SH: arch = "SuperH"; break;
622 case IH_ARCH_SPARC64: arch = "SPARC 64 Bit"; break;
623 case IH_ARCH_SPARC: arch = "SPARC"; break;
624 default: arch = "Unknown Architecture"; break;
627 switch (image_get_type (hdr)) {
628 case IH_TYPE_INVALID: type = "Invalid Image"; break;
629 case IH_TYPE_STANDALONE:type = "Standalone Program"; break;
630 case IH_TYPE_KERNEL: type = "Kernel Image"; break;
631 case IH_TYPE_RAMDISK: type = "RAMDisk Image"; break;
632 case IH_TYPE_MULTI: type = "Multi-File Image"; break;
633 case IH_TYPE_FIRMWARE: type = "Firmware"; break;
634 case IH_TYPE_SCRIPT: type = "Script"; break;
635 case IH_TYPE_FLATDT: type = "Flat Device Tree"; break;
636 default: type = "Unknown Image"; break;
639 switch (image_get_comp (hdr)) {
640 case IH_COMP_NONE: comp = "uncompressed"; break;
641 case IH_COMP_GZIP: comp = "gzip compressed"; break;
642 case IH_COMP_BZIP2: comp = "bzip2 compressed"; break;
643 default: comp = "unknown compression"; break;
646 printf ("%s %s %s (%s)", arch, os, type, comp);
649 #ifdef CONFIG_SILENT_CONSOLE
650 static void fixup_silent_linux ()
652 char buf[256], *start, *end;
653 char *cmdline = getenv ("bootargs");
655 /* Only fix cmdline when requested */
656 if (!(gd->flags & GD_FLG_SILENT))
659 debug ("before silent fix-up: %s\n", cmdline);
661 if ((start = strstr (cmdline, "console=")) != NULL) {
662 end = strchr (start, ' ');
663 strncpy (buf, cmdline, (start - cmdline + 8));
665 strcpy (buf + (start - cmdline + 8), end);
667 buf[start - cmdline + 8] = '\0';
669 strcpy (buf, cmdline);
670 strcat (buf, " console=");
673 strcpy (buf, "console=");
676 setenv ("bootargs", buf);
677 debug ("after silent fix-up: %s\n", buf);
679 #endif /* CONFIG_SILENT_CONSOLE */
682 /*******************************************************************/
683 /* OS booting routines */
684 /*******************************************************************/
686 static void do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
687 int argc, char *argv[],
688 ulong addr, ulong *len_ptr,
691 image_header_t *hdr = &header;
693 void (*loader)(bd_t *, image_header_t *, char *, char *);
694 image_header_t *img_addr;
699 * Booting a (NetBSD) kernel image
701 * This process is pretty similar to a standalone application:
702 * The (first part of an multi-) image must be a stage-2 loader,
703 * which in turn is responsible for loading & invoking the actual
704 * kernel. The only differences are the parameters being passed:
705 * besides the board info strucure, the loader expects a command
706 * line, the name of the console device, and (optionally) the
707 * address of the original image header.
711 if ((image_check_type (hdr, IH_TYPE_MULTI)) && (len_ptr[1]))
712 img_addr = (image_header_t *)addr;
715 #if defined (CONFIG_8xx_CONS_SMC1)
717 #elif defined (CONFIG_8xx_CONS_SMC2)
719 #elif defined (CONFIG_8xx_CONS_SCC2)
721 #elif defined (CONFIG_8xx_CONS_SCC3)
729 for (i = 2, len = 0; i < argc; i += 1)
730 len += strlen (argv[i]) + 1;
731 cmdline = malloc (len);
733 for (i = 2, len = 0; i < argc; i += 1) {
735 cmdline[len++] = ' ';
736 strcpy (&cmdline[len], argv[i]);
737 len += strlen (argv[i]);
739 } else if ((cmdline = getenv ("bootargs")) == NULL) {
743 loader = (void (*)(bd_t *, image_header_t *, char *, char *))image_get_ep (hdr);
745 printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
748 show_boot_progress (15);
751 * NetBSD Stage-2 Loader Parameters:
752 * r3: ptr to board info data
755 * r6: boot args string
757 (*loader) (gd->bd, img_addr, consdev, cmdline);
760 #ifdef CONFIG_LYNXKDI
761 static void do_bootm_lynxkdi (cmd_tbl_t *cmdtp, int flag,
762 int argc, char *argv[],
763 ulong addr, ulong *len_ptr,
766 lynxkdi_boot (&header);
768 #endif /* CONFIG_LYNXKDI */
770 static void do_bootm_rtems (cmd_tbl_t *cmdtp, int flag,
771 int argc, char *argv[],
772 ulong addr, ulong *len_ptr,
775 image_header_t *hdr = &header;
776 void (*entry_point)(bd_t *);
778 entry_point = (void (*)(bd_t *))image_get_ep (hdr);
780 printf ("## Transferring control to RTEMS (at address %08lx) ...\n",
783 show_boot_progress (15);
787 * r3: ptr to board info data
789 (*entry_point)(gd->bd);
792 #if defined(CONFIG_CMD_ELF)
793 static void do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag,
794 int argc, char *argv[],
795 ulong addr, ulong *len_ptr,
798 image_header_t *hdr = &header;
801 sprintf(str, "%x", image_get_ep (hdr)); /* write entry-point into string */
802 setenv("loadaddr", str);
803 do_bootvx(cmdtp, 0, 0, NULL);
806 static void do_bootm_qnxelf (cmd_tbl_t *cmdtp, int flag,
807 int argc, char *argv[],
808 ulong addr, ulong *len_ptr,
811 image_header_t *hdr = &header;
815 sprintf(str, "%x", image_get_ep (hdr)); /* write entry-point into string */
816 local_args[0] = argv[0];
817 local_args[1] = str; /* and provide it via the arguments */
818 do_bootelf(cmdtp, 0, 2, local_args);
822 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
823 static void do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
824 int argc, char *argv[],
825 ulong addr, ulong *len_ptr,
831 int i, j, nxt, len, envno, envsz;
833 void (*entry)(bd_t *bd, char *cmdline, char **fwenv, ulong top);
834 image_header_t *hdr = &header;
837 * Booting an ARTOS kernel image + application
840 /* this used to be the top of memory, but was wrong... */
842 /* get stack pointer */
843 asm volatile ("mr %0,1" : "=r"(top) );
845 debug ("## Current stack ends at 0x%08lX ", top);
847 top -= 2048; /* just to be sure */
848 if (top > CFG_BOOTMAPSZ)
852 debug ("=> set upper limit to 0x%08lX\n", top);
854 /* first check the artos specific boot args, then the linux args*/
855 if ((s = getenv( "abootargs")) == NULL && (s = getenv ("bootargs")) == NULL)
858 /* get length of cmdline, and place it */
860 top = (top - (len + 1)) & ~0xF;
861 cmdline = (char *)top;
862 debug ("## cmdline at 0x%08lX ", top);
866 top = (top - sizeof (bd_t)) & ~0xF;
867 debug ("## bd at 0x%08lX ", top);
869 memcpy (kbd, gd->bd, sizeof (bd_t));
871 /* first find number of env entries, and their size */
874 for (i = 0; env_get_char (i) != '\0'; i = nxt + 1) {
875 for (nxt = i; env_get_char (nxt) != '\0'; ++nxt)
878 envsz += (nxt - i) + 1; /* plus trailing zero */
880 envno++; /* plus the terminating zero */
881 debug ("## %u envvars total size %u ", envno, envsz);
883 top = (top - sizeof (char **) * envno) & ~0xF;
884 fwenv = (char **)top;
885 debug ("## fwenv at 0x%08lX ", top);
887 top = (top - envsz) & ~0xF;
892 for (i = 0; env_get_char (i) != '\0'; i = nxt + 1) {
893 for (nxt = i; env_get_char (nxt) != '\0'; ++nxt)
896 for (j = i; j < nxt; ++j)
897 *s++ = env_get_char (j);
900 *ss++ = NULL; /* terminate */
902 entry = (void (*)(bd_t *, char *, char **, ulong))image_get_ep (hdr);
903 (*entry) (kbd, cmdline, fwenv, top);