[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 <vish.ishaya@oracle.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2017-04-12 15:03:25 +01:00
parent a82f937485
commit 84d406ccf4
12 changed files with 97 additions and 21 deletions

View File

@@ -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: