diff options
-rw-r--r-- | boot/pxe_utils.c | 15 | ||||
-rw-r--r-- | doc/README.pxe | 5 | ||||
-rw-r--r-- | include/pxe_utils.h | 2 |
3 files changed, 22 insertions, 0 deletions
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index 4e27842b088..a80119c9a3b 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -781,6 +781,7 @@ enum token_type { T_IPAPPEND, T_BACKGROUND, T_KASLRSEED, + T_FALLBACK, T_INVALID }; @@ -814,6 +815,7 @@ static const struct token keywords[] = { {"ipappend", T_IPAPPEND,}, {"background", T_BACKGROUND,}, {"kaslrseed", T_KASLRSEED,}, + {"fallback", T_FALLBACK,}, {NULL, T_INVALID} }; @@ -1356,6 +1358,18 @@ static int parse_pxefile_top(struct pxe_context *ctx, char *p, unsigned long bas break; + case T_FALLBACK: + err = parse_sliteral(&p, &label_name); + + if (label_name) { + if (cfg->fallback_label) + free(cfg->fallback_label); + + cfg->fallback_label = label_name; + } + + break; + case T_INCLUDE: err = handle_include(ctx, &p, base + ALIGN(strlen(b), 4), cfg, @@ -1395,6 +1409,7 @@ void destroy_pxe_menu(struct pxe_menu *cfg) free(cfg->title); free(cfg->default_label); + free(cfg->fallback_label); list_for_each_safe(pos, n, &cfg->labels) { label = list_entry(pos, struct pxe_label, list); diff --git a/doc/README.pxe b/doc/README.pxe index 172201093d0..af2e64a5776 100644 --- a/doc/README.pxe +++ b/doc/README.pxe @@ -120,6 +120,11 @@ Unrecognized commands are ignored. default <label> - the label named here is treated as the default and is the first label 'pxe boot' attempts to boot. +fallback <label> - the label named here is treated as a fallback option that + may be attempted should it be detected that booting of + the default has failed to complete, for example via + U-Boot's boot count limit functionality. + menu title <string> - sets a title for the menu of labels being displayed. menu include <path> - use tftp to retrieve the pxe file at <path>, which diff --git a/include/pxe_utils.h b/include/pxe_utils.h index 9f195930487..a408fb7f13c 100644 --- a/include/pxe_utils.h +++ b/include/pxe_utils.h @@ -62,6 +62,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. + * fallback_label - the name of the fallback 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. @@ -73,6 +74,7 @@ struct pxe_label { struct pxe_menu { char *title; char *default_label; + char *fallback_label; char *bmp; int timeout; int prompt; |