From: Michael Tremer Date: Thu, 14 Sep 2023 15:26:11 +0000 (+0000) Subject: bootloader: Correctly configure the serial console for GRUB X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c13f10e7588b0baaceff88f291c9c9cfbc2346b;p=people%2Fms%2Fbricklayer.git bootloader: Correctly configure the serial console for GRUB Signed-off-by: Michael Tremer --- diff --git a/src/python/__init__.py b/src/python/__init__.py index f3add6b..339a67a 100644 --- a/src/python/__init__.py +++ b/src/python/__init__.py @@ -76,7 +76,7 @@ class Bricklayer(object): "timezone" : "UTC", # Kernel Commandline - "kernel-cmdline" : "quiet splash", + "kernel-cmdline" : ["quiet", "splash"], # Serial Console "serial-console" : False, diff --git a/src/python/bootloaders.py b/src/python/bootloaders.py index 6d2405e..13459b1 100644 --- a/src/python/bootloaders.py +++ b/src/python/bootloaders.py @@ -118,6 +118,9 @@ class Grub(Bootloader): """ log.debug("Writing GRUB Configuration:") + # Fetch the kernel commandline + kernel_cmdline = self.bricklayer.settings.get("kernel-cmdline", []).copy() + conf = { # Tell GRUB who we are "GRUB_DISTRIBUTOR" : "\"$(sed 's, release .*$,,g' /etc/system-release)\"", @@ -148,14 +151,16 @@ class Grub(Bootloader): "GRUB_SERIAL_COMMAND" : "\"serial --unit=%s --speed=%s\"" % (unit, baudrate), } + # Append the serial console to the kernel commandline + kernel_cmdline.append("console=%s,%sn8" % (device, baudrate)) + # Otherwise enable a generic VGA console else: conf["GRUB_TERMINAL_OUTPUT"] = "\"console\"" # Set the kernel commandline - kernel_cmdline = self.bricklayer.settings.get("kernel-cmdline") if kernel_cmdline: - conf["GRUB_CMDLINE_LINUX"] = "\"%s\"" % kernel_cmdline + conf["GRUB_CMDLINE_LINUX"] = "\"%s\"" % " ".join(kernel_cmdline) # Write everything to file with self.bricklayer.open("/etc/default/grub", "w") as f: