From 8ba82a91b3aa615fb6148ecfa2af4e91a28659ae Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Wed, 9 Oct 2024 14:15:39 +0100 Subject: boot: Add logic to enable booting from fallback option The "fallback" extlinux config option allows us to set an alternative default boot option for when it has been detected that the default is failing. Implement the logic required to boot from this option when desired. Signed-off-by: Martyn Welch Reviewed-by: Simon Glass --- include/pxe_utils.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/pxe_utils.h b/include/pxe_utils.h index a408fb7f13c..68ac40b64ad 100644 --- a/include/pxe_utils.h +++ b/include/pxe_utils.h @@ -96,6 +96,8 @@ typedef int (*pxe_getfile_func)(struct pxe_context *ctx, const char *file_path, * allocated * @pxe_file_size: Size of the PXE file * @use_ipv6: TRUE : use IPv6 addressing, FALSE : use IPv4 addressing + * @use_fallback: TRUE : use "fallback" option as default, FALSE : use + * "default" option as default */ struct pxe_context { struct cmd_tbl *cmdtp; @@ -116,6 +118,7 @@ struct pxe_context { char *bootdir; ulong pxe_file_size; bool use_ipv6; + bool use_fallback; }; /** @@ -215,12 +218,17 @@ int format_mac_pxe(char *outbuf, size_t outbuf_len); * none * @use_ipv6: TRUE : use IPv6 addressing * FALSE : use IPv4 addressing + * @use_fallback: TRUE : Use "fallback" option instead of "default" should no + * other choice be selected + * FALSE : Use "default" option should no other choice be + * selected * Return: 0 if OK, -ENOMEM if out of memory, -E2BIG if bootfile is larger than * MAX_TFTP_PATH_LEN bytes */ int pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl *cmdtp, pxe_getfile_func getfile, void *userdata, - bool allow_abs_path, const char *bootfile, bool use_ipv6); + bool allow_abs_path, const char *bootfile, bool use_ipv6, + bool use_fallback); /** * pxe_destroy_ctx() - Destroy a PXE context -- cgit v1.2.3