diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/board_f.c | 6 | ||||
-rw-r--r-- | common/board_r.c | 2 | ||||
-rw-r--r-- | common/bootm.c | 10 | ||||
-rw-r--r-- | common/cli_simple.c | 4 | ||||
-rw-r--r-- | common/cmd_pxe.c | 29 | ||||
-rw-r--r-- | common/image.c | 39 |
6 files changed, 50 insertions, 40 deletions
diff --git a/common/board_f.c b/common/board_f.c index d5e7622..11aa555 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -270,7 +270,7 @@ static int setup_mon_len(void) gd->mon_len = (ulong)&__bss_end - (ulong)_start; #elif defined(CONFIG_SANDBOX) gd->mon_len = (ulong)&_end - (ulong)_init; -#elif defined(CONFIG_BLACKFIN) +#elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2) gd->mon_len = CONFIG_SYS_MONITOR_LEN; #else /* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */ @@ -945,7 +945,7 @@ static init_fnc_t init_sequence_f[] = { * - board info struct */ setup_dest_addr, -#if defined(CONFIG_BLACKFIN) +#if defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2) /* Blackfin u-boot monitor should be on top of the ram */ reserve_uboot, #endif @@ -970,7 +970,7 @@ static init_fnc_t init_sequence_f[] = { !defined(CONFIG_BLACKFIN) reserve_video, #endif -#if !defined(CONFIG_BLACKFIN) +#if !defined(CONFIG_BLACKFIN) && !defined(CONFIG_NIOS2) reserve_uboot, #endif #ifndef CONFIG_SPL_BUILD diff --git a/common/board_r.c b/common/board_r.c index ba9a68d..f9647e1 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -133,7 +133,7 @@ static int initr_reloc_global_data(void) { #ifdef __ARM__ monitor_flash_len = _end - __image_copy_start; -#elif !defined(CONFIG_SANDBOX) +#elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2) monitor_flash_len = (ulong)&__init_end - gd->relocaddr; #endif #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) diff --git a/common/bootm.c b/common/bootm.c index 76d811c..ff81a27 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -725,13 +725,15 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, #endif ulong img_addr; const void *buf; -#if defined(CONFIG_FIT) const char *fit_uname_config = NULL; const char *fit_uname_kernel = NULL; +#if defined(CONFIG_FIT) int os_noffset; #endif - img_addr = genimg_get_kernel_addr(argv[0]); + img_addr = genimg_get_kernel_addr_fit(argc < 1 ? NULL : argv[0], + &fit_uname_config, + &fit_uname_kernel); bootstage_mark(BOOTSTAGE_ID_CHECK_MAGIC); @@ -788,10 +790,6 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, #endif #if defined(CONFIG_FIT) case IMAGE_FORMAT_FIT: - if (!fit_parse_conf(argv[0], load_addr, &img_addr, - &fit_uname_config)) - fit_parse_subimage(argv[0], load_addr, &img_addr, - &fit_uname_kernel); os_noffset = fit_image_load(images, img_addr, &fit_uname_kernel, &fit_uname_config, IH_ARCH_DEFAULT, IH_TYPE_KERNEL, diff --git a/common/cli_simple.c b/common/cli_simple.c index 353ceeb..6c65cc6 100644 --- a/common/cli_simple.c +++ b/common/cli_simple.c @@ -57,7 +57,7 @@ int cli_simple_parse_line(char *line, char *argv[]) return nargs; } -static void process_macros(const char *input, char *output) +void cli_simple_process_macros(const char *input, char *output) { char c, prev; const char *varname_start = NULL; @@ -236,7 +236,7 @@ int cli_simple_run_command(const char *cmd, int flag) debug_parser("token: \"%s\"\n", token); /* find macros in this token and replace them */ - process_macros(token, finaltoken); + cli_simple_process_macros(token, finaltoken); /* Extract arguments */ argc = cli_simple_parse_line(finaltoken, argv); diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index c816339..0ab1e0a 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -15,6 +15,7 @@ #include <fs.h> #include "menu.h" +#include "cli.h" #define MAX_TFTP_PATH_LEN 127 @@ -578,8 +579,12 @@ static int label_localboot(struct pxe_label *label) if (!localcmd) return -ENOENT; - if (label->append) - setenv("bootargs", label->append); + if (label->append) { + char bootargs[CONFIG_SYS_CBSIZE]; + + cli_simple_process_macros(label->append, bootargs); + setenv("bootargs", bootargs); + } debug("running: %s\n", localcmd); @@ -607,7 +612,6 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label) char initrd_str[22]; char mac_str[29] = ""; char ip_str[68] = ""; - char *bootargs; int bootm_argc = 3; int len = 0; ulong kernel_addr; @@ -654,7 +658,6 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label) sprintf(ip_str, " ip=%s:%s:%s:%s", getenv("ipaddr"), getenv("serverip"), getenv("gatewayip"), getenv("netmask")); - len += strlen(ip_str); } #ifdef CONFIG_CMD_NET @@ -664,27 +667,21 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label) err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8); if (err < 0) mac_str[0] = '\0'; - len += strlen(mac_str); } #endif - if (label->append) - len += strlen(label->append); + if ((label->ipappend & 0x3) || label->append) { + char bootargs[CONFIG_SYS_CBSIZE] = ""; + char finalbootargs[CONFIG_SYS_CBSIZE]; - if (len) { - bootargs = malloc(len + 1); - if (!bootargs) - return 1; - bootargs[0] = '\0'; if (label->append) strcpy(bootargs, label->append); strcat(bootargs, ip_str); strcat(bootargs, mac_str); - setenv("bootargs", bootargs); - printf("append: %s\n", bootargs); - - free(bootargs); + cli_simple_process_macros(bootargs, finalbootargs); + setenv("bootargs", finalbootargs); + printf("append: %s\n", finalbootargs); } bootm_argv[1] = getenv("kernel_addr_r"); diff --git a/common/image.c b/common/image.c index a2999c0..d4ccff0 100644 --- a/common/image.c +++ b/common/image.c @@ -643,22 +643,24 @@ int genimg_get_comp_id(const char *name) #ifndef USE_HOSTCC /** - * genimg_get_kernel_addr - get the real kernel address + * genimg_get_kernel_addr_fit - get the real kernel address and return 2 + * FIT strings * @img_addr: a string might contain real image address + * @fit_uname_config: double pointer to a char, will hold pointer to a + * configuration unit name + * @fit_uname_kernel: double pointer to a char, will hold pointer to a subimage + * name * - * genimg_get_kernel_addr() get the real kernel start address from a string + * genimg_get_kernel_addr_fit get the real kernel start address from a string * which is normally the first argv of bootm/bootz * * returns: * kernel start address */ -ulong genimg_get_kernel_addr(char * const img_addr) +ulong genimg_get_kernel_addr_fit(char * const img_addr, + const char **fit_uname_config, + const char **fit_uname_kernel) { -#if defined(CONFIG_FIT) - const char *fit_uname_config = NULL; - const char *fit_uname_kernel = NULL; -#endif - ulong kernel_addr; /* find out kernel image address */ @@ -668,13 +670,13 @@ ulong genimg_get_kernel_addr(char * const img_addr) load_addr); #if defined(CONFIG_FIT) } else if (fit_parse_conf(img_addr, load_addr, &kernel_addr, - &fit_uname_config)) { + fit_uname_config)) { debug("* kernel: config '%s' from image at 0x%08lx\n", - fit_uname_config, kernel_addr); + *fit_uname_config, kernel_addr); } else if (fit_parse_subimage(img_addr, load_addr, &kernel_addr, - &fit_uname_kernel)) { + fit_uname_kernel)) { debug("* kernel: subimage '%s' from image at 0x%08lx\n", - fit_uname_kernel, kernel_addr); + *fit_uname_kernel, kernel_addr); #endif } else { kernel_addr = simple_strtoul(img_addr, NULL, 16); @@ -686,6 +688,19 @@ ulong genimg_get_kernel_addr(char * const img_addr) } /** + * genimg_get_kernel_addr() is the simple version of + * genimg_get_kernel_addr_fit(). It ignores those return FIT strings + */ +ulong genimg_get_kernel_addr(char * const img_addr) +{ + const char *fit_uname_config = NULL; + const char *fit_uname_kernel = NULL; + + return genimg_get_kernel_addr_fit(img_addr, &fit_uname_config, + &fit_uname_kernel); +} + +/** * genimg_get_format - get image format type * @img_addr: image start address * |