#!/bin/sh
# scutarius-gb10-config: GRUB menu on the GB10 UART (921600) as well as the
# display. Emitted right after 00_header, which has already set the terminals
# from GRUB_TERMINAL_INPUT/_OUTPUT (gfxterm when scutarius-grub-theme is
# installed, console otherwise); --append adds the serial port to both.
#
# Why not GRUB_TERMINAL_*="... serial" + GRUB_SERIAL_COMMAND: on GB10 the
# port is registered by `serial efi0 ...` and its terminal is named
# serial_efi0. 00_header then writes `terminal_output gfxterm serial`, the
# name "serial" does not exist, and the WHOLE command fails -- GRUB stays on
# the EFI text console with no theme and no serial menu (proven at the GRUB
# prompt on brain-cell-g4, 2026-09-05: active = console, available =
# "gfxterm serial_efi0"). 00_header also emits GRUB_SERIAL_COMMAND only for
# the literal word "serial", so the serial command lives here too.
set -e
cat <<'GRUB'
# GB10 serial console (scutarius-gb10-config): the port is serial_efi0.
if serial efi0 --speed=921600 --word=8 --parity=no --stop=1; then
  terminal_input --append serial_efi0
  terminal_output --append serial_efi0
fi
GRUB
