===== (cbfsdisk)/etc/grub.cfg =====
==== For ThinkPads ====
set prefix=(memdisk)/boot/grub
terminal_input --append at_keyboard
terminal_output --append cbmemc
terminal_output --append gfxterm
gfxpayload=keep
loadfont (memdisk)/boot/grub/fonts/dejavusansmono.pf2
keymap usqwerty
set pager=1
set default=0
set timeout=2
function try_user_config {
set root="${1}"
for dir in boot grub grub2 boot/grub boot/grub2 @/boot/grub @/boot/grub2 @rootfs/boot/grub @rootfs/boot/grub2; do
for name in '' autoboot_ libreboot_ coreboot_; do
if [ -f /"${dir}"/"${name}"grub.cfg ]; then
unset superusers
configfile /"${dir}"/"${name}"grub.cfg
fi
done
done
}
function search_grub {
for i in 0 1 2 3 4 5; do
try_user_config "(${1}${i})"
for part in 1 2 3 4 5; do
try_user_config "(${1}${i},${part})"
done
done
}
function try_isolinux_config {
set root="${1}"
for dir in '' /boot; do
if [ -f "${dir}"/isolinux/isolinux.cfg ]; then
syslinux_configfile -i "${dir}"/isolinux/isolinux.cfg
elif [ -f "${dir}"/syslinux/syslinux.cfg ]; then
syslinux_configfile -s "${dir}"/syslinux/syslinux.cfg
fi
done
}
function search_isolinux {
for i in 0 1 2 3 4 5; do
try_isolinux_config "(${1}${i})"
for part in 1 2 3 4 5; do
try_isolinux_config "(${1}${i},${part})"
done
done
}
menuentry 'Load operating system [o]' --hotkey='o' {
search_grub ahci
}
menuentry 'Search GRUB2 configuration (USB) [s]' --hotkey='s' {
search_grub usb
}
menuentry 'Search ISOLINUX menu (USB) [u]' --hotkey='u' {
search_isolinux usb
}
menuentry 'Search ISOLINUX menu (AHCI) [a]' --hotkey='a' {
search_isolinux ahci
}
menuentry 'Poweroff [p]' --hotkey='p' {
halt
}
menuentry 'Reboot [r]' --hotkey='r' {
reboot
}
==== For desktop boards ====
set prefix=(memdisk)/boot/grub
rmmod at_keyboard
terminal_output --append cbmemc
terminal_output --append gfxterm
gfxpayload=keep
loadfont (memdisk)/boot/grub/fonts/dejavusansmono.pf2
keymap usqwerty
set pager=1
set default=0
set timeout=2
function try_user_config {
set root="${1}"
for dir in boot grub grub2 boot/grub boot/grub2 @/boot/grub @/boot/grub2 @rootfs/boot/grub @rootfs/boot/grub2; do
for name in '' autoboot_ libreboot_ coreboot_; do
if [ -f /"${dir}"/"${name}"grub.cfg ]; then
unset superusers
configfile /"${dir}"/"${name}"grub.cfg
fi
done
done
}
function search_grub {
for i in 0 1 2 3 4 5; do
try_user_config "(${1}${i})"
for part in 1 2 3 4 5; do
try_user_config "(${1}${i},${part})"
done
done
}
function try_isolinux_config {
set root="${1}"
for dir in '' /boot; do
if [ -f "${dir}"/isolinux/isolinux.cfg ]; then
syslinux_configfile -i "${dir}"/isolinux/isolinux.cfg
elif [ -f "${dir}"/syslinux/syslinux.cfg ]; then
syslinux_configfile -s "${dir}"/syslinux/syslinux.cfg
fi
done
}
function search_isolinux {
for i in 0 1 2 3 4 5; do
try_isolinux_config "(${1}${i})"
for part in 1 2 3 4 5; do
try_isolinux_config "(${1}${i},${part})"
done
done
}
menuentry 'Load operating system [o]' --hotkey='o' {
search_grub ahci
}
menuentry 'Search GRUB2 configuration (USB) [s]' --hotkey='s' {
search_grub usb
}
menuentry 'Search ISOLINUX menu (USB) [u]' --hotkey='u' {
search_isolinux usb
}
menuentry 'Search ISOLINUX menu (AHCI) [a]' --hotkey='a' {
search_isolinux ahci
}
menuentry 'Poweroff [p]' --hotkey='p' {
halt
}
menuentry 'Reboot [r]' --hotkey='r' {
reboot
}