X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/blobdiff_plain/a6d3ecc7a9b01e6cd7a08bb03ca72a88f928df8d..cbbd57eee5980acc6879e119fe6b8913285f2af6:/INSTALL/grub/localboot.cfg diff --git a/INSTALL/grub/localboot.cfg b/INSTALL/grub/localboot.cfg index d841587..169a8d4 100644 --- a/INSTALL/grub/localboot.cfg +++ b/INSTALL/grub/localboot.cfg @@ -1,10 +1,38 @@ if [ "$grub_platform" = "pc" ]; then - menuentry 'Search and boot Windows' --class=boot_windows { - if search -n -s -f /bootmgr; then - ntldr /bootmgr - elif search -n -s -f /NTLDR; then - ntldr /NTLDR + menuentry 'Search and boot Windows' --class=boot_windows { + + set partid=3 + while [ $partid -le 128 ]; do + if vt_check_part_exist $partid; then + for bt in bootmgr BOOTMGR Bootmgr BootMGR; do + if [ -f ($vtoydev,$partid)/$bt ]; then + set root=($vtoydev,$partid) + ntldr /$bt + boot + fi + done + else + break + fi + vt_incr partid 1 + done + + if search -n -s -f /Boot/BCD; then + for bt in bootmgr BOOTMGR Bootmgr BootMGR; do + if [ -f /$bt ]; then + if regexp '^hd0' $root; then + ntldr /$bt + else + drivemap -s hd0 $root + ntldr /$bt + fi + break + fi + done + elif search -n -s -f /NTDETECT.COM; then + drivemap -s hd0 $root + ntldr /ntldr else echo "Windows NOT found ..." fi @@ -39,6 +67,22 @@ if [ "$grub_platform" = "pc" ]; then else menuentry 'Search and boot Windows' --class=boot_windows { + + set partid=3 + while [ $partid -le 128 ]; do + if vt_check_part_exist $partid; then + if [ -f ($vtoydev,$partid)/EFI/Microsoft/Boot/bootmgfw.efi ]; then + set root=($vtoydev,$partid) + terminal_output console + chainloader /EFI/Microsoft/Boot/bootmgfw.efi + boot + fi + else + break + fi + vt_incr partid 1 + done + if search -n -s -f /EFI/Microsoft/Boot/bootmgfw.efi; then terminal_output console chainloader /EFI/Microsoft/Boot/bootmgfw.efi @@ -48,18 +92,51 @@ else fi } - menuentry 'Search and boot BOOTX64.EFI' --class=boot_uefi { - if search -n -s -f /efi/boot/bootx64.efi; then - terminal_output console - chainloader /efi/boot/bootx64.efi - boot - else - echo "BOOTX64.EFI NOT found ..." - fi - } + if [ "$grub_cpu" = "i386" ]; then + menuentry 'Search and boot BOOTIA32.EFI' --class=boot_uefi { + set VTOY_SEARCH_NO_VTOYEFI=1 + if search -n -s -f /efi/boot/bootia32.efi; then + unset VTOY_SEARCH_NO_VTOYEFI + terminal_output console + chainloader /efi/boot/bootia32.efi + boot + else + unset VTOY_SEARCH_NO_VTOYEFI + echo "BOOTIA32.EFI NOT found ..." + fi + } + elif [ "$grub_cpu" = "arm64" ]; then + menuentry 'Search and boot BOOTAA64.EFI' --class=boot_uefi { + set VTOY_SEARCH_NO_VTOYEFI=1 + if search -n -s -f /efi/boot/bootaa64.efi; then + unset VTOY_SEARCH_NO_VTOYEFI + terminal_output console + chainloader /efi/boot/bootaa64.efi + boot + else + unset VTOY_SEARCH_NO_VTOYEFI + echo "BOOTAA64.EFI NOT found ..." + fi + } + else + menuentry 'Search and boot BOOTX64.EFI' --class=boot_uefi { + set VTOY_SEARCH_NO_VTOYEFI=1 + if search -n -s -f /efi/boot/bootx64.efi; then + unset VTOY_SEARCH_NO_VTOYEFI + terminal_output console + chainloader /efi/boot/bootx64.efi + boot + else + unset VTOY_SEARCH_NO_VTOYEFI + echo "BOOTX64.EFI NOT found ..." + fi + } + fi + + fi -menuentry 'Return to menu [Esc]' --class=vtoyret VTOY_RET { +menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { echo 'Return ...' }