From 8bde7f776c77b343aca29b8c7b58464d915ac245 Mon Sep 17 00:00:00 2001 From: wdenk Date: Fri, 27 Jun 2003 21:31:46 +0000 Subject: * Code cleanup: - remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen) --- common/cmd_elf.c | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'common/cmd_elf.c') diff --git a/common/cmd_elf.c b/common/cmd_elf.c index 74957622b..c068c104b 100644 --- a/common/cmd_elf.c +++ b/common/cmd_elf.c @@ -17,8 +17,6 @@ #include #include #include - -#include #include @@ -28,6 +26,8 @@ #define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif +int valid_elf_image (unsigned long addr); +unsigned long load_elf_image (unsigned long addr); /* ====================================================================== * Interpreter command to boot an arbitrary ELF image from memory. @@ -136,11 +136,11 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) printf ("## Ethernet MAC address not copied to NV RAM\n"); #endif - /* - * Use bootaddr to find the location in memory that VxWorks - * will look for the bootline string. The default value for - * PowerPC is LOCAL_MEM_LOCAL_ADRS + BOOT_LINE_OFFSET which - * defaults to 0x4200 + /* + * Use bootaddr to find the location in memory that VxWorks + * will look for the bootline string. The default value for + * PowerPC is LOCAL_MEM_LOCAL_ADRS + BOOT_LINE_OFFSET which + * defaults to 0x4200 */ if ((tmp = getenv ("bootaddr")) == NULL) @@ -148,10 +148,10 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) else bootaddr = simple_strtoul (tmp, NULL, 16); - /* - * Check to see if the bootline is defined in the 'bootargs' - * parameter. If it is not defined, we may be able to - * construct the info + /* + * Check to see if the bootline is defined in the 'bootargs' + * parameter. If it is not defined, we may be able to + * construct the info */ if ((bootline = getenv ("bootargs")) != NULL) { @@ -194,10 +194,10 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) flush_cache (bootaddr, MAX(strlen(build_buf), 255)); #else - /* - * I'm not sure what the device should be for other - * PPC flavors, the hostname and ipaddr should be ok - * to just copy + /* + * I'm not sure what the device should be for other + * PPC flavors, the hostname and ipaddr should be ok + * to just copy */ printf ("No bootargs defined\n"); @@ -205,10 +205,10 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #endif } - /* - * If the data at the load address is an elf image, then - * treat it like an elf image. Otherwise, assume that it is a - * binary image + /* + * If the data at the load address is an elf image, then + * treat it like an elf image. Otherwise, assume that it is a + * binary image */ if (valid_elf_image (addr)) { @@ -321,4 +321,16 @@ unsigned long load_elf_image (unsigned long addr) } /* ====================================================================== */ +cmd_tbl_t U_BOOT_CMD(BOOTELF) = MK_CMD_ENTRY( + "bootelf", 2, 0, do_bootelf, + "bootelf - Boot from an ELF image in memory\n", + " [address] - load address of ELF image.\n" +); + +cmd_tbl_t U_BOOT_CMD(BOOTVX) = MK_CMD_ENTRY( + "bootvx", 2, 0, do_bootvx, + "bootvx - Boot vxWorks from an ELF image\n", + " [address] - load address of vxWorks ELF image.\n" +); + #endif /* CFG_CMD_ELF */ -- cgit v1.2.3