-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgrub.cfg
410 lines (368 loc) · 9.2 KB
/
grub.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
function addmodule {
addmodulewithpath "usb-modboot" $1 $2
}
function addmodulewithpath {
set path="$1"
set file="$2"
if [ -f "/$path/$file.module.tar" -o -f "/$path/$file.module.cfg" -o -f "/$path/$file.module.inc" ]; then
return 0
fi
set LABEL=
if [ -f "/$path/$file.ini" ]; then
source "/$path/$file.ini"
fi
if [ -n "$3" ]; then
set LABEL="$3"
fi
set menulabel="$LABEL"
if [ -z "$menulabel" ] ; then
set menulabel="$file"
if regexp -s 1:innerlabel '\[(.*)\]' "$menulabel"; then
set menulabel="$innerlabel"
fi
fi
if [ -d "/$path/$file" ]; then
if [ -f "/$path/$file/grub.cfg" ]; then
menuentry "$menulabel" "$file" "$path" {
set MODULE_PATH="/$3/$2"
export MODULE_PATH
configfile "$MODULE_PATH/grub.cfg"
}
elif [ -f "/$path/$file/grub.inc" ]; then
set MODULE_PATH="/$path/$file"
export MODULE_PATH
source "$MODULE_PATH/grub.inc"
else
submenu "$menulabel" "$file" "$path" {
for subpath in /$3/$2/*; do
regexp -s 1:subfile '.*/(.*)' "$subpath"
addmodulewithpath "$3/$2" "$subfile"
done
}
fi
elif regexp '^(.*)\.[Ii][Ss][Oo]$' "$file"; then
loopback mod "/$path/$file"
if [ -f (mod)/.disk/info -a -z "$LABEL" ]; then
bqcat (mod)/.disk/info menulabel
fi
if [ -f (mod)/boot/grub/loopback.cfg ]; then
menuentry "$menulabel" "$file" "$path" {
set iso_path="/$3/$2"
export iso_path
loopback loopdev_cfg "${iso_path}"
set orig_root="$root"
set root=(loopdev_cfg)
configfile /boot/grub/loopback.cfg
loopback -d loopdev_cfg
set root="$orig_root"
terminal_output $terminal
}
else
echo $"Skipping unsupported ISO module: ${file}"
fi
loopback -d mod
elif regexp '^(.*)\.[Ll][Kk][Rr][Nn]$' "$file"; then
if [ "$grub_platform" = "pc" ]; then
menuentry "$menulabel" "$file" "$path" {
linux16 "/$3/$2"
}
fi
elif regexp '^(.*)\.[Bb][Ii][Nn]$' "$file"; then
if [ "$grub_platform" = "pc" ]; then
menuentry "$menulabel" "$file" "$path" {
linux16 "/$3/$2"
}
fi
elif regexp '^(.*)\.[Cc][Ff][Gg]$' "$file"; then
menuentry "$menulabel" "$file" "$path" {
set MODULE_PATH="/$3/$2"
export MODULE_PATH
configfile "$MODULE_PATH"
}
elif regexp '^(.*)\.[Ii][Nn][Cc]$' "$file"; then
source "/$path/$file"
elif regexp '^(.*)\.[Ii][Mm][Gg]$' "$file"; then
if [ "$grub_platform" = "pc" ]; then
menuentry "$menulabel" "$file" "$path" {
linux16 (core)/boot/grub/memdisk
initrd16 "/$3/$2"
}
fi
elif regexp '^(.*)\.[Ee][Ff][Ii]$' "$file"; then
if [ "$grub_platform" = "efi" -a "$grub_cpu" = "x86_64" ]; then
menuentry "$menulabel" "$file" "$path" {
chainloader "/$3/$2"
}
fi
elif regexp '^(.*)\.[Ee][Ff][Ii]32$' "$file"; then
if [ "$grub_platform" = "efi" -a "$grub_cpu" = "i386" ]; then
menuentry "$menulabel" "$file" "$path" {
chainloader "/$3/$2"
}
fi
elif regexp '^(.*)\.[Tt][Aa][Rr]$' "$file"; then
menuentry "$menulabel" "$file" "$path" {
set MODULE_PATH="/$3/$2"
export MODULE_PATH
loopback mod "$MODULE_PATH"
configfile "(mod)/grub.cfg"
loopback -d mod
}
elif regexp '^.*\.[Ii][Nn][Ii]$' "$file"; then
true # skip INI files
elif [ "$file" == "core-module.dat" ]; then
true # skip core-module.dat
else
echo $"Skipping unsupported module: ${file}"
fi
}
if [ -z "$incmode" ]; then
insmod regexp
set incmode=main
set lang=en
set locale_dir=(core)/boot/grub/locale
set secondary_locale_dir=(core)/boot/grub/locale/usb-modboot
export lang incmode secondary_locale_dir
fi
if [ "$incmode" = "main" ]; then
if [ "$grub_platform" = "efi" ]; then
insmod efi_gop
set FIRMWARE_NAME=UEFI
else
insmod vbe
set FIRMWARE_NAME=BIOS
fi
if [ -z "$menu_color_defined"]; then
set menu_color_normal=light-gray/blue
set menu_color_highlight=yellow/blue
set menu_color_defined=1
fi
set gfxmode=auto
set terminal console
set SUPPORTS_64_BIT=
if cpuid -l; then set SUPPORTS_64_BIT=1; fi
export FIRMWARE_NAME menu_color_normal menu_color_highlight menu_color_defined gfxmode terminal SUPPORTS_64_BIT
set default=1
menuentry $"GRUB configuration" {
set incmode=cfg
configfile (core)/boot/grub/grub.cfg
if [ "$incmode" = "cfgafter" ]; then
set incmode=main
clear_menu
source (core)/boot/grub/grub.cfg
fi
set incmode=main
}
source /usb-modboot/menu.ini
submenu $"All Boot Modules" {
for path in /usb-modboot/*; do
regexp -s 1:file '.*/(.*)' "$path"
addmodule "$file"
done
}
menuentry $"Auto-detect operating systems on disk(s)" {
configfile (core)/boot/grub/osdetect.cfg
}
menuentry $"Exit to ${FIRMWARE_NAME}" {
insmod minicmd
loopback -d core
exit
}
menuentry $"Reboot" {
reboot
}
menuentry $"Halt" {
halt
}
elif [ "$incmode" = "cfg" ]; then
menuentry $"Language" {
set incmode=lng
configfile (core)/boot/grub/grub.cfg
if [ "$incmode" = "reload" ]; then
set incmode=cfgafter
pop_env incmode
set incmode=cfg
clear_menu
source (core)/boot/grub/grub.cfg
else
set incmode=cfg
fi
}
submenu $"Color Scheme" {
set default="1"
menuentry $"Apply current scheme" {
pop_env menu_color_normal menu_color_highlight
submenu_exit
}
menuentry $"Preview: Default scheme" {
set menu_color_normal=light-gray/blue
set menu_color_highlight=yellow/blue
}
menuentry $"Preview: Inverted" {
set menu_color_normal=light-gray/brown
set menu_color_highlight=light-blue/brown
}
menuentry $"Preview: Barlond" {
set menu_color_normal=white/cyan
set menu_color_highlight=yellow/blue
}
menuentry $"Preview: Barlond2" {
set menu_color_normal=white/blue
set menu_color_highlight=yellow/cyan
}
menuentry $"Preview: Simple Black" {
set menu_color_normal=light-gray/black
set menu_color_highlight=yellow/blue
}
menuentry $"Preview: Matrix" {
set menu_color_normal=green/black
set menu_color_highlight=light-green/green
}
menuentry $"Preview: Dalton Bros." {
set menu_color_normal=red/green
set menu_color_highlight=green/red
}
menuentry $"Preview: Debian" {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
}
menuentry $"Preview: BW" {
set menu_color_normal=light-gray/black
set menu_color_highlight=black/light-gray
}
menuentry $"Preview: BW Inverse" {
set menu_color_normal=black/light-gray
set menu_color_highlight=light-gray/black
}
menuentry $"Preview: SGD" {
set menu_color_normal=white/brown
set menu_color_highlight=white/blue
}
menuentry $"Preview: SGD Non Default" {
set menu_color_normal=black/cyan
set menu_color_highlight=yellow/black
}
}
submenu $"Keyboard layout" {
menuentry $"Default ${FIRMWARE_NAME} keyboard layout" {
terminal_input console
submenu_exit
}
menuentry $"German" {
terminal_input at_keyboard
keymap (core)/boot/grub/kbd/de.gkb
submenu_exit
}
menuentry $"Austrian" {
terminal_input at_keyboard
keymap (core)/boot/grub/kbd/at.gkb
submenu_exit
}
menuentry $"Swiss" {
terminal_input at_keyboard
keymap (core)/boot/grub/kbd/ch.gkb
submenu_exit
}
menuentry $"Spanish" {
terminal_input at_keyboard
keymap (core)/boot/grub/kbd/es.gkb
submenu_exit
}
menuentry $"French" {
terminal_input at_keyboard
keymap (core)/boot/grub/kbd/fr.gkb
submenu_exit
}
menuentry $"US English" {
terminal_input at_keyboard
keymap (core)/boot/grub/kbd/us.gkb
submenu_exit
}
menuentry $"Czech" {
terminal_input at_keyboard
keymap (core)/boot/grub/kbd/cz.gkb
submenu_exit
}
}
submenu $"Graphics resolution" {
set default="$gfxmode"
insmod all_video
bqvideoinfo RESOLUTIONS
menuentry "auto" {
set gfxmode=auto
pop_env gfxmode
if [ "$terminal" = "gfxterm" ]; then
terminal_output console
terminal_output gfxterm
fi
submenu_exit
}
for res in $RESOLUTIONS; do
menuentry "$res" {
set gfxmode=$1
pop_env gfxmode
if [ "$terminal" = "gfxterm" ]; then
terminal_output console
terminal_output gfxterm
fi
submenu_exit
}
done
}
submenu $"Graphics mode" {
menuentry $"GRUB: Text, OS: Text" {
set terminal=console
terminal_output $terminal
set gfxpayload=text
pop_env gfxpayload terminal
submenu_exit
}
menuentry $"GRUB: Text, OS: Selected resolution ($gfxmode)" {
set terminal=console
terminal_output $terminal
set gfxpayload=$gfxmode
pop_env gfxpayload terminal
submenu_exit
}
menuentry $"GRUB: Graphics, OS: Text" {
loadfont (core)/boot/grub/fonts/euro.pf2
insmod all_video
set terminal=gfxterm
terminal_output $terminal
set gfxpayload=text
pop_env gfxpayload terminal
submenu_exit
}
menuentry $"GRUB: Graphics, OS: Same resolution" {
loadfont (core)/boot/grub/fonts/euro.pf2
insmod all_video
set terminal=gfxterm
terminal_output $terminal
set gfxpayload=keep
pop_env gfxpayload terminal
submenu_exit
}
menuentry $"GRUB: Graphics, OS: Selected resolution ($gfxmode)" {
loadfont (core)/boot/grub/fonts/euro.pf2
insmod all_video
set terminal=gfxterm
terminal_output $terminal
set gfxpayload=$gfxmode
pop_env gfxpayload terminal
submenu_exit
}
}
elif [ "$incmode" = "lng" ]; then
menuentry $"English" {
set lang=en
set incmode=reload
pop_env lang incmode
submenu_exit
}
menuentry $"German" {
set lang=de
set incmode=reload
pop_env lang incmode
submenu_exit
}
fi