summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-01-30 16:26:50 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-02-23 09:51:18 +0100
commit717af0de4648ccc223f06683a6baf73d64271e02 (patch)
treeaa18d03123d5df175bc39c5f897167c2a8692b7c
parenta885188b3ab71c222cbcc42b083ba671884aa651 (diff)
downloadsystemd-717af0de4648ccc223f06683a6baf73d64271e02.tar.gz
stub: Read extra kernel command line items from SMBIOS
Let's read more kernel command line arguments from SMBIOS OEM string io.systemd.stub.kernel-cmdline-extra. This allows adding debug kernel command line arguments when booting in qemy without having to modify the UKI.
-rw-r--r--man/systemd-stub.xml17
-rw-r--r--src/boot/efi/stub.c7
2 files changed, 24 insertions, 0 deletions
diff --git a/man/systemd-stub.xml b/man/systemd-stub.xml
index c230168780..7934f344f8 100644
--- a/man/systemd-stub.xml
+++ b/man/systemd-stub.xml
@@ -380,6 +380,23 @@
</refsect1>
<refsect1>
+ <title>SMBIOS Type 11 Strings</title>
+
+ <para><command>systemd-stub</command> can be configured using SMBIOS Type 11 strings. Applicable strings
+ consist of a name, followed by <literal>=</literal>, followed by the value.
+ <command>systemd-stub</command> will search the table for a string with a specific name, and if found,
+ use its value. The following strings are read:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><varname>io.systemd.stub.kernel-cmdline-extra</varname></term>
+ <listitem><para>If set, the value of this string is added to the list of kernel command line
+ arguments that are passed to the kernel.</para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
<title>Assembling Kernel Images</title>
<para>In order to assemble a bootable Unified Kernel Image from various components as described above, use
diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c
index d85424ceae..25fd1bdb7f 100644
--- a/src/boot/efi/stub.c
+++ b/src/boot/efi/stub.c
@@ -14,6 +14,7 @@
#include "splash.h"
#include "tpm-pcr.h"
#include "util.h"
+#include "vmm.h"
/* magic string to find in the binary image */
_used_ _section_(".sdmagic") static const char magic[] = "#### LoaderInfo: systemd-stub " GIT_VERSION " ####";
@@ -275,6 +276,12 @@ static EFI_STATUS run(EFI_HANDLE image) {
mangle_stub_cmdline(cmdline);
}
+ const char *extra = smbios_find_oem_string("io.systemd.stub.kernel-cmdline-extra");
+ if (extra) {
+ _cleanup_free_ char16_t *tmp = TAKE_PTR(cmdline), *extra16 = xstr8_to_16(extra);
+ cmdline = xasprintf("%ls %ls", tmp, extra16);
+ }
+
export_variables(loaded_image);
if (pack_cpio(loaded_image,