Implement call to efi_boot_local() from efi_block_boot()
when there is no san_device defined for the given drive #.

This is will allow the sanboot command to attempt to boot
a local UEFI disk in the event that a drive was specified
for which there is no corrensponding san_device "hooked".

Signed-off-by: Aaron Young <aaron.yo...@oracle.com>
---
 src/include/usr/efiboot.h     |  1 +
 src/interface/efi/efi_block.c |  8 +++++++-
 src/interface/efi/efi_boot.c  | 14 ++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/include/usr/efiboot.h b/src/include/usr/efiboot.h
index 816a0bb..bd3065f 100644
--- a/src/include/usr/efiboot.h
+++ b/src/include/usr/efiboot.h
@@ -10,5 +10,6 @@
 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 
 extern void efi_boot_display_map ( void );
+extern int efi_boot_local ( unsigned int drive, const char *filename );
 
 #endif /* _USR_EFIBOOT_H */
diff --git a/src/interface/efi/efi_block.c b/src/interface/efi/efi_block.c
index 91f830a..3c0409a 100644
--- a/src/interface/efi/efi_block.c
+++ b/src/interface/efi/efi_block.c
@@ -56,6 +56,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #include <ipxe/efi/efi_snp.h>
 #include <ipxe/efi/efi_utils.h>
 #include <ipxe/efi/efi_block.h>
+#include <usr/efiboot.h>
 
 /** ACPI table protocol protocol */
 static EFI_ACPI_TABLE_PROTOCOL *acpi;
@@ -634,7 +635,12 @@ static int efi_block_boot ( unsigned int drive, const char 
*filename ) {
        sandev = sandev_find ( drive );
        if ( ! sandev ) {
                DBG ( "EFIBLK cannot find drive %#02x\n", drive );
-               rc = -ENODEV;
+               DBG ( "EFIBLK attempting local boot for drive %#02x, "
+                     "filename=%s\n", drive, filename );
+               rc = efi_boot_local( drive, filename );
+               if (rc)
+                       rc = -ENODEV;
+
                goto err_sandev_find;
        }
 
diff --git a/src/interface/efi/efi_boot.c b/src/interface/efi/efi_boot.c
index 9976084..5d44f8b 100644
--- a/src/interface/efi/efi_boot.c
+++ b/src/interface/efi/efi_boot.c
@@ -30,6 +30,20 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  *
  */
 
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
 void efi_boot_display_map ( void ) {
        return;
 }
+
+int efi_boot_local ( unsigned int drive, const char *filename ) {
+
+       // Dummy code to get around compiler for now.
+       if (filename)
+               return drive;
+
+       return 0;
+}
-- 
1.8.3.1

_______________________________________________
ipxe-devel mailing list
ipxe-devel@lists.ipxe.org
https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel

Reply via email to