pxe: add support for ontimeout token
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.herring@calxeda.com>
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index acc6a9b..7781469 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -690,6 +690,7 @@
T_PROMPT,
T_INCLUDE,
T_FDT,
+ T_ONTIMEOUT,
T_INVALID
};
@@ -718,6 +719,7 @@
{"initrd", T_INITRD},
{"include", T_INCLUDE},
{"fdt", T_FDT},
+ {"ontimeout", T_ONTIMEOUT,},
{NULL, T_INVALID}
};
@@ -1016,10 +1018,8 @@
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;
@@ -1179,6 +1179,7 @@
break;
case T_DEFAULT:
+ case T_ONTIMEOUT:
err = parse_sliteral(&p, &label_name);
if (label_name) {