From: Stoiko Ivanov Date: Tue, 21 Nov 2023 11:09:59 +0000 (+0100) Subject: serial installer: add serial config for grub to target system X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=6b01ac545b992f7e57fe38a7114ea68cb5e48d30;p=pve-installer.git serial installer: add serial config for grub to target system Matching if a serial will be needed for grub is based on the target commandline - the speed is also read from there. The unit is based on the ttyS device - although I'd assume that this might not always match up. Signed-off-by: Stoiko Ivanov --- diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm index 1a4ee93..811db8c 100644 --- a/Proxmox/Install.pm +++ b/Proxmox/Install.pm @@ -1158,7 +1158,13 @@ _EOD update_progress(0.8, 0.95, 1, "make system bootable"); my $target_cmdline=''; if ($target_cmdline = Proxmox::Install::Config::get_target_cmdline()) { - my $target_cmdline_snippet = "GRUB_CMDLINE_LINUX=\"\$GRUB_CMDLINE_LINUX $target_cmdline\""; + my $target_cmdline_snippet = ''; + if ($target_cmdline =~ /console=ttyS(\d+),(\d+)/) { + $target_cmdline_snippet .= "GRUB_TERMINAL_INPUT=\"console serial\"\n"; + $target_cmdline_snippet .= "GRUB_TERMINAL_OUTPUT=\"gfxterm serial\"\n"; + $target_cmdline_snippet .= "GRUB_SERIAL_COMMAND=\"serial --unit=$1 --speed=$2\"\n"; + } + $target_cmdline_snippet .= "GRUB_CMDLINE_LINUX=\"\$GRUB_CMDLINE_LINUX $target_cmdline\""; file_write_all("$targetdir/etc/default/grub.d/installer.cfg", $target_cmdline_snippet); }