summaryrefslogtreecommitdiffstats
path: root/src/usr/autoboot.c
diff options
context:
space:
mode:
authorMichael Brown2024-03-05 21:20:10 +0100
committerMichael Brown2024-03-06 13:19:22 +0100
commit636ccb4ca55c73841e634f9d5986087fb3565da4 (patch)
tree31a788498a6a03bfead3a7df5c8da9ef13eab8b9 /src/usr/autoboot.c
parent[efi] Allow booting from local disks via the "sanboot" command (diff)
downloadipxe-636ccb4ca55c73841e634f9d5986087fb3565da4.tar.gz
ipxe-636ccb4ca55c73841e634f9d5986087fb3565da4.tar.xz
ipxe-636ccb4ca55c73841e634f9d5986087fb3565da4.zip
[block] Allow for additional SAN boot parameters alongside filename
The drive specification alone does not necessarily contain enough information to perform a SAN boot (or local disk boot) under UEFI. If the next-stage bootloader is installed in the EFI system partition under a non-standard name (e.g. "\EFI\debian\grubx64.efi") then this explicit boot filename must also be specified. Generalise this concept to use a "SAN boot configuration parameters" structure (currently containing only the optional explicit boot filename), to allow for easy expansion to provide other parameters such as the partition UUID or volume label. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/usr/autoboot.c')
-rw-r--r--src/usr/autoboot.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
index d1f25962..4b64ca82 100644
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -116,7 +116,7 @@ const struct setting skip_san_boot_setting __setting ( SETTING_SANBOOT_EXTRA,
* @v root_paths Root path(s)
* @v root_path_count Number of root paths
* @v drive SAN drive (if applicable)
- * @v san_filename SAN filename (or NULL to use default)
+ * @v san_config SAN boot configuration parameters
* @v flags Boot action flags
* @ret rc Return status code
*
@@ -128,8 +128,9 @@ const struct setting skip_san_boot_setting __setting ( SETTING_SANBOOT_EXTRA,
*/
int uriboot ( struct uri *filename, struct uri **root_paths,
unsigned int root_path_count, int drive,
- const char *san_filename, unsigned int flags ) {
+ struct san_boot_config *san_config, unsigned int flags ) {
struct image *image;
+ const char *san_filename;
int rc;
/* Hook SAN device, if applicable */
@@ -182,11 +183,12 @@ int uriboot ( struct uri *filename, struct uri **root_paths,
/* Attempt SAN boot if applicable */
if ( ! ( flags & URIBOOT_NO_SAN_BOOT ) ) {
+ san_filename = san_config->filename;
if ( fetch_intz_setting ( NULL, &skip_san_boot_setting) == 0 ) {
printf ( "Booting%s%s from SAN device %#02x\n",
( san_filename ? " " : "" ),
( san_filename ? san_filename : "" ), drive );
- rc = san_boot ( drive, san_filename );
+ rc = san_boot ( drive, san_config );
printf ( "Boot from SAN device %#02x failed: %s\n",
drive, strerror ( rc ) );
} else {
@@ -387,6 +389,7 @@ static int have_pxe_menu ( void ) {
* @ret rc Return status code
*/
int netboot ( struct net_device *netdev ) {
+ struct san_boot_config san_config;
struct uri *filename;
struct uri *root_path;
char *san_filename;
@@ -421,6 +424,10 @@ int netboot ( struct net_device *netdev ) {
/* Fetch SAN filename (if any) */
san_filename = fetch_san_filename ( NULL );
+ /* Construct SAN boot configuration parameters */
+ memset ( &san_config, 0, sizeof ( san_config ) );
+ san_config.filename = san_filename;
+
/* If we have both a filename and a root path, ignore an
* unsupported or missing URI scheme in the root path, since
* it may represent an NFS root.
@@ -442,7 +449,7 @@ int netboot ( struct net_device *netdev ) {
/* Boot using next server, filename and root path */
if ( ( rc = uriboot ( filename, &root_path, ( root_path ? 1 : 0 ),
- san_default_drive(), san_filename,
+ san_default_drive(), &san_config,
( root_path ? 0 : URIBOOT_NO_SAN ) ) ) != 0 )
goto err_uriboot;