[block] Allow SAN boot device to be identified by UUID

Add a "--uuid" option which may be used to specify a boot device UUID,
to be matched against the GPT partition GUID.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2024-03-06 08:55:55 +00:00
parent c4471e3408
commit cea22d76e4
5 changed files with 41 additions and 7 deletions

View File

@@ -49,12 +49,14 @@ struct sanboot_options {
int keep;
/** Filename */
char *filename;
/** UUID */
struct uuid_option uuid;
};
/** "sanboot" option list */
static union {
/* "sanboot" takes all four options */
struct option_descriptor sanboot[4];
/* "sanboot" takes all options */
struct option_descriptor sanboot[5];
/* "sanhook" takes only --drive and --no-describe */
struct option_descriptor sanhook[2];
/* "sanunhook" takes only --drive */
@@ -69,10 +71,11 @@ static union {
struct sanboot_options, keep, parse_flag ),
OPTION_DESC ( "filename", 'f', required_argument,
struct sanboot_options, filename, parse_string ),
OPTION_DESC ( "uuid", 'u', required_argument,
struct sanboot_options, uuid, parse_uuid ),
},
};
/** "sanhook" command descriptor */
static struct command_descriptor sanhook_cmd =
COMMAND_DESC ( struct sanboot_options, opts.sanhook, 1, MAX_ARGUMENTS,
@@ -127,6 +130,7 @@ static int sanboot_core_exec ( int argc, char **argv,
/* Construct configuration parameters */
config.filename = opts.filename;
config.uuid = opts.uuid.value;
/* Construct flags */
flags = default_flags;