From 84d406ccf48c8808b0bb30d526b758e4b58cacc8 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 12 Apr 2017 15:03:25 +0100 Subject: [block] Allow use of a non-default EFI SAN boot filename Some older operating systems (e.g. RHEL6) use a non-default filename on the root disk and rely on setting an EFI variable to point to the bootloader. This does not work when performing a SAN boot on a machine where the EFI variable is not present. Fix by allowing a non-default filename to be specified via the "sanboot --filename" option or the "san-filename" setting. For example: sanboot --filename \efi\redhat\grub.efi \ iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6 or option ipxe.san-filename code 188 = string; option ipxe.san-filename "\\efi\\redhat\\grub.efi"; option root-path "iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6"; Originally-implemented-by: Vishvananda Ishaya Abrams Signed-off-by: Michael Brown --- src/hci/commands/sanboot_cmd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/hci') diff --git a/src/hci/commands/sanboot_cmd.c b/src/hci/commands/sanboot_cmd.c index 9965ec15..3907276a 100644 --- a/src/hci/commands/sanboot_cmd.c +++ b/src/hci/commands/sanboot_cmd.c @@ -47,12 +47,14 @@ struct sanboot_options { int no_describe; /** Keep SAN device */ int keep; + /** Filename */ + char *filename; }; /** "sanboot" option list */ static union { - /* "sanboot" takes all three options */ - struct option_descriptor sanboot[3]; + /* "sanboot" takes all four options */ + struct option_descriptor sanboot[4]; /* "sanhook" takes only --drive and --no-describe */ struct option_descriptor sanhook[2]; /* "sanunhook" takes only --drive */ @@ -65,6 +67,8 @@ static union { struct sanboot_options, no_describe, parse_flag ), OPTION_DESC ( "keep", 'k', no_argument, struct sanboot_options, keep, parse_flag ), + OPTION_DESC ( "filename", 'f', required_argument, + struct sanboot_options, filename, parse_string ), }, }; @@ -130,7 +134,8 @@ static int sanboot_core_exec ( int argc, char **argv, flags |= no_root_path_flags; /* Boot from root path */ - if ( ( rc = uriboot ( NULL, uris, count, opts.drive, flags ) ) != 0 ) + if ( ( rc = uriboot ( NULL, uris, count, opts.drive, opts.filename, + flags ) ) != 0 ) goto err_uriboot; err_uriboot: -- cgit v1.2.3-55-g7522