From c698750a1cee03b0cbb0f01ed9312bff49acee79 Mon Sep 17 00:00:00 2001
From: Andreas Loibl <andreas@andreas-loibl.de>
Date: Mon, 21 May 2012 13:22:13 +0200
Subject: updated EFI detection

---
 config/binary_grub/grub.cfg | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/config/binary_grub/grub.cfg b/config/binary_grub/grub.cfg
index 9aba770..1897c6b 100644
--- a/config/binary_grub/grub.cfg
+++ b/config/binary_grub/grub.cfg
@@ -7,12 +7,12 @@ set boot_de='boot=live config utc=no timezone=Europe/Berlin locales=de keyboard-
 
 if loadfont /boot/grub/unicode.pf2 ; then
   set gfxmode=800x600
-  if [ $efi != 1 ] ; then
-    insmod vbe
-    insmod vga
-  else
+  if [ "$grub_platform" == "efi" ]; then
     insmod efi_gop
     insmod efi_uga
+  else
+    insmod vbe
+    insmod vga
   fi
   insmod video_bochs
   insmod video_cirrus
@@ -101,11 +101,7 @@ menuentry 'Start Kanotix EN (failsafe)' --class kanotix64 --class gnu-linux --cl
 
 #####
 
-if [ $efi != 1 ] ; then
-  menuentry 'Memtest86+' --class memtest {
-        linux16 /live/memtest
-  }
-else
+if [ "$grub_platform" == "efi" ]; then
   if test -f /efi/boot/shellx64.efi ; then
     menuentry 'EFI Shell x64' {
           chainloader /efi/boot/shellx64.efi
@@ -116,11 +112,19 @@ else
           chainloader /efi/boot/shellx86.efi
     }
   fi
-  if search -nf /EFI/Microsoft/Boot/BOOTMGR.EFI ; then
-    menuentry 'Microsoft Bootmgr' {
-        search -sf /EFI/Microsoft/Boot/BOOTMGR.EFI
-        chainloader /EFI/Boot/BOOTX64.EFI
+  insmod regexp
+  for bootmgfw in (*)/EFI/Microsoft/Boot/bootmgfw.efi; do 
+   if [ -e "$bootmgfw" ]; then
+    regexp --set=device '(\(.*\))' "$bootmgfw"
+    menuentry "Boot Windows UEFI from device $device" "$device" "$bootmgfw" {
+     root="$2"
+     chainloader "$3" 
     }
-  fi
+   fi
+  done
+else
+  menuentry 'Memtest86+' --class memtest {
+        linux16 /live/memtest
+  }
 fi
 
-- 
cgit v1.0