mirror of
https://github.com/ipxe/ipxe
synced 2025-12-22 04:50:25 +03:00
[autoboot] Connect SAN disk during a filename boot, if applicable
For performing installations direct to a SAN target, it can be very useful to hook a SAN disk and then proceed to perform a filename boot. For example, the user may wish to hook the (empty) SAN installation disk and then boot into the OS installer via TFTP. This provides an alternative mechanism to using "keep-san" and relying on the BIOS to fall through to boot from the installation media, which is unreliable on many BIOSes. When a root-path is specified in addition to a boot filename, attempt to hook the root-path as a SAN disk before booting from the specified filename. Since the root-path may be used for non-SAN purposes (e.g. an NFS root mount point), ignore the root-path if it contains a URI scheme that we do not support. Originally-implemented-by: Jarrod Johnson <jarrod.b.johnson@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -18,9 +18,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <ipxe/command.h>
|
||||
#include <ipxe/parseopt.h>
|
||||
#include <ipxe/uri.h>
|
||||
#include <usr/autoboot.h>
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
@@ -52,23 +54,33 @@ static struct command_descriptor sanboot_cmd =
|
||||
static int sanboot_exec ( int argc, char **argv ) {
|
||||
struct sanboot_options opts;
|
||||
const char *root_path;
|
||||
struct uri *uri;
|
||||
int rc;
|
||||
|
||||
/* Parse options */
|
||||
if ( ( rc = parse_options ( argc, argv, &sanboot_cmd, &opts ) ) != 0 )
|
||||
return rc;
|
||||
goto err_parse_options;
|
||||
|
||||
/* Parse root path */
|
||||
root_path = argv[optind];
|
||||
|
||||
/* Boot from root path */
|
||||
if ( ( rc = boot_root_path ( root_path ) ) != 0 ) {
|
||||
printf ( "Could not boot from %s: %s\n",
|
||||
root_path, strerror ( rc ) );
|
||||
return rc;
|
||||
uri = parse_uri ( root_path );
|
||||
if ( ! uri ) {
|
||||
rc = -ENOMEM;
|
||||
goto err_parse_uri;
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* Boot from root path */
|
||||
if ( ( rc = uriboot ( NULL, uri ) ) != 0 ) {
|
||||
printf ( "Could not boot from %s: %s\n",
|
||||
root_path, strerror ( rc ) );
|
||||
goto err_uriboot;
|
||||
}
|
||||
|
||||
err_uriboot:
|
||||
uri_put ( uri );
|
||||
err_parse_uri:
|
||||
err_parse_options:
|
||||
return rc;
|
||||
}
|
||||
|
||||
/** SAN commands */
|
||||
|
||||
Reference in New Issue
Block a user