[edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Ubuntu boot

xianhu2x posted 1 patch 7 years, 3 months ago
Failed in applying to current master (apply log)
.../Library/GenericBdsLib/BdsBoot.c                | 28 ++++++++++++++++++++++
Core/MdePkg/Include/Uefi/UefiSpec.h                | 11 +++++----
2 files changed, 34 insertions(+), 5 deletions(-)
[edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Ubuntu boot
Posted by xianhu2x 7 years, 3 months ago
Add Ubuntu boot loader file path \\EFI\\UBUNTU\\GRUBX64.EFI into known OS loader list.

Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: xianhu2x <xianhuix.liu@intel.com>
---
 .../Library/GenericBdsLib/BdsBoot.c                | 28 ++++++++++++++++++++++
 Core/MdePkg/Include/Uefi/UefiSpec.h                | 11 +++++----
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/Core/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/Core/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index d1da635f3..ce1dd4a0b 100644
--- a/Core/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/Core/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -2384,6 +2384,22 @@ BdsLibBootViaBootOption (
                           0,
                           &ImageHandle
                           );
+
+  if (EFI_ERROR(Status)) {
+            //
+            //Try Ubuntu boot loader
+            //
+            FilePath = FileDevicePath (Handle, EFI_REMOVABLE_MEDIA_FILE_NAME_UBUNTU_X64);
+            Status = gBS->LoadImage (
+                            TRUE,
+                            gImageHandle,
+                            FilePath,
+                            NULL,
+                            0,
+                            &ImageHandle
+                            );
+          }
+           
         }
       }
     }
@@ -3721,6 +3737,18 @@ BdsLibGetBootableHandle (
                  &DosHeader,
                  Hdr
                  );
+
+      if (EFI_ERROR(Status)) {
+        //
+        //Try Ubuntu boot loader
+        //
+        Status = BdsLibGetImageHeader (
+                   SimpleFileSystemHandles[Index],
+                   EFI_REMOVABLE_MEDIA_FILE_NAME_UBUNTU_X64,
+                   &DosHeader,
+                   Hdr
+                   );
+      }
       if (!EFI_ERROR (Status) &&
         EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Hdr.Pe32->FileHeader.Machine) &&
         Hdr.Pe32->OptionalHeader.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
diff --git a/Core/MdePkg/Include/Uefi/UefiSpec.h b/Core/MdePkg/Include/Uefi/UefiSpec.h
index 57cb4e804..e5556952b 100644
--- a/Core/MdePkg/Include/Uefi/UefiSpec.h
+++ b/Core/MdePkg/Include/Uefi/UefiSpec.h
@@ -2166,11 +2166,12 @@ typedef struct {
 //
 // EFI File location to boot from on removable media devices
 //
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32    L"\\EFI\\BOOT\\BOOTIA32.EFI"
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64    L"\\EFI\\BOOT\\BOOTIA64.EFI"
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64     L"\\EFI\\BOOT\\BOOTX64.EFI"
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM     L"\\EFI\\BOOT\\BOOTARM.EFI"
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32       L"\\EFI\\BOOT\\BOOTIA32.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64       L"\\EFI\\BOOT\\BOOTIA64.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64        L"\\EFI\\BOOT\\BOOTX64.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM        L"\\EFI\\BOOT\\BOOTARM.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64    L"\\EFI\\BOOT\\BOOTAA64.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_UBUNTU_X64 L"\\EFI\\UBUNTU\\GRUBX64.EFI"
 
 #if   defined (MDE_CPU_IA32)
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
-- 
2.14.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel