-
Notifications
You must be signed in to change notification settings - Fork 0
/
grub.cfg
104 lines (91 loc) · 2.1 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
zfs_pool=rpool
zfs_basefs=ubuntu
# bootmode:
# rn -- regular normal
# ra -- regular admin
# cn -- control normal
# ca -- control admin (no need to make available in grub menu)
# can assume path names don't contain spaces
# to accommodate spaces, would have to update init in initramfs
function load_video {
if [ x${feature_all_video_module} = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
function gfxmode {
gfxpayload="${1}"
if [ "${1}" = "keep" ]; then
vt_handoff=vt.handoff=7
else
vt_handoff=
fi
}
function show_menuentry {
# ${1} - title
# ${2} - bootmode
# ${3} - basefs
# ${4} - pool
# ${5} - class
menuentry "${1}" --class=${5} ${2} ${3} ${4} {
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ ${2} == rn -o ${2} == ra ]; then
bootfs=/${3}/boot/regular
else
bootfs=/${3}/boot/control
fi
linux ${bootfs}@/vmlinuz bootmode=${2} root=ZFS=${4}/${3}
initrd ${bootfs}@/initrd.img
}
}
insmod part_msdos
insmod zfs
if [ x${feature_default_font_path} = xy ] ; then
font=unicode
else
font="${prefix}/fonts/unicode.pf2"
fi
if loadfont $font ; then
gfxmode=auto
load_video
insmod gfxterm
locale_dir=${prefix}/locale
lang=en_US
insmod gettext
fi
insmod gfxterm
terminal_output gfxterm
if [ x${feature_timeout_style} = xy ] ; then
timeout_style=menu
timeout=10
else
timeout=10
fi
menu_color_normal=white/black
menu_color_highlight=black/light-gray
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
linux_gfx_mode=keep
else
linux_gfx_mode=text
fi
else
linux_gfx_mode=text
fi
else
linux_gfx_mode=keep
fi
export linux_gfx_mode
show_menuentry Normal rn ${zfs_basefs} ${zfs_pool} ubuntu_normal
show_menuentry Admin ra ${zfs_basefs} ${zfs_pool} ubuntu_admin
show_menuentry Recovery cn ${zfs_basefs} ${zfs_pool} ubuntu_recovery