diff --git a/scripts/grub.cfg b/scripts/grub.cfg index cf9106b..5594c4e 100644 --- a/scripts/grub.cfg +++ b/scripts/grub.cfg @@ -12,46 +12,71 @@ function load_video { fi } +set prefix=($root)/boot/grub if loadfont $prefix/fonts/unicode.pf2 ; then set gfxmode=auto load_video insmod gfxterm + insmod serial set locale_dir=$prefix/locale set lang=en_US set gfxpayload=keep fi -terminal_output gfxterm -serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1 +if [ "$grub_platform" = xen ]; then + set serial_console="" + set gfx_console="console=hvc0" +else + set serial_console="console=ttyS0,115200n8" + set gfx_console="console=tty0" + set default="serial" + serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 + if terminal_output gfxterm; then + set default="video" + terminal_output --append serial + terminal_input --append serial + elif [ "$grub_platform" = pc ]; then + # PC console generally outputs to only the video console + terminal_input console serial + terminal_output console serial + elif [ "$grub_platform" = efi ]; then + # EFI console generally outputs to both the video console and serial port + terminal_input console + terminal_output console + fi +fi + +# With serial input enabled, sleep helps consume buffered input +# grub.cfg generated by grub-install also includes the sleep for this purpose. +sleep -i 1 set menu_color_normal=cyan/blue set menu_color_highlight=white/blue -terminal_output gfxterm if [ "${recordfail}" = 1 ] ; then set timeout=30 else if [ x$feature_timeout_style = xy ] ; then # set timeout_style=hidden - set timeout=3 + set timeout=15 # Fallback hidden-timeout code in case the timeout_style feature is # unavailable. elif sleep --interruptible 0 ; then - set timeout=3 + set timeout=15 fi fi insmod play play 960 440 1 0 4 440 1 -menuentry --hotkey=i 'Start TrueNAS SCALE Installation' { +menuentry --hotkey=i --id=video 'Start TrueNAS SCALE Installation' { load_video set background_color=black - linux /vmlinuz gfxpayload=text quiet nomodeset boot=live toram=filesystem.squashfs console=ttyS0,9600 console=tty0 + linux /vmlinuz gfxpayload=text quiet nomodeset boot=live toram=filesystem.squashfs $gfx_console initrd /initrd.img } -menuentry --hotkey=j 'Start TrueNAS SCALE Installation (115200 baud)' { +menuentry --hotkey=j --id=serial 'Start TrueNAS SCALE Installation (115200 baud)' { load_video set background_color=black - linux /vmlinuz gfxpayload=text quiet nomodeset boot=live toram=filesystem.squashfs console=ttyS0,115200 console=tty0 + linux /vmlinuz gfxpayload=text quiet nomodeset boot=live toram=filesystem.squashfs $gfx_console $serial_console initrd /initrd.img }