]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Reduce kernel command line size
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 6 Dec 2024 14:04:56 +0000 (15:04 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 8 Dec 2024 11:55:43 +0000 (12:55 +0100)
The kernel command line has a size limit and we've hit it before so
let's move some stuff to configuration files or scripts to reduce the
kernel command line size a bit.

mkosi.conf
mkosi.extra.common/usr/lib/systemd/system.conf.d/10-device-timeout.conf [new file with mode: 0644]
mkosi.postinst.chroot
mkosi.sanitizers/mkosi.conf
mkosi.sanitizers/mkosi.extra/usr/lib/systemd/system.conf.d/10-sanitizers.conf [new file with mode: 0644]
mkosi.sanitizers/mkosi.extra/usr/lib/systemd/system/service.d/10-timeout-abort.conf [moved from mkosi.sanitizers/mkosi.extra/etc/systemd/system/service.d/10-timeout-abort.conf with 100% similarity]
mkosi.sanitizers/mkosi.extra/usr/lib/systemd/system/systemd-journald.service.d/10-stdout-tty.conf [moved from mkosi.sanitizers/mkosi.extra/etc/systemd/system/systemd-journald.service.d/10-stdout-tty.conf with 100% similarity]

index 35a19a27aad3975b22819b4d56672d57756e06eb..a5d4eab23bd6b453c7c6283d5a5c449a494ca12a 100644 (file)
@@ -66,9 +66,6 @@ KernelCommandLine=
         printk.devkmsg=on
         # Make sure /sysroot is mounted rw in the initrd.
         rw
-        # Lower the default device timeout so we get a shell earlier if the root device does
-        # not appear for some reason.
-        systemd.default_device_timeout_sec=90
         # Make sure no LSMs are enabled by default.
         selinux=0
         systemd.early_core_pattern=/core
@@ -78,9 +75,6 @@ KernelCommandLine=
         panic=-1
         softlockup_panic=1
         panic_on_warn=1
-        # These don't ship proper units with [Install] directives so we have to mask them instead.
-        systemd.mask=isc-dhcp-server.service
-        systemd.mask=mdmonitor.service
         psi=1
 
 KernelModulesInitrdExclude=.*
diff --git a/mkosi.extra.common/usr/lib/systemd/system.conf.d/10-device-timeout.conf b/mkosi.extra.common/usr/lib/systemd/system.conf.d/10-device-timeout.conf
new file mode 100644 (file)
index 0000000..05fb1f7
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Manager]
+# Lower the default device timeout so we get a shell earlier if the root device does
+# not appear for some reason.
+DefaultDeviceTimeoutSec=90
index a35f824176be55c38d23b66cf7fd49d1a51d9c8d..0f9e361488a9a05e019c09a363bb138ee2267a83 100755 (executable)
@@ -48,6 +48,10 @@ cp "$SRCDIR/factory/etc/nsswitch.conf" /etc/nsswitch.conf
 # Remove to make TEST-73-LOCALE pass on Ubuntu.
 rm -f /etc/default/keyboard
 
+# These don't ship proper units with [Install] directives so we have to mask them instead.
+systemctl mask isc-dhcp-server.service
+systemctl mask mdmonitor.service
+
 # This is executed inside the chroot so no need to disable any features as the default features will match
 # the kernel's supported features.
 SYSTEMD_REPART_MKFS_OPTIONS_EXT4="" \
index 0137d4e38d6438f944a95139b8157f1844bb727c..0492716ec110c7214fcfaa9121e63b045e420986 100644 (file)
@@ -13,10 +13,10 @@ Environment=!SANITIZERS=
 Environment=ASAN_OPTIONS=verify_asan_link_order=0:intercept_tls_get_addr=0
 
 [Content]
+# When modifying these also modify mkosi.extra/usr/lib/systemd/system.conf.d/10-sanitizers.conf. We don't use
+# systemd.setenv here as there's a size limit on the kernel command line and we don't want to trigger it. We
+# don't use ManagerEnvironment= either as we want these to be set for pid1 from the earliest possible moment.
 KernelCommandLine=
         ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:disable_coredump=0:use_madv_dontdump=1
-        systemd.setenv=ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:disable_coredump=0:use_madv_dontdump=1
         UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1
-        systemd.setenv=UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1
         LSAN_OPTIONS=suppressions=/usr/lib/systemd/leak-sanitizer-suppressions
-        systemd.setenv=LSAN_OPTIONS=suppressions=/usr/lib/systemd/leak-sanitizer-suppressions
diff --git a/mkosi.sanitizers/mkosi.extra/usr/lib/systemd/system.conf.d/10-sanitizers.conf b/mkosi.sanitizers/mkosi.extra/usr/lib/systemd/system.conf.d/10-sanitizers.conf
new file mode 100644 (file)
index 0000000..a7152a3
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Manager]
+DefaultEnvironment=ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:disable_coredump=0:use_madv_dontdump=1 \
+                   UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1 \
+                   LSAN_OPTIONS=suppressions=/usr/lib/systemd/leak-sanitizer-suppressions