]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - INSTALL/grub/localboot.cfg
fix integer overflow issue for i386-pc
[Ventoy.git] / INSTALL / grub / localboot.cfg
1
2 if [ "$grub_platform" = "pc" ]; then
3 menuentry 'Search and boot Windows' --class=boot_windows {
4
5 set partid=3
6 while [ $partid -le 128 ]; do
7 if vt_check_part_exist $partid; then
8 for bt in bootmgr BOOTMGR Bootmgr BootMGR; do
9 if [ -f ($vtoydev,$partid)/$bt ]; then
10 set root=($vtoydev,$partid)
11 ntldr /$bt
12 boot
13 fi
14 done
15 else
16 break
17 fi
18 vt_incr partid 1
19 done
20
21 if search -n -s -f /Boot/BCD; then
22 for bt in bootmgr BOOTMGR Bootmgr BootMGR; do
23 if [ -f /$bt ]; then
24 if regexp '^hd0' $root; then
25 ntldr /$bt
26 else
27 drivemap -s hd0 $root
28 ntldr /$bt
29 fi
30 break
31 fi
32 done
33 elif search -n -s -f /NTDETECT.COM; then
34 drivemap -s hd0 $root
35 ntldr /ntldr
36 else
37 echo "Windows NOT found ..."
38 fi
39 }
40
41 menuentry 'Search and boot Grub4dos' --class=boot_g4d {
42 if search -n -s -f /grldr; then
43 ntldr /grldr
44 else
45 echo "Grub4dos NOT found ..."
46 fi
47 }
48
49 menuentry 'Boot the 1st local disk' --class=boot_disk {
50 set root=(hd0,1)
51 chainloader +1
52 boot
53 }
54
55 menuentry 'Boot the 2nd local disk' --class=boot_disk {
56 set root=(hd1,1)
57 chainloader +1
58 boot
59 }
60
61 menuentry 'Boot the 3rd local disk' --class=boot_disk {
62 set root=(hd2,1)
63 chainloader +1
64 boot
65 }
66
67 else
68
69 menuentry 'Search and boot Windows' --class=boot_windows {
70
71 set partid=3
72 while [ $partid -le 128 ]; do
73 if vt_check_part_exist $partid; then
74 if [ -f ($vtoydev,$partid)/EFI/Microsoft/Boot/bootmgfw.efi ]; then
75 set root=($vtoydev,$partid)
76 terminal_output console
77 chainloader /EFI/Microsoft/Boot/bootmgfw.efi
78 boot
79 fi
80 else
81 break
82 fi
83 vt_incr partid 1
84 done
85
86 if search -n -s -f /EFI/Microsoft/Boot/bootmgfw.efi; then
87 terminal_output console
88 chainloader /EFI/Microsoft/Boot/bootmgfw.efi
89 boot
90 else
91 echo "Windows NOT found ..."
92 fi
93 }
94
95 if [ "$grub_cpu" = "i386" ]; then
96 menuentry 'Search and boot BOOTIA32.EFI' --class=boot_uefi {
97 set VTOY_SEARCH_NO_VTOYEFI=1
98 if search -n -s -f /efi/boot/bootia32.efi; then
99 unset VTOY_SEARCH_NO_VTOYEFI
100 terminal_output console
101 chainloader /efi/boot/bootia32.efi
102 boot
103 else
104 unset VTOY_SEARCH_NO_VTOYEFI
105 echo "BOOTIA32.EFI NOT found ..."
106 fi
107 }
108 elif [ "$grub_cpu" = "arm64" ]; then
109 menuentry 'Search and boot BOOTAA64.EFI' --class=boot_uefi {
110 set VTOY_SEARCH_NO_VTOYEFI=1
111 if search -n -s -f /efi/boot/bootaa64.efi; then
112 unset VTOY_SEARCH_NO_VTOYEFI
113 terminal_output console
114 chainloader /efi/boot/bootaa64.efi
115 boot
116 else
117 unset VTOY_SEARCH_NO_VTOYEFI
118 echo "BOOTAA64.EFI NOT found ..."
119 fi
120 }
121 else
122 menuentry 'Search and boot BOOTX64.EFI' --class=boot_uefi {
123 set VTOY_SEARCH_NO_VTOYEFI=1
124 if search -n -s -f /efi/boot/bootx64.efi; then
125 unset VTOY_SEARCH_NO_VTOYEFI
126 terminal_output console
127 chainloader /efi/boot/bootx64.efi
128 boot
129 else
130 unset VTOY_SEARCH_NO_VTOYEFI
131 echo "BOOTX64.EFI NOT found ..."
132 fi
133 }
134 fi
135
136
137
138 fi
139
140 menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
141 echo 'Return ...'
142 }