OSDN Git Service

1-install: mount efivarfs earlier
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 17 Jan 2018 03:30:05 +0000 (11:30 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 17 Jan 2018 03:30:05 +0000 (11:30 +0800)
install/scripts/1-install

index 7ffd287..aed38ae 100644 (file)
@@ -307,7 +307,6 @@ install_to()
        cmdline=`sed "s|\(initrd.*img\s*\)||; s|quiet\s*||; s|\(vga=\w\+\?\s*\)||; s|\(DPI=\w\+\?\s*\)||; s|\(INSTALL=\w\+\?\s*\)||; s|\(SRC=\S\+\?\s*\)||; s|\(DEBUG=\w\+\?\s*\)||; s|\(BOOT_IMAGE=\S\+\?\s*\)||; s|\(iso-scan/filename=\S\+\?\s*\)||;" /proc/cmdline`
 
        [ -n "$INSTALL_PREFIX" ] && asrc=$INSTALL_PREFIX || asrc=android-$VER
-       efi="`dmesg | grep EFI.VGA`"
        [ -z "$efi" ] && dialog --title " Confirm " --no-label Skip --defaultno --yesno \
                "\n Do you want to install boot loader GRUB?" 7 47
        if [ $? -eq 0 ]; then
@@ -356,13 +355,12 @@ install_to()
                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
 
                # Checking for old EFI entries, removing them and adding new depending on bitness
-               mount -t efivarfs none /sys/firmware/efi/efivars
                efibootmgr | grep -Eo ".{0,6}Android-x86" | cut -c1-4 > /tmp/efientries
                if [ -s /tmp/efientries ]; then
                        dialog --title " Question " --defaultno --yesno "\nEFI boot entries for previous Android-x86 installations were found.\n\nDo you wish to delete them?" 10 61
                        [ $? -eq 0 ] && while read entry; do efibootmgr -Bb "$entry" > /dev/tty4 2>&1; done < /tmp/efientries
                fi
-               if [ "$(cat /sys/firmware/efi/fw_platform_size)" == "32" ]; then
+               if [ "$efi" = "32" ]; then
                        bootefi=bootia32.efi
                else
                        bootefi=BOOTx64.EFI
@@ -448,6 +446,9 @@ install_hd()
 do_install()
 {
        booted_from=`basename $dev`
+       efi=$(cat /sys/firmware/efi/fw_platform_size 2> /dev/null)
+       [ -n "$efi" ] && mount -t efivarfs none /sys/firmware/efi/efivars
+
        until install_hd; do
                if [ $retval -eq 255 ]; then
                        dialog --title ' Error! ' --yes-label Retry --no-label Reboot \