diff options
author | Rob Herring <rob.herring@calxeda.com> | 2012-12-02 21:00:27 -0600 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2013-06-24 19:07:34 -0500 |
commit | 8577fec976c58a0bd1c2c767f9dba058043624f4 (patch) | |
tree | 4a5d91d2c2c39aea23942d836e3c08445c91b64c /common/cmd_pxe.c | |
parent | 32d2ffe7316b39fbeb38525e9445601cb39276fd (diff) | |
download | u-boot-imx-8577fec976c58a0bd1c2c767f9dba058043624f4.zip u-boot-imx-8577fec976c58a0bd1c2c767f9dba058043624f4.tar.gz u-boot-imx-8577fec976c58a0bd1c2c767f9dba058043624f4.tar.bz2 |
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>
Diffstat (limited to 'common/cmd_pxe.c')
-rw-r--r-- | common/cmd_pxe.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index 079d226..5a239ed 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -672,6 +672,7 @@ enum token_type { T_PROMPT, T_INCLUDE, T_FDT, + T_ONTIMEOUT, T_INVALID }; @@ -700,6 +701,7 @@ static const struct token keywords[] = { {"initrd", T_INITRD}, {"include", T_INCLUDE}, {"fdt", T_FDT}, + {"ontimeout", T_ONTIMEOUT,}, {NULL, T_INVALID} }; @@ -997,10 +999,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; @@ -1159,6 +1159,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) { @@ -1280,7 +1281,7 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg) return NULL; } if (cfg->default_label && - (strcmp(label->name, cfg->default_label) == 0)) + (strcmp(label->name, cfg->default_label) == 0)) default_num = label->num; } |