OSDN Git Service

1-install: search bootmgfw.efi at runtime
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 10 Jan 2018 09:51:21 +0000 (17:51 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 10 Jan 2018 09:51:21 +0000 (17:51 +0800)
Originally we only create Windows boot item on installation. So
if bootmgfw.efi is installed afterward, it won't be shown in the
grub boot menu.

The patch searches bootmgfw.efi at runtime and shows it if it's
available.

boot/boot/grub/grub.cfg
install/scripts/1-install

index 58f5d11..6d64d5f 100644 (file)
@@ -18,7 +18,11 @@ menuentry 'Android-x86 VER Installation' --class android-x86 {
        initrd /initrd.img
 }
 
-menuentry 'Windows' {
-       search --file --no-floppy --set=root /EFI/Microsoft/Boot/bootmgfw.efi
-       chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
-}
+set winefi=/EFI/Microsoft/Boot/bootmgfw.efi
+search --file --no-floppy --set=win ${winefi}
+if [ -e (${win})/${winefi} ]; then
+       menuentry Windows --class windows {
+               set root=${win}
+               chainloader (${root})/${winefi}
+       }
+fi
index de40155..66f03d6 100644 (file)
@@ -326,9 +326,7 @@ install_to()
                echo -e "set timeout=5\n\n" > $grubcfg
                echo -e "menuentry \"Android-x86 $VER\" {\n\tsearch --set=root --file /$asrc/kernel\n\tlinux /$asrc/kernel quiet $cmdline \n\tinitrd /$asrc/initrd.img\n}" >> $grubcfg
                echo -e "menuentry \"Android-x86 $VER (DEBUG mode)\" {\n\tsearch --set=root --file /$asrc/kernel\n\tlinux /$asrc/kernel $cmdline DEBUG=2\n\tinitrd /$asrc/initrd.img\n}" >> $grubcfg
-               if [ -e /hd/EFI/Microsoft/Boot/bootmgfw.efi ]; then
-                       echo -e "menuentry \"Windows (UEFI)\" {\n\tsearch --set=root --file /EFI/Microsoft/Boot/bootmgfw.efi\n\tchainloader /EFI/Microsoft/Boot/bootmgfw.efi\n}" >> $grubcfg
-               fi
+               echo -e '\nset winefi=/EFI/Microsoft/Boot/bootmgfw.efi\nsearch --file --no-floppy --set=win ${winefi}\nif [ -e (${win})/${winefi} ]; then\n\tmenuentry 'Windows' --class windows {\n\t\tset root=${win}\n\t\tchainloader (${root})/${winefi}\n\t}\nfi\n' >> $grubcfg
                mountpoint -q /hd && umount /hd
                try_mount rw /dev/$1 /hd
        fi