[pve-devel] [PATCH installer 2/2] serial installer: add serial config for grub to target system

Stoiko Ivanov s.ivanov at proxmox.com
Tue Nov 21 12:09:59 CET 2023


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 <s.ivanov at proxmox.com>
---
 Proxmox/Install.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index fd9bf84..4293f96 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -1162,7 +1162,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);
 	}
 
-- 
2.39.2






More information about the pve-devel mailing list