[block] Allow SAN boot device to be identified by an extra filename

Add an "--extra" option that can be used to specify an extra
(non-boot) filename that must exist within the booted filesystem.

Note that only files within the FAT-formatted bootable partition will
be visible to this filter.  Files within the operating system's root
disk (e.g. "/etc/redhat-release") are not generally accessible to the
firmware and so cannot be used as the existence check filter filename.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2024-03-07 13:31:29 +00:00
parent cea22d76e4
commit 62b6d36335
3 changed files with 72 additions and 32 deletions

View File

@@ -47,8 +47,10 @@ struct sanboot_options {
int no_describe;
/** Keep SAN device */
int keep;
/** Filename */
/** Boot filename */
char *filename;
/** Required extra filename */
char *extra;
/** UUID */
struct uuid_option uuid;
};
@@ -56,7 +58,7 @@ struct sanboot_options {
/** "sanboot" option list */
static union {
/* "sanboot" takes all options */
struct option_descriptor sanboot[5];
struct option_descriptor sanboot[6];
/* "sanhook" takes only --drive and --no-describe */
struct option_descriptor sanhook[2];
/* "sanunhook" takes only --drive */
@@ -71,6 +73,8 @@ static union {
struct sanboot_options, keep, parse_flag ),
OPTION_DESC ( "filename", 'f', required_argument,
struct sanboot_options, filename, parse_string ),
OPTION_DESC ( "extra", 'e', required_argument,
struct sanboot_options, extra, parse_string ),
OPTION_DESC ( "uuid", 'u', required_argument,
struct sanboot_options, uuid, parse_uuid ),
},
@@ -130,6 +134,7 @@ static int sanboot_core_exec ( int argc, char **argv,
/* Construct configuration parameters */
config.filename = opts.filename;
config.extra = opts.extra;
config.uuid = opts.uuid.value;
/* Construct flags */