From: Rob Herring <rob.herr...@calxeda.com>

ontimeout is similar to default, but is the selection on menu timeout.
This is how cobbler sets a default. The label default is supposed to be
the default selection when <enter> is pressed. If both default and
ontimeout are set, last one parsed wins.

Signed-off-by: Rob Herring <rob.herr...@calxeda.com>
---
 common/cmd_pxe.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index d697045..93c8df5 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -671,6 +671,7 @@ enum token_type {
        T_PROMPT,
        T_INCLUDE,
        T_FDT,
+       T_ONTIMEOUT,
        T_INVALID
 };
 
@@ -699,6 +700,7 @@ static const struct token keywords[] = {
        {"initrd", T_INITRD},
        {"include", T_INCLUDE},
        {"fdt", T_FDT},
+       {"ontimeout", T_ONTIMEOUT,},
        {NULL, T_INVALID}
 };
 
@@ -996,10 +998,8 @@ static int parse_label_menu(char **c, struct pxe_menu *cfg,
 
        switch (t.type) {
        case T_DEFAULT:
-               if (cfg->default_label)
-                       free(cfg->default_label);
-
-               cfg->default_label = strdup(label->name);
+               if (!cfg->default_label)
+                       cfg->default_label = strdup(label->name);
 
                if (!cfg->default_label)
                        return -ENOMEM;
@@ -1158,6 +1158,7 @@ static int parse_pxefile_top(char *p, struct pxe_menu 
*cfg, int nest_level)
                        break;
 
                case T_DEFAULT:
+               case T_ONTIMEOUT:
                        err = parse_sliteral(&p, &label_name);
 
                        if (label_name) {
-- 
1.7.10.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to