From bcd1a4eef0dadd9e1ff16ebfc98fa4d722c8d4e8 Mon Sep 17 00:00:00 2001 From: Umer Saleem Date: Tue, 2 Aug 2022 19:28:15 +0500 Subject: [PATCH] Update serial setup in Installer's grub.cfg This commit fixes SCALE boot issue in BIOS mode on X series hardware. In BIOS mode, we were not able to see any output from GRUB on IPMI since serial setup was not being done properly in SCALE installer's grub.cfg. Moreover, currently both boot options provide serial console options for SCALE, due to which we always see Linux console on serial since serial settings are saved by installer. User should only select (115200 baud) boot option if they want serial console, otherwise serial console should not be provided. Signed-off-by: Umer Saleem --- scripts/grub.cfg | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) 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 }