rockchip: misc: protect serial# from getting overwritten
[oweals/u-boot.git] / cmd / pxe.c
index 274555319ba8d8ab026e9600a8a23e9428281b15..768e50aba610ed6a60336597b6b85f0e8d3abd94 100644 (file)
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -6,13 +6,16 @@
 
 #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"
@@ -22,6 +25,9 @@
 
 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,
@@ -488,6 +494,7 @@ struct pxe_label {
  *
  * 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
@@ -498,6 +505,7 @@ struct pxe_label {
 struct pxe_menu {
        char *title;
        char *default_label;
+       char *bmp;
        int timeout;
        int prompt;
        struct list_head labels;
@@ -655,6 +663,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
                strncpy(bootm_argv[2], env_get("ramdisk_addr_r"), 18);
                strcat(bootm_argv[2], ":");
                strncat(bootm_argv[2], env_get("filesize"), 9);
+               bootm_argc = 3;
        }
 
        if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) {
@@ -850,6 +859,7 @@ enum token_type {
        T_FDTDIR,
        T_ONTIMEOUT,
        T_IPAPPEND,
+       T_BACKGROUND,
        T_INVALID
 };
 
@@ -883,6 +893,7 @@ static const struct token keywords[] = {
        {"fdtdir", T_FDTDIR},
        {"ontimeout", T_ONTIMEOUT,},
        {"ipappend", T_IPAPPEND,},
+       {"background", T_BACKGROUND,},
        {NULL, T_INVALID}
 };
 
@@ -1160,6 +1171,10 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
                                                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);
@@ -1574,6 +1589,20 @@ static void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)
        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;