summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_block.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/interface/efi/efi_block.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/interface/efi/efi_block.c')
-rw-r--r--src/interface/efi/efi_block.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/interface/efi/efi_block.c b/src/interface/efi/efi_block.c
index 11d11156..e81d6bb7 100644
--- a/src/interface/efi/efi_block.c
+++ b/src/interface/efi/efi_block.c
@@ -583,13 +583,13 @@ static int efi_block_filename ( unsigned int drive, EFI_HANDLE handle,
* @v drive Drive number
* @v handle Filesystem handle
* @v path Block device path
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @v fspath Filesystem device path to fill in
* @ret rc Return status code
*/
static int efi_block_match ( unsigned int drive, EFI_HANDLE handle,
EFI_DEVICE_PATH_PROTOCOL *path,
- const char *filename,
+ struct san_boot_config *config,
EFI_DEVICE_PATH_PROTOCOL **fspath ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_GUID *protocol = &efi_device_path_protocol_guid;
@@ -624,8 +624,10 @@ static int efi_block_match ( unsigned int drive, EFI_HANDLE handle,
drive, efi_devpath_text ( u.path ) );
/* Check if filesystem contains boot filename */
- if ( ( rc = efi_block_filename ( drive, handle, filename ) ) != 0 )
+ if ( ( rc = efi_block_filename ( drive, handle,
+ config->filename ) ) != 0 ) {
goto err_filename;
+ }
/* Success */
rc = 0;
@@ -642,12 +644,12 @@ static int efi_block_match ( unsigned int drive, EFI_HANDLE handle,
*
* @v drive Drive number
* @v handle Block device handle
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @v fspath Filesystem device path to fill in
* @ret rc Return status code
*/
static int efi_block_scan ( unsigned int drive, EFI_HANDLE handle,
- const char *filename,
+ struct san_boot_config *config,
EFI_DEVICE_PATH_PROTOCOL **fspath ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_GUID *protocol = &efi_device_path_protocol_guid;
@@ -690,7 +692,7 @@ static int efi_block_scan ( unsigned int drive, EFI_HANDLE handle,
/* Check for a matching filesystem */
if ( ( rc = efi_block_match ( drive, handles[i], u.path,
- filename, fspath ) ) != 0 )
+ config, fspath ) ) != 0 )
continue;
break;
@@ -847,10 +849,11 @@ static int efi_block_local ( EFI_HANDLE handle ) {
* Boot from EFI block device
*
* @v drive Drive number
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @ret rc Return status code
*/
-static int efi_block_boot ( unsigned int drive, const char *filename ) {
+static int efi_block_boot ( unsigned int drive,
+ struct san_boot_config *config ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_DEVICE_PATH_PROTOCOL *fspath = NULL;
EFI_HANDLE *handles;
@@ -943,13 +946,13 @@ static int efi_block_boot ( unsigned int drive, const char *filename ) {
DBGC ( vdrive, "EFIBLK %#02x attempting to boot\n", vdrive );
/* Scan for a matching filesystem within this drive */
- if ( ( rc = efi_block_scan ( vdrive, handle, filename,
+ if ( ( rc = efi_block_scan ( vdrive, handle, config,
&fspath ) ) != 0 ) {
continue;
}
/* Attempt to boot from the matched filesystem */
- rc = efi_block_exec ( vdrive, fspath, filename );
+ rc = efi_block_exec ( vdrive, fspath, config->filename );
break;
}