#include <common.h>
#include <command.h>
+#include <env.h>
#include <malloc.h>
#include <mapmem.h>
+#include <lcd.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <errno.h>
#include <linux/list.h>
#include <fs.h>
+#include <splash.h>
#include <asm/io.h>
#include "menu.h"
const char *pxe_default_paths[] = {
#ifdef CONFIG_SYS_SOC
+#ifdef CONFIG_SYS_BOARD
+ "default-" CONFIG_SYS_ARCH "-" CONFIG_SYS_SOC "-" CONFIG_SYS_BOARD,
+#endif
"default-" CONFIG_SYS_ARCH "-" CONFIG_SYS_SOC,
#endif
"default-" CONFIG_SYS_ARCH,
char *name;
char *menu;
char *kernel;
+ char *config;
char *append;
char *initrd;
char *fdt;
*
* title - the name of the menu as given by a 'menu title' line.
* default_label - the name of the default label, if any.
+ * bmp - the bmp file name which is displayed in background
* timeout - time in tenths of a second to wait for a user key-press before
* booting the default label.
* prompt - if 0, don't prompt for a choice unless the timeout period is
struct pxe_menu {
char *title;
char *default_label;
+ char *bmp;
int timeout;
int prompt;
struct list_head labels;
if (label->kernel)
free(label->kernel);
+ if (label->config)
+ free(label->config);
+
if (label->append)
free(label->append);
char initrd_str[28];
char mac_str[29] = "";
char ip_str[68] = "";
+ char *fit_addr = NULL;
int bootm_argc = 2;
int len = 0;
ulong kernel_addr;
}
bootm_argv[1] = env_get("kernel_addr_r");
+ /* for FIT, append the configuration identifier */
+ if (label->config) {
+ int len = strlen(bootm_argv[1]) + strlen(label->config) + 1;
+
+ fit_addr = malloc(len);
+ if (!fit_addr) {
+ printf("malloc fail (FIT address)\n");
+ return 1;
+ }
+ snprintf(fit_addr, len, "%s%s", bootm_argv[1], label->config);
+ bootm_argv[1] = fit_addr;
+ }
/*
* fdt usage is optional:
fdtfilefree = malloc(len);
if (!fdtfilefree) {
printf("malloc fail (FDT filename)\n");
- return 1;
+ goto cleanup;
}
snprintf(fdtfilefree, len, "%s%s%s%s%s%s",
if (err < 0) {
printf("Skipping %s for failure retrieving fdt\n",
label->name);
- return 1;
+ goto cleanup;
}
} else {
bootm_argv[3] = NULL;
do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
#endif
unmap_sysmem(buf);
+
+cleanup:
+ if (fit_addr)
+ free(fit_addr);
return 1;
}
T_FDTDIR,
T_ONTIMEOUT,
T_IPAPPEND,
+ T_BACKGROUND,
T_INVALID
};
{"fdtdir", T_FDTDIR},
{"ontimeout", T_ONTIMEOUT,},
{"ipappend", T_IPAPPEND,},
+ {"background", T_BACKGROUND,},
{NULL, T_INVALID}
};
nest_level + 1);
break;
+ case T_BACKGROUND:
+ err = parse_sliteral(c, &cfg->bmp);
+ break;
+
default:
printf("Ignoring malformed menu command: %.*s\n",
(int)(*c - s), s);
return 0;
}
+/*
+ * Handles parsing a 'kernel' label.
+ * expecting "filename" or "<fit_filename>#cfg"
+ */
+static int parse_label_kernel(char **c, struct pxe_label *label)
+{
+ char *s;
+ int err;
+
+ err = parse_sliteral(c, &label->kernel);
+ if (err < 0)
+ return err;
+
+ s = strstr(label->kernel, "#");
+ if (!s)
+ return 1;
+
+ label->config = malloc(strlen(s) + 1);
+ if (!label->config)
+ return -ENOMEM;
+
+ strcpy(label->config, s);
+ *s = 0;
+
+ return 1;
+}
+
/*
* Parses a label and adds it to the list of labels for a menu.
*
case T_KERNEL:
case T_LINUX:
- err = parse_sliteral(c, &label->kernel);
+ err = parse_label_kernel(c, label);
break;
case T_APPEND:
/*
* Create a menu and add items for all the labels.
*/
- m = menu_create(cfg->title, cfg->timeout, cfg->prompt, label_print,
- NULL, NULL);
+ m = menu_create(cfg->title, DIV_ROUND_UP(cfg->timeout, 10),
+ cfg->prompt, label_print, NULL, NULL);
if (!m)
return NULL;
struct menu *m;
int err;
+#ifdef CONFIG_CMD_BMP
+ /* display BMP if available */
+ if (cfg->bmp) {
+ if (get_relfile(cmdtp, cfg->bmp, load_addr)) {
+ run_command("cls", 0);
+ bmp_display(load_addr,
+ BMP_ALIGN_CENTER, BMP_ALIGN_CENTER);
+ } else {
+ printf("Skipping background bmp %s for failure\n",
+ cfg->bmp);
+ }
+ }
+#endif
+
m = pxe_menu_to_menu(cfg);
if (!m)
return;