Skip to content

Commit 9fba15b

Browse files
committed
M9.R.37.7: GRUB menu on serial console so headless QEMU boot succeeds
The runMinimalBootstrap GRUB config wrote set timeout=5 + a single ReproOS menuentry but no serial terminal config. Consequence: on a headless QEMU run (-nographic -serial mon:stdio), GRUB renders the menu on the framebuffer ONLY, and since the framebuffer doesn't exist, the serial console sees nothing. The 5s timeout ticks down internally but no boot ever triggers AND no key event reaches GRUB. Stage-2 boot hangs in GRUB indefinitely. Fix: wire GRUB's UI to BOTH the console AND ttyS0 via serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 terminal_input console serial terminal_output console serial set timeout_style=hidden set timeout=3 timeout_style=hidden skips the interactive menu entirely (no risk of the FIFO driver's idle input typing into edit mode), and 3s is enough for a serial console to settle. Also bump _m9r37_boot_installed.sh's sleep from 90s to 150s so the FIFO input lands after the installed system reaches the login prompt, not during early kernel init.
1 parent 97e15b7 commit 9fba15b

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

_m9r37_boot_installed.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ date
2727
BOOT_FIFO="$(mktemp -d)/boot-in.fifo"
2828
mkfifo "$BOOT_FIFO"
2929
(
30-
sleep 90
30+
# GRUB defaults to a 5s timeout + auto-boots the first entry; any
31+
# keystroke during the menu (even an idle "root\n" from this FIFO)
32+
# interrupts the timeout and the menu sits forever. Sleep through
33+
# the GRUB timeout + boot + login prompt before sending anything.
34+
# M9.R.36 used sleep 90 here; bump to 150 to be safe in case the
35+
# OVMF firmware adds a "Press any key to continue" extra step.
36+
sleep 150
3137
echo "root"
3238
sleep 3
3339
echo "reproos"

apps/reproos-installer/src/installer_state.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,21 @@ void InstallerState::runMinimalBootstrap(const QString &target) {
600600
"/boot --boot-directory=" + target +
601601
"/boot --no-nvram --removable --recheck " + grubDevice, 120000);
602602
appendLog("Phase 5e: writing GRUB config");
603+
// M9.R.37.7 — wire the GRUB UI to BOTH console (tty1) AND serial
604+
// (ttyS0) so headless QEMU runs see the menu + boot countdown
605+
// tick. Without ``serial --unit=0`` + ``terminal_input/_output
606+
// serial console`` GRUB renders the menu on the framebuffer ONLY
607+
// — which on ``qemu -nographic -serial mon:stdio`` is invisible —
608+
// and the timeout ticks but no key event ever reaches GRUB. A
609+
// ``set timeout_style=hidden`` together with ``set timeout=3``
610+
// also bypasses the interactive menu entirely on serial-only
611+
// hardware (matching Debian's serial-installer pattern).
603612
QString grubCfg =
604-
"set timeout=5\n"
613+
"serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n"
614+
"terminal_input console serial\n"
615+
"terminal_output console serial\n"
616+
"set timeout_style=hidden\n"
617+
"set timeout=3\n"
605618
"set default=0\n"
606619
"menuentry 'ReproOS' {\n"
607620
" linux /boot/vmlinuz root=/dev/vda2 ro console=tty1 console=ttyS0,115200\n"

0 commit comments

Comments
 (0)