Support BOOT_FILE variable for usage within secureboot templates
[grml-live.git] / templates / secureboot / grub.cfg
1 set grml_orig_prefix=$prefix
2 export grml_orig_prefix
3 set grml_orig_root=$root
4 export grml_orig_root
5
6 search.file %BOOT_FILE% root
7 set prefix=($root)/boot/grub/
8 source ($root)/boot/grub/grmlenv.cfg
9
10 if [ "$grml_secureboot" = false ] ; then
11   configfile /boot/grub/grub.cfg
12   # if that fails we need to fallback, but how?
13 else
14   if [ "$grml_orig_prefix" != "" ] ; then
15     set prefix=$grml_orig_prefix
16   fi
17
18   # this is basically a copy of templates/boot/grub/header.cfg but to avoid
19   # failures due to Secure Boot restrictions and sourcing addons.cfg via
20   # /boot/grub/loopback.cfg (and then showing entries that are at the wrong
21   # position as well as don't work at all) we have to specify the appropriate
22   # config here
23   set timeout=20
24   if loadfont /boot/grub/ascii.pf2 ; then
25     set gfxmode=auto
26     insmod efi_gop
27     insmod efi_uga
28     insmod gfxterm
29     insmod png
30     terminal_output gfxterm
31   fi
32
33   if [ -f /boot/grub/%GRML_NAME%-theme/theme.txt ] ; then
34     set theme=/boot/grub/%GRML_NAME%-theme/theme.txt
35     export theme
36   elif [ -f /boot/grub/grml-theme/theme.txt ] ; then
37     set theme=/boot/grub/grml-theme/theme.txt
38     export theme
39   else
40     set menu_color_normal=white/black
41     set menu_color_highlight=black/light-gray
42     set color_normal=white/black
43   fi
44
45   menuentry "Boot %GRML_NAME% in normal mode (release %VERSION%, Secure Boot enabled)" {
46       set gfxpayload=keep
47       echo 'Loading kernel...'
48       linux   /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce net.ifnames=0 
49       echo 'Loading initrd...'
50       initrd  /boot/%SHORT_NAME%/initrd.img
51   }
52
53   menuentry "Boot %GRML_NAME% - enable persistency" {
54       set gfxpayload=keep
55       echo 'Loading kernel...'
56       linux   /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce net.ifnames=0 persistence 
57       echo 'Loading initrd...'
58       initrd  /boot/%SHORT_NAME%/initrd.img
59   }
60
61   menuentry "Boot %GRML_NAME% - copy %GRML_NAME% to RAM" {
62       set gfxpayload=keep
63       echo 'Loading kernel...'
64       linux   /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce net.ifnames=0 toram=%GRML_NAME%.squashfs 
65       echo 'Loading initrd...'
66       initrd  /boot/%SHORT_NAME%/initrd.img
67   }
68
69   menuentry "Boot %GRML_NAME% - copy whole medium to RAM" {
70       set gfxpayload=keep
71       echo 'Loading kernel...'
72       linux   /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce net.ifnames=0 toram 
73       echo 'Loading initrd...'
74       initrd  /boot/%SHORT_NAME%/initrd.img
75   }
76
77   menuentry "Boot %GRML_NAME% - disable framebuffer/kernel mode setting" {
78       set gfxpayload=keep
79       echo 'Loading kernel...'
80       linux   /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce net.ifnames=0 video=vesafb:off cirrus.modeset=0 i915.modeset=0 mgag200.modeset=0 nomodeset nouveau.modeset=0 radeon.modeset=0 
81       echo 'Loading initrd...'
82       initrd  /boot/%SHORT_NAME%/initrd.img
83   }
84
85   menuentry "Boot %GRML_NAME% - enable forensic mode" {
86       set gfxpayload=keep
87       echo 'Loading kernel...'
88       linux   /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce net.ifnames=0 read-only nofstab noraid nodmraid nolvm noautoconfig noswap raid=noautodetect 
89       echo 'Loading initrd...'
90       initrd  /boot/%SHORT_NAME%/initrd.img
91   }
92
93   menuentry "Boot %GRML_NAME% - enable serial console" {
94       set gfxpayload=keep
95       echo 'Loading kernel...'
96       linux   /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce net.ifnames=0 video=vesafb:off console=tty1 console=ttyS0,9600n8 
97       echo 'Loading initrd...'
98       initrd  /boot/%SHORT_NAME%/initrd.img
99   }
100
101   menuentry "Boot %GRML_NAME% - debug mode" {
102       set gfxpayload=keep
103       echo 'Loading kernel...'
104       linux   /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live live-media-path=/live/%GRML_NAME%/ bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce net.ifnames=0 initcall verbose debug=vc systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M 
105       echo 'Loading initrd...'
106       initrd  /boot/%SHORT_NAME%/initrd.img
107   }
108 fi