nixos/iso-image: Use intrinsic UEFI console for serial output in GRUB

The `serial` console hangs on some systems. Unknown why.

Anyway, the way this worked right now relied on it telling the user on
the UEFI console how to enable it. So if I understand it correctly, it
will not cause any regression there.
This commit is contained in:
Samuel Dionne-Riel 2023-08-14 17:00:34 -04:00
parent fad94acaa8
commit 080bff8159

View File

@ -201,11 +201,11 @@ let
if [ "\$textmode" != "true" -a "\$with_fonts" == "true" ]; then if [ "\$textmode" != "true" -a "\$with_fonts" == "true" ]; then
# Use graphical term, it can be either with background image or a theme. # Use graphical term, it can be either with background image or a theme.
# input is "console", while output is "gfxterm". # input is "console", while output is "gfxterm".
# This enables "serial" input and output only when possible.
# Otherwise the failure mode is to not even enable gfxterm. # Otherwise the failure mode is to not even enable gfxterm.
# Note that "with_serial" relies on the EFI console.
if test "\$with_serial" == "yes"; then if test "\$with_serial" == "yes"; then
terminal_output gfxterm serial terminal_output console
terminal_input console serial terminal_input console
else else
terminal_output gfxterm terminal_output gfxterm
terminal_input console terminal_input console
@ -336,12 +336,11 @@ let
# → serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 # → serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
# This uses the defaults, and makes the serial terminal available. # This uses the defaults, and makes the serial terminal available.
set with_serial=no set with_serial=no
if serial; then set with_serial=yes ;fi
export with_serial export with_serial
clear clear
set timeout=${toString grubEfiTimeout} set timeout=${toString grubEfiTimeout}
# This message will only be viewable when "gfxterm" is not used. # This message will only be viewable on the default (UEFI) console.
echo "" echo ""
echo "Loading graphical boot menu..." echo "Loading graphical boot menu..."
echo "" echo ""
@ -352,12 +351,14 @@ let
hiddenentry 'Text mode' --hotkey 't' { hiddenentry 'Text mode' --hotkey 't' {
loadfont (\$root)/EFI/boot/unicode.pf2 loadfont (\$root)/EFI/boot/unicode.pf2
set with_serial=yes
set textmode=true set textmode=true
terminal_output gfxterm console terminal_output console
} }
hiddenentry 'GUI mode' --hotkey 'g' { hiddenentry 'GUI mode' --hotkey 'g' {
$(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont (\$root)/EFI/boot/grub-theme/%P\n") $(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont (\$root)/EFI/boot/grub-theme/%P\n")
set textmode=false set textmode=false
set with_serial=no
terminal_output gfxterm terminal_output gfxterm
} }