]> git.proxmox.com Git - pve-installer.git/commitdiff
pass optional console parameter from installer to target
authorStoiko Ivanov <s.ivanov@proxmox.com>
Thu, 22 Jun 2023 20:08:48 +0000 (22:08 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 12 Nov 2023 18:28:54 +0000 (19:28 +0100)
If an installation needs to provide a dedicated console parameter
(e.g. because it runs on the serial console) the target system most
likely will need the parameter too.

This patch adds the parameter to the kernel-commandline (in case zfs
is used for both grub and systemd)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Proxmox/Install.pm
Proxmox/Install/Config.pm

index c4b0700ed6712e72da652804ba993e72f973c9af..a289037e804af6896d46f2803fb9473cbf9c5824 100644 (file)
@@ -1152,13 +1152,19 @@ _EOD
        }
 
        update_progress(0.8, 0.95, 1, "make system bootable");
+       my $console_param='';
+       if (my $console = Proxmox::Install::Config::get_console()) {
+           my $console_param="console=$console";;
+           my $console_snippet = "GRUB_CMDLINE_LINUX=\"\$GRUB_CMDLINE_LINUX $console_param\"";
+           file_write_all("$targetdir/etc/default/grub.d/console.cfg", $console_snippet);
+       }
 
        if ($use_zfs) {
            # add ZFS options while preserving existing kernel cmdline
            my $zfs_snippet = "GRUB_CMDLINE_LINUX=\"\$GRUB_CMDLINE_LINUX root=ZFS=$zfs_pool_name/ROOT/$zfs_root_volume_name boot=zfs\"";
            file_write_all("$targetdir/etc/default/grub.d/zfs.cfg", $zfs_snippet);
 
-           file_write_all("$targetdir/etc/kernel/cmdline", "root=ZFS=$zfs_pool_name/ROOT/$zfs_root_volume_name boot=zfs\n");
+           file_write_all("$targetdir/etc/kernel/cmdline", "root=ZFS=$zfs_pool_name/ROOT/$zfs_root_volume_name boot=zfs $console_param\n");
 
            zfs_setup_module_conf($targetdir);
        }
index f496d613f51ff32d65163e9d778bebdd7e9d4a3d..55e53c7e78d8d22e1f801c105b7dac08faea5fd1 100644 (file)
@@ -43,6 +43,10 @@ my sub parse_kernel_cmdline {
        }
     }
 
+    if ($cmdline =~ m/console=(\S+)[\s\n]/i) {
+           $cfg->{console} = $1;
+    }
+
     return $cfg;
 }
 
@@ -97,6 +101,7 @@ my sub init_cfg {
        cidr => undef,
        gateway => undef,
        dns => undef,
+       console => undef,
     };
 
     $initial = parse_kernel_cmdline($initial);
@@ -230,4 +235,8 @@ sub get_gateway { return get('gateway'); }
 sub set_dns { set_key('dns', $_[0]); }
 sub get_dns { return get('dns'); }
 
+sub set_console { set_key('console', $_[0]); }
+sub get_console { return get('console'); }
+
+
 1;