]> git.proxmox.com Git - pve-installer.git/commitdiff
serial installer: add serial config for grub to target system
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 21 Nov 2023 11:09:59 +0000 (12:09 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 21 Nov 2023 12:12:54 +0000 (13:12 +0100)
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@proxmox.com>
Proxmox/Install.pm

index 1a4ee93ef11b3aa0d066c9dc8e519230d1a1f48a..811db8c49e7a528975cabe4bcc26be3d286ed911 100644 (file)
@@ -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);
        }