summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd')
-rw-r--r--meta/recipes-core/systemd/dlopen-deps.inc81
-rw-r--r--meta/recipes-core/systemd/systemd-boot-native_257.6.bb18
-rw-r--r--meta/recipes-core/systemd/systemd-boot_247.3.bb70
-rw-r--r--meta/recipes-core/systemd/systemd-boot_257.6.bb75
-rw-r--r--meta/recipes-core/systemd/systemd-bootconf_1.00.bb8
-rw-r--r--meta/recipes-core/systemd/systemd-compat-units.bb18
-rw-r--r--meta/recipes-core/systemd/systemd-conf/wired.network2
-rw-r--r--meta/recipes-core/systemd/systemd-conf_1.0.bb (renamed from meta/recipes-core/systemd/systemd-conf_247.3.bb)24
-rw-r--r--meta/recipes-core/systemd/systemd-machine-units_1.0.bb9
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty.bb36
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service45
-rw-r--r--meta/recipes-core/systemd/systemd-systemctl-native.bb17
-rw-r--r--meta/recipes-core/systemd/systemd-systemctl-native_257.6.bb16
-rwxr-xr-xmeta/recipes-core/systemd/systemd-systemctl/systemctl325
-rw-r--r--meta/recipes-core/systemd/systemd.inc11
-rw-r--r--meta/recipes-core/systemd/systemd/00-create-volatile.conf6
-rw-r--r--meta/recipes-core/systemd/systemd/0001-Do-not-create-var-log-README.patch30
-rw-r--r--meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch39
-rw-r--r--meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch88
-rw-r--r--meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch227
-rw-r--r--meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch37
-rw-r--r--meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch164
-rw-r--r--meta/recipes-core/systemd/systemd/0002-implment-systemd-sysv-install-for-OE.patch (renamed from meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch)12
-rw-r--r--meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch78
-rw-r--r--meta/recipes-core/systemd/systemd/0003-missing_type.h-add-comparison_fn_t.patch61
-rw-r--r--meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch65
-rw-r--r--meta/recipes-core/systemd/systemd/0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch (renamed from meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch)46
-rw-r--r--meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch590
-rw-r--r--meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch326
-rw-r--r--meta/recipes-core/systemd/systemd/0006-add-missing-FTW_-macros-for-musl.patch44
-rw-r--r--meta/recipes-core/systemd/systemd/0007-Use-uintmax_t-for-handling-rlim_t.patch (renamed from meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch)59
-rw-r--r--meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch34
-rw-r--r--meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch47
-rw-r--r--meta/recipes-core/systemd/systemd/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch (renamed from meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch)14
-rw-r--r--meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch45
-rw-r--r--meta/recipes-core/systemd/systemd/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch (renamed from meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch)66
-rw-r--r--meta/recipes-core/systemd/systemd/0011-avoid-redefinition-of-prctl_mm_map-structure.patch (renamed from meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch)12
-rw-r--r--meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch42
-rw-r--r--meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch530
-rw-r--r--meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch99
-rw-r--r--meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch35
-rw-r--r--meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch (renamed from meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch)14
-rw-r--r--meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow.patch (renamed from meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch)69
-rw-r--r--meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch42
-rw-r--r--meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch35
-rw-r--r--meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch37
-rw-r--r--meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch526
-rw-r--r--meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch30
-rw-r--r--meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch52
-rw-r--r--meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch26
-rw-r--r--meta/recipes-core/systemd/systemd/0019-errno-util-Make-STRERROR-portable-for-musl.patch41
-rw-r--r--meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch40
-rw-r--r--meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch39
-rw-r--r--meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch57
-rw-r--r--meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch33
-rw-r--r--meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch56
-rw-r--r--meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch413
-rw-r--r--meta/recipes-core/systemd/systemd/0023-include-signal.h-to-avoid-the-undeclared-error.patch27
-rw-r--r--meta/recipes-core/systemd/systemd/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch48
-rw-r--r--meta/recipes-core/systemd/systemd/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch288
-rw-r--r--meta/recipes-core/systemd/systemd/0026-build-path.c-avoid-boot-time-segfault-for-musl.patch31
-rw-r--r--meta/recipes-core/systemd/systemd/0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch97
-rw-r--r--meta/recipes-core/systemd/systemd_247.3.bb762
-rw-r--r--meta/recipes-core/systemd/systemd_257.6.bb940
64 files changed, 3364 insertions, 3890 deletions
diff --git a/meta/recipes-core/systemd/dlopen-deps.inc b/meta/recipes-core/systemd/dlopen-deps.inc
new file mode 100644
index 0000000000..e0b333398c
--- /dev/null
+++ b/meta/recipes-core/systemd/dlopen-deps.inc
@@ -0,0 +1,81 @@
1PACKAGEFUNCS =+ "package_generate_dlopen_deps"
2
3python package_generate_dlopen_deps() {
4 # https://systemd.io/ELF_DLOPEN_METADATA/
5
6 import struct, json
7
8 def extract_segment(filename, segment):
9 """
10 Return the named segment from the ELF.
11 """
12 import tempfile, subprocess
13
14 with tempfile.NamedTemporaryFile() as f:
15 try:
16 cmd = [d.getVar("OBJCOPY"), "--dump-section", f"{segment}={f.name}", filename]
17 subprocess.run(cmd, check=True)
18 with open(f.name, "rb") as f2:
19 return f2.read()
20 except subprocess.CalledProcessError as e:
21 # binutils-objcopy has 0 exit code if the segment can't be found, but llvm-objcopy
22 # does not. Assume the failure isn't critical and ignore errors.
23 if e.returncode == 1:
24 return b""
25 raise e
26
27 def parse(buffer, is_little):
28 deps = []
29 offset = 0
30 while offset < len(buffer):
31 format = f"{'<' if is_little else '>'}iii"
32 name_size, desc_size, note_type = struct.unpack_from(format, buffer, offset)
33 offset += struct.calcsize(format)
34
35 format = f"{name_size}s0i{desc_size}s0i"
36 if note_type == 0x407c0c0a:
37 name_b, desc_b = struct.unpack_from(format, buffer, offset)
38 name = name_b.strip(b"\x00").decode("ascii")
39 if name == "FDO":
40 desc = desc_b.strip(b"\x00").decode("utf-8")
41 deps.append(*json.loads(desc))
42 offset += struct.calcsize(format)
43 return deps
44
45 dep_map = {
46 "required": "RDEPENDS",
47 "recommended": "RRECOMMENDS",
48 "suggested": "RSUGGESTS"
49 }
50
51 shlibs = oe.package.read_shlib_providers(d)
52
53 for pkg, files in pkgfiles.items():
54 # Skip -dbg packages as we won't need to generate dependencies for those
55 # but scanning can take time
56 if pkg.endswith("-dbg"):
57 continue
58
59 for f in files:
60 # Skip symlinks, just look for real libraries
61 if cpath.islink(f):
62 continue
63
64 if ".so." in f or f.endswith(".so"):
65 try:
66 elf = oe.qa.ELFFile(f)
67 elf.open()
68 for dep in parse(extract_segment(f, ".note.dlopen"), elf.isLittleEndian()):
69 for soname in dep["soname"]:
70 if soname in shlibs:
71 # TODO assumes the first match is good
72 package, version = list(shlibs[soname].values())[0]
73 dependency = dep_map[dep["priority"]]
74 bb.note(f"{pkg}: adding {dependency} on {package} via .note.dlopen")
75 d.appendVar(f"{dependency}:{pkg}", f" {package} (>= {version})")
76 else:
77 bb.warn(f"cannot find {soname}")
78 except oe.qa.NotELFFileError as e:
79 bb.note(f"Cannot extract ELF notes: {e}")
80 pass
81}
diff --git a/meta/recipes-core/systemd/systemd-boot-native_257.6.bb b/meta/recipes-core/systemd/systemd-boot-native_257.6.bb
new file mode 100644
index 0000000000..05ebe7b63e
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-boot-native_257.6.bb
@@ -0,0 +1,18 @@
1require systemd.inc
2FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3
4inherit native
5
6deltask do_configure
7deltask do_compile
8
9do_install () {
10 install -Dm 0755 ${S}/src/ukify/ukify.py ${D}${bindir}/ukify
11}
12addtask install after do_patch
13
14PACKAGES = "${PN}"
15
16FILES:${PN} = "${bindir}/ukify"
17
18RDEPENDS:${PN} += "python3-pefile-native"
diff --git a/meta/recipes-core/systemd/systemd-boot_247.3.bb b/meta/recipes-core/systemd/systemd-boot_247.3.bb
deleted file mode 100644
index 249e620f4e..0000000000
--- a/meta/recipes-core/systemd/systemd-boot_247.3.bb
+++ /dev/null
@@ -1,70 +0,0 @@
1require systemd.inc
2FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3
4require conf/image-uefi.conf
5
6DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native"
7
8inherit meson pkgconfig gettext
9inherit deploy
10
11LDFLAGS_prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
12
13do_write_config[vardeps] += "CC OBJCOPY"
14do_write_config_append() {
15 cat >${WORKDIR}/meson-${PN}.cross <<EOF
16[binaries]
17efi_cc = ${@meson_array('CC', d)}
18objcopy = ${@meson_array('OBJCOPY', d)}
19EOF
20}
21
22EXTRA_OEMESON += "-Defi=true \
23 -Dgnu-efi=true \
24 -Defi-includedir=${STAGING_INCDIR}/efi \
25 -Defi-libdir=${STAGING_LIBDIR} \
26 -Defi-ld=${@ d.getVar('LD').split()[0]} \
27 -Dman=false \
28 --cross-file ${WORKDIR}/meson-${PN}.cross \
29 "
30
31# install to the image as boot*.efi if its the EFI_PROVIDER,
32# otherwise install as the full name.
33# This allows multiple bootloaders to coexist in a single image.
34python __anonymous () {
35 import re
36 target = d.getVar('TARGET_ARCH')
37 prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-"
38 systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE")
39 d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
40 prefix = "systemd-" if prefix == "" else ""
41 d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
42}
43
44FILES_${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
45
46RDEPENDS_${PN} += "virtual/systemd-bootconf"
47
48# Imported from the old gummiboot recipe
49TUNE_CCARGS_remove = "-mfpmath=sse"
50
51COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
52COMPATIBLE_HOST_x86-x32 = "null"
53
54do_compile() {
55 ninja \
56 src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} \
57 src/boot/efi/linux${EFI_ARCH}.efi.stub
58}
59
60do_install() {
61 install -d ${D}${EFI_FILES_PATH}
62 install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
63}
64
65do_deploy () {
66 install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
67 install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
68}
69
70addtask deploy before do_build after do_compile
diff --git a/meta/recipes-core/systemd/systemd-boot_257.6.bb b/meta/recipes-core/systemd/systemd-boot_257.6.bb
new file mode 100644
index 0000000000..c6c443f929
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-boot_257.6.bb
@@ -0,0 +1,75 @@
1require systemd.inc
2FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3
4require conf/image-uefi.conf
5
6DEPENDS = "libcap util-linux gperf-native python3-jinja2-native python3-pyelftools-native"
7
8inherit meson pkgconfig gettext
9inherit deploy
10
11LDFLAGS =+ "${@ " ".join(d.getVar('LD').split()[1:])} "
12
13EFI_LD = "bfd"
14LDFLAGS += "-fuse-ld=${EFI_LD}"
15
16do_write_config[vardeps] += "EFI_LD"
17do_write_config:append() {
18 cat >${WORKDIR}/meson-${PN}.cross <<EOF
19[binaries]
20c_ld = ${@meson_array('EFI_LD', d)}
21EOF
22}
23
24MESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross"
25
26MESON_TARGET = "systemd-boot"
27
28EXTRA_OEMESON += "-Defi=true \
29 -Dbootloader=true \
30 -Dman=false \
31 "
32
33# install to the image as boot*.efi if its the EFI_PROVIDER,
34# otherwise install as the full name.
35# This allows multiple bootloaders to coexist in a single image.
36python __anonymous () {
37 import re
38 target = d.getVar('TARGET_ARCH')
39 prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-"
40 systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE")
41 d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
42 prefix = "systemd-" if prefix == "" else ""
43 d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
44}
45
46FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
47
48RDEPENDS:${PN} += "virtual-systemd-bootconf"
49
50# efi portions use -mgeneral-regs-only option which conflicts with SSE
51# especially clang throws errors about it
52# error: the 'sse' unit is not supported with this instruction set
53TUNE_CCARGS:remove = "-mfpmath=sse"
54
55CFLAGS:append:libc-musl = " -D__DEFINED_wchar_t"
56
57# arm-poky-linux-musleabi-clang: error: unsupported option '-mgeneral-regs-only' for target 'arm-poky-linux-musleabi'
58TOOLCHAIN:arm = "gcc"
59
60COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*|riscv.*)-linux"
61COMPATIBLE_HOST:x86-x32 = "null"
62
63do_install() {
64 install -d ${D}${EFI_FILES_PATH}
65 install ${B}/src/boot/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
66}
67
68do_deploy () {
69 install ${B}/src/boot/systemd-boot*.efi ${DEPLOYDIR}
70 install ${B}/src/boot/linux*.efi.stub ${DEPLOYDIR}
71 install ${B}/src/boot/addon*.efi.stub ${DEPLOYDIR}
72}
73
74addtask deploy before do_build after do_compile
75
diff --git a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb
index d13b8c518f..5efac3e410 100644
--- a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb
+++ b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb
@@ -2,17 +2,17 @@ LICENSE = "MIT"
2LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 2LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
3SUMMARY = "Basic systemd-boot configuration files" 3SUMMARY = "Basic systemd-boot configuration files"
4 4
5RPROVIDES_${PN} += "virtual/systemd-bootconf" 5RPROVIDES:${PN} += "virtual-systemd-bootconf"
6PACKAGE_ARCH = "${MACHINE_ARCH}" 6PACKAGE_ARCH = "${MACHINE_ARCH}"
7 7
8inherit systemd-boot-cfg 8inherit systemd-boot-cfg
9 9
10S = "${WORKDIR}" 10S = "${UNPACKDIR}"
11 11
12LABELS = "boot" 12LABELS = "boot"
13 13
14ROOT ?= "root=/dev/sda2" 14ROOT ?= "root=/dev/sda2"
15APPEND_append = " ${ROOT}" 15APPEND:append = " ${ROOT}"
16 16
17python do_configure() { 17python do_configure() {
18 bb.build.exec_func('build_efi_cfg', d) 18 bb.build.exec_func('build_efi_cfg', d)
@@ -29,4 +29,4 @@ do_install() {
29 install *.conf ${D}/boot/loader/entries/ 29 install *.conf ${D}/boot/loader/entries/
30} 30}
31 31
32FILES_${PN} = "/boot/loader/* /boot/loader/entries/*" 32FILES:${PN} = "/boot/loader/* /boot/loader/entries/*"
diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
index 361dc1cbb4..d6da34e9b8 100644
--- a/meta/recipes-core/systemd/systemd-compat-units.bb
+++ b/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -2,19 +2,18 @@ SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts"
2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd" 2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
3LICENSE = "MIT" 3LICENSE = "MIT"
4 4
5PR = "r29"
6
7PACKAGE_WRITE_DEPS += "systemd-systemctl-native" 5PACKAGE_WRITE_DEPS += "systemd-systemctl-native"
8 6
9S = "${WORKDIR}" 7S = "${UNPACKDIR}"
10 8
11inherit features_check 9inherit features_check
12 10
13INHIBIT_DEFAULT_DEPS = "1" 11INHIBIT_DEFAULT_DEPS = "1"
14 12
15ALLOW_EMPTY_${PN} = "1" 13ALLOW_EMPTY:${PN} = "1"
16 14
17REQUIRED_DISTRO_FEATURES = "systemd" 15REQUIRED_DISTRO_FEATURES += "systemd"
16REQUIRED_DISTRO_FEATURES += "usrmerge"
18 17
19SYSTEMD_DISABLED_SYSV_SERVICES = " \ 18SYSTEMD_DISABLED_SYSV_SERVICES = " \
20 busybox-udhcpc \ 19 busybox-udhcpc \
@@ -25,9 +24,10 @@ SYSTEMD_DISABLED_SYSV_SERVICES = " \
25 syslog.busybox \ 24 syslog.busybox \
26" 25"
27 26
28pkg_postinst_${PN} () { 27pkg_postinst_ontarget:${PN} () {
29 28
30 cd $D${sysconfdir}/init.d || exit 0 29 test -d $D${sysconfdir}/init.d || exit 0
30 cd $D${sysconfdir}/init.d
31 31
32 echo "Disabling the following sysv scripts: " 32 echo "Disabling the following sysv scripts: "
33 33
@@ -38,7 +38,7 @@ pkg_postinst_${PN} () {
38 fi 38 fi
39 39
40 for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do 40 for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do
41 if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service ] ; then 41 if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_system_unitdir}/$i.service ] ; then
42 echo -n "$i: " 42 echo -n "$i: "
43 systemctl $OPTS mask $i.service 43 systemctl $OPTS mask $i.service
44 fi 44 fi
@@ -46,4 +46,4 @@ pkg_postinst_${PN} () {
46 echo 46 echo
47} 47}
48 48
49RDEPENDS_${PN} = "systemd" 49RDEPENDS:${PN} = "systemd"
diff --git a/meta/recipes-core/systemd/systemd-conf/wired.network b/meta/recipes-core/systemd/systemd-conf/wired.network
index 09367edb10..7406287248 100644
--- a/meta/recipes-core/systemd/systemd-conf/wired.network
+++ b/meta/recipes-core/systemd/systemd-conf/wired.network
@@ -1,6 +1,8 @@
1[Match] 1[Match]
2Type=ether 2Type=ether
3Name=!veth*
3KernelCommandLine=!nfsroot 4KernelCommandLine=!nfsroot
5KernelCommandLine=!ip
4 6
5[Network] 7[Network]
6DHCP=yes 8DHCP=yes
diff --git a/meta/recipes-core/systemd/systemd-conf_247.3.bb b/meta/recipes-core/systemd/systemd-conf_1.0.bb
index 944b56ff82..60066cd60a 100644
--- a/meta/recipes-core/systemd/systemd-conf_247.3.bb
+++ b/meta/recipes-core/systemd/systemd-conf_1.0.bb
@@ -5,6 +5,11 @@ DefaultTimeoutStartSec setting."
5LICENSE = "MIT" 5LICENSE = "MIT"
6LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 6LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
7 7
8inherit features_check
9REQUIRED_DISTRO_FEATURES += "usrmerge"
10
11PE = "1"
12
8PACKAGECONFIG ??= "dhcp-ethernet" 13PACKAGECONFIG ??= "dhcp-ethernet"
9PACKAGECONFIG[dhcp-ethernet] = "" 14PACKAGECONFIG[dhcp-ethernet] = ""
10 15
@@ -16,27 +21,26 @@ SRC_URI = "\
16 file://wired.network \ 21 file://wired.network \
17" 22"
18 23
24S = "${UNPACKDIR}"
25
19do_install() { 26do_install() {
20 install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf 27 install -D -m0644 ${S}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf
21 install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf 28 install -D -m0644 ${S}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf
22 install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf 29 install -D -m0644 ${S}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf
23 30
24 if ${@bb.utils.contains('PACKAGECONFIG', 'dhcp-ethernet', 'true', 'false', d)}; then 31 if ${@bb.utils.contains('PACKAGECONFIG', 'dhcp-ethernet', 'true', 'false', d)}; then
25 install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network 32 install -D -m0644 ${S}/wired.network ${D}${systemd_unitdir}/network/80-wired.network
26 fi 33 fi
27} 34}
28 35
29# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52 36# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
30do_install_append_qemuall() { 37do_install:append:qemuall() {
31 install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf 38 install -D -m0644 ${S}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf
32
33 # Do not install wired.network for qemu bsps
34 rm -rf ${D}${systemd_unitdir}/network
35} 39}
36 40
37PACKAGE_ARCH = "${MACHINE_ARCH}" 41PACKAGE_ARCH = "${MACHINE_ARCH}"
38 42
39FILES_${PN} = "\ 43FILES:${PN} = "\
40 ${systemd_unitdir}/journald.conf.d/ \ 44 ${systemd_unitdir}/journald.conf.d/ \
41 ${systemd_unitdir}/logind.conf.d/ \ 45 ${systemd_unitdir}/logind.conf.d/ \
42 ${systemd_unitdir}/system.conf.d/ \ 46 ${systemd_unitdir}/system.conf.d/ \
diff --git a/meta/recipes-core/systemd/systemd-machine-units_1.0.bb b/meta/recipes-core/systemd/systemd-machine-units_1.0.bb
index 02756f43d7..a366f199ee 100644
--- a/meta/recipes-core/systemd/systemd-machine-units_1.0.bb
+++ b/meta/recipes-core/systemd/systemd-machine-units_1.0.bb
@@ -5,9 +5,8 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda
5 5
6PACKAGE_ARCH = "${MACHINE_ARCH}" 6PACKAGE_ARCH = "${MACHINE_ARCH}"
7 7
8PR = "r19" 8inherit systemd features_check
9REQUIRED_DISTRO_FEATURES += "usrmerge"
10SYSTEMD_SERVICE:${PN} = ""
9 11
10inherit systemd 12ALLOW_EMPTY:${PN} = "1"
11SYSTEMD_SERVICE_${PN} = ""
12
13ALLOW_EMPTY_${PN} = "1"
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
index 34defeb3b1..c3fe9d5b6d 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty.bb
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -1,29 +1,23 @@
1SUMMARY = "Serial terminal support for systemd" 1SUMMARY = "Serial terminal support for systemd (using SERIAL_CONSOLES)"
2HOMEPAGE = "https://www.freedesktop.org/wiki/Software/systemd/" 2HOMEPAGE = "https://www.freedesktop.org/wiki/Software/systemd/"
3LICENSE = "GPLv2+" 3LICENSE = "GPL-2.0-or-later"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" 4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
5 5
6PR = "r5" 6# Note that this recipe explicitly creates a serial-getty@ service for every tty
7 7# in SERIAL_CONSOLES. This is typically not always needed with systemd as it
8SERIAL_CONSOLES ?= "115200;ttyS0" 8# will probe at boot and generate getty instances for any active consoles as
9SERIAL_TERM ?= "linux" 9# required. This recipe (enabled via disabling serial-getty-generator in systemd)
10 10# should only be used if the generator is not appropriate.
11SRC_URI = "file://serial-getty@.service"
12
13S = "${WORKDIR}"
14 11
15# As this package is tied to systemd, only build it when we're also building systemd. 12# As this package is tied to systemd, only build it when we're also building systemd.
16inherit features_check 13inherit features_check
17REQUIRED_DISTRO_FEATURES = "systemd" 14REQUIRED_DISTRO_FEATURES += "systemd"
15REQUIRED_DISTRO_FEATURES += "usrmerge"
18 16
19do_install() { 17do_install() {
20 if [ ! -z "${SERIAL_CONSOLES}" ] ; then 18 if [ ! -z "${SERIAL_CONSOLES}" ] ; then
21 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` 19 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
22 install -d ${D}${systemd_unitdir}/system/
23 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ 20 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
24 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
25 sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_unitdir}/system/serial-getty@.service
26 sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_unitdir}/system/serial-getty@.service
27 21
28 tmp="${SERIAL_CONSOLES}" 22 tmp="${SERIAL_CONSOLES}"
29 for entry in $tmp ; do 23 for entry in $tmp ; do
@@ -31,14 +25,14 @@ do_install() {
31 ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'` 25 ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
32 if [ "$baudrate" = "$default_baudrate" ] ; then 26 if [ "$baudrate" = "$default_baudrate" ] ; then
33 # enable the service 27 # enable the service
34 ln -sf ${systemd_unitdir}/system/serial-getty@.service \ 28 ln -sf ${systemd_system_unitdir}/serial-getty@.service \
35 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service 29 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
36 else 30 else
37 # install custom service file for the non-default baudrate 31 # install custom service file for the non-default baudrate
38 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service 32 install -m 0644 ${S}/serial-getty@.service ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
39 sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service 33 sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
40 # enable the service 34 # enable the service
41 ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \ 35 ln -sf ${systemd_system_unitdir}/serial-getty$baudrate@.service \
42 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service 36 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service
43 fi 37 fi
44 done 38 done
@@ -46,7 +40,7 @@ do_install() {
46} 40}
47 41
48# This is a machine specific file 42# This is a machine specific file
49FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}"
50PACKAGE_ARCH = "${MACHINE_ARCH}" 43PACKAGE_ARCH = "${MACHINE_ARCH}"
44FILES:${PN} = "${sysconfdir}"
51 45
52ALLOW_EMPTY_${PN} = "1" 46ALLOW_EMPTY:${PN} = "1"
diff --git a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
deleted file mode 100644
index b16fe1188e..0000000000
--- a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
+++ /dev/null
@@ -1,45 +0,0 @@
1# SPDX-License-Identifier: LGPL-2.1+
2#
3# This file is part of systemd.
4#
5# systemd is free software; you can redistribute it and/or modify it
6# under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; either version 2.1 of the License, or
8# (at your option) any later version.
9
10[Unit]
11Description=Serial Getty on %I
12Documentation=man:agetty(8) man:systemd-getty-generator(8)
13Documentation=http://0pointer.de/blog/projects/serial-console.html
14PartOf=dev-%i.device
15ConditionPathExists=/dev/%i
16After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
17After=rc-local.service
18
19# If additional gettys are spawned during boot then we should make
20# sure that this is synchronized before getty.target, even though
21# getty.target didn't actually pull it in.
22Before=getty.target
23IgnoreOnIsolate=yes
24
25# IgnoreOnIsolate causes issues with sulogin, if someone isolates
26# rescue.target or starts rescue.service from multi-user.target or
27# graphical.target.
28Conflicts=rescue.service
29Before=rescue.service
30
31[Service]
32Environment="TERM=@TERM@"
33ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM
34Type=idle
35Restart=always
36UtmpIdentifier=%I
37TTYPath=/dev/%I
38TTYReset=yes
39TTYVHangup=yes
40KillMode=process
41IgnoreSIGPIPE=no
42SendSIGHUP=yes
43
44[Install]
45WantedBy=getty.target
diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb b/meta/recipes-core/systemd/systemd-systemctl-native.bb
deleted file mode 100644
index fadc8433d8..0000000000
--- a/meta/recipes-core/systemd/systemd-systemctl-native.bb
+++ /dev/null
@@ -1,17 +0,0 @@
1SUMMARY = "Wrapper for enabling systemd services"
2
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
5
6PR = "r6"
7
8inherit native
9
10SRC_URI = "file://systemctl"
11
12S = "${WORKDIR}"
13
14do_install() {
15 install -d ${D}${bindir}
16 install -m 0755 ${WORKDIR}/systemctl ${D}${bindir}
17}
diff --git a/meta/recipes-core/systemd/systemd-systemctl-native_257.6.bb b/meta/recipes-core/systemd/systemd-systemctl-native_257.6.bb
new file mode 100644
index 0000000000..041a040a26
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-systemctl-native_257.6.bb
@@ -0,0 +1,16 @@
1SUMMARY = "Systemctl executable from systemd"
2
3require systemd.inc
4
5DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native"
6
7inherit pkgconfig meson native
8
9MESON_TARGET = "systemctl:executable"
10MESON_INSTALL_TAGS = "systemctl"
11EXTRA_OEMESON += "-Dlink-systemctl-shared=false"
12
13# Systemctl is supposed to operate on target, but the target sysroot is not
14# determined at run-time, but rather set during configure
15# More details are here https://github.com/systemd/systemd/issues/35897#issuecomment-2665405887
16EXTRA_OEMESON += "--sysconfdir ${sysconfdir_native}"
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
deleted file mode 100755
index de733e255b..0000000000
--- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
+++ /dev/null
@@ -1,325 +0,0 @@
1#!/usr/bin/env python3
2"""systemctl: subset of systemctl used for image construction
3
4Mask/preset systemd units
5"""
6
7import argparse
8import fnmatch
9import os
10import re
11import sys
12
13from collections import namedtuple
14from pathlib import Path
15
16version = 1.0
17
18ROOT = Path("/")
19SYSCONFDIR = Path("etc")
20BASE_LIBDIR = Path("lib")
21LIBDIR = Path("usr", "lib")
22
23locations = list()
24
25
26class SystemdFile():
27 """Class representing a single systemd configuration file"""
28 def __init__(self, root, path):
29 self.sections = dict()
30 self._parse(root, path)
31 dirname = os.path.basename(path.name) + ".d"
32 for location in locations:
33 for path2 in sorted((root / location / "system" / dirname).glob("*.conf")):
34 self._parse(root, path2)
35
36 def _parse(self, root, path):
37 """Parse a systemd syntax configuration file
38
39 Args:
40 path: A pathlib.Path object pointing to the file
41
42 """
43 skip_re = re.compile(r"^\s*([#;]|$)")
44 section_re = re.compile(r"^\s*\[(?P<section>.*)\]")
45 kv_re = re.compile(r"^\s*(?P<key>[^\s]+)\s*=\s*(?P<value>.*)")
46 section = None
47
48 if path.is_symlink():
49 try:
50 path.resolve()
51 except FileNotFoundError:
52 # broken symlink, try relative to root
53 path = root / Path(os.readlink(str(path))).relative_to(ROOT)
54
55 with path.open() as f:
56 for line in f:
57 if skip_re.match(line):
58 continue
59
60 line = line.strip()
61 m = section_re.match(line)
62 if m:
63 if m.group('section') not in self.sections:
64 section = dict()
65 self.sections[m.group('section')] = section
66 else:
67 section = self.sections[m.group('section')]
68 continue
69
70 while line.endswith("\\"):
71 line += f.readline().rstrip("\n")
72
73 m = kv_re.match(line)
74 k = m.group('key')
75 v = m.group('value')
76 if k not in section:
77 section[k] = list()
78 section[k].extend(v.split())
79
80 def get(self, section, prop):
81 """Get a property from section
82
83 Args:
84 section: Section to retrieve property from
85 prop: Property to retrieve
86
87 Returns:
88 List representing all properties of type prop in section.
89
90 Raises:
91 KeyError: if ``section`` or ``prop`` not found
92 """
93 return self.sections[section][prop]
94
95
96class Presets():
97 """Class representing all systemd presets"""
98 def __init__(self, scope, root):
99 self.directives = list()
100 self._collect_presets(scope, root)
101
102 def _parse_presets(self, presets):
103 """Parse presets out of a set of preset files"""
104 skip_re = re.compile(r"^\s*([#;]|$)")
105 directive_re = re.compile(r"^\s*(?P<action>enable|disable)\s+(?P<unit_name>(.+))")
106
107 Directive = namedtuple("Directive", "action unit_name")
108 for preset in presets:
109 with preset.open() as f:
110 for line in f:
111 m = directive_re.match(line)
112 if m:
113 directive = Directive(action=m.group('action'),
114 unit_name=m.group('unit_name'))
115 self.directives.append(directive)
116 elif skip_re.match(line):
117 pass
118 else:
119 sys.exit("Unparsed preset line in {}".format(preset))
120
121 def _collect_presets(self, scope, root):
122 """Collect list of preset files"""
123 presets = dict()
124 for location in locations:
125 paths = (root / location / scope).glob("*.preset")
126 for path in paths:
127 # earlier names override later ones
128 if path.name not in presets:
129 presets[path.name] = path
130
131 self._parse_presets([v for k, v in sorted(presets.items())])
132
133 def state(self, unit_name):
134 """Return state of preset for unit_name
135
136 Args:
137 presets: set of presets
138 unit_name: name of the unit
139
140 Returns:
141 None: no matching preset
142 `enable`: unit_name is enabled
143 `disable`: unit_name is disabled
144 """
145 for directive in self.directives:
146 if fnmatch.fnmatch(unit_name, directive.unit_name):
147 return directive.action
148
149 return None
150
151
152def add_link(path, target):
153 try:
154 path.parent.mkdir(parents=True)
155 except FileExistsError:
156 pass
157 if not path.is_symlink():
158 print("ln -s {} {}".format(target, path))
159 path.symlink_to(target)
160
161
162class SystemdUnitNotFoundError(Exception):
163 pass
164
165
166class SystemdUnit():
167 def __init__(self, root, unit):
168 self.root = root
169 self.unit = unit
170 self.config = None
171
172 def _path_for_unit(self, unit):
173 for location in locations:
174 path = self.root / location / "system" / unit
175 if path.exists() or path.is_symlink():
176 return path
177
178 raise SystemdUnitNotFoundError(self.root, unit)
179
180 def _process_deps(self, config, service, location, prop, dirstem):
181 systemdir = self.root / SYSCONFDIR / "systemd" / "system"
182
183 target = ROOT / location.relative_to(self.root)
184 try:
185 for dependent in config.get('Install', prop):
186 wants = systemdir / "{}.{}".format(dependent, dirstem) / service
187 add_link(wants, target)
188
189 except KeyError:
190 pass
191
192 def enable(self):
193 # if we're enabling an instance, first extract the actual instance
194 # then figure out what the template unit is
195 template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit)
196 if template:
197 instance = template.group('instance')
198 unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1)
199 else:
200 instance = None
201 unit = self.unit
202
203 path = self._path_for_unit(unit)
204
205 if path.is_symlink():
206 # ignore aliases
207 return
208
209 config = SystemdFile(self.root, path)
210 if instance == "":
211 try:
212 default_instance = config.get('Install', 'DefaultInstance')[0]
213 except KeyError:
214 # no default instance, so nothing to enable
215 return
216
217 service = self.unit.replace("@.",
218 "@{}.".format(default_instance))
219 else:
220 service = self.unit
221
222 self._process_deps(config, service, path, 'WantedBy', 'wants')
223 self._process_deps(config, service, path, 'RequiredBy', 'requires')
224
225 try:
226 for also in config.get('Install', 'Also'):
227 SystemdUnit(self.root, also).enable()
228
229 except KeyError:
230 pass
231
232 systemdir = self.root / SYSCONFDIR / "systemd" / "system"
233 target = ROOT / path.relative_to(self.root)
234 try:
235 for dest in config.get('Install', 'Alias'):
236 alias = systemdir / dest
237 add_link(alias, target)
238
239 except KeyError:
240 pass
241
242 def mask(self):
243 systemdir = self.root / SYSCONFDIR / "systemd" / "system"
244 add_link(systemdir / self.unit, "/dev/null")
245
246
247def collect_services(root):
248 """Collect list of service files"""
249 services = set()
250 for location in locations:
251 paths = (root / location / "system").glob("*")
252 for path in paths:
253 if path.is_dir():
254 continue
255 services.add(path.name)
256
257 return services
258
259
260def preset_all(root):
261 presets = Presets('system-preset', root)
262 services = collect_services(root)
263
264 for service in services:
265 state = presets.state(service)
266
267 if state == "enable" or state is None:
268 SystemdUnit(root, service).enable()
269
270 # If we populate the systemd links we also create /etc/machine-id, which
271 # allows systemd to boot with the filesystem read-only before generating
272 # a real value and then committing it back.
273 #
274 # For the stateless configuration, where /etc is generated at runtime
275 # (for example on a tmpfs), this script shouldn't run at all and we
276 # allow systemd to completely populate /etc.
277 (root / SYSCONFDIR / "machine-id").touch()
278
279
280def main():
281 if sys.version_info < (3, 4, 0):
282 sys.exit("Python 3.4 or greater is required")
283
284 parser = argparse.ArgumentParser()
285 parser.add_argument('command', nargs='?', choices=['enable', 'mask',
286 'preset-all'])
287 parser.add_argument('service', nargs=argparse.REMAINDER)
288 parser.add_argument('--root')
289 parser.add_argument('--preset-mode',
290 choices=['full', 'enable-only', 'disable-only'],
291 default='full')
292
293 args = parser.parse_args()
294
295 root = Path(args.root) if args.root else ROOT
296
297 locations.append(SYSCONFDIR / "systemd")
298 # Handle the usrmerge case by ignoring /lib when it's a symlink
299 if not (root / BASE_LIBDIR).is_symlink():
300 locations.append(BASE_LIBDIR / "systemd")
301 locations.append(LIBDIR / "systemd")
302
303 command = args.command
304 if not command:
305 parser.print_help()
306 return 0
307
308 if command == "mask":
309 for service in args.service:
310 SystemdUnit(root, service).mask()
311 elif command == "enable":
312 for service in args.service:
313 SystemdUnit(root, service).enable()
314 elif command == "preset-all":
315 if len(args.service) != 0:
316 sys.exit("Too many arguments.")
317 if args.preset_mode != "enable-only":
318 sys.exit("Only enable-only is supported as preset-mode.")
319 preset_all(root)
320 else:
321 raise RuntimeError()
322
323
324if __name__ == '__main__':
325 main()
diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc
index ccff8c8b9e..101457140f 100644
--- a/meta/recipes-core/systemd/systemd.inc
+++ b/meta/recipes-core/systemd/systemd.inc
@@ -10,12 +10,13 @@ state, maintains mount and automount points and implements an \
10elaborate transactional dependency-based service control logic. It can \ 10elaborate transactional dependency-based service control logic. It can \
11work as a drop-in replacement for sysvinit." 11work as a drop-in replacement for sysvinit."
12 12
13LICENSE = "GPLv2 & LGPLv2.1" 13LICENSE = "GPL-2.0-only & LGPL-2.1-or-later"
14LICENSE:libsystemd = "LGPL-2.1-or-later"
14LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ 15LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
15 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" 16 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
16 17
17SRCREV = "551dd873b0bdfb9e7e47431b2933c8b910228f0c" 18SRCREV = "00a12c234e2506f5cab683460199575f13c454db"
18SRCBRANCH = "v247-stable" 19SRCBRANCH = "v257-stable"
19SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH}" 20SRC_URI = "git://github.com/systemd/systemd.git;protocol=https;branch=${SRCBRANCH};tag=v${PV}"
20 21
21S = "${WORKDIR}/git" 22CVE_PRODUCT = "systemd"
diff --git a/meta/recipes-core/systemd/systemd/00-create-volatile.conf b/meta/recipes-core/systemd/systemd/00-create-volatile.conf
index 87cbe1e7d3..1092bda010 100644
--- a/meta/recipes-core/systemd/systemd/00-create-volatile.conf
+++ b/meta/recipes-core/systemd/systemd/00-create-volatile.conf
@@ -1,7 +1,9 @@
1#This goes hand-in-hand with the base-files of OE-Core. The file must 1# This goes hand-in-hand with the base-files of OE-Core. The file must
2# be sorted before 'systemd.conf' becuase this attempts to create a file 2# be sorted before 'systemd.conf' because this attempts to create a file
3# inside /var/log. 3# inside /var/log.
4 4
5 5
6d /run/lock 1777 - - -
6d /var/volatile/log - - - - 7d /var/volatile/log - - - -
7d /var/volatile/tmp 1777 - - 8d /var/volatile/tmp 1777 - -
9L /var/tmp - - - - /var/volatile/tmp
diff --git a/meta/recipes-core/systemd/systemd/0001-Do-not-create-var-log-README.patch b/meta/recipes-core/systemd/systemd/0001-Do-not-create-var-log-README.patch
new file mode 100644
index 0000000000..850e356b2f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-Do-not-create-var-log-README.patch
@@ -0,0 +1,30 @@
1From 425ad51e727058b48dd4580fd6afe7e51e96a28a Mon Sep 17 00:00:00 2001
2From: Peter Kjellerstedt <pkj@axis.com>
3Date: Tue, 21 Jan 2025 05:02:00 +0100
4Subject: [PATCH] Do not create /var/log/README
5
6/var/log/README is a link to /usr/share/doc/systemd/README.logs. The
7latter is packaged in systemd-doc and likely not installed, which leaves
8/var/log/README as a dead link. Since /var/log/README is not very
9useful, just remove it.
10
11Upstream-Status: Inappropriate [OE specific]
12Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
13---
14 tmpfiles.d/legacy.conf.in | 3 ---
15 1 file changed, 3 deletions(-)
16
17diff --git a/tmpfiles.d/legacy.conf.in b/tmpfiles.d/legacy.conf.in
18index b475500e58..650c91a8da 100644
19--- a/tmpfiles.d/legacy.conf.in
20+++ b/tmpfiles.d/legacy.conf.in
21@@ -13,9 +13,6 @@
22
23 d /run/lock 0755 root root -
24 L /var/lock - - - - ../run/lock
25-{% if CREATE_LOG_DIRS %}
26-L$ /var/log/README - - - - ../..{{DOC_DIR}}/README.logs
27-{% endif %}
28
29 {% if HAVE_SYSV_COMPAT %}
30 # /run/lock/subsys is used for serializing SysV service execution, and
diff --git a/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch b/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch
deleted file mode 100644
index fd7f94a61d..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From b9b7a8e3825f0433e120f7a6d7d5d635a839cab9 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com>
3Date: Thu, 21 Jan 2021 06:19:44 +0000
4Subject: [PATCH] analyze: resolve executable path if it is relative
5
6Upstream-Status: Backport [https://github.com/systemd/systemd/commit/f1fb046a985521f7d4a662f02546686ff20b7e5d]
7
8Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
9---
10 src/analyze/analyze-verify.c | 7 +++++--
11 1 file changed, 5 insertions(+), 2 deletions(-)
12
13diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c
14index a9c89173bf..969523df18 100644
15--- a/src/analyze/analyze-verify.c
16+++ b/src/analyze/analyze-verify.c
17@@ -115,14 +115,17 @@ static int verify_socket(Unit *u) {
18 }
19
20 int verify_executable(Unit *u, const ExecCommand *exec) {
21+ int r;
22+
23 if (!exec)
24 return 0;
25
26 if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE)
27 return 0;
28
29- if (access(exec->path, X_OK) < 0)
30- return log_unit_error_errno(u, errno, "Command %s is not executable: %m", exec->path);
31+ r = find_executable_full(exec->path, false, NULL);
32+ if (r < 0)
33+ return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path);
34
35 return 0;
36 }
37--
382.26.2
39
diff --git a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
index 8dd22eeb7b..5101f9227e 100644
--- a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
@@ -1,8 +1,8 @@
1From 564830719be2017c4953589d50f21a9e856a4ecc Mon Sep 17 00:00:00 2001 1From e5fd143f215f072404c544f694cb026a4231503e Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Thu, 21 Feb 2019 16:23:24 +0800 3Date: Thu, 21 Feb 2019 16:23:24 +0800
4Subject: [PATCH] binfmt: Don't install dependency links at install time for 4Subject: [PATCH 01/26] binfmt: Don't install dependency links at install time
5 the binfmt services 5 for the binfmt services
6 6
7use [Install] blocks so that they get created when the service is enabled 7use [Install] blocks so that they get created when the service is enabled
8like a traditional service. 8like a traditional service.
@@ -18,64 +18,62 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
18Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 18Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
19[rebased for systemd 243] 19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com> 20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21
22--- 21---
23 units/meson.build | 6 ++---- 22 units/meson.build | 2 --
24 units/proc-sys-fs-binfmt_misc.automount | 3 +++ 23 units/proc-sys-fs-binfmt_misc.automount | 3 +++
25 units/systemd-binfmt.service.in | 4 ++++ 24 units/systemd-binfmt.service.in | 4 ++++
26 3 files changed, 9 insertions(+), 4 deletions(-) 25 3 files changed, 7 insertions(+), 2 deletions(-)
27 26
28Index: systemd-stable/units/meson.build 27diff --git a/units/meson.build b/units/meson.build
29=================================================================== 28index 96f4852741..0a3a4fee67 100644
30--- systemd-stable.orig/units/meson.build 29--- a/units/meson.build
31+++ systemd-stable/units/meson.build 30+++ b/units/meson.build
32@@ -55,8 +55,7 @@ units = [ 31@@ -156,7 +156,6 @@ units = [
33 ['poweroff.target', '', 32 {
34 (with_runlevels ? 'runlevel0.target' : '')], 33 'file' : 'proc-sys-fs-binfmt_misc.automount',
35 ['printer.target', ''], 34 'conditions' : ['ENABLE_BINFMT'],
36- ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT', 35- 'symlinks' : ['sysinit.target.wants/'],
37- 'sysinit.target.wants/'], 36 },
38+ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'], 37 {
39 ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], 38 'file' : 'proc-sys-fs-binfmt_misc.mount',
40 ['reboot.target', '', 39@@ -258,7 +257,6 @@ units = [
41 'ctrl-alt-del.target' + (with_runlevels ? ' runlevel6.target' : '')], 40 {
42@@ -166,8 +165,7 @@ in_units = [ 41 'file' : 'systemd-binfmt.service.in',
43 ['rc-local.service', 'HAVE_SYSV_COMPAT'], 42 'conditions' : ['ENABLE_BINFMT'],
44 ['rescue.service', ''], 43- 'symlinks' : ['sysinit.target.wants/'],
45 ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'], 44 },
46- ['systemd-binfmt.service', 'ENABLE_BINFMT', 45 {
47- 'sysinit.target.wants/'], 46 'file' : 'systemd-bless-boot.service.in',
48+ ['systemd-binfmt.service', 'ENABLE_BINFMT'], 47diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
49 ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'], 48index 7ec21e76c9..fee4d1345f 100644
50 ['systemd-boot-check-no-failures.service', ''], 49--- a/units/proc-sys-fs-binfmt_misc.automount
51 ['systemd-coredump@.service', 'ENABLE_COREDUMP'], 50+++ b/units/proc-sys-fs-binfmt_misc.automount
52Index: systemd-stable/units/proc-sys-fs-binfmt_misc.automount 51@@ -22,3 +22,6 @@ Before=shutdown.target
53===================================================================
54--- systemd-stable.orig/units/proc-sys-fs-binfmt_misc.automount
55+++ systemd-stable/units/proc-sys-fs-binfmt_misc.automount
56@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/
57 52
58 [Automount] 53 [Automount]
59 Where=/proc/sys/fs/binfmt_misc 54 Where=/proc/sys/fs/binfmt_misc
60+ 55+
61+[Install] 56+[Install]
62+WantedBy=sysinit.target 57+WantedBy=sysinit.target
63Index: systemd-stable/units/systemd-binfmt.service.in 58diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
64=================================================================== 59index 318bf8efc2..6ef684861d 100644
65--- systemd-stable.orig/units/systemd-binfmt.service.in 60--- a/units/systemd-binfmt.service.in
66+++ systemd-stable/units/systemd-binfmt.service.in 61+++ b/units/systemd-binfmt.service.in
67@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm 62@@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html
68 Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems 63 Documentation=https://systemd.io/API_FILE_SYSTEMS
69 DefaultDependencies=no 64 DefaultDependencies=no
70 Conflicts=shutdown.target 65 Conflicts=shutdown.target
71+Wants=proc-sys-fs-binfmt_misc.automount 66+Wants=proc-sys-fs-binfmt_misc.automount
72 After=proc-sys-fs-binfmt_misc.automount 67 After=proc-sys-fs-binfmt_misc.automount
73 After=proc-sys-fs-binfmt_misc.mount 68 After=proc-sys-fs-binfmt_misc.mount
74 Before=sysinit.target shutdown.target 69 After=local-fs.target
75@@ -30,3 +31,6 @@ RemainAfterExit=yes 70@@ -31,3 +32,6 @@ RemainAfterExit=yes
76 ExecStart=@rootlibexecdir@/systemd-binfmt 71 ExecStart={{LIBEXECDIR}}/systemd-binfmt
77 ExecStop=@rootlibexecdir@/systemd-binfmt --unregister 72 ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
78 TimeoutSec=90s 73 TimeoutSec=90s
79+ 74+
80+[Install] 75+[Install]
81+WantedBy=sysinit.target 76+WantedBy=sysinit.target
77--
782.34.1
79
diff --git a/meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch b/meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch
deleted file mode 100644
index 89ef39bc3e..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch
+++ /dev/null
@@ -1,227 +0,0 @@
1From 150d9cade6d475570395cb418b824524dead9577 Mon Sep 17 00:00:00 2001
2From: Joshua Watt <JPEWhacker@gmail.com>
3Date: Fri, 30 Oct 2020 08:15:43 -0500
4Subject: [PATCH] logind: Restore chvt as non-root user without polkit
5
64acf0cfd2f ("logind: check PolicyKit before allowing VT switch") broke
7the ability to write user sessions that run graphical sessions (e.g.
8weston/X11). This was partially amended in 19bb87fbfa ("login: allow
9non-console sessions to change vt") by changing the default PolicyKit
10policy so that non-root users are again allowed to switch the VT. This
11makes the policy when PolKit is not enabled (as on many embedded
12systems) match the default PolKit policy and allows launching graphical
13sessions as a non-root user.
14
15Closes #17473
16---
17 src/login/logind-dbus.c | 11 ++-------
18 src/login/logind-polkit.c | 26 +++++++++++++++++++++
19 src/login/logind-polkit.h | 10 ++++++++
20 src/login/logind-seat-dbus.c | 41 ++++-----------------------------
21 src/login/logind-session-dbus.c | 11 ++-------
22 src/login/meson.build | 1 +
23 6 files changed, 46 insertions(+), 54 deletions(-)
24 create mode 100644 src/login/logind-polkit.c
25 create mode 100644 src/login/logind-polkit.h
26
27diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
28index 0f83ed99bc..a3765d88ba 100644
29--- a/src/login/logind-dbus.c
30+++ b/src/login/logind-dbus.c
31@@ -30,6 +30,7 @@
32 #include "format-util.h"
33 #include "fs-util.h"
34 #include "logind-dbus.h"
35+#include "logind-polkit.h"
36 #include "logind-seat-dbus.h"
37 #include "logind-session-dbus.h"
38 #include "logind-user-dbus.h"
39@@ -1047,15 +1048,7 @@ static int method_activate_session_on_seat(sd_bus_message *message, void *userda
40 return sd_bus_error_setf(error, BUS_ERROR_SESSION_NOT_ON_SEAT,
41 "Session %s not on seat %s", session_name, seat_name);
42
43- r = bus_verify_polkit_async(
44- message,
45- CAP_SYS_ADMIN,
46- "org.freedesktop.login1.chvt",
47- NULL,
48- false,
49- UID_INVALID,
50- &m->polkit_registry,
51- error);
52+ r = check_polkit_chvt(message, m, error);
53 if (r < 0)
54 return r;
55 if (r == 0)
56diff --git a/src/login/logind-polkit.c b/src/login/logind-polkit.c
57new file mode 100644
58index 0000000000..9072570cc6
59--- /dev/null
60+++ b/src/login/logind-polkit.c
61@@ -0,0 +1,26 @@
62+/* SPDX-License-Identifier: LGPL-2.1+ */
63+
64+#include "bus-polkit.h"
65+#include "logind-polkit.h"
66+#include "missing_capability.h"
67+#include "user-util.h"
68+
69+int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error) {
70+#if ENABLE_POLKIT
71+ return bus_verify_polkit_async(
72+ message,
73+ CAP_SYS_ADMIN,
74+ "org.freedesktop.login1.chvt",
75+ NULL,
76+ false,
77+ UID_INVALID,
78+ &manager->polkit_registry,
79+ error);
80+#else
81+ /* Allow chvt when polkit is not present. This allows a service to start a graphical session as a
82+ * non-root user when polkit is not compiled in, matching the default polkit policy */
83+ return 1;
84+#endif
85+}
86+
87+
88diff --git a/src/login/logind-polkit.h b/src/login/logind-polkit.h
89new file mode 100644
90index 0000000000..476c077a8a
91--- /dev/null
92+++ b/src/login/logind-polkit.h
93@@ -0,0 +1,10 @@
94+/* SPDX-License-Identifier: LGPL-2.1+ */
95+#pragma once
96+
97+#include "sd-bus.h"
98+
99+#include "bus-object.h"
100+#include "logind.h"
101+
102+int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error);
103+
104diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c
105index a945132284..f22e9e2734 100644
106--- a/src/login/logind-seat-dbus.c
107+++ b/src/login/logind-seat-dbus.c
108@@ -9,6 +9,7 @@
109 #include "bus-polkit.h"
110 #include "bus-util.h"
111 #include "logind-dbus.h"
112+#include "logind-polkit.h"
113 #include "logind-seat-dbus.h"
114 #include "logind-seat.h"
115 #include "logind-session-dbus.h"
116@@ -179,15 +180,7 @@ static int method_activate_session(sd_bus_message *message, void *userdata, sd_b
117 if (session->seat != s)
118 return sd_bus_error_setf(error, BUS_ERROR_SESSION_NOT_ON_SEAT, "Session %s not on seat %s", name, s->id);
119
120- r = bus_verify_polkit_async(
121- message,
122- CAP_SYS_ADMIN,
123- "org.freedesktop.login1.chvt",
124- NULL,
125- false,
126- UID_INVALID,
127- &s->manager->polkit_registry,
128- error);
129+ r = check_polkit_chvt(message, s->manager, error);
130 if (r < 0)
131 return r;
132 if (r == 0)
133@@ -215,15 +208,7 @@ static int method_switch_to(sd_bus_message *message, void *userdata, sd_bus_erro
134 if (to <= 0)
135 return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid virtual terminal");
136
137- r = bus_verify_polkit_async(
138- message,
139- CAP_SYS_ADMIN,
140- "org.freedesktop.login1.chvt",
141- NULL,
142- false,
143- UID_INVALID,
144- &s->manager->polkit_registry,
145- error);
146+ r = check_polkit_chvt(message, s->manager, error);
147 if (r < 0)
148 return r;
149 if (r == 0)
150@@ -243,15 +228,7 @@ static int method_switch_to_next(sd_bus_message *message, void *userdata, sd_bus
151 assert(message);
152 assert(s);
153
154- r = bus_verify_polkit_async(
155- message,
156- CAP_SYS_ADMIN,
157- "org.freedesktop.login1.chvt",
158- NULL,
159- false,
160- UID_INVALID,
161- &s->manager->polkit_registry,
162- error);
163+ r = check_polkit_chvt(message, s->manager, error);
164 if (r < 0)
165 return r;
166 if (r == 0)
167@@ -271,15 +248,7 @@ static int method_switch_to_previous(sd_bus_message *message, void *userdata, sd
168 assert(message);
169 assert(s);
170
171- r = bus_verify_polkit_async(
172- message,
173- CAP_SYS_ADMIN,
174- "org.freedesktop.login1.chvt",
175- NULL,
176- false,
177- UID_INVALID,
178- &s->manager->polkit_registry,
179- error);
180+ r = check_polkit_chvt(message, s->manager, error);
181 if (r < 0)
182 return r;
183 if (r == 0)
184diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
185index ccc5ac8df2..57c8a4e900 100644
186--- a/src/login/logind-session-dbus.c
187+++ b/src/login/logind-session-dbus.c
188@@ -11,6 +11,7 @@
189 #include "fd-util.h"
190 #include "logind-brightness.h"
191 #include "logind-dbus.h"
192+#include "logind-polkit.h"
193 #include "logind-seat-dbus.h"
194 #include "logind-session-dbus.h"
195 #include "logind-session-device.h"
196@@ -192,15 +193,7 @@ int bus_session_method_activate(sd_bus_message *message, void *userdata, sd_bus_
197 assert(message);
198 assert(s);
199
200- r = bus_verify_polkit_async(
201- message,
202- CAP_SYS_ADMIN,
203- "org.freedesktop.login1.chvt",
204- NULL,
205- false,
206- UID_INVALID,
207- &s->manager->polkit_registry,
208- error);
209+ r = check_polkit_chvt(message, s->manager, error);
210 if (r < 0)
211 return r;
212 if (r == 0)
213diff --git a/src/login/meson.build b/src/login/meson.build
214index 0a7d3d5440..7e46be2add 100644
215--- a/src/login/meson.build
216+++ b/src/login/meson.build
217@@ -26,6 +26,7 @@ liblogind_core_sources = files('''
218 logind-device.h
219 logind-inhibit.c
220 logind-inhibit.h
221+ logind-polkit.c
222 logind-seat-dbus.c
223 logind-seat-dbus.h
224 logind-seat.c
225--
2262.28.0
227
diff --git a/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch b/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch
deleted file mode 100644
index e49e06672e..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From 58860e0f248576a80ff2af256ba42713c186ae93 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 29 Sep 2020 18:01:41 -0700
4Subject: [PATCH] systemd.pc.in: use ROOTPREFIX without suffixed slash
5
6This complements the commit
7https://github.com/poettering/systemd/commit/b612c26ceb9f56af0271fc9f07c1724d2d260a8a
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 src/core/systemd.pc.in | 8 ++++----
13 1 file changed, 4 insertions(+), 4 deletions(-)
14
15--- a/src/core/systemd.pc.in
16+++ b/src/core/systemd.pc.in
17@@ -65,16 +65,16 @@ systemdshutdowndir=${systemd_shutdown_dir}
18 tmpfiles_dir=/usr/lib/tmpfiles.d
19 tmpfilesdir=${tmpfiles_dir}
20
21-sysusers_dir=${rootprefix}/lib/sysusers.d
22+sysusers_dir=${prefix}/lib/sysusers.d
23 sysusersdir=${sysusers_dir}
24
25-sysctl_dir=${rootprefix}/lib/sysctl.d
26+sysctl_dir=${prefix}/lib/sysctl.d
27 sysctldir=${sysctl_dir}
28
29-binfmt_dir=${rootprefix}/lib/binfmt.d
30+binfmt_dir=${prefix}/lib/binfmt.d
31 binfmtdir=${binfmt_dir}
32
33-modules_load_dir=${rootprefix}/lib/modules-load.d
34+modules_load_dir=${prefix}/lib/modules-load.d
35 modulesloaddir=${modules_load_dir}
36
37 catalog_dir=/usr/lib/systemd/catalog
diff --git a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch
deleted file mode 100644
index d856bcb583..0000000000
--- a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch
+++ /dev/null
@@ -1,164 +0,0 @@
1From 66ece0b870b3a34fdabc48b88437e6cc354e9fce Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 13:41:41 +0800
4Subject: [PATCH 02/26] don't use glibc-specific qsort_r
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9[Rebased for v241]
10Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
11[Rebased for v242]
12Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
13[Rebased for v247]
14Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
15---
16 src/basic/sort-util.h | 14 ------------
17 src/libsystemd/sd-hwdb/hwdb-util.c | 19 +++++++++++-----
18 src/shared/format-table.c | 36 ++++++++++++++++++++----------
19 3 files changed, 38 insertions(+), 31 deletions(-)
20
21diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
22index 1d194a1f04..3394c9eb72 100644
23--- a/src/basic/sort-util.h
24+++ b/src/basic/sort-util.h
25@@ -54,17 +54,3 @@ static inline void _qsort_safe(void *base, size_t nmemb, size_t size, __compar_f
26 int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \
27 _qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \
28 })
29-
30-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) {
31- if (nmemb <= 1)
32- return;
33-
34- assert(base);
35- qsort_r(base, nmemb, size, compar, userdata);
36-}
37-
38-#define typesafe_qsort_r(p, n, func, userdata) \
39- ({ \
40- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
41- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \
42- })
43diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c
44index 4c94ba9c88..95495dba6d 100644
45--- a/src/libsystemd/sd-hwdb/hwdb-util.c
46+++ b/src/libsystemd/sd-hwdb/hwdb-util.c
47@@ -126,9 +126,13 @@ static void trie_free(struct trie *trie) {
48
49 DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free);
50
51-static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) {
52- return strcmp(trie->strings->buf + a->key_off,
53- trie->strings->buf + b->key_off);
54+static struct trie *trie_node_add_value_trie;
55+static int trie_values_cmp(const void *v1, const void *v2) {
56+ const struct trie_value_entry *a = v1;
57+ const struct trie_value_entry *b = v2;
58+
59+ return strcmp(trie_node_add_value_trie->strings->buf + a->key_off,
60+ trie_node_add_value_trie->strings->buf + b->key_off);
61 }
62
63 static int trie_node_add_value(struct trie *trie, struct trie_node *node,
64@@ -156,7 +160,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
65 .value_off = v,
66 };
67
68- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie);
69+ trie_node_add_value_trie = trie;
70+ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
71+ trie_node_add_value_trie = NULL;
72+
73 if (val) {
74 /* At this point we have 2 identical properties on the same match-string.
75 * Since we process files in order, we just replace the previous value. */
76@@ -182,7 +189,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
77 .line_number = line_number,
78 };
79 node->values_count++;
80- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie);
81+ trie_node_add_value_trie = trie;
82+ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
83+ trie_node_add_value_trie = NULL;
84 return 0;
85 }
86
87diff --git a/src/shared/format-table.c b/src/shared/format-table.c
88index a13a198b7a..bce10bc607 100644
89--- a/src/shared/format-table.c
90+++ b/src/shared/format-table.c
91@@ -1243,30 +1243,32 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t
92 return CMP(index_a, index_b);
93 }
94
95-static int table_data_compare(const size_t *a, const size_t *b, Table *t) {
96+static Table *user_table;
97+static int table_data_compare(const void *x, const void *y) {
98+ const size_t *a = x, *b=y;
99 int r;
100
101- assert(t);
102- assert(t->sort_map);
103+ assert(user_table);
104+ assert(user_table->sort_map);
105
106 /* Make sure the header stays at the beginning */
107- if (*a < t->n_columns && *b < t->n_columns)
108+ if (*a < user_table->n_columns && *b < user_table->n_columns)
109 return 0;
110- if (*a < t->n_columns)
111+ if (*a < user_table->n_columns)
112 return -1;
113- if (*b < t->n_columns)
114+ if (*b < user_table->n_columns)
115 return 1;
116
117 /* Order other lines by the sorting map */
118- for (size_t i = 0; i < t->n_sort_map; i++) {
119+ for (size_t i = 0; i < user_table->n_sort_map; i++) {
120 TableData *d, *dd;
121
122- d = t->data[*a + t->sort_map[i]];
123- dd = t->data[*b + t->sort_map[i]];
124+ d = user_table->data[*a + user_table->sort_map[i]];
125+ dd = user_table->data[*b + user_table->sort_map[i]];
126
127 r = cell_data_compare(d, *a, dd, *b);
128 if (r != 0)
129- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r;
130+ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r;
131 }
132
133 /* Order identical lines by the order there were originally added in */
134@@ -1844,7 +1846,12 @@ int table_print(Table *t, FILE *f) {
135 for (size_t i = 0; i < n_rows; i++)
136 sorted[i] = i * t->n_columns;
137
138- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
139+ if (n_rows <= 1)
140+ return 0;
141+ assert(sorted);
142+ user_table = t;
143+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
144+ user_table = NULL;
145 }
146
147 if (t->display_map)
148@@ -2440,7 +2447,12 @@ int table_to_json(Table *t, JsonVariant **ret) {
149 for (size_t i = 0; i < n_rows; i++)
150 sorted[i] = i * t->n_columns;
151
152- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
153+ if (n_rows <= 1)
154+ return 0;
155+ assert(sorted);
156+ user_table = t;
157+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
158+ user_table = NULL;
159 }
160
161 if (t->display_map)
162--
1632.27.0
164
diff --git a/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0002-implment-systemd-sysv-install-for-OE.patch
index c6204786b3..d8bb572261 100644
--- a/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch
+++ b/meta/recipes-core/systemd/systemd/0002-implment-systemd-sysv-install-for-OE.patch
@@ -1,7 +1,7 @@
1From f9078501a1495c9991431d1435d081cd2e830328 Mon Sep 17 00:00:00 2001 1From fab8c573d06340868f070446118673b1c23584c5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 5 Sep 2015 06:31:47 +0000 3Date: Sat, 5 Sep 2015 06:31:47 +0000
4Subject: [PATCH] implment systemd-sysv-install for OE 4Subject: [PATCH 02/26] implment systemd-sysv-install for OE
5 5
6Use update-rc.d for enabling/disabling and status command 6Use update-rc.d for enabling/disabling and status command
7to check the status of the sysv service 7to check the status of the sysv service
@@ -9,16 +9,15 @@ to check the status of the sysv service
9Upstream-Status: Inappropriate [OE-Specific] 9Upstream-Status: Inappropriate [OE-Specific]
10 10
11Signed-off-by: Khem Raj <raj.khem@gmail.com> 11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13--- 12---
14 src/systemctl/systemd-sysv-install.SKELETON | 6 +++--- 13 src/systemctl/systemd-sysv-install.SKELETON | 6 +++---
15 1 file changed, 3 insertions(+), 3 deletions(-) 14 1 file changed, 3 insertions(+), 3 deletions(-)
16 15
17diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON 16diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON
18index 8c16cf99913f..9f078a121469 100755 17index cb58d8243b..000bdf6165 100755
19--- a/src/systemctl/systemd-sysv-install.SKELETON 18--- a/src/systemctl/systemd-sysv-install.SKELETON
20+++ b/src/systemctl/systemd-sysv-install.SKELETON 19+++ b/src/systemctl/systemd-sysv-install.SKELETON
21@@ -32,17 +32,17 @@ case "$1" in 20@@ -34,17 +34,17 @@ case "$1" in
22 enable) 21 enable)
23 # call the command to enable SysV init script $NAME here 22 # call the command to enable SysV init script $NAME here
24 # (consider optional $ROOT) 23 # (consider optional $ROOT)
@@ -39,3 +38,6 @@ index 8c16cf99913f..9f078a121469 100755
39 ;; 38 ;;
40 *) 39 *)
41 usage ;; 40 usage ;;
41--
422.34.1
43
diff --git a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
deleted file mode 100644
index f43a22aa8b..0000000000
--- a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
+++ /dev/null
@@ -1,78 +0,0 @@
1From 9f0d5996bbb2db3679a4075fa8301750b786c03b Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 13:55:12 +0800
4Subject: [PATCH 03/26] missing_type.h: add __compare_fn_t and comparison_fn_t
5
6Make it work with musl where comparison_fn_t and __compare_fn_t
7is not provided.
8
9Upstream-Status: Inappropriate [musl specific]
10
11Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
12[Rebased for v244]
13Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
14[Rebased for v242]
15Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
16---
17 src/basic/missing_type.h | 9 +++++++++
18 src/basic/sort-util.h | 1 +
19 src/core/kmod-setup.c | 1 +
20 src/journal/catalog.c | 1 +
21 4 files changed, 12 insertions(+)
22
23diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
24index f6233090a9..aeaf6ad5ec 100644
25--- a/src/basic/missing_type.h
26+++ b/src/basic/missing_type.h
27@@ -10,3 +10,12 @@
28 #if !HAVE_CHAR16_T
29 #define char16_t uint16_t
30 #endif
31+
32+#ifndef __GLIBC__
33+typedef int (*comparison_fn_t)(const void *, const void *);
34+#endif
35+
36+#ifndef __COMPAR_FN_T
37+#define __COMPAR_FN_T
38+typedef int (*__compar_fn_t)(const void *, const void *);
39+#endif
40diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
41index 3394c9eb72..d9cb2aecb6 100644
42--- a/src/basic/sort-util.h
43+++ b/src/basic/sort-util.h
44@@ -4,6 +4,7 @@
45 #include <stdlib.h>
46
47 #include "macro.h"
48+#include "missing_type.h"
49
50 void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
51 __compar_d_fn_t compar, void *arg);
52diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
53index 8a7f82812a..a56f12f47f 100644
54--- a/src/core/kmod-setup.c
55+++ b/src/core/kmod-setup.c
56@@ -10,6 +10,7 @@
57 #include "kmod-setup.h"
58 #include "macro.h"
59 #include "string-util.h"
60+#include "missing_type.h"
61
62 #if HAVE_KMOD
63 #include "module-util.h"
64diff --git a/src/journal/catalog.c b/src/journal/catalog.c
65index 0f6ad8a29e..4e1077ade4 100644
66--- a/src/journal/catalog.c
67+++ b/src/journal/catalog.c
68@@ -28,6 +28,7 @@
69 #include "string-util.h"
70 #include "strv.h"
71 #include "tmpfile-util.h"
72+#include "missing_type.h"
73
74 const char * const catalog_file_dirs[] = {
75 "/usr/local/lib/systemd/catalog/",
76--
772.27.0
78
diff --git a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-comparison_fn_t.patch b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-comparison_fn_t.patch
new file mode 100644
index 0000000000..f2094eb71d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-comparison_fn_t.patch
@@ -0,0 +1,61 @@
1From f99ef6c4407b56e8d15455fe27eb732ada87215b Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 13:55:12 +0800
4Subject: [PATCH 03/26] missing_type.h: add comparison_fn_t
5
6Make it work with musl where comparison_fn_t and is not provided.
7
8Upstream-Status: Inappropriate [musl specific]
9
10Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
11[Rebased for v244]
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13[Rebased for v242]
14Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
15[Rebased for v250, Drop __compare_fn_t]
16Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
17---
18 src/basic/missing_type.h | 4 ++++
19 src/basic/sort-util.h | 1 +
20 src/libsystemd/sd-journal/catalog.c | 1 +
21 3 files changed, 6 insertions(+)
22
23diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
24index 1d17705c35..fc33b76ec1 100644
25--- a/src/basic/missing_type.h
26+++ b/src/basic/missing_type.h
27@@ -10,3 +10,7 @@
28 #if !HAVE_CHAR16_T
29 # define char16_t uint16_t
30 #endif
31+
32+#ifndef __GLIBC__
33+typedef int (*comparison_fn_t)(const void *, const void *);
34+#endif
35diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
36index 9c818bd747..ef10c8be2c 100644
37--- a/src/basic/sort-util.h
38+++ b/src/basic/sort-util.h
39@@ -4,6 +4,7 @@
40 #include <stdlib.h>
41
42 #include "macro.h"
43+#include "missing_type.h"
44
45 /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
46 * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
47diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
48index 7dcc35d8d5..87b8d6aad6 100644
49--- a/src/libsystemd/sd-journal/catalog.c
50+++ b/src/libsystemd/sd-journal/catalog.c
51@@ -29,6 +29,7 @@
52 #include "string-util.h"
53 #include "strv.h"
54 #include "tmpfile-util.h"
55+#include "missing_type.h"
56
57 const char * const catalog_file_dirs[] = {
58 "/usr/local/lib/systemd/catalog/",
59--
602.34.1
61
diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
index bdd64a0252..47b8583e7a 100644
--- a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
+++ b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
@@ -1,6 +1,6 @@
1From f3dbe29f7620a063af4d8eb3ea7c48ecd410200d Mon Sep 17 00:00:00 2001 1From 34fe809cf686c1a81db5f3f027e33fece350ba0b Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Mon, 25 Feb 2019 14:04:21 +0800 3Date: Sat, 22 May 2021 20:26:24 +0200
4Subject: [PATCH 04/26] add fallback parse_printf_format implementation 4Subject: [PATCH 04/26] add fallback parse_printf_format implementation
5 5
6Upstream-Status: Inappropriate [musl specific] 6Upstream-Status: Inappropriate [musl specific]
@@ -11,44 +11,44 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
11[rebased for systemd 243] 11[rebased for systemd 243]
12Signed-off-by: Scott Murray <scott.murray@konsulko.com> 12Signed-off-by: Scott Murray <scott.murray@konsulko.com>
13--- 13---
14 meson.build | 1 + 14 meson.build | 1 +
15 src/basic/meson.build | 5 + 15 src/basic/meson.build | 5 +
16 src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++ 16 src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
17 src/basic/parse-printf-format.h | 57 +++++++ 17 src/basic/parse-printf-format.h | 57 +++++
18 src/basic/stdio-util.h | 2 +- 18 src/basic/stdio-util.h | 2 +-
19 src/journal/journal-send.c | 2 +- 19 src/libsystemd/sd-journal/journal-send.c | 2 +-
20 6 files changed, 338 insertions(+), 2 deletions(-) 20 6 files changed, 338 insertions(+), 2 deletions(-)
21 create mode 100644 src/basic/parse-printf-format.c 21 create mode 100644 src/basic/parse-printf-format.c
22 create mode 100644 src/basic/parse-printf-format.h 22 create mode 100644 src/basic/parse-printf-format.h
23 23
24diff --git a/meson.build b/meson.build 24diff --git a/meson.build b/meson.build
25index f406d595e6..6aa47fc755 100644 25index bffda86845..4146f4beef 100644
26--- a/meson.build 26--- a/meson.build
27+++ b/meson.build 27+++ b/meson.build
28@@ -646,6 +646,7 @@ endif 28@@ -770,6 +770,7 @@ foreach header : ['crypt.h',
29 foreach header : ['crypt.h', 29 'linux/ioprio.h',
30 'linux/memfd.h', 30 'linux/memfd.h',
31 'linux/vm_sockets.h', 31 'linux/time_types.h',
32+ 'printf.h', 32+ 'printf.h',
33 'sys/auxv.h', 33 'sys/auxv.h',
34 'valgrind/memcheck.h', 34 'sys/sdt.h',
35 'valgrind/valgrind.h', 35 'threads.h',
36diff --git a/src/basic/meson.build b/src/basic/meson.build 36diff --git a/src/basic/meson.build b/src/basic/meson.build
37index 1183ea83ad..aa5c958850 100644 37index e02f787c75..9435df895d 100644
38--- a/src/basic/meson.build 38--- a/src/basic/meson.build
39+++ b/src/basic/meson.build 39+++ b/src/basic/meson.build
40@@ -322,6 +322,11 @@ foreach item : [['af', af_list_txt, 'af', ''], 40@@ -188,6 +188,11 @@ endforeach
41 endforeach
42 41
43 basic_sources += generated_gperf_headers 42 basic_sources += generated_gperf_headers
44+ 43
45+if conf.get('HAVE_PRINTF_H') != 1 44+if conf.get('HAVE_PRINTF_H') != 1
46+ basic_sources += [files('parse-printf-format.c')] 45+ basic_sources += [files('parse-printf-format.c')]
47+endif 46+endif
48+ 47+
49 basic_gcrypt_sources = files( 48+
50 'gcrypt-util.c', 49 ############################################################
51 'gcrypt-util.h') 50
51 arch_list = [
52diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c 52diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
53new file mode 100644 53new file mode 100644
54index 0000000000..49437e5445 54index 0000000000..49437e5445
@@ -392,10 +392,10 @@ index 0000000000..47be7522d7
392+ 392+
393+#endif /* HAVE_PRINTF_H */ 393+#endif /* HAVE_PRINTF_H */
394diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h 394diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
395index 6dc1e72312..cea76b36cf 100644 395index 0a2239d022..43a765dacd 100644
396--- a/src/basic/stdio-util.h 396--- a/src/basic/stdio-util.h
397+++ b/src/basic/stdio-util.h 397+++ b/src/basic/stdio-util.h
398@@ -1,13 +1,13 @@ 398@@ -1,12 +1,12 @@
399 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 399 /* SPDX-License-Identifier: LGPL-2.1-or-later */
400 #pragma once 400 #pragma once
401 401
@@ -405,15 +405,14 @@ index 6dc1e72312..cea76b36cf 100644
405 #include <sys/types.h> 405 #include <sys/types.h>
406 406
407 #include "macro.h" 407 #include "macro.h"
408 #include "memory-util.h"
409+#include "parse-printf-format.h" 408+#include "parse-printf-format.h"
410 409
411 #define snprintf_ok(buf, len, fmt, ...) \ 410 _printf_(3, 4)
412 ((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len)) 411 static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
413diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c 412diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
414index fd3fd7ef9c..e8e6ad555b 100644 413index 7d02b57d7b..75e8e08add 100644
415--- a/src/journal/journal-send.c 414--- a/src/libsystemd/sd-journal/journal-send.c
416+++ b/src/journal/journal-send.c 415+++ b/src/libsystemd/sd-journal/journal-send.c
417@@ -2,7 +2,6 @@ 416@@ -2,7 +2,6 @@
418 417
419 #include <errno.h> 418 #include <errno.h>
@@ -422,7 +421,7 @@ index fd3fd7ef9c..e8e6ad555b 100644
422 #include <stddef.h> 421 #include <stddef.h>
423 #include <sys/un.h> 422 #include <sys/un.h>
424 #include <unistd.h> 423 #include <unistd.h>
425@@ -21,6 +20,7 @@ 424@@ -28,6 +27,7 @@
426 #include "stdio-util.h" 425 #include "stdio-util.h"
427 #include "string-util.h" 426 #include "string-util.h"
428 #include "tmpfile-util.h" 427 #include "tmpfile-util.h"
@@ -431,5 +430,5 @@ index fd3fd7ef9c..e8e6ad555b 100644
431 #define SNDBUF_SIZE (8*1024*1024) 430 #define SNDBUF_SIZE (8*1024*1024)
432 431
433-- 432--
4342.27.0 4332.34.1
435 434
diff --git a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/meta/recipes-core/systemd/systemd/0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
index 6865421586..1b5e0d54c4 100644
--- a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
+++ b/meta/recipes-core/systemd/systemd/0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
@@ -1,7 +1,7 @@
1From 87a14dde13c8fa68239a4ab62914a093062b3b29 Mon Sep 17 00:00:00 2001 1From d368a0317c747961f69a455a09a3de3fd13410a2 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 14:56:21 +0800 3Date: Mon, 25 Feb 2019 14:56:21 +0800
4Subject: [PATCH 07/26] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not 4Subject: [PATCH 05/26] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not
5 defined 5 defined
6 6
7If the standard library doesn't provide brace 7If the standard library doesn't provide brace
@@ -24,7 +24,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
24 3 files changed, 38 insertions(+) 24 3 files changed, 38 insertions(+)
25 25
26diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c 26diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
27index bc0278e57f..c973f82e54 100644 27index 802ca8c655..23818a67c6 100644
28--- a/src/basic/glob-util.c 28--- a/src/basic/glob-util.c
29+++ b/src/basic/glob-util.c 29+++ b/src/basic/glob-util.c
30@@ -12,6 +12,12 @@ 30@@ -12,6 +12,12 @@
@@ -64,12 +64,12 @@ index bc0278e57f..c973f82e54 100644
64 return -ENOENT; 64 return -ENOENT;
65 if (k == GLOB_NOSPACE) 65 if (k == GLOB_NOSPACE)
66diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c 66diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
67index df6444c433..79a692046e 100644 67index 49d71f15c7..0a49ebcc17 100644
68--- a/src/test/test-glob-util.c 68--- a/src/test/test-glob-util.c
69+++ b/src/test/test-glob-util.c 69+++ b/src/test/test-glob-util.c
70@@ -12,6 +12,12 @@ 70@@ -34,6 +34,12 @@ TEST(glob_first) {
71 #include "rm-rf.h" 71 ASSERT_NULL(first);
72 #include "tmpfile-util.h" 72 }
73 73
74+/* Don't fail if the standard library 74+/* Don't fail if the standard library
75+ * doesn't provide brace expansion */ 75+ * doesn't provide brace expansion */
@@ -77,10 +77,10 @@ index df6444c433..79a692046e 100644
77+#define GLOB_BRACE 0 77+#define GLOB_BRACE 0
78+#endif 78+#endif
79+ 79+
80 static void test_glob_exists(void) { 80 TEST(glob_exists) {
81 char name[] = "/tmp/test-glob_exists.XXXXXX"; 81 char name[] = "/tmp/test-glob_exists.XXXXXX";
82 int fd = -1; 82 int fd = -EBADF;
83@@ -39,11 +45,13 @@ static void test_glob_no_dot(void) { 83@@ -61,11 +67,13 @@ TEST(glob_no_dot) {
84 const char *fn; 84 const char *fn;
85 85
86 _cleanup_globfree_ glob_t g = { 86 _cleanup_globfree_ glob_t g = {
@@ -94,7 +94,7 @@ index df6444c433..79a692046e 100644
94 }; 94 };
95 95
96 int r; 96 int r;
97@@ -51,11 +59,19 @@ static void test_glob_no_dot(void) { 97@@ -73,11 +81,19 @@ TEST(glob_no_dot) {
98 assert_se(mkdtemp(template)); 98 assert_se(mkdtemp(template));
99 99
100 fn = strjoina(template, "/*"); 100 fn = strjoina(template, "/*");
@@ -115,12 +115,12 @@ index df6444c433..79a692046e 100644
115 115
116 (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); 116 (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
117diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c 117diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
118index 9906c70eef..5eb63b1d57 100644 118index 86bf16356d..da552dbaab 100644
119--- a/src/tmpfiles/tmpfiles.c 119--- a/src/tmpfiles/tmpfiles.c
120+++ b/src/tmpfiles/tmpfiles.c 120+++ b/src/tmpfiles/tmpfiles.c
121@@ -63,6 +63,12 @@ 121@@ -73,6 +73,12 @@
122 #include "umask-util.h"
123 #include "user-util.h" 122 #include "user-util.h"
123 #include "virt.h"
124 124
125+/* Don't fail if the standard library 125+/* Don't fail if the standard library
126+ * doesn't provide brace expansion */ 126+ * doesn't provide brace expansion */
@@ -131,26 +131,26 @@ index 9906c70eef..5eb63b1d57 100644
131 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates 131 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
132 * them in the file system. This is intended to be used to create 132 * them in the file system. This is intended to be used to create
133 * properly owned directories beneath /tmp, /var/tmp, /run, which are 133 * properly owned directories beneath /tmp, /var/tmp, /run, which are
134@@ -1936,7 +1942,9 @@ finish: 134@@ -2573,7 +2579,9 @@ finish:
135 135
136 static int glob_item(Item *i, action_t action) { 136 static int glob_item(Context *c, Item *i, action_t action) {
137 _cleanup_globfree_ glob_t g = { 137 _cleanup_globfree_ glob_t g = {
138+#ifdef GLOB_ALTDIRFUNC 138+#ifdef GLOB_ALTDIRFUNC
139 .gl_opendir = (void *(*)(const char *)) opendir_nomod, 139 .gl_opendir = (void *(*)(const char *)) opendir_nomod,
140+#endif 140+#endif
141 }; 141 };
142 int r = 0, k; 142 int r;
143 char **fn; 143
144@@ -1956,7 +1964,9 @@ static int glob_item(Item *i, action_t action) { 144@@ -2601,7 +2609,9 @@ static int glob_item_recursively(
145 fdaction_t action) {
145 146
146 static int glob_item_recursively(Item *i, fdaction_t action) {
147 _cleanup_globfree_ glob_t g = { 147 _cleanup_globfree_ glob_t g = {
148+#ifdef GLOB_ALTDIRFUNC 148+#ifdef GLOB_ALTDIRFUNC
149 .gl_opendir = (void *(*)(const char *)) opendir_nomod, 149 .gl_opendir = (void *(*)(const char *)) opendir_nomod,
150+#endif 150+#endif
151 }; 151 };
152 int r = 0, k; 152 int r;
153 char **fn; 153
154-- 154--
1552.27.0 1552.34.1
156 156
diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
deleted file mode 100644
index d63e3c0d09..0000000000
--- a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
+++ /dev/null
@@ -1,590 +0,0 @@
1From 5aeae0ea89f5af74ed5d95bed1d87a03b3801ff0 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 14:18:21 +0800
4Subject: [PATCH 05/26] src/basic/missing.h: check for missing strndupa
5
6include missing.h for definition of strndupa
7
8Upstream-Status: Inappropriate [musl specific]
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12[Rebased for v242]
13Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
14[rebased for systemd 243]
15Signed-off-by: Scott Murray <scott.murray@konsulko.com>
16Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
17[rebased for systemd 244]
18[Rebased for v247]
19Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
20---
21 meson.build | 1 +
22 src/backlight/backlight.c | 1 +
23 src/basic/cgroup-util.c | 1 +
24 src/basic/env-util.c | 1 +
25 src/basic/log.c | 1 +
26 src/basic/missing_stdlib.h | 12 ++++++++++++
27 src/basic/mkdir.c | 1 +
28 src/basic/parse-util.c | 1 +
29 src/basic/path-lookup.c | 1 +
30 src/basic/proc-cmdline.c | 1 +
31 src/basic/procfs-util.c | 1 +
32 src/basic/selinux-util.c | 1 +
33 src/basic/time-util.c | 1 +
34 src/boot/bless-boot.c | 1 +
35 src/core/dbus-cgroup.c | 1 +
36 src/core/dbus-execute.c | 1 +
37 src/core/dbus-util.c | 1 +
38 src/core/execute.c | 1 +
39 src/core/kmod-setup.c | 1 +
40 src/core/service.c | 1 +
41 src/coredump/coredump-vacuum.c | 1 +
42 src/journal-remote/journal-remote-main.c | 1 +
43 src/journal/journalctl.c | 1 +
44 src/journal/sd-journal.c | 1 +
45 src/libsystemd/sd-bus/bus-message.c | 1 +
46 src/libsystemd/sd-bus/bus-objects.c | 1 +
47 src/libsystemd/sd-bus/bus-socket.c | 1 +
48 src/libsystemd/sd-bus/sd-bus.c | 1 +
49 src/libsystemd/sd-bus/test-bus-benchmark.c | 1 +
50 src/locale/keymap-util.c | 1 +
51 src/login/pam_systemd.c | 1 +
52 src/network/generator/network-generator.c | 1 +
53 src/nspawn/nspawn-settings.c | 1 +
54 src/nss-mymachines/nss-mymachines.c | 1 +
55 src/portable/portable.c | 1 +
56 src/resolve/resolvectl.c | 1 +
57 src/shared/bus-get-properties.c | 1 +
58 src/shared/bus-unit-procs.c | 1 +
59 src/shared/bus-unit-util.c | 1 +
60 src/shared/bus-util.c | 1 +
61 src/shared/dns-domain.c | 1 +
62 src/shared/journal-importer.c | 1 +
63 src/shared/logs-show.c | 1 +
64 src/shared/pager.c | 1 +
65 src/shared/uid-range.c | 1 +
66 src/socket-proxy/socket-proxyd.c | 1 +
67 src/test/test-hexdecoct.c | 1 +
68 src/udev/udev-builtin-path_id.c | 1 +
69 src/udev/udev-event.c | 1 +
70 src/udev/udev-rules.c | 1 +
71 50 files changed, 61 insertions(+)
72
73--- a/meson.build
74+++ b/meson.build
75@@ -535,6 +535,7 @@ foreach ident : [
76 #include <sys/wait.h>'''],
77 ['mallinfo', '''#include <malloc.h>'''],
78 ['close_range', '''#include <unistd.h>'''],
79+ ['strndupa' , '''#include <string.h>'''],
80 ]
81
82 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
83--- a/src/backlight/backlight.c
84+++ b/src/backlight/backlight.c
85@@ -19,6 +19,7 @@
86 #include "string-util.h"
87 #include "strv.h"
88 #include "util.h"
89+#include "missing_stdlib.h"
90
91 static int help(void) {
92 _cleanup_free_ char *link = NULL;
93--- a/src/basic/cgroup-util.c
94+++ b/src/basic/cgroup-util.c
95@@ -38,6 +38,7 @@
96 #include "unit-name.h"
97 #include "user-util.h"
98 #include "xattr-util.h"
99+#include "missing_stdlib.h"
100
101 static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
102 _cleanup_free_ char *fs = NULL;
103--- a/src/basic/env-util.c
104+++ b/src/basic/env-util.c
105@@ -15,6 +15,7 @@
106 #include "string-util.h"
107 #include "strv.h"
108 #include "utf8.h"
109+#include "missing_stdlib.h"
110
111 /* We follow bash for the character set. Different shells have different rules. */
112 #define VALID_BASH_ENV_NAME_CHARS \
113--- a/src/basic/log.c
114+++ b/src/basic/log.c
115@@ -36,6 +36,7 @@
116 #include "terminal-util.h"
117 #include "time-util.h"
118 #include "utf8.h"
119+#include "missing_stdlib.h"
120
121 #define SNDBUF_SIZE (8*1024*1024)
122
123--- a/src/basic/missing_stdlib.h
124+++ b/src/basic/missing_stdlib.h
125@@ -11,3 +11,15 @@
126 # error "neither secure_getenv nor __secure_getenv are available"
127 # endif
128 #endif
129+
130+/* string.h */
131+#if ! HAVE_STRNDUPA
132+#define strndupa(s, n) \
133+ ({ \
134+ const char *__old = (s); \
135+ size_t __len = strnlen(__old, (n)); \
136+ char *__new = (char *)alloca(__len + 1); \
137+ __new[__len] = '\0'; \
138+ (char *)memcpy(__new, __old, __len); \
139+ })
140+#endif
141--- a/src/basic/mkdir.c
142+++ b/src/basic/mkdir.c
143@@ -14,6 +14,7 @@
144 #include "stat-util.h"
145 #include "stdio-util.h"
146 #include "user-util.h"
147+#include "missing_stdlib.h"
148
149 int mkdir_safe_internal(
150 const char *path,
151--- a/src/basic/parse-util.c
152+++ b/src/basic/parse-util.c
153@@ -22,6 +22,7 @@
154 #include "stat-util.h"
155 #include "string-util.h"
156 #include "strv.h"
157+#include "missing_stdlib.h"
158
159 int parse_boolean(const char *v) {
160 if (!v)
161--- a/src/basic/path-lookup.c
162+++ b/src/basic/path-lookup.c
163@@ -15,6 +15,7 @@
164 #include "strv.h"
165 #include "tmpfile-util.h"
166 #include "user-util.h"
167+#include "missing_stdlib.h"
168
169 int xdg_user_runtime_dir(char **ret, const char *suffix) {
170 const char *e;
171--- a/src/basic/proc-cmdline.c
172+++ b/src/basic/proc-cmdline.c
173@@ -15,6 +15,7 @@
174 #include "string-util.h"
175 #include "util.h"
176 #include "virt.h"
177+#include "missing_stdlib.h"
178
179 int proc_cmdline(char **ret) {
180 const char *e;
181--- a/src/basic/procfs-util.c
182+++ b/src/basic/procfs-util.c
183@@ -11,6 +11,7 @@
184 #include "procfs-util.h"
185 #include "stdio-util.h"
186 #include "string-util.h"
187+#include "missing_stdlib.h"
188
189 int procfs_tasks_get_limit(uint64_t *ret) {
190 _cleanup_free_ char *value = NULL;
191--- a/src/basic/selinux-util.c
192+++ b/src/basic/selinux-util.c
193@@ -27,6 +27,7 @@
194 #include "selinux-util.h"
195 #include "stdio-util.h"
196 #include "time-util.h"
197+#include "missing_stdlib.h"
198
199 #if HAVE_SELINUX
200 DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free);
201--- a/src/basic/time-util.c
202+++ b/src/basic/time-util.c
203@@ -27,6 +27,7 @@
204 #include "string-util.h"
205 #include "strv.h"
206 #include "time-util.h"
207+#include "missing_stdlib.h"
208
209 static clockid_t map_clock_id(clockid_t c) {
210
211--- a/src/boot/bless-boot.c
212+++ b/src/boot/bless-boot.c
213@@ -18,6 +18,7 @@
214 #include "util.h"
215 #include "verbs.h"
216 #include "virt.h"
217+#include "missing_stdlib.h"
218
219 static char **arg_path = NULL;
220
221--- a/src/core/dbus-cgroup.c
222+++ b/src/core/dbus-cgroup.c
223@@ -16,6 +16,7 @@
224 #include "fileio.h"
225 #include "limits-util.h"
226 #include "path-util.h"
227+#include "missing_stdlib.h"
228
229 BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
230
231--- a/src/core/dbus-execute.c
232+++ b/src/core/dbus-execute.c
233@@ -41,6 +41,7 @@
234 #include "unit-printf.h"
235 #include "user-util.h"
236 #include "utf8.h"
237+#include "missing_stdlib.h"
238
239 BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
240 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
241--- a/src/core/dbus-util.c
242+++ b/src/core/dbus-util.c
243@@ -7,6 +7,7 @@
244 #include "unit-printf.h"
245 #include "user-util.h"
246 #include "unit.h"
247+#include "missing_stdlib.h"
248
249 int bus_property_get_triggered_unit(
250 sd_bus *bus,
251--- a/src/core/execute.c
252+++ b/src/core/execute.c
253@@ -96,6 +96,7 @@
254 #include "unit.h"
255 #include "user-util.h"
256 #include "utmp-wtmp.h"
257+#include "missing_stdlib.h"
258
259 #define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
260 #define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC)
261--- a/src/core/kmod-setup.c
262+++ b/src/core/kmod-setup.c
263@@ -11,6 +11,7 @@
264 #include "macro.h"
265 #include "string-util.h"
266 #include "missing_type.h"
267+#include "missing_stdlib.h"
268
269 #if HAVE_KMOD
270 #include "module-util.h"
271--- a/src/core/service.c
272+++ b/src/core/service.c
273@@ -41,6 +41,7 @@
274 #include "unit.h"
275 #include "utf8.h"
276 #include "util.h"
277+#include "missing_stdlib.h"
278
279 static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
280 [SERVICE_DEAD] = UNIT_INACTIVE,
281--- a/src/coredump/coredump-vacuum.c
282+++ b/src/coredump/coredump-vacuum.c
283@@ -16,6 +16,7 @@
284 #include "string-util.h"
285 #include "time-util.h"
286 #include "user-util.h"
287+#include "missing_stdlib.h"
288
289 #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
290 #define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
291--- a/src/journal-remote/journal-remote-main.c
292+++ b/src/journal-remote/journal-remote-main.c
293@@ -22,6 +22,7 @@
294 #include "stat-util.h"
295 #include "string-table.h"
296 #include "strv.h"
297+#include "missing_stdlib.h"
298
299 #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
300 #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
301--- a/src/journal/journalctl.c
302+++ b/src/journal/journalctl.c
303@@ -73,6 +73,7 @@
304 #include "unit-name.h"
305 #include "user-util.h"
306 #include "varlink.h"
307+#include "missing_stdlib.h"
308
309 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
310 #define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
311--- a/src/journal/sd-journal.c
312+++ b/src/journal/sd-journal.c
313@@ -40,6 +40,7 @@
314 #include "string-util.h"
315 #include "strv.h"
316 #include "syslog-util.h"
317+#include "missing_stdlib.h"
318
319 #define JOURNAL_FILES_MAX 7168
320
321--- a/src/libsystemd/sd-bus/bus-message.c
322+++ b/src/libsystemd/sd-bus/bus-message.c
323@@ -21,6 +21,7 @@
324 #include "strv.h"
325 #include "time-util.h"
326 #include "utf8.h"
327+#include "missing_stdlib.h"
328
329 static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
330
331--- a/src/libsystemd/sd-bus/bus-objects.c
332+++ b/src/libsystemd/sd-bus/bus-objects.c
333@@ -13,6 +13,7 @@
334 #include "set.h"
335 #include "string-util.h"
336 #include "strv.h"
337+#include "missing_stdlib.h"
338
339 static int node_vtable_get_userdata(
340 sd_bus *bus,
341--- a/src/libsystemd/sd-bus/bus-socket.c
342+++ b/src/libsystemd/sd-bus/bus-socket.c
343@@ -28,6 +28,7 @@
344 #include "string-util.h"
345 #include "user-util.h"
346 #include "utf8.h"
347+#include "missing_stdlib.h"
348
349 #define SNDBUF_SIZE (8*1024*1024)
350
351--- a/src/libsystemd/sd-bus/sd-bus.c
352+++ b/src/libsystemd/sd-bus/sd-bus.c
353@@ -41,6 +41,7 @@
354 #include "process-util.h"
355 #include "string-util.h"
356 #include "strv.h"
357+#include "missing_stdlib.h"
358
359 #define log_debug_bus_message(m) \
360 do { \
361--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
362+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
363@@ -14,6 +14,7 @@
364 #include "missing_resource.h"
365 #include "time-util.h"
366 #include "util.h"
367+#include "missing_stdlib.h"
368
369 #define MAX_SIZE (2*1024*1024)
370
371--- a/src/locale/keymap-util.c
372+++ b/src/locale/keymap-util.c
373@@ -21,6 +21,7 @@
374 #include "string-util.h"
375 #include "strv.h"
376 #include "tmpfile-util.h"
377+#include "missing_stdlib.h"
378
379 static bool startswith_comma(const char *s, const char *prefix) {
380 s = startswith(s, prefix);
381--- a/src/login/pam_systemd.c
382+++ b/src/login/pam_systemd.c
383@@ -31,6 +31,7 @@
384 #include "locale-util.h"
385 #include "login-util.h"
386 #include "macro.h"
387+#include "missing_stdlib.h"
388 #include "pam-util.h"
389 #include "parse-util.h"
390 #include "path-util.h"
391--- a/src/network/generator/network-generator.c
392+++ b/src/network/generator/network-generator.c
393@@ -13,6 +13,7 @@
394 #include "string-table.h"
395 #include "string-util.h"
396 #include "strv.h"
397+#include "missing_stdlib.h"
398
399 /*
400 # .network
401--- a/src/nspawn/nspawn-settings.c
402+++ b/src/nspawn/nspawn-settings.c
403@@ -16,6 +16,7 @@
404 #include "strv.h"
405 #include "user-util.h"
406 #include "util.h"
407+#include "missing_stdlib.h"
408
409 Settings *settings_new(void) {
410 Settings *s;
411--- a/src/nss-mymachines/nss-mymachines.c
412+++ b/src/nss-mymachines/nss-mymachines.c
413@@ -19,6 +19,7 @@
414 #include "nss-util.h"
415 #include "signal-util.h"
416 #include "string-util.h"
417+#include "missing_stdlib.h"
418
419 NSS_GETHOSTBYNAME_PROTOTYPES(mymachines);
420 NSS_GETPW_PROTOTYPES(mymachines);
421--- a/src/portable/portable.c
422+++ b/src/portable/portable.c
423@@ -31,6 +31,7 @@
424 #include "strv.h"
425 #include "tmpfile-util.h"
426 #include "user-util.h"
427+#include "missing_stdlib.h"
428
429 static const char profile_dirs[] = CONF_PATHS_NULSTR("systemd/portable/profile");
430
431--- a/src/resolve/resolvectl.c
432+++ b/src/resolve/resolvectl.c
433@@ -37,6 +37,7 @@
434 #include "terminal-util.h"
435 #include "utf8.h"
436 #include "verbs.h"
437+#include "missing_stdlib.h"
438
439 static int arg_family = AF_UNSPEC;
440 static int arg_ifindex = 0;
441--- a/src/shared/bus-get-properties.c
442+++ b/src/shared/bus-get-properties.c
443@@ -4,6 +4,7 @@
444 #include "rlimit-util.h"
445 #include "stdio-util.h"
446 #include "string-util.h"
447+#include "missing_stdlib.h"
448
449 int bus_property_get_bool(
450 sd_bus *bus,
451--- a/src/shared/bus-unit-procs.c
452+++ b/src/shared/bus-unit-procs.c
453@@ -10,6 +10,7 @@
454 #include "sort-util.h"
455 #include "string-util.h"
456 #include "terminal-util.h"
457+#include "missing_stdlib.h"
458
459 struct CGroupInfo {
460 char *cgroup_path;
461--- a/src/shared/bus-unit-util.c
462+++ b/src/shared/bus-unit-util.c
463@@ -44,6 +44,7 @@
464 #include "unit-def.h"
465 #include "user-util.h"
466 #include "utf8.h"
467+#include "missing_stdlib.h"
468
469 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
470 assert(message);
471--- a/src/shared/bus-util.c
472+++ b/src/shared/bus-util.c
473@@ -21,6 +21,7 @@
474 #include "path-util.h"
475 #include "socket-util.h"
476 #include "stdio-util.h"
477+#include "missing_stdlib.h"
478
479 static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
480 sd_event *e = userdata;
481--- a/src/shared/dns-domain.c
482+++ b/src/shared/dns-domain.c
483@@ -17,6 +17,7 @@
484 #include "string-util.h"
485 #include "strv.h"
486 #include "utf8.h"
487+#include "missing_stdlib.h"
488
489 int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
490 const char *n;
491--- a/src/shared/journal-importer.c
492+++ b/src/shared/journal-importer.c
493@@ -14,6 +14,7 @@
494 #include "parse-util.h"
495 #include "string-util.h"
496 #include "unaligned.h"
497+#include "missing_stdlib.h"
498
499 enum {
500 IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
501--- a/src/shared/logs-show.c
502+++ b/src/shared/logs-show.c
503@@ -41,6 +41,7 @@
504 #include "utf8.h"
505 #include "util.h"
506 #include "web-util.h"
507+#include "missing_stdlib.h"
508
509 /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
510 #define PRINT_LINE_THRESHOLD 3
511--- a/src/shared/pager.c
512+++ b/src/shared/pager.c
513@@ -26,6 +26,7 @@
514 #include "strv.h"
515 #include "terminal-util.h"
516 #include "util.h"
517+#include "missing_stdlib.h"
518
519 static pid_t pager_pid = 0;
520
521--- a/src/shared/uid-range.c
522+++ b/src/shared/uid-range.c
523@@ -9,6 +9,7 @@
524 #include "sort-util.h"
525 #include "uid-range.h"
526 #include "user-util.h"
527+#include "missing_stdlib.h"
528
529 static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
530 assert(range);
531--- a/src/socket-proxy/socket-proxyd.c
532+++ b/src/socket-proxy/socket-proxyd.c
533@@ -26,6 +26,7 @@
534 #include "socket-util.h"
535 #include "string-util.h"
536 #include "util.h"
537+#include "missing_stdlib.h"
538
539 #define BUFFER_SIZE (256 * 1024)
540
541--- a/src/test/test-hexdecoct.c
542+++ b/src/test/test-hexdecoct.c
543@@ -6,6 +6,7 @@
544 #include "hexdecoct.h"
545 #include "macro.h"
546 #include "string-util.h"
547+#include "missing_stdlib.h"
548
549 static void test_hexchar(void) {
550 assert_se(hexchar(0xa) == 'a');
551--- a/src/udev/udev-builtin-path_id.c
552+++ b/src/udev/udev-builtin-path_id.c
553@@ -22,6 +22,7 @@
554 #include "strv.h"
555 #include "sysexits.h"
556 #include "udev-builtin.h"
557+#include "missing_stdlib.h"
558
559 _printf_(2,3)
560 static void path_prepend(char **path, const char *fmt, ...) {
561--- a/src/udev/udev-event.c
562+++ b/src/udev/udev-event.c
563@@ -34,6 +34,7 @@
564 #include "udev-util.h"
565 #include "udev-watch.h"
566 #include "user-util.h"
567+#include "missing_stdlib.h"
568
569 typedef struct Spawn {
570 sd_device *device;
571--- a/src/udev/udev-rules.c
572+++ b/src/udev/udev-rules.c
573@@ -30,6 +30,7 @@
574 #include "udev-rules.h"
575 #include "user-util.h"
576 #include "virt.h"
577+#include "missing_stdlib.h"
578
579 #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d")
580
581--- a/src/basic/mountpoint-util.c
582+++ b/src/basic/mountpoint-util.c
583@@ -10,6 +10,7 @@
584 #include "fs-util.h"
585 #include "missing_stat.h"
586 #include "missing_syscall.h"
587+#include "missing_stdlib.h"
588 #include "mountpoint-util.h"
589 #include "parse-util.h"
590 #include "path-util.h"
diff --git a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch
deleted file mode 100644
index b689cf1297..0000000000
--- a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch
+++ /dev/null
@@ -1,326 +0,0 @@
1From d3ed0da271738fd0fc3d3e4d82d6f5810334b05e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 26 Oct 2017 22:10:42 -0700
4Subject: [PATCH 06/26] Include netinet/if_ether.h
5
6Fixes
7/path/to/systemd/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr'
8 struct ethhdr {
9 ^~~~~~
10
11and related arphdr, arpreq, and arpreq_old errors
12/path/to/systemd/recipe-sysroot/usr/include/net/if_arp.h:22:8: error: redefinition of 'struct arphdr'
13 struct arphdr {
14 ^~~~~~
15
16The latter requires removing some includes of net/if_arp.h to avoid
17conflicting with netinet/if_ether.h.
18
19Upstream-Status: Inappropriate [musl specific]
20
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
23[rebased for systemd 243]
24Signed-off-by: Scott Murray <scott.murray@konsulko.com>
25
26Upstream-Status: Inappropriate [musl specific]
27
28Signed-off-by: Khem Raj <raj.khem@gmail.com>
29Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
30[rebased for systemd 243]
31Signed-off-by: Scott Murray <scott.murray@konsulko.com>
32[rebased for systemd 247]
33Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
34---
35 src/libsystemd-network/sd-dhcp6-client.c | 1 -
36 src/libsystemd/sd-netlink/netlink-types.c | 1 +
37 src/machine/machine-dbus.c | 1 +
38 src/network/netdev/bond.c | 1 +
39 src/network/netdev/bridge.c | 1 +
40 src/network/netdev/macsec.c | 1 +
41 src/network/netdev/netdev-gperf.gperf | 1 +
42 src/network/netdev/netdev.c | 1 +
43 src/network/networkd-brvlan.c | 1 +
44 src/network/networkd-dhcp-common.c | 1 +
45 src/network/networkd-dhcp4.c | 2 +-
46 src/network/networkd-dhcp6.c | 2 +-
47 src/network/networkd-link.c | 2 +-
48 src/network/networkd-network.c | 1 +
49 src/network/test-network-tables.c | 1 +
50 src/shared/ethtool-util.c | 1 +
51 src/shared/ethtool-util.h | 1 +
52 src/udev/net/link-config.c | 1 +
53 src/udev/udev-builtin-net_setup_link.c | 1 +
54 19 files changed, 18 insertions(+), 4 deletions(-)
55
56diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
57index 30ac526fc9..126077e13c 100644
58--- a/src/libsystemd-network/sd-dhcp6-client.c
59+++ b/src/libsystemd-network/sd-dhcp6-client.c
60@@ -5,7 +5,6 @@
61
62 #include <errno.h>
63 #include <sys/ioctl.h>
64-#include <linux/if_arp.h>
65 #include <linux/if_infiniband.h>
66
67 #include "sd-dhcp6-client.h"
68diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
69index 6fb6c147d9..8eda02d202 100644
70--- a/src/libsystemd/sd-netlink/netlink-types.c
71+++ b/src/libsystemd/sd-netlink/netlink-types.c
72@@ -3,6 +3,7 @@
73 #include <netinet/in.h>
74 #include <stdint.h>
75 #include <sys/socket.h>
76+#include <netinet/if_ether.h>
77 #include <linux/can/vxcan.h>
78 #include <linux/netlink.h>
79 #include <linux/rtnetlink.h>
80diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
81index bb67beb665..f5780f1aec 100644
82--- a/src/machine/machine-dbus.c
83+++ b/src/machine/machine-dbus.c
84@@ -3,6 +3,7 @@
85 #include <errno.h>
86 #include <sys/mount.h>
87 #include <sys/wait.h>
88+#include <netinet/if_ether.h>
89
90 /* When we include libgen.h because we need dirname() we immediately
91 * undefine basename() since libgen.h defines it as a macro to the POSIX
92diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
93index e27f36067b..8868f1da5d 100644
94--- a/src/network/netdev/bond.c
95+++ b/src/network/netdev/bond.c
96@@ -1,5 +1,6 @@
97 /* SPDX-License-Identifier: LGPL-2.1-or-later */
98
99+#include <netinet/if_ether.h>
100 #include "alloc-util.h"
101 #include "bond.h"
102 #include "bond-util.h"
103diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
104index 1f59cd8b42..5fdbae7e99 100644
105--- a/src/network/netdev/bridge.c
106+++ b/src/network/netdev/bridge.c
107@@ -1,5 +1,6 @@
108 /* SPDX-License-Identifier: LGPL-2.1-or-later */
109
110+#include <netinet/if_ether.h>
111 #include <net/if.h>
112
113 #include "bridge.h"
114diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
115index 82e71c3920..fbae86e216 100644
116--- a/src/network/netdev/macsec.c
117+++ b/src/network/netdev/macsec.c
118@@ -1,5 +1,6 @@
119 /* SPDX-License-Identifier: LGPL-2.1-or-later */
120
121+#include <netinet/if_ether.h>
122 #include <netinet/in.h>
123 #include <linux/if_ether.h>
124 #include <linux/if_macsec.h>
125diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf
126index 4e89761f2c..91251fa6ec 100644
127--- a/src/network/netdev/netdev-gperf.gperf
128+++ b/src/network/netdev/netdev-gperf.gperf
129@@ -2,6 +2,7 @@
130 #if __GNUC__ >= 7
131 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
132 #endif
133+#include <netinet/if_ether.h>
134 #include <stddef.h>
135 #include "bareudp.h"
136 #include "bond.h"
137diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
138index 9f390b5781..62aeafb1e4 100644
139--- a/src/network/netdev/netdev.c
140+++ b/src/network/netdev/netdev.c
141@@ -1,5 +1,6 @@
142 /* SPDX-License-Identifier: LGPL-2.1-or-later */
143
144+#include <netinet/if_ether.h>
145 #include <net/if.h>
146 #include <netinet/in.h>
147 #include <unistd.h>
148diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c
149index e53c73c30c..9bf0771b84 100644
150--- a/src/network/networkd-brvlan.c
151+++ b/src/network/networkd-brvlan.c
152@@ -4,6 +4,7 @@
153 ***/
154
155 #include <netinet/in.h>
156+#include <netinet/if_ether.h>
157 #include <linux/if_bridge.h>
158 #include <stdbool.h>
159
160diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
161index c338c775a7..ab35d65c53 100644
162--- a/src/network/networkd-dhcp-common.c
163+++ b/src/network/networkd-dhcp-common.c
164@@ -1,7 +1,8 @@
165 /* SPDX-License-Identifier: LGPL-2.1-or-later */
166
167 #include <netinet/in.h>
168-#include <linux/if_arp.h>
169+#include <net/if_arp.h>
170+#include <net/if.h>
171
172 #include "dhcp-internal.h"
173 #include "dhcp6-internal.h"
174@@ -10,6 +10,7 @@
175 #include "networkd-dhcp-common.h"
176 #include "networkd-link.h"
177 #include "networkd-manager.h"
178+#include <netinet/if_ether.h>
179 #include "networkd-network.h"
180 #include "parse-util.h"
181 #include "socket-util.h"
182diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
183index cf279c640d..bae541029b 100644
184--- a/src/network/networkd-dhcp-server.c
185+++ b/src/network/networkd-dhcp-server.c
186@@ -1,8 +1,8 @@
187 /* SPDX-License-Identifier: LGPL-2.1-or-later */
188
189 #include <netinet/in.h>
190-#include <linux/if_arp.h>
191-#include <linux/if.h>
192+#include <net/if_arp.h>
193+#include <net/if.h>
194
195 #include "sd-dhcp-server.h"
196
197diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
198index 02d33841b6..a30d8dd82c 100644
199--- a/src/network/networkd-dhcp4.c
200+++ b/src/network/networkd-dhcp4.c
201@@ -1,9 +1,9 @@
202 /* SPDX-License-Identifier: LGPL-2.1-or-later */
203
204+#include <netinet/if_ether.h>
205 #include <netinet/in.h>
206 #include <netinet/ip.h>
207 #include <linux/if.h>
208-#include <linux/if_arp.h>
209
210 #include "escape.h"
211 #include "alloc-util.h"
212diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
213index d4d4182ee5..635d08f7d5 100644
214--- a/src/network/networkd-dhcp6.c
215+++ b/src/network/networkd-dhcp6.c
216@@ -3,9 +3,9 @@
217 Copyright © 2014 Intel Corporation. All rights reserved.
218 ***/
219
220+#include <netinet/if_ether.h>
221 #include <netinet/in.h>
222 #include <linux/if.h>
223-#include <linux/if_arp.h>
224
225 #include "sd-dhcp6-client.h"
226
227diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
228index ced18de425..07b43770de 100644
229--- a/src/network/networkd-link.c
230+++ b/src/network/networkd-link.c
231@@ -1,8 +1,8 @@
232 /* SPDX-License-Identifier: LGPL-2.1-or-later */
233
234+#include <netinet/if_ether.h>
235 #include <netinet/in.h>
236 #include <linux/if.h>
237-#include <linux/if_arp.h>
238 #include <linux/if_link.h>
239 #include <unistd.h>
240
241diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
242index 3254641461..f0ada419fd 100644
243--- a/src/network/networkd-network.c
244+++ b/src/network/networkd-network.c
245@@ -1,5 +1,6 @@
246 /* SPDX-License-Identifier: LGPL-2.1-or-later */
247
248+#include <netinet/if_ether.h>
249 #include <net/if.h>
250 #include <netinet/in.h>
251 #include <linux/netdevice.h>
252diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
253index 10f30c1a7e..579885726c 100644
254--- a/src/network/networkd-route.c
255+++ b/src/network/networkd-route.c
256@@ -1,7 +1,10 @@
257 /* SPDX-License-Identifier: LGPL-2.1-or-later */
258
259 #include <linux/icmpv6.h>
260-#include <linux/ipv6_route.h>
261+/* linux/ipv6_route.h conflicts with netinet/in.h so define manually */
262+#ifndef IP6_RT_PRIO_USER
263+#define IP6_RT_PRIO_USER 1024
264+#endif
265
266 #include "alloc-util.h"
267 #include "netlink-util.h"
268diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
269index 475cac7527..9bae6eda16 100644
270--- a/src/network/test-network-tables.c
271+++ b/src/network/test-network-tables.c
272@@ -1,5 +1,6 @@
273 /* SPDX-License-Identifier: LGPL-2.1-or-later */
274
275+#include <netinet/if_ether.h>
276 #include "bond.h"
277 #include "dhcp6-internal.h"
278 #include "dhcp6-protocol.h"
279diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c
280index e6fab262f2..41dd3d7df7 100644
281--- a/src/shared/ethtool-util.c
282+++ b/src/shared/ethtool-util.c
283@@ -1,5 +1,6 @@
284 /* SPDX-License-Identifier: LGPL-2.1-or-later */
285
286+#include <netinet/if_ether.h>
287 #include <net/if.h>
288 #include <sys/ioctl.h>
289 #include <linux/ethtool.h>
290diff --git a/src/shared/ethtool-util.h b/src/shared/ethtool-util.h
291index f94b3e15bf..08a7e4fa09 100644
292--- a/src/shared/ethtool-util.h
293+++ b/src/shared/ethtool-util.h
294@@ -3,6 +3,7 @@
295
296 #include <macro.h>
297 #include <net/ethernet.h>
298+#include <netinet/if_ether.h>
299 #include <linux/ethtool.h>
300
301 #include "conf-parser.h"
302diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
303index d12fd0e299..636806dc23 100644
304--- a/src/udev/net/link-config.c
305+++ b/src/udev/net/link-config.c
306@@ -1,5 +1,6 @@
307 /* SPDX-License-Identifier: LGPL-2.1-or-later */
308
309+#include <netinet/if_ether.h>
310 #include <linux/netdevice.h>
311 #include <netinet/ether.h>
312 #include <unistd.h>
313diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c
314index cb12b943fe..5a28c8b563 100644
315--- a/src/udev/udev-builtin-net_setup_link.c
316+++ b/src/udev/udev-builtin-net_setup_link.c
317@@ -1,5 +1,6 @@
318 /* SPDX-License-Identifier: LGPL-2.1-or-later */
319
320+#include <netinet/if_ether.h>
321 #include "device-util.h"
322 #include "alloc-util.h"
323 #include "link-config.h"
324--
3252.27.0
326
diff --git a/meta/recipes-core/systemd/systemd/0006-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0006-add-missing-FTW_-macros-for-musl.patch
new file mode 100644
index 0000000000..578411c4cf
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0006-add-missing-FTW_-macros-for-musl.patch
@@ -0,0 +1,44 @@
1From 54b6e10aea2b0fb52782c3a71f06654a89b46bff Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:00:06 +0800
4Subject: [PATCH 06/26] add missing FTW_ macros for musl
5
6This is to avoid build failures like below for musl.
7
8 locale-util.c:296:24: error: 'FTW_STOP' undeclared
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13---
14 src/basic/missing_type.h | 4 ++++
15 src/test/test-recurse-dir.c | 1 +
16 2 files changed, 5 insertions(+)
17
18diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
19index fc33b76ec1..34a36d83f0 100644
20--- a/src/basic/missing_type.h
21+++ b/src/basic/missing_type.h
22@@ -14,3 +14,7 @@
23 #ifndef __GLIBC__
24 typedef int (*comparison_fn_t)(const void *, const void *);
25 #endif
26+
27+#ifndef FTW_CONTINUE
28+#define FTW_CONTINUE 0
29+#endif
30diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
31index 8684d064ec..70fc2b5376 100644
32--- a/src/test/test-recurse-dir.c
33+++ b/src/test/test-recurse-dir.c
34@@ -8,6 +8,7 @@
35 #include "recurse-dir.h"
36 #include "strv.h"
37 #include "tests.h"
38+#include "missing_type.h"
39
40 static char **list_nftw = NULL;
41
42--
432.34.1
44
diff --git a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0007-Use-uintmax_t-for-handling-rlim_t.patch
index aeacd865ae..b4a570e1f5 100644
--- a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
+++ b/meta/recipes-core/systemd/systemd/0007-Use-uintmax_t-for-handling-rlim_t.patch
@@ -1,7 +1,7 @@
1From e45bb02174812e4935214f42a18725be320770d5 Mon Sep 17 00:00:00 2001 1From 85d8c4c27e855d54c1740902a836c8f2aea9bebc Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:12:41 +0800 3Date: Mon, 25 Feb 2019 15:12:41 +0800
4Subject: [PATCH 10/26] Use uintmax_t for handling rlim_t 4Subject: [PATCH 07/26] Use uintmax_t for handling rlim_t
5 5
6PRIu{32,64} is not right format to represent rlim_t type 6PRIu{32,64} is not right format to represent rlim_t type
7therefore use %ju and typecast the rlim_t variables to 7therefore use %ju and typecast the rlim_t variables to
@@ -22,16 +22,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
22Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 22Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
23--- 23---
24 src/basic/format-util.h | 8 +------- 24 src/basic/format-util.h | 8 +-------
25 src/basic/rlimit-util.c | 10 +++++----- 25 src/basic/rlimit-util.c | 12 ++++++------
26 src/core/execute.c | 4 ++-- 26 src/core/execute.c | 4 ++--
27 3 files changed, 8 insertions(+), 14 deletions(-) 27 3 files changed, 9 insertions(+), 15 deletions(-)
28 28
29diff --git a/src/basic/format-util.h b/src/basic/format-util.h 29diff --git a/src/basic/format-util.h b/src/basic/format-util.h
30index b7e18768e3..3195ab205d 100644 30index b528c005ca..41c4c095be 100644
31--- a/src/basic/format-util.h 31--- a/src/basic/format-util.h
32+++ b/src/basic/format-util.h 32+++ b/src/basic/format-util.h
33@@ -32,13 +32,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t)); 33@@ -41,13 +41,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
34 # define PRI_TIMEX "li" 34 # error Unknown timex member size
35 #endif 35 #endif
36 36
37-#if SIZEOF_RLIM_T == 8 37-#if SIZEOF_RLIM_T == 8
@@ -46,30 +46,39 @@ index b7e18768e3..3195ab205d 100644
46 #if SIZEOF_DEV_T == 8 46 #if SIZEOF_DEV_T == 8
47 # define DEV_FMT "%" PRIu64 47 # define DEV_FMT "%" PRIu64
48diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c 48diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
49index 880976312c..9e1b61cd4a 100644 49index a9f7b87f28..059c67731d 100644
50--- a/src/basic/rlimit-util.c 50--- a/src/basic/rlimit-util.c
51+++ b/src/basic/rlimit-util.c 51+++ b/src/basic/rlimit-util.c
52@@ -306,13 +306,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { 52@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
53 fixed.rlim_max == highest.rlim_max)
54 return 0;
55
56- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
57+ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
58
59 return RET_NERRNO(setrlimit(resource, &fixed));
60 }
61@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
53 if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) 62 if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
54 s = strdup("infinity"); 63 r = free_and_strdup(&s, "infinity");
55 else if (rl->rlim_cur >= RLIM_INFINITY) 64 else if (rl->rlim_cur >= RLIM_INFINITY)
56- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); 65- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
57+ (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); 66+ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
58 else if (rl->rlim_max >= RLIM_INFINITY) 67 else if (rl->rlim_max >= RLIM_INFINITY)
59- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); 68- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
60+ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); 69+ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
61 else if (rl->rlim_cur == rl->rlim_max) 70 else if (rl->rlim_cur == rl->rlim_max)
62- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur); 71- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
63+ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); 72+ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
64 else 73 else
65- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); 74- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
66+ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); 75+ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
67 76 if (r < 0)
68 if (!s)
69 return -ENOMEM; 77 return -ENOMEM;
70@@ -403,7 +403,7 @@ int rlimit_nofile_safe(void) {
71 78
72 rl.rlim_cur = FD_SETSIZE; 79@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) {
80 rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
81 rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
73 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) 82 if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
74- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur); 83- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
75+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur); 84+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
@@ -77,10 +86,10 @@ index 880976312c..9e1b61cd4a 100644
77 return 1; 86 return 1;
78 } 87 }
79diff --git a/src/core/execute.c b/src/core/execute.c 88diff --git a/src/core/execute.c b/src/core/execute.c
80index 89632e0582..335283776c 100644 89index 3d55b0b772..4824ff159e 100644
81--- a/src/core/execute.c 90--- a/src/core/execute.c
82+++ b/src/core/execute.c 91+++ b/src/core/execute.c
83@@ -5288,9 +5288,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { 92@@ -1162,9 +1162,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
84 for (unsigned i = 0; i < RLIM_NLIMITS; i++) 93 for (unsigned i = 0; i < RLIM_NLIMITS; i++)
85 if (c->rlimit[i]) { 94 if (c->rlimit[i]) {
86 fprintf(f, "%sLimit%s: " RLIM_FMT "\n", 95 fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
@@ -93,5 +102,5 @@ index 89632e0582..335283776c 100644
93 102
94 if (c->ioprio_set) { 103 if (c->ioprio_set) {
95-- 104--
962.27.0 1052.34.1
97 106
diff --git a/meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch
new file mode 100644
index 0000000000..22e2ceadcc
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch
@@ -0,0 +1,34 @@
1From f4cd939c7cc1ce0a59bab2693768f2c95d9ced00 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 May 2018 08:36:44 -0700
4Subject: [PATCH 08/26] Define glibc compatible basename() for non-glibc
5 systems
6
7Fixes builds with musl, even though systemd is adamant about
8using non-posix basename implementation, we have a way out
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/basic/string-util.h | 4 ++++
15 1 file changed, 4 insertions(+)
16
17diff --git a/src/basic/string-util.h b/src/basic/string-util.h
18index cc6aa183c0..0b035125cd 100644
19--- a/src/basic/string-util.h
20+++ b/src/basic/string-util.h
21@@ -27,6 +27,10 @@
22 #define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */
23 #define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */
24
25+#if !defined(__GLIBC__)
26+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
27+#endif
28+
29 static inline char* strstr_ptr(const char *haystack, const char *needle) {
30 if (!haystack || !needle)
31 return NULL;
32--
332.34.1
34
diff --git a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch
deleted file mode 100644
index 94cdc2efde..0000000000
--- a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1From 8caea3fe87d55fd16de7d1b8266239fa954cb498 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:00:06 +0800
4Subject: [PATCH 08/26] add missing FTW_ macros for musl
5
6This is to avoid build failures like below for musl.
7
8 locale-util.c:296:24: error: 'FTW_STOP' undeclared
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13---
14 src/basic/missing_type.h | 20 ++++++++++++++++++++
15 1 file changed, 20 insertions(+)
16
17diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
18index aeaf6ad5ec..3df1084ef2 100644
19--- a/src/basic/missing_type.h
20+++ b/src/basic/missing_type.h
21@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const void *, const void *);
22 #define __COMPAR_FN_T
23 typedef int (*__compar_fn_t)(const void *, const void *);
24 #endif
25+
26+#ifndef FTW_ACTIONRETVAL
27+#define FTW_ACTIONRETVAL 16
28+#endif
29+
30+#ifndef FTW_CONTINUE
31+#define FTW_CONTINUE 0
32+#endif
33+
34+#ifndef FTW_STOP
35+#define FTW_STOP 1
36+#endif
37+
38+#ifndef FTW_SKIP_SUBTREE
39+#define FTW_SKIP_SUBTREE 2
40+#endif
41+
42+#ifndef FTW_SKIP_SIBLINGS
43+#define FTW_SKIP_SIBLINGS 3
44+#endif
45--
462.27.0
47
diff --git a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
index e95d2ae078..8e3eb15b54 100644
--- a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
+++ b/meta/recipes-core/systemd/systemd/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
@@ -1,7 +1,7 @@
1From 55af446156da863b5b36a1109845858956a4c274 Mon Sep 17 00:00:00 2001 1From 6959db351fdd551d46e22667deec6032552b2662 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 4 Jul 2018 15:00:44 +0800 3Date: Wed, 4 Jul 2018 15:00:44 +0800
4Subject: [PATCH 14/26] Do not disable buffering when writing to oom_score_adj 4Subject: [PATCH 09/26] Do not disable buffering when writing to oom_score_adj
5 5
6On musl, disabling buffering when writing to oom_score_adj will 6On musl, disabling buffering when writing to oom_score_adj will
7cause the following error. 7cause the following error.
@@ -24,18 +24,18 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
24 1 file changed, 1 insertion(+), 1 deletion(-) 24 1 file changed, 1 insertion(+), 1 deletion(-)
25 25
26diff --git a/src/basic/process-util.c b/src/basic/process-util.c 26diff --git a/src/basic/process-util.c b/src/basic/process-util.c
27index 4417101569..556dab8ebf 100644 27index 3253a9c3fb..772c4082a1 100644
28--- a/src/basic/process-util.c 28--- a/src/basic/process-util.c
29+++ b/src/basic/process-util.c 29+++ b/src/basic/process-util.c
30@@ -1536,7 +1536,7 @@ int set_oom_score_adjust(int value) { 30@@ -1848,7 +1848,7 @@ int set_oom_score_adjust(int value) {
31 sprintf(t, "%i", value); 31 xsprintf(t, "%i", value);
32 32
33 return write_string_file("/proc/self/oom_score_adj", t, 33 return write_string_file("/proc/self/oom_score_adj", t,
34- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); 34- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
35+ WRITE_STRING_FILE_VERIFY_ON_FAILURE); 35+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
36 } 36 }
37 37
38 int pidfd_get_pid(int fd, pid_t *ret) { 38 int get_oom_score_adjust(int *ret) {
39-- 39--
402.27.0 402.34.1
41 41
diff --git a/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
deleted file mode 100644
index 76cc75cf6a..0000000000
--- a/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1From d8e4f0aa1760e4c7bb8476beecd35025c9cbb95a Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:03:47 +0800
4Subject: [PATCH 09/26] fix missing of __register_atfork for non-glibc builds
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
9---
10 src/basic/process-util.c | 7 +++++++
11 1 file changed, 7 insertions(+)
12
13diff --git a/src/basic/process-util.c b/src/basic/process-util.c
14index 0851613fc9..4417101569 100644
15--- a/src/basic/process-util.c
16+++ b/src/basic/process-util.c
17@@ -18,6 +18,9 @@
18 #if HAVE_VALGRIND_VALGRIND_H
19 #include <valgrind/valgrind.h>
20 #endif
21+#ifndef __GLIBC__
22+#include <pthread.h>
23+#endif
24
25 #include "alloc-util.h"
26 #include "architecture.h"
27@@ -1143,11 +1146,15 @@ void reset_cached_pid(void) {
28 cached_pid = CACHED_PID_UNSET;
29 }
30
31+#ifdef __GLIBC__
32 /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
33 * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
34 * libpthread, as it is part of glibc anyway. */
35 extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
36 extern void* __dso_handle _weak_;
37+#else
38+#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child)
39+#endif
40
41 pid_t getpid_cached(void) {
42 static bool installed = false;
43--
442.27.0
45
diff --git a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
index 5cdcf84dc1..0dfb77890e 100644
--- a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
+++ b/meta/recipes-core/systemd/systemd/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
@@ -1,7 +1,7 @@
1From e382845aed90cfe4496a8351d57d4466dd2e9a9c Mon Sep 17 00:00:00 2001 1From b7f6c245b4ae72999f23eecc2bbb6d6fb8db667c Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 10 Jul 2018 15:40:17 +0800 3Date: Tue, 10 Jul 2018 15:40:17 +0800
4Subject: [PATCH 15/26] distinguish XSI-compliant strerror_r from GNU-specifi 4Subject: [PATCH 10/26] distinguish XSI-compliant strerror_r from GNU-specifi
5 strerror_r 5 strerror_r
6 6
7XSI-compliant strerror_r and GNU-specifi strerror_r are different. 7XSI-compliant strerror_r and GNU-specifi strerror_r are different.
@@ -19,32 +19,15 @@ Upstream-Status: Inappropriate [musl specific]
19 19
20Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 20Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
21--- 21---
22 src/journal/journal-send.c | 5 +++++ 22 src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
23 src/libsystemd/sd-bus/bus-error.c | 5 +++++ 23 src/libsystemd/sd-journal/journal-send.c | 5 +++++
24 2 files changed, 10 insertions(+) 24 2 files changed, 15 insertions(+), 1 deletion(-)
25 25
26diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
27index e8e6ad555b..8ca5271d02 100644
28--- a/src/journal/journal-send.c
29+++ b/src/journal/journal-send.c
30@@ -348,7 +348,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
31 char* j;
32
33 errno = 0;
34+#ifndef __GLIBC__
35+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
36+ j = buffer + 8 + k;
37+#else
38 j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
39+#endif
40 if (errno == 0) {
41 char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
42
43diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c 26diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
44index 8da2024a50..9605a9b869 100644 27index 58c24d25c0..69a0d09d42 100644
45--- a/src/libsystemd/sd-bus/bus-error.c 28--- a/src/libsystemd/sd-bus/bus-error.c
46+++ b/src/libsystemd/sd-bus/bus-error.c 29+++ b/src/libsystemd/sd-bus/bus-error.c
47@@ -392,7 +392,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { 30@@ -405,7 +405,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
48 return; 31 return;
49 32
50 errno = 0; 33 errno = 0;
@@ -57,6 +40,37 @@ index 8da2024a50..9605a9b869 100644
57 if (errno == ERANGE || strlen(x) >= k - 1) { 40 if (errno == ERANGE || strlen(x) >= k - 1) {
58 free(m); 41 free(m);
59 k *= 2; 42 k *= 2;
43@@ -590,8 +595,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
44
45 if (e && e->message)
46 return e->message;
47-
48+#ifndef __GLIBC__
49+ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
50+ return buf;
51+#else
52 return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
53+#endif
54 }
55
56 static bool map_ok(const sd_bus_error_map *map) {
57diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
58index 75e8e08add..41e5c7c2b8 100644
59--- a/src/libsystemd/sd-journal/journal-send.c
60+++ b/src/libsystemd/sd-journal/journal-send.c
61@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
62 char* j;
63
64 errno = 0;
65+#ifndef __GLIBC__
66+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
67+ j = buffer + 8 + k;
68+#else
69 j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
70+#endif
71 if (errno == 0) {
72 char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
73
60-- 74--
612.27.0 752.34.1
62 76
diff --git a/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch b/meta/recipes-core/systemd/systemd/0011-avoid-redefinition-of-prctl_mm_map-structure.patch
index 56d361a213..16d741cf87 100644
--- a/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch
+++ b/meta/recipes-core/systemd/systemd/0011-avoid-redefinition-of-prctl_mm_map-structure.patch
@@ -1,7 +1,7 @@
1From bfc3416edeb69082ac9b9c9e844f12d7b45bb006 Mon Sep 17 00:00:00 2001 1From 43b0269e850a2fbcb6ca615258aa8f8a9b4f6a9d Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:44:54 +0800 3Date: Mon, 25 Feb 2019 15:44:54 +0800
4Subject: [PATCH 18/26] avoid redefinition of prctl_mm_map structure 4Subject: [PATCH 11/26] avoid redefinition of prctl_mm_map structure
5 5
6Fix the following compile failure: 6Fix the following compile failure:
7error: redefinition of 'struct prctl_mm_map' 7error: redefinition of 'struct prctl_mm_map'
@@ -14,7 +14,7 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
14 1 file changed, 2 insertions(+) 14 1 file changed, 2 insertions(+)
15 15
16diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h 16diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
17index ab851306ba..5547cad875 100644 17index 2c9f9f6c50..65a984b564 100644
18--- a/src/basic/missing_prctl.h 18--- a/src/basic/missing_prctl.h
19+++ b/src/basic/missing_prctl.h 19+++ b/src/basic/missing_prctl.h
20@@ -1,7 +1,9 @@ 20@@ -1,7 +1,9 @@
@@ -25,8 +25,8 @@ index ab851306ba..5547cad875 100644
25 #include <linux/prctl.h> 25 #include <linux/prctl.h>
26+#endif 26+#endif
27 27
28 /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ 28 #include "macro.h"
29 #ifndef PR_CAP_AMBIENT 29
30-- 30--
312.27.0 312.34.1
32 32
diff --git a/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
deleted file mode 100644
index 6d7fdbcb64..0000000000
--- a/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From d1db531ddd3bbf94d5e764b7917bcc8684ff6357 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 28 Feb 2018 21:25:22 -0800
4Subject: [PATCH 11/26] test-sizeof.c: Disable tests for missing typedefs in
5 musl
6
7Upstream-Status: Inappropriate [musl specific]
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
11---
12 src/test/test-sizeof.c | 4 ++++
13 1 file changed, 4 insertions(+)
14
15diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
16index 3c9dc180fa..e1a59d408c 100644
17--- a/src/test/test-sizeof.c
18+++ b/src/test/test-sizeof.c
19@@ -55,8 +55,10 @@ int main(void) {
20 info(unsigned);
21 info(long unsigned);
22 info(long long unsigned);
23+#ifdef __GLIBC__
24 info(__syscall_ulong_t);
25 info(__syscall_slong_t);
26+#endif
27
28 info(float);
29 info(double);
30@@ -74,7 +76,9 @@ int main(void) {
31 info(ssize_t);
32 info(time_t);
33 info(usec_t);
34+#ifdef __GLIBC__
35 info(__time_t);
36+#endif
37 info(pid_t);
38 info(uid_t);
39 info(gid_t);
40--
412.27.0
42
diff --git a/meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch
new file mode 100644
index 0000000000..0bbc6bbac7
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch
@@ -0,0 +1,530 @@
1From eaf26fdad00448b8cd336eb5db51e0baa8d8e588 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 16 Dec 2024 14:37:25 +0800
4Subject: [PATCH 12/26] do not disable buffer in writing files
5
6Do not disable buffer in writing files, otherwise we get
7failure at boot for musl like below.
8
9 [!!!!!!] Failed to allocate manager object.
10
11And there will be other failures, critical or not critical.
12This is specific to musl.
13
14Upstream-Status: Inappropriate [musl]
15
16Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
17[Rebased for v242]
18Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21[rebased for systemd 254]
22Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
23[rebased for systemd 255.1]
24---
25 src/basic/cgroup-util.c | 4 ++--
26 src/basic/namespace-util.c | 4 ++--
27 src/basic/procfs-util.c | 4 ++--
28 src/basic/sysctl-util.c | 2 +-
29 src/binfmt/binfmt.c | 6 +++---
30 src/core/cgroup.c | 2 +-
31 src/core/ipe-setup.c | 2 +-
32 src/core/main.c | 2 +-
33 src/core/smack-setup.c | 6 +++---
34 src/home/homework.c | 2 +-
35 src/libsystemd/sd-device/sd-device.c | 2 +-
36 src/nspawn/nspawn-cgroup.c | 2 +-
37 src/nspawn/nspawn.c | 6 +++---
38 src/shared/binfmt-util.c | 2 +-
39 src/shared/cgroup-setup.c | 12 ++++++------
40 src/shared/coredump-util.c | 2 +-
41 src/shared/hibernate-util.c | 4 ++--
42 src/shared/smack-util.c | 2 +-
43 src/sleep/sleep.c | 2 +-
44 src/storagetm/storagetm.c | 24 ++++++++++++------------
45 src/vconsole/vconsole-setup.c | 2 +-
46 21 files changed, 47 insertions(+), 47 deletions(-)
47
48diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
49index 309dccb45a..7aec5072a0 100644
50--- a/src/basic/cgroup-util.c
51+++ b/src/basic/cgroup-util.c
52@@ -495,7 +495,7 @@ int cg_kill_kernel_sigkill(const char *path) {
53 if (r < 0)
54 return r;
55
56- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
57+ r = write_string_file(killfile, "1", 0);
58 if (r < 0)
59 return log_debug_errno(r, "Failed to write to cgroup.kill for cgroup '%s': %m", path);
60
61@@ -1721,7 +1721,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
62 if (r < 0)
63 return r;
64
65- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
66+ return write_string_file(p, value, 0);
67 }
68
69 int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
70diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c
71index 332e8cdfd5..804498127d 100644
72--- a/src/basic/namespace-util.c
73+++ b/src/basic/namespace-util.c
74@@ -359,12 +359,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
75 freeze();
76
77 xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
78- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
79+ r = write_string_file(path, uid_map, 0);
80 if (r < 0)
81 return log_debug_errno(r, "Failed to write UID map: %m");
82
83 xsprintf(path, "/proc/" PID_FMT "/gid_map", pid);
84- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
85+ r = write_string_file(path, gid_map, 0);
86 if (r < 0)
87 return log_debug_errno(r, "Failed to write GID map: %m");
88
89diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
90index d7cfcd9105..58fb5918a3 100644
91--- a/src/basic/procfs-util.c
92+++ b/src/basic/procfs-util.c
93@@ -63,13 +63,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
94 * decrease it, as threads-max is the much more relevant sysctl. */
95 if (limit > pid_max-1) {
96 sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
97- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
98+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
99 if (r < 0)
100 return r;
101 }
102
103 sprintf(buffer, "%" PRIu64, limit);
104- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
105+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
106 if (r < 0) {
107 uint64_t threads_max;
108
109diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c
110index 2feb4917d7..4c74620a00 100644
111--- a/src/basic/sysctl-util.c
112+++ b/src/basic/sysctl-util.c
113@@ -97,7 +97,7 @@ int sysctl_write_full(const char *property, const char *value, Hashmap **shadow)
114 if (r < 0)
115 return r;
116
117- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
118+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0 | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
119 }
120
121 int sysctl_writef(const char *property, const char *format, ...) {
122diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
123index d21f3f79ff..258607cc7e 100644
124--- a/src/binfmt/binfmt.c
125+++ b/src/binfmt/binfmt.c
126@@ -30,7 +30,7 @@ static bool arg_unregister = false;
127
128 static int delete_rule(const char *rulename) {
129 const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename);
130- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
131+ return write_string_file(fn, "-1", 0);
132 }
133
134 static int apply_rule(const char *filename, unsigned line, const char *rule) {
135@@ -58,7 +58,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) {
136 if (r >= 0)
137 log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename);
138
139- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
140+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
141 if (r < 0)
142 return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m",
143 filename, line, rulename);
144@@ -248,7 +248,7 @@ static int run(int argc, char *argv[]) {
145 return r;
146
147 /* Flush out all rules */
148- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
149+ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
150 if (r < 0)
151 log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m");
152 else
153diff --git a/src/core/cgroup.c b/src/core/cgroup.c
154index 6933aae54d..ab6fccc0e4 100644
155--- a/src/core/cgroup.c
156+++ b/src/core/cgroup.c
157@@ -5175,7 +5175,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
158 if (r < 0)
159 return r;
160
161- r = write_string_file(path, one_zero(objective == FREEZER_FROZEN), WRITE_STRING_FILE_DISABLE_BUFFER);
162+ r = write_string_file(path, one_zero(objective == FREEZER_FROZEN), 0);
163 if (r < 0)
164 return r;
165
166diff --git a/src/core/ipe-setup.c b/src/core/ipe-setup.c
167index 4648d43829..80d03d87d4 100644
168--- a/src/core/ipe-setup.c
169+++ b/src/core/ipe-setup.c
170@@ -94,7 +94,7 @@ int ipe_setup(void) {
171 if (!activate_path)
172 return log_oom();
173
174- r = write_string_file(activate_path, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
175+ r = write_string_file(activate_path, "1", 0);
176 if (r == -ESTALE) {
177 log_debug_errno(r,
178 "IPE policy %s is already loaded with a version that is equal or higher, skipping.",
179diff --git a/src/core/main.c b/src/core/main.c
180index 172742c769..e68ce2a6d8 100644
181--- a/src/core/main.c
182+++ b/src/core/main.c
183@@ -1826,7 +1826,7 @@ static void initialize_core_pattern(bool skip_setup) {
184 if (getpid_cached() != 1)
185 return;
186
187- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
188+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
189 if (r < 0)
190 log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m",
191 arg_early_core_pattern);
192diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
193index 7ea902b6f9..ee4cd56023 100644
194--- a/src/core/smack-setup.c
195+++ b/src/core/smack-setup.c
196@@ -321,17 +321,17 @@ int mac_smack_setup(bool *loaded_policy) {
197 }
198
199 #if HAVE_SMACK_RUN_LABEL
200- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
201+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
202 if (r < 0)
203 log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
204- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
205+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
206 if (r < 0)
207 log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
208 r = write_string_file("/sys/fs/smackfs/netlabel",
209 "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
210 if (r < 0)
211 log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
212- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
213+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
214 if (r < 0)
215 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
216 #endif
217diff --git a/src/home/homework.c b/src/home/homework.c
218index 00e74894b3..7457113efe 100644
219--- a/src/home/homework.c
220+++ b/src/home/homework.c
221@@ -304,7 +304,7 @@ static void drop_caches_now(void) {
222 * for details. We write "3" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but
223 * not more. */
224
225- r = write_string_file("/proc/sys/vm/drop_caches", "3\n", WRITE_STRING_FILE_DISABLE_BUFFER);
226+ r = write_string_file("/proc/sys/vm/drop_caches", "3\n", 0);
227 if (r < 0)
228 log_warning_errno(r, "Failed to drop caches, ignoring: %m");
229 else
230diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
231index 01fa90b1ff..83ab655bf4 100644
232--- a/src/libsystemd/sd-device/sd-device.c
233+++ b/src/libsystemd/sd-device/sd-device.c
234@@ -2564,7 +2564,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
235 if (!value)
236 return -ENOMEM;
237
238- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
239+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
240 if (r < 0) {
241 /* On failure, clear cache entry, as we do not know how it fails. */
242 device_remove_cached_sysattr_value(device, sysattr);
243diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
244index 4f28b4a225..c899c218b2 100644
245--- a/src/nspawn/nspawn-cgroup.c
246+++ b/src/nspawn/nspawn-cgroup.c
247@@ -93,7 +93,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
248 fn = strjoina(tree, cgroup, "/cgroup.procs");
249
250 sprintf(pid_string, PID_FMT, pid);
251- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
252+ r = write_string_file(fn, pid_string, 0|WRITE_STRING_FILE_MKDIR_0755);
253 if (r < 0) {
254 log_error_errno(r, "Failed to move process: %m");
255 goto finish;
256diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
257index 500725d35f..745b6815db 100644
258--- a/src/nspawn/nspawn.c
259+++ b/src/nspawn/nspawn.c
260@@ -2857,7 +2857,7 @@ static int reset_audit_loginuid(void) {
261 if (streq(p, "4294967295"))
262 return 0;
263
264- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
265+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
266 if (r < 0) {
267 log_error_errno(r,
268 "Failed to reset audit login UID. This probably means that your kernel is too\n"
269@@ -4588,7 +4588,7 @@ static int setup_uid_map(
270 return log_oom();
271
272 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
273- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
274+ r = write_string_file(uid_map, s, 0);
275 if (r < 0)
276 return log_error_errno(r, "Failed to write UID map: %m");
277
278@@ -4598,7 +4598,7 @@ static int setup_uid_map(
279 return log_oom();
280
281 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
282- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
283+ r = write_string_file(uid_map, s, 0);
284 if (r < 0)
285 return log_error_errno(r, "Failed to write GID map: %m");
286
287diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c
288index a26175474b..1413a9c72c 100644
289--- a/src/shared/binfmt-util.c
290+++ b/src/shared/binfmt-util.c
291@@ -46,7 +46,7 @@ int disable_binfmt(void) {
292 return 0;
293 }
294
295- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
296+ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
297 if (r < 0)
298 return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m");
299
300diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
301index 49d40f60d8..0f4aa8512a 100644
302--- a/src/shared/cgroup-setup.c
303+++ b/src/shared/cgroup-setup.c
304@@ -369,7 +369,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
305
306 xsprintf(c, PID_FMT "\n", pid);
307
308- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
309+ r = write_string_file(fs, c, 0);
310 if (r == -EOPNOTSUPP && cg_is_threaded(path) > 0)
311 /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */
312 return -EUCLEAN;
313@@ -399,7 +399,7 @@ int cg_fd_attach(int fd, pid_t pid) {
314
315 xsprintf(c, PID_FMT "\n", pid);
316
317- return write_string_file_at(fd, "cgroup.procs", c, WRITE_STRING_FILE_DISABLE_BUFFER);
318+ return write_string_file_at(fd, "cgroup.procs", c, 0);
319 }
320
321 int cg_attach_fallback(const char *controller, const char *path, pid_t pid) {
322@@ -1049,7 +1049,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
323
324 sc = strstrip(contents);
325 if (isempty(sc)) {
326- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
327+ r = write_string_file(fs, agent, 0);
328 if (r < 0)
329 return r;
330 } else if (!path_equal(sc, agent))
331@@ -1067,7 +1067,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
332
333 sc = strstrip(contents);
334 if (streq(sc, "0")) {
335- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
336+ r = write_string_file(fs, "1", 0);
337 if (r < 0)
338 return r;
339
340@@ -1094,7 +1094,7 @@ int cg_uninstall_release_agent(const char *controller) {
341 if (r < 0)
342 return r;
343
344- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
345+ r = write_string_file(fs, "0", 0);
346 if (r < 0)
347 return r;
348
349@@ -1104,7 +1104,7 @@ int cg_uninstall_release_agent(const char *controller) {
350 if (r < 0)
351 return r;
352
353- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
354+ r = write_string_file(fs, "", 0);
355 if (r < 0)
356 return r;
357
358diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c
359index 805503f366..3234a1d76e 100644
360--- a/src/shared/coredump-util.c
361+++ b/src/shared/coredump-util.c
362@@ -180,7 +180,7 @@ void disable_coredumps(void) {
363 if (detect_container() > 0)
364 return;
365
366- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
367+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
368 if (r < 0)
369 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
370 }
371diff --git a/src/shared/hibernate-util.c b/src/shared/hibernate-util.c
372index 1213fdc2c7..4c26e6a4ee 100644
373--- a/src/shared/hibernate-util.c
374+++ b/src/shared/hibernate-util.c
375@@ -498,7 +498,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
376
377 /* We write the offset first since it's safer. Note that this file is only available in 4.17+, so
378 * fail gracefully if it doesn't exist and we're only overwriting it with 0. */
379- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
380+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
381 if (r == -ENOENT) {
382 if (offset != 0)
383 return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
384@@ -514,7 +514,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
385 log_debug("Wrote resume_offset=%s for device '%s' to /sys/power/resume_offset.",
386 offset_str, device);
387
388- r = write_string_file("/sys/power/resume", devno_str, WRITE_STRING_FILE_DISABLE_BUFFER);
389+ r = write_string_file("/sys/power/resume", devno_str, 0);
390 if (r < 0)
391 return log_error_errno(r,
392 "Failed to write device '%s' (%s) to /sys/power/resume: %m",
393diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
394index d0a79b2635..0c82d9943a 100644
395--- a/src/shared/smack-util.c
396+++ b/src/shared/smack-util.c
397@@ -113,7 +113,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
398 return 0;
399
400 p = procfs_file_alloca(pid, "attr/current");
401- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
402+ r = write_string_file(p, label, 0);
403 if (r < 0)
404 return r;
405
406diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
407index 181bb4ccef..2dbb3f4bc6 100644
408--- a/src/sleep/sleep.c
409+++ b/src/sleep/sleep.c
410@@ -158,7 +158,7 @@ static int write_mode(const char *path, char * const *modes) {
411 assert(path);
412
413 STRV_FOREACH(mode, modes) {
414- r = write_string_file(path, *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
415+ r = write_string_file(path, *mode, 0);
416 if (r >= 0) {
417 log_debug("Using sleep mode '%s' for %s.", *mode, path);
418 return 0;
419diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c
420index ca8e886d37..5c27c54f09 100644
421--- a/src/storagetm/storagetm.c
422+++ b/src/storagetm/storagetm.c
423@@ -197,7 +197,7 @@ static int nvme_subsystem_unlink(NvmeSubsystem *s) {
424 if (!enable_fn)
425 return log_oom();
426
427- r = write_string_file_at(namespaces_fd, enable_fn, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
428+ r = write_string_file_at(namespaces_fd, enable_fn, "0", 0);
429 if (r < 0)
430 log_warning_errno(r, "Failed to disable namespace '%s' of NVME subsystem '%s', ignoring: %m", e->d_name, s->name);
431
432@@ -265,7 +265,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
433 _cleanup_free_ char *truncated = strndup(w, 40); /* kernel refuses more than 40 chars (as per nvme spec) */
434
435 /* The default string stored in 'attr_model' is "Linux" btw. */
436- r = write_string_file_at(subsystem_fd, "attr_model", truncated, WRITE_STRING_FILE_DISABLE_BUFFER);
437+ r = write_string_file_at(subsystem_fd, "attr_model", truncated, 0);
438 if (r < 0)
439 log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", w);
440 }
441@@ -279,7 +279,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
442 return log_oom();
443
444 /* The default string stored in 'attr_firmware' is `uname -r` btw, but truncated to 8 chars. */
445- r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, WRITE_STRING_FILE_DISABLE_BUFFER);
446+ r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, 0);
447 if (r < 0)
448 log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", truncated);
449 }
450@@ -306,7 +306,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
451 if (!truncated)
452 return log_oom();
453
454- r = write_string_file_at(subsystem_fd, "attr_serial", truncated, WRITE_STRING_FILE_DISABLE_BUFFER);
455+ r = write_string_file_at(subsystem_fd, "attr_serial", truncated, 0);
456 if (r < 0)
457 log_warning_errno(r, "Failed to set serial of subsystem to '%s', ignoring: %m", truncated);
458 }
459@@ -356,7 +356,7 @@ static int nvme_namespace_write_metadata(int namespace_fd, sd_device *device, co
460 id = id128_digest(j, l);
461 }
462
463- r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), WRITE_STRING_FILE_DISABLE_BUFFER);
464+ r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), 0);
465 if (r < 0)
466 log_warning_errno(r, "Failed to set uuid of namespace to '%s', ignoring: %m", SD_ID128_TO_UUID_STRING(id));
467
468@@ -419,7 +419,7 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi
469 if (subsystem_fd < 0)
470 return log_error_errno(subsystem_fd, "Failed to create NVME subsystem '%s': %m", j);
471
472- r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", WRITE_STRING_FILE_DISABLE_BUFFER);
473+ r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", 0);
474 if (r < 0)
475 return log_error_errno(r, "Failed to set 'attr_allow_any_host' flag: %m");
476
477@@ -434,11 +434,11 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi
478
479 /* We use /proc/$PID/fd/$FD rather than /proc/self/fd/$FD, because this string is visible to others
480 * via configfs, and by including the PID it's clear to who the stuff belongs. */
481- r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), WRITE_STRING_FILE_DISABLE_BUFFER);
482+ r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), 0);
483 if (r < 0)
484 return log_error_errno(r, "Failed to write 'device_path' attribute: %m");
485
486- r = write_string_file_at(namespace_fd, "enable", "1", WRITE_STRING_FILE_DISABLE_BUFFER);
487+ r = write_string_file_at(namespace_fd, "enable", "1", 0);
488 if (r < 0)
489 return log_error_errno(r, "Failed to write 'enable' attribute: %m");
490
491@@ -568,19 +568,19 @@ static int nvme_port_add_portnr(
492 return 0;
493 }
494
495- r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), WRITE_STRING_FILE_DISABLE_BUFFER);
496+ r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), 0);
497 if (r < 0)
498 return log_error_errno(r, "Failed to set address family on NVME port %" PRIu16 ": %m", portnr);
499
500- r = write_string_file_at(port_fd, "addr_trtype", "tcp", WRITE_STRING_FILE_DISABLE_BUFFER);
501+ r = write_string_file_at(port_fd, "addr_trtype", "tcp", 0);
502 if (r < 0)
503 return log_error_errno(r, "Failed to set transport type on NVME port %" PRIu16 ": %m", portnr);
504
505- r = write_string_file_at(port_fd, "addr_trsvcid", fname, WRITE_STRING_FILE_DISABLE_BUFFER);
506+ r = write_string_file_at(port_fd, "addr_trsvcid", fname, 0);
507 if (r < 0)
508 return log_error_errno(r, "Failed to set IP port on NVME port %" PRIu16 ": %m", portnr);
509
510- r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", WRITE_STRING_FILE_DISABLE_BUFFER);
511+ r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", 0);
512 if (r < 0)
513 return log_error_errno(r, "Failed to set IP address on NVME port %" PRIu16 ": %m", portnr);
514
515diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
516index ba742dda69..6f20e81615 100644
517--- a/src/vconsole/vconsole-setup.c
518+++ b/src/vconsole/vconsole-setup.c
519@@ -277,7 +277,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
520 static int toggle_utf8_sysfs(bool utf8) {
521 int r;
522
523- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
524+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
525 if (r < 0)
526 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
527
528--
5292.34.1
530
diff --git a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
deleted file mode 100644
index c15b6e7d82..0000000000
--- a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
+++ /dev/null
@@ -1,99 +0,0 @@
1From 03e89da266edf70121a19ffc32a78cc3b97585ef Mon Sep 17 00:00:00 2001
2From: Andre McCurdy <armccurdy@gmail.com>
3Date: Tue, 10 Oct 2017 14:33:30 -0700
4Subject: [PATCH 12/26] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat()
5
6Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right
7thing to do and it's not portable (not supported by musl). See:
8
9 http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
10 http://www.openwall.com/lists/musl/2015/02/05/2
11
12Note that laccess() is never passing AT_EACCESS so a lot of the
13discussion in the links above doesn't apply. Note also that
14(currently) all systemd callers of laccess() pass mode as F_OK, so
15only check for existence of a file, not access permissions.
16Therefore, in this case, the only distiction between faccessat()
17with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour
18for broken symlinks; laccess() on a broken symlink will succeed with
19(flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
20
21The laccess() macros was added to systemd some time ago and it's not
22clear if or why it needs to return success for broken symlinks. Maybe
23just historical and not actually necessary or desired behaviour?
24
25Upstream-Status: Inappropriate [musl specific]
26
27Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
28---
29 src/basic/fs-util.h | 22 +++++++++++++++++++++-
30 src/shared/base-filesystem.c | 6 +++---
31 2 files changed, 24 insertions(+), 4 deletions(-)
32
33diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
34index 5dc8853eac..0491b3dae2 100644
35--- a/src/basic/fs-util.h
36+++ b/src/basic/fs-util.h
37@@ -43,7 +43,27 @@ int futimens_opath(int fd, const struct timespec ts[2]);
38 int fd_warn_permissions(const char *path, int fd);
39 int stat_warn_permissions(const char *path, const struct stat *st);
40
41-#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)
42+/*
43+ Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to
44+ do and it's not portable (not supported by musl). See:
45+
46+ http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
47+ http://www.openwall.com/lists/musl/2015/02/05/2
48+
49+ Note that laccess() is never passing AT_EACCESS so a lot of the discussion in
50+ the links above doesn't apply. Note also that (currently) all systemd callers
51+ of laccess() pass mode as F_OK, so only check for existence of a file, not
52+ access permissions. Therefore, in this case, the only distiction between
53+ faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the
54+ behaviour for broken symlinks; laccess() on a broken symlink will succeed
55+ with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
56+
57+ The laccess() macros was added to systemd some time ago and it's not clear if
58+ or why it needs to return success for broken symlinks. Maybe just historical
59+ and not actually necessary or desired behaviour?
60+*/
61+
62+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0)
63
64 int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
65 int touch(const char *path);
66diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
67index 1d05409086..1ed06c31ab 100644
68--- a/src/shared/base-filesystem.c
69+++ b/src/shared/base-filesystem.c
70@@ -54,7 +54,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
71 return log_error_errno(errno, "Failed to open root file system: %m");
72
73 for (i = 0; i < ELEMENTSOF(table); i ++) {
74- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
75+ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0)
76 continue;
77
78 if (table[i].target) {
79@@ -62,7 +62,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
80
81 /* check if one of the targets exists */
82 NULSTR_FOREACH(s, table[i].target) {
83- if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
84+ if (faccessat(fd, s, F_OK, 0) < 0)
85 continue;
86
87 /* check if a specific file exists at the target path */
88@@ -73,7 +73,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
89 if (!p)
90 return log_oom();
91
92- if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
93+ if (faccessat(fd, p, F_OK, 0) < 0)
94 continue;
95 }
96
97--
982.27.0
99
diff --git a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
deleted file mode 100644
index 89736bcfde..0000000000
--- a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From dd134880e9a16595ab473934577e873c748e9c7a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 May 2018 08:36:44 -0700
4Subject: [PATCH 13/26] Define glibc compatible basename() for non-glibc
5 systems
6
7Fixes builds with musl, even though systemd is adamant about
8using non-posix basename implementation, we have a way out
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/machine/machine-dbus.c | 5 +++++
15 1 file changed, 5 insertions(+)
16
17diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
18index f5780f1aec..aec5825b3e 100644
19--- a/src/machine/machine-dbus.c
20+++ b/src/machine/machine-dbus.c
21@@ -11,6 +11,11 @@
22 #include <libgen.h>
23 #undef basename
24
25+#if !defined(__GLIBC__)
26+#include <string.h>
27+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
28+#endif
29+
30 #include "alloc-util.h"
31 #include "bus-common-errors.h"
32 #include "bus-get-properties.h"
33--
342.27.0
35
diff --git a/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch b/meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch
index 1cc3985d12..35009cba42 100644
--- a/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch
+++ b/meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch
@@ -1,7 +1,7 @@
1From bbda4a48a34662393117fc677c3a678d4ce4c2ec Mon Sep 17 00:00:00 2001 1From ab4fda874b26542de96720db58cb0e8704a40108 Mon Sep 17 00:00:00 2001
2From: Scott Murray <scott.murray@konsulko.com> 2From: Scott Murray <scott.murray@konsulko.com>
3Date: Fri, 13 Sep 2019 19:26:27 -0400 3Date: Fri, 13 Sep 2019 19:26:27 -0400
4Subject: [PATCH 25/26] Handle __cpu_mask usage 4Subject: [PATCH 13/26] Handle __cpu_mask usage
5 5
6Fixes errors: 6Fixes errors:
7 7
@@ -24,7 +24,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
24 2 files changed, 3 insertions(+), 1 deletion(-) 24 2 files changed, 3 insertions(+), 1 deletion(-)
25 25
26diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h 26diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h
27index 3c63a58826..4c2d4347fc 100644 27index 2c477d8a01..c026ce77a6 100644
28--- a/src/shared/cpu-set-util.h 28--- a/src/shared/cpu-set-util.h
29+++ b/src/shared/cpu-set-util.h 29+++ b/src/shared/cpu-set-util.h
30@@ -6,6 +6,8 @@ 30@@ -6,6 +6,8 @@
@@ -37,7 +37,7 @@ index 3c63a58826..4c2d4347fc 100644
37 typedef struct CPUSet { 37 typedef struct CPUSet {
38 cpu_set_t *set; 38 cpu_set_t *set;
39diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c 39diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
40index e1a59d408c..c269ea6e8c 100644 40index ea0c58770e..b65c0bd370 100644
41--- a/src/test/test-sizeof.c 41--- a/src/test/test-sizeof.c
42+++ b/src/test/test-sizeof.c 42+++ b/src/test/test-sizeof.c
43@@ -1,6 +1,5 @@ 43@@ -1,6 +1,5 @@
@@ -46,8 +46,8 @@ index e1a59d408c..c269ea6e8c 100644
46-#include <sched.h> 46-#include <sched.h>
47 #include <stdio.h> 47 #include <stdio.h>
48 #include <string.h> 48 #include <string.h>
49 #include <sys/types.h> 49 #include <sys/resource.h>
50@@ -10,6 +9,7 @@ 50@@ -12,6 +11,7 @@
51 #include <float.h> 51 #include <float.h>
52 52
53 #include "time-util.h" 53 #include "time-util.h"
@@ -56,5 +56,5 @@ index e1a59d408c..c269ea6e8c 100644
56 /* Print information about various types. Useful when diagnosing 56 /* Print information about various types. Useful when diagnosing
57 * gcc diagnostics on an unfamiliar architecture. */ 57 * gcc diagnostics on an unfamiliar architecture. */
58-- 58--
592.27.0 592.34.1
60 60
diff --git a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow.patch
index 4180afb08e..0aabae6d82 100644
--- a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
+++ b/meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow.patch
@@ -1,7 +1,7 @@
1From 47bf88f74717b417e4adbcc04256334b2335c873 Mon Sep 17 00:00:00 2001 1From c5165f6adf8a9cfe8c0784c598b87d7d7e8b7d1a Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com> 2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Tue, 10 Mar 2020 11:05:20 +0000 3Date: Tue, 10 Mar 2020 11:05:20 +0000
4Subject: [PATCH 26/26] Handle missing gshadow 4Subject: [PATCH 14/26] Handle missing gshadow
5 5
6gshadow usage is now present in the userdb code. Mask all uses of it to 6gshadow usage is now present in the userdb code. Mask all uses of it to
7allow compilation on musl 7allow compilation on musl
@@ -13,14 +13,14 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
13--- 13---
14 src/shared/user-record-nss.c | 20 ++++++++++++++++++++ 14 src/shared/user-record-nss.c | 20 ++++++++++++++++++++
15 src/shared/user-record-nss.h | 4 ++++ 15 src/shared/user-record-nss.h | 4 ++++
16 src/shared/userdb.c | 6 ++++++ 16 src/shared/userdb.c | 7 ++++++-
17 3 files changed, 30 insertions(+) 17 3 files changed, 30 insertions(+), 1 deletion(-)
18 18
19diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c 19diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
20index 88b8fc2f8f..a819d41bac 100644 20index 9223a2e6ca..f9eb1a5b64 100644
21--- a/src/shared/user-record-nss.c 21--- a/src/shared/user-record-nss.c
22+++ b/src/shared/user-record-nss.c 22+++ b/src/shared/user-record-nss.c
23@@ -331,8 +331,10 @@ int nss_group_to_group_record( 23@@ -286,8 +286,10 @@ int nss_group_to_group_record(
24 if (isempty(grp->gr_name)) 24 if (isempty(grp->gr_name))
25 return -EINVAL; 25 return -EINVAL;
26 26
@@ -31,7 +31,7 @@ index 88b8fc2f8f..a819d41bac 100644
31 31
32 g = group_record_new(); 32 g = group_record_new();
33 if (!g) 33 if (!g)
34@@ -348,6 +350,7 @@ int nss_group_to_group_record( 34@@ -303,6 +305,7 @@ int nss_group_to_group_record(
35 35
36 g->gid = grp->gr_gid; 36 g->gid = grp->gr_gid;
37 37
@@ -39,15 +39,15 @@ index 88b8fc2f8f..a819d41bac 100644
39 if (sgrp) { 39 if (sgrp) {
40 if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) { 40 if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
41 g->hashed_password = strv_new(sgrp->sg_passwd); 41 g->hashed_password = strv_new(sgrp->sg_passwd);
42@@ -363,6 +366,7 @@ int nss_group_to_group_record( 42@@ -318,6 +321,7 @@ int nss_group_to_group_record(
43 if (r < 0) 43 if (r < 0)
44 return r; 44 return r;
45 } 45 }
46+#endif 46+#endif
47 47
48 r = json_build(&g->json, JSON_BUILD_OBJECT( 48 r = sd_json_buildo(
49 JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), 49 &g->json,
50@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re 50@@ -345,6 +349,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
51 assert(ret_sgrp); 51 assert(ret_sgrp);
52 assert(ret_buffer); 52 assert(ret_buffer);
53 53
@@ -55,7 +55,7 @@ index 88b8fc2f8f..a819d41bac 100644
55 for (;;) { 55 for (;;) {
56 _cleanup_free_ char *buf = NULL; 56 _cleanup_free_ char *buf = NULL;
57 struct sgrp sgrp, *result; 57 struct sgrp sgrp, *result;
58@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re 58@@ -373,6 +378,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
59 buflen *= 2; 59 buflen *= 2;
60 buf = mfree(buf); 60 buf = mfree(buf);
61 } 61 }
@@ -65,25 +65,25 @@ index 88b8fc2f8f..a819d41bac 100644
65 } 65 }
66 66
67 int nss_group_record_by_name( 67 int nss_group_record_by_name(
68@@ -427,7 +435,9 @@ int nss_group_record_by_name( 68@@ -383,7 +391,9 @@ int nss_group_record_by_name(
69 struct group grp, *result; 69 _cleanup_free_ char *sbuf = NULL;
70 _cleanup_free_ struct group *result = NULL;
70 bool incomplete = false; 71 bool incomplete = false;
71 size_t buflen = 4096;
72+#if ENABLE_GSHADOW 72+#if ENABLE_GSHADOW
73 struct sgrp sgrp, *sresult = NULL; 73 struct sgrp sgrp, *sresult = NULL;
74+#endif 74+#endif
75 int r; 75 int r;
76 76
77 assert(name); 77 assert(name);
78@@ -457,6 +467,7 @@ int nss_group_record_by_name( 78@@ -392,6 +402,7 @@ int nss_group_record_by_name(
79 buf = mfree(buf); 79 if (r < 0)
80 } 80 return r;
81 81
82+#if ENABLE_GSHADOW 82+#if ENABLE_GSHADOW
83 if (with_shadow) { 83 if (with_shadow) {
84 r = nss_sgrp_for_group(result, &sgrp, &sbuf); 84 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
85 if (r < 0) { 85 if (r < 0) {
86@@ -468,6 +479,9 @@ int nss_group_record_by_name( 86@@ -403,6 +414,9 @@ int nss_group_record_by_name(
87 incomplete = true; 87 incomplete = true;
88 88
89 r = nss_group_to_group_record(result, sresult, ret); 89 r = nss_group_to_group_record(result, sresult, ret);
@@ -93,25 +93,24 @@ index 88b8fc2f8f..a819d41bac 100644
93 if (r < 0) 93 if (r < 0)
94 return r; 94 return r;
95 95
96@@ -484,7 +498,9 @@ int nss_group_record_by_gid( 96@@ -419,13 +433,16 @@ int nss_group_record_by_gid(
97 struct group grp, *result; 97 _cleanup_free_ char *sbuf = NULL;
98 _cleanup_free_ struct group *result = NULL;
98 bool incomplete = false; 99 bool incomplete = false;
99 size_t buflen = 4096;
100+#if ENABLE_GSHADOW 100+#if ENABLE_GSHADOW
101 struct sgrp sgrp, *sresult = NULL; 101 struct sgrp sgrp, *sresult = NULL;
102+#endif 102+#endif
103 int r; 103 int r;
104 104
105 assert(ret); 105 r = getgrgid_malloc(gid, &result);
106@@ -512,6 +528,7 @@ int nss_group_record_by_gid( 106 if (r < 0)
107 buf = mfree(buf); 107 return r;
108 }
109 108
110+#if ENABLE_GSHADOW 109+#if ENABLE_GSHADOW
111 if (with_shadow) { 110 if (with_shadow) {
112 r = nss_sgrp_for_group(result, &sgrp, &sbuf); 111 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
113 if (r < 0) { 112 if (r < 0) {
114@@ -523,6 +540,9 @@ int nss_group_record_by_gid( 113@@ -437,6 +454,9 @@ int nss_group_record_by_gid(
115 incomplete = true; 114 incomplete = true;
116 115
117 r = nss_group_to_group_record(result, sresult, ret); 116 r = nss_group_to_group_record(result, sresult, ret);
@@ -138,27 +137,27 @@ index 22ab04d6ee..4e52e7a911 100644
138 #include <shadow.h> 137 #include <shadow.h>
139 138
140diff --git a/src/shared/userdb.c b/src/shared/userdb.c 139diff --git a/src/shared/userdb.c b/src/shared/userdb.c
141index 2d480283d1..0d19764f2e 100644 140index ff83d4bf90..54d36cc706 100644
142--- a/src/shared/userdb.c 141--- a/src/shared/userdb.c
143+++ b/src/shared/userdb.c 142+++ b/src/shared/userdb.c
144@@ -929,13 +929,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { 143@@ -1042,13 +1042,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
145 if (gr) { 144 if (gr) {
146 _cleanup_free_ char *buffer = NULL; 145 _cleanup_free_ char *buffer = NULL;
147 bool incomplete = false; 146 bool incomplete = false;
148+#if ENABLE_GSHADOW 147+#if ENABLE_GSHADOW
149 struct sgrp sgrp; 148 struct sgrp sgrp;
149-
150+#endif 150+#endif
151
152 if (streq_ptr(gr->gr_name, "root")) 151 if (streq_ptr(gr->gr_name, "root"))
153 iterator->synthesize_root = false; 152 iterator->synthesize_root = false;
154 if (gr->gr_gid == GID_NOBODY) 153 if (gr->gr_gid == GID_NOBODY)
155 iterator->synthesize_nobody = false; 154 iterator->synthesize_nobody = false;
156 155
157+#if ENABLE_GSHADOW 156+#if ENABLE_GSHADOW
158 r = nss_sgrp_for_group(gr, &sgrp, &buffer); 157 if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
159 if (r < 0) { 158 r = nss_sgrp_for_group(gr, &sgrp, &buffer);
160 log_debug_errno(r, "Failed to acquire shadow entry for group %s, ignoring: %m", gr->gr_name); 159 if (r < 0) {
161@@ -943,6 +946,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { 160@@ -1061,6 +1063,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
162 } 161 }
163 162
164 r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); 163 r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
@@ -169,5 +168,5 @@ index 2d480283d1..0d19764f2e 100644
169 return r; 168 return r;
170 169
171-- 170--
1722.27.0 1712.34.1
173 172
diff --git a/meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch b/meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
new file mode 100644
index 0000000000..1443c5082b
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
@@ -0,0 +1,42 @@
1From ef9ad83759f78de983d2d7c4f95bc48b83bb8f66 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 12 Apr 2021 23:44:53 -0700
4Subject: [PATCH 15/26] missing_syscall.h: Define MIPS ABI defines for musl
5
6musl does not define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32, _MIPS_SIM_ABI64
7unlike glibc where these are provided by libc headers, therefore define
8them here in case they are undefined
9
10Upstream-Status: Pending
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/basic/missing_syscall.h | 6 ++++++
15 src/shared/base-filesystem.c | 1 +
16 2 files changed, 7 insertions(+)
17
18--- a/src/basic/missing_syscall.h
19+++ b/src/basic/missing_syscall.h
20@@ -20,6 +20,12 @@
21 #include <asm/sgidefs.h>
22 #endif
23
24+#ifndef _MIPS_SIM_ABI32
25+#define _MIPS_SIM_ABI32 1
26+#define _MIPS_SIM_NABI32 2
27+#define _MIPS_SIM_ABI64 3
28+#endif
29+
30 #include "macro.h"
31 #include "missing_keyctl.h"
32 #include "missing_sched.h"
33--- a/src/shared/base-filesystem.c
34+++ b/src/shared/base-filesystem.c
35@@ -20,6 +20,7 @@
36 #include "string-util.h"
37 #include "umask-util.h"
38 #include "user-util.h"
39+#include "missing_syscall.h"
40
41 typedef enum BaseFilesystemFlags {
42 BASE_FILESYSTEM_IGNORE_ON_FAILURE = 1 << 0,
diff --git a/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
deleted file mode 100644
index 9a125de638..0000000000
--- a/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From 0c7af5f288231a8c0545e169e01ba5ee173cafe7 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:18:00 +0800
4Subject: [PATCH 16/26] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP
5
6for currently unknown reasons they get exported to the shared libries
7even without being listed in the sym file
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12[Rebased for v241]
13Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
14---
15 src/libsystemd/sd-bus/bus-error.c | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
19index 9605a9b869..38b6cf90c3 100644
20--- a/src/libsystemd/sd-bus/bus-error.c
21+++ b/src/libsystemd/sd-bus/bus-error.c
22@@ -55,8 +55,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = {
23 };
24
25 /* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */
26-extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[];
27-extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[];
28+extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
29+extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
30
31 /* Additional maps registered with sd_bus_error_add_map() are in this
32 * NULL terminated array */
33--
342.27.0
35
diff --git a/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch b/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch
new file mode 100644
index 0000000000..b802106155
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch
@@ -0,0 +1,37 @@
1From 9079b158779a9c395c24f882f72a1c734795045d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 21 Jan 2022 15:15:11 -0800
4Subject: [PATCH 16/26] pass correct parameters to getdents64
5
6Fixes
7../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types]
8 n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
9 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
11../git/src/basic/stat-util.c:102:28: error: incompatible pointer types passing 'union (unnamed union at ../git/src/basic/stat-util.c:78:9) *' to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types]
12 n = getdents64(fd, &buffer, sizeof(buffer));
13 ^~~~~~~
14
15Upstream-Status: Inappropriate [musl specific]
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
18---
19 src/basic/recurse-dir.c | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c
23index 378fd92b06..5b567b457d 100644
24--- a/src/basic/recurse-dir.c
25+++ b/src/basic/recurse-dir.c
26@@ -56,7 +56,7 @@ int readdir_all(int dir_fd,
27 bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX);
28 assert(bs > de->buffer_size);
29
30- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
31+ n = getdents64(dir_fd, (struct dirent*)((uint8_t*) de->buffer + de->buffer_size), bs - de->buffer_size);
32 if (n < 0)
33 return -errno;
34 if (n == 0)
35--
362.34.1
37
diff --git a/meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch b/meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch
new file mode 100644
index 0000000000..5a2bc3c552
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch
@@ -0,0 +1,526 @@
1From be9d8f221ab9d31c0df8b2b3e66172bb9bc0f71f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 21 Jan 2022 22:19:37 -0800
4Subject: [PATCH 17/26] Adjust for musl headers
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10[Rebased for v255.1]
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12---
13 src/basic/linux/ethtool.h | 3 ++-
14 src/libsystemd-network/sd-dhcp6-client.c | 2 +-
15 src/network/netdev/bareudp.c | 2 +-
16 src/network/netdev/batadv.c | 2 +-
17 src/network/netdev/bond.c | 2 +-
18 src/network/netdev/bridge.c | 3 ++-
19 src/network/netdev/dummy.c | 2 +-
20 src/network/netdev/geneve.c | 2 +-
21 src/network/netdev/ifb.c | 2 +-
22 src/network/netdev/ipoib.c | 2 +-
23 src/network/netdev/ipvlan.c | 2 +-
24 src/network/netdev/macsec.c | 2 +-
25 src/network/netdev/macvlan.c | 2 +-
26 src/network/netdev/netdev.c | 2 +-
27 src/network/netdev/netdevsim.c | 2 +-
28 src/network/netdev/nlmon.c | 2 +-
29 src/network/netdev/tunnel.c | 2 +-
30 src/network/netdev/vcan.c | 2 +-
31 src/network/netdev/veth.c | 2 +-
32 src/network/netdev/vlan.c | 2 +-
33 src/network/netdev/vrf.c | 2 +-
34 src/network/netdev/vxcan.c | 2 +-
35 src/network/netdev/vxlan.c | 2 +-
36 src/network/netdev/wireguard.c | 2 +-
37 src/network/netdev/xfrm.c | 2 +-
38 src/network/networkd-dhcp-common.c | 3 ++-
39 src/network/networkd-dhcp-prefix-delegation.c | 3 ++-
40 src/network/networkd-dhcp-server.c | 2 +-
41 src/network/networkd-dhcp4.c | 2 +-
42 src/network/networkd-ipv6ll.c | 2 +-
43 src/network/networkd-link.c | 2 +-
44 src/network/networkd-ndisc.c | 2 +-
45 src/network/networkd-setlink.c | 2 +-
46 src/network/networkd-sysctl.c | 2 +-
47 src/shared/netif-util.c | 2 +-
48 src/udev/udev-builtin-net_id.c | 2 +-
49 36 files changed, 40 insertions(+), 36 deletions(-)
50
51diff --git a/src/basic/linux/ethtool.h b/src/basic/linux/ethtool.h
52index a32293ba20..2aad67e9c0 100644
53--- a/src/basic/linux/ethtool.h
54+++ b/src/basic/linux/ethtool.h
55@@ -16,7 +16,8 @@
56
57 #include <linux/const.h>
58 #include <linux/types.h>
59-#include <linux/if_ether.h>
60+#include <netinet/if_ether.h>
61+//#include <linux/if_ether.h>
62
63 #include <limits.h> /* for INT_MAX */
64
65diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
66index 3e992d7cad..c7e1ff4dbf 100644
67--- a/src/libsystemd-network/sd-dhcp6-client.c
68+++ b/src/libsystemd-network/sd-dhcp6-client.c
69@@ -5,7 +5,7 @@
70
71 #include <errno.h>
72 #include <sys/ioctl.h>
73-#include <linux/if_arp.h>
74+//#include <linux/if_arp.h>
75 #include <linux/if_infiniband.h>
76
77 #include "sd-dhcp6-client.h"
78diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
79index e122abd97f..c120c2969b 100644
80--- a/src/network/netdev/bareudp.c
81+++ b/src/network/netdev/bareudp.c
82@@ -2,7 +2,7 @@
83 * Copyright © 2020 VMware, Inc. */
84
85 #include <netinet/in.h>
86-#include <linux/if_arp.h>
87+//#include <linux/if_arp.h>
88
89 #include "bareudp.h"
90 #include "netlink-util.h"
91diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
92index 9806d8eb7c..19c3d881c2 100644
93--- a/src/network/netdev/batadv.c
94+++ b/src/network/netdev/batadv.c
95@@ -3,7 +3,7 @@
96 #include <inttypes.h>
97 #include <netinet/in.h>
98 #include <linux/genetlink.h>
99-#include <linux/if_arp.h>
100+//#include <linux/if_arp.h>
101
102 #include "batadv.h"
103 #include "fileio.h"
104diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
105index b866940b7a..a0eaf0a866 100644
106--- a/src/network/netdev/bond.c
107+++ b/src/network/netdev/bond.c
108@@ -1,7 +1,7 @@
109 /* SPDX-License-Identifier: LGPL-2.1-or-later */
110
111 #include <netinet/in.h>
112-#include <linux/if_arp.h>
113+//#include <linux/if_arp.h>
114
115 #include "alloc-util.h"
116 #include "bond.h"
117diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
118index d3ba4989d9..4f7301c4f1 100644
119--- a/src/network/netdev/bridge.c
120+++ b/src/network/netdev/bridge.c
121@@ -2,7 +2,8 @@
122
123 /* Make sure the net/if.h header is included before any linux/ one */
124 #include <net/if.h>
125-#include <linux/if_arp.h>
126+#include <netinet/in.h>
127+//#include <linux/if_arp.h>
128 #include <linux/if_bridge.h>
129 #include <netinet/in.h>
130
131diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
132index 8b2893d5b4..412123f036 100644
133--- a/src/network/netdev/dummy.c
134+++ b/src/network/netdev/dummy.c
135@@ -1,6 +1,6 @@
136 /* SPDX-License-Identifier: LGPL-2.1-or-later */
137
138-#include <linux/if_arp.h>
139+//#include <linux/if_arp.h>
140
141 #include "dummy.h"
142
143diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
144index 1d68be9bc8..539151c49e 100644
145--- a/src/network/netdev/geneve.c
146+++ b/src/network/netdev/geneve.c
147@@ -2,7 +2,7 @@
148
149 /* Make sure the net/if.h header is included before any linux/ one */
150 #include <net/if.h>
151-#include <linux/if_arp.h>
152+//#include <linux/if_arp.h>
153 #include <netinet/in.h>
154
155 #include "alloc-util.h"
156diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
157index d7ff44cb9e..e037629ae4 100644
158--- a/src/network/netdev/ifb.c
159+++ b/src/network/netdev/ifb.c
160@@ -1,7 +1,7 @@
161 /* SPDX-License-Identifier: LGPL-2.1-or-later
162 * Copyright © 2019 VMware, Inc. */
163
164-#include <linux/if_arp.h>
165+//#include <linux/if_arp.h>
166
167 #include "ifb.h"
168
169diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
170index 6932c62e2a..fc458da9e8 100644
171--- a/src/network/netdev/ipoib.c
172+++ b/src/network/netdev/ipoib.c
173@@ -1,6 +1,6 @@
174 /* SPDX-License-Identifier: LGPL-2.1-or-later */
175
176-#include <linux/if_arp.h>
177+//#include <linux/if_arp.h>
178 #include <linux/if_link.h>
179
180 #include "ipoib.h"
181diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
182index 6e50f72aaa..49acfee25e 100644
183--- a/src/network/netdev/ipvlan.c
184+++ b/src/network/netdev/ipvlan.c
185@@ -3,7 +3,7 @@
186 /* Make sure the net/if.h header is included before any linux/ one */
187 #include <net/if.h>
188 #include <netinet/in.h>
189-#include <linux/if_arp.h>
190+//#include <linux/if_arp.h>
191
192 #include "conf-parser.h"
193 #include "ipvlan.h"
194diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
195index 6dd434f803..f9fbe9f51a 100644
196--- a/src/network/netdev/macsec.c
197+++ b/src/network/netdev/macsec.c
198@@ -1,7 +1,7 @@
199 /* SPDX-License-Identifier: LGPL-2.1-or-later */
200
201 #include <netinet/in.h>
202-#include <linux/if_arp.h>
203+//#include <linux/if_arp.h>
204 #include <linux/if_ether.h>
205 #include <linux/if_macsec.h>
206 #include <linux/genetlink.h>
207diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
208index fd112b58e1..b038740bda 100644
209--- a/src/network/netdev/macvlan.c
210+++ b/src/network/netdev/macvlan.c
211@@ -3,7 +3,7 @@
212 /* Make sure the net/if.h header is included before any linux/ one */
213 #include <net/if.h>
214 #include <netinet/in.h>
215-#include <linux/if_arp.h>
216+//#include <linux/if_arp.h>
217
218 #include "conf-parser.h"
219 #include "macvlan.h"
220diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
221index c2986aafb5..147f1c95d0 100644
222--- a/src/network/netdev/netdev.c
223+++ b/src/network/netdev/netdev.c
224@@ -3,7 +3,7 @@
225 /* Make sure the net/if.h header is included before any linux/ one */
226 #include <net/if.h>
227 #include <netinet/in.h>
228-#include <linux/if_arp.h>
229+//#include <linux/if_arp.h>
230 #include <unistd.h>
231
232 #include "alloc-util.h"
233diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
234index 59958c3bbe..61169016b0 100644
235--- a/src/network/netdev/netdevsim.c
236+++ b/src/network/netdev/netdevsim.c
237@@ -1,6 +1,6 @@
238 /* SPDX-License-Identifier: LGPL-2.1-or-later */
239
240-#include <linux/if_arp.h>
241+//#include <linux/if_arp.h>
242
243 #include "netdevsim.h"
244
245diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
246index ff372092e6..eef66811f4 100644
247--- a/src/network/netdev/nlmon.c
248+++ b/src/network/netdev/nlmon.c
249@@ -1,6 +1,6 @@
250 /* SPDX-License-Identifier: LGPL-2.1-or-later */
251
252-#include <linux/if_arp.h>
253+//#include <linux/if_arp.h>
254
255 #include "nlmon.h"
256
257diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
258index af05cfda81..f659bed3a6 100644
259--- a/src/network/netdev/tunnel.c
260+++ b/src/network/netdev/tunnel.c
261@@ -2,7 +2,7 @@
262
263 #include <netinet/in.h>
264 #include <linux/fou.h>
265-#include <linux/if_arp.h>
266+//#include <linux/if_arp.h>
267 #include <linux/if_tunnel.h>
268 #include <linux/ip.h>
269 #include <linux/ip6_tunnel.h>
270diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
271index 380547ee1e..137c1adf8a 100644
272--- a/src/network/netdev/vcan.c
273+++ b/src/network/netdev/vcan.c
274@@ -1,6 +1,6 @@
275 /* SPDX-License-Identifier: LGPL-2.1-or-later */
276
277-#include <linux/if_arp.h>
278+//#include <linux/if_arp.h>
279
280 #include "vcan.h"
281
282diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
283index 54d3b59734..f3f75e22b5 100644
284--- a/src/network/netdev/veth.c
285+++ b/src/network/netdev/veth.c
286@@ -3,7 +3,7 @@
287 /* Make sure the net/if.h header is included before any linux/ one */
288 #include <net/if.h>
289 #include <errno.h>
290-#include <linux/if_arp.h>
291+//#include <linux/if_arp.h>
292 #include <linux/veth.h>
293 #include <netinet/in.h>
294
295diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
296index 60e49a5b8a..266fd58813 100644
297--- a/src/network/netdev/vlan.c
298+++ b/src/network/netdev/vlan.c
299@@ -3,7 +3,7 @@
300 /* Make sure the net/if.h header is included before any linux/ one */
301 #include <net/if.h>
302 #include <errno.h>
303-#include <linux/if_arp.h>
304+//#include <linux/if_arp.h>
305 #include <linux/if_vlan.h>
306
307 #include "parse-util.h"
308diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
309index c35419f859..4d1d3ef141 100644
310--- a/src/network/netdev/vrf.c
311+++ b/src/network/netdev/vrf.c
312@@ -2,8 +2,8 @@
313
314 /* Make sure the net/if.h header is included before any linux/ one */
315 #include <net/if.h>
316-#include <linux/if_arp.h>
317 #include <netinet/in.h>
318+//#include <linux/if_arp.h>
319
320 #include "vrf.h"
321
322diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
323index 2de89b8e24..ce1b8f9b69 100644
324--- a/src/network/netdev/vxcan.c
325+++ b/src/network/netdev/vxcan.c
326@@ -1,7 +1,7 @@
327 /* SPDX-License-Identifier: LGPL-2.1-or-later */
328
329 #include <linux/can/vxcan.h>
330-#include <linux/if_arp.h>
331+//#include <linux/if_arp.h>
332
333 #include "vxcan.h"
334
335diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
336index d8a066370d..8f94eeb763 100644
337--- a/src/network/netdev/vxlan.c
338+++ b/src/network/netdev/vxlan.c
339@@ -3,7 +3,7 @@
340 /* Make sure the net/if.h header is included before any linux/ one */
341 #include <net/if.h>
342 #include <netinet/in.h>
343-#include <linux/if_arp.h>
344+//#include <linux/if_arp.h>
345
346 #include "conf-parser.h"
347 #include "alloc-util.h"
348diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
349index 8d1dddf828..5182783f45 100644
350--- a/src/network/netdev/wireguard.c
351+++ b/src/network/netdev/wireguard.c
352@@ -5,7 +5,7 @@
353
354 /* Make sure the net/if.h header is included before any linux/ one */
355 #include <net/if.h>
356-#include <linux/if_arp.h>
357+//#include <linux/if_arp.h>
358 #include <linux/ipv6_route.h>
359 #include <netinet/in.h>
360 #include <sys/ioctl.h>
361diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
362index 905bfc0bdf..39e34dbb3b 100644
363--- a/src/network/netdev/xfrm.c
364+++ b/src/network/netdev/xfrm.c
365@@ -1,6 +1,6 @@
366 /* SPDX-License-Identifier: LGPL-2.1-or-later */
367
368-#include <linux/if_arp.h>
369+//#include <linux/if_arp.h>
370
371 #include "missing_network.h"
372 #include "xfrm.h"
373diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
374index 8b64dfe8f0..caa2885728 100644
375--- a/src/network/networkd-dhcp-common.c
376+++ b/src/network/networkd-dhcp-common.c
377@@ -1,7 +1,8 @@
378 /* SPDX-License-Identifier: LGPL-2.1-or-later */
379
380 #include <netinet/in.h>
381-#include <linux/if_arp.h>
382+//#include <linux/if_arp.h>
383+#include <net/if.h>
384
385 #include "bus-error.h"
386 #include "bus-locator.h"
387diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c
388index 16426de981..3d8efc05f1 100644
389--- a/src/network/networkd-dhcp-prefix-delegation.c
390+++ b/src/network/networkd-dhcp-prefix-delegation.c
391@@ -1,6 +1,5 @@
392 /* SPDX-License-Identifier: LGPL-2.1-or-later */
393
394-#include <linux/ipv6_route.h>
395
396 #include "dhcp6-lease-internal.h"
397 #include "hashmap.h"
398@@ -21,6 +20,8 @@
399 #include "strv.h"
400 #include "tunnel.h"
401
402+#include <linux/ipv6_route.h>
403+
404 bool link_dhcp_pd_is_enabled(Link *link) {
405 assert(link);
406
407diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
408index c35102af74..3be469ae16 100644
409--- a/src/network/networkd-dhcp-server.c
410+++ b/src/network/networkd-dhcp-server.c
411@@ -1,7 +1,7 @@
412 /* SPDX-License-Identifier: LGPL-2.1-or-later */
413
414 #include <netinet/in.h>
415-#include <linux/if_arp.h>
416+//#include <linux/if_arp.h>
417 #include <linux/if.h>
418
419 #include "sd-dhcp-server.h"
420diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
421index d94ac1a213..b8fe82cb6a 100644
422--- a/src/network/networkd-dhcp4.c
423+++ b/src/network/networkd-dhcp4.c
424@@ -3,7 +3,7 @@
425 #include <netinet/in.h>
426 #include <netinet/ip.h>
427 #include <linux/if.h>
428-#include <linux/if_arp.h>
429+//#include <linux/if_arp.h>
430
431 #include "alloc-util.h"
432 #include "device-private.h"
433diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
434index 04f51ab530..c4580754f7 100644
435--- a/src/network/networkd-ipv6ll.c
436+++ b/src/network/networkd-ipv6ll.c
437@@ -1,7 +1,7 @@
438 /* SPDX-License-Identifier: LGPL-2.1-or-later */
439
440 #include <linux/if.h>
441-#include <linux/if_arp.h>
442+//#include <linux/if_arp.h>
443
444 #include "in-addr-util.h"
445 #include "networkd-address.h"
446diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
447index 3c042e6c18..05fe2cb900 100644
448--- a/src/network/networkd-link.c
449+++ b/src/network/networkd-link.c
450@@ -4,7 +4,7 @@
451 #include <net/if.h>
452 #include <netinet/in.h>
453 #include <linux/if.h>
454-#include <linux/if_arp.h>
455+//#include <linux/if_arp.h>
456 #include <linux/if_link.h>
457 #include <linux/netdevice.h>
458 #include <sys/socket.h>
459diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
460index 33e86fb04e..51292871fc 100644
461--- a/src/network/networkd-ndisc.c
462+++ b/src/network/networkd-ndisc.c
463@@ -6,7 +6,7 @@
464 #include <arpa/inet.h>
465 #include <netinet/icmp6.h>
466 #include <linux/if.h>
467-#include <linux/if_arp.h>
468+//#include <linux/if_arp.h>
469
470 #include "sd-ndisc.h"
471
472diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
473index 8519e6e7a0..7aca2bbecc 100644
474--- a/src/network/networkd-setlink.c
475+++ b/src/network/networkd-setlink.c
476@@ -2,7 +2,7 @@
477
478 #include <netinet/in.h>
479 #include <linux/if.h>
480-#include <linux/if_arp.h>
481+//#include <linux/if_arp.h>
482 #include <linux/if_bridge.h>
483 #include <linux/ipv6.h>
484
485diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
486index 10a35bc44b..84c6b68ee4 100644
487--- a/src/network/networkd-sysctl.c
488+++ b/src/network/networkd-sysctl.c
489@@ -2,7 +2,7 @@
490
491 #include <netinet/in.h>
492 #include <linux/if.h>
493-#include <linux/if_arp.h>
494+//#include <linux/if_arp.h>
495
496 #include "sd-messages.h"
497
498diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
499index 978ce42341..899b5f613f 100644
500--- a/src/shared/netif-util.c
501+++ b/src/shared/netif-util.c
502@@ -1,7 +1,7 @@
503 /* SPDX-License-Identifier: LGPL-2.1-or-later */
504
505 #include <linux/if.h>
506-#include <linux/if_arp.h>
507+//#include <linux/if_arp.h>
508
509 #include "arphrd-util.h"
510 #include "device-util.h"
511diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
512index 09c04b9a7f..4686897dbf 100644
513--- a/src/udev/udev-builtin-net_id.c
514+++ b/src/udev/udev-builtin-net_id.c
515@@ -19,7 +19,7 @@
516 #include <stdarg.h>
517 #include <unistd.h>
518 #include <linux/if.h>
519-#include <linux/if_arp.h>
520+//#include <linux/if_arp.h>
521 #include <linux/netdevice.h>
522 #include <linux/pci_regs.h>
523
524--
5252.34.1
526
diff --git a/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
deleted file mode 100644
index 31747c6b40..0000000000
--- a/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 32dd7a47b87793cd836ab4bb776d1524f24c2d58 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:27:54 +0800
4Subject: [PATCH 17/26] missing_type.h: add __compar_d_fn_t definition
5
6Fix the following compile failure:
7src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'?
8
9Upstream-Status: Inappropriate [musl specific]
10
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12---
13 src/basic/missing_type.h | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
17index 3df1084ef2..697aa7f58a 100644
18--- a/src/basic/missing_type.h
19+++ b/src/basic/missing_type.h
20@@ -13,6 +13,7 @@
21
22 #ifndef __GLIBC__
23 typedef int (*comparison_fn_t)(const void *, const void *);
24+typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
25 #endif
26
27 #ifndef __COMPAR_FN_T
28--
292.27.0
30
diff --git a/meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch b/meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
new file mode 100644
index 0000000000..a92b8cc80f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
@@ -0,0 +1,52 @@
1From 349f9a0f9ecfc6575a3d9eeaffe89536e6a43914 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 8 Nov 2022 13:31:34 -0800
4Subject: [PATCH 18/26] test-bus-error: strerror() is assumed to be GNU
5 specific version mark it so
6
7Upstream-Status: Inappropriate [Upstream systemd only supports glibc]
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 src/libsystemd/sd-bus/test-bus-error.c | 2 ++
12 src/test/test-errno-util.c | 3 ++-
13 2 files changed, 4 insertions(+), 1 deletion(-)
14
15diff --git a/src/libsystemd/sd-bus/test-bus-error.c b/src/libsystemd/sd-bus/test-bus-error.c
16index 91045c06c2..a06b9bac0c 100644
17--- a/src/libsystemd/sd-bus/test-bus-error.c
18+++ b/src/libsystemd/sd-bus/test-bus-error.c
19@@ -99,7 +99,9 @@ TEST(error) {
20 assert_se(!sd_bus_error_is_set(&error));
21 assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY);
22 assert_se(streq(error.name, "System.Error.EBUSY"));
23+#ifdef __GLIBC__
24 assert_se(streq(error.message, STRERROR(EBUSY)));
25+#endif
26 assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY"));
27 assert_se(sd_bus_error_get_errno(&error) == EBUSY);
28 assert_se(sd_bus_error_is_set(&error));
29diff --git a/src/test/test-errno-util.c b/src/test/test-errno-util.c
30index ab463bd1b3..e2ebcaaf33 100644
31--- a/src/test/test-errno-util.c
32+++ b/src/test/test-errno-util.c
33@@ -4,7 +4,7 @@
34 #include "stdio-util.h"
35 #include "string-util.h"
36 #include "tests.h"
37-
38+#ifdef __GLIBC__
39 TEST(strerror_not_threadsafe) {
40 /* Just check that strerror really is not thread-safe. */
41 log_info("strerror(%d) → %s", 200, strerror(200));
42@@ -46,6 +46,7 @@ TEST(STRERROR_OR_ELSE) {
43 log_info("STRERROR_OR_ELSE(EPERM, \"EOF\") → %s", STRERROR_OR_EOF(EPERM));
44 log_info("STRERROR_OR_ELSE(-EPERM, \"EOF\") → %s", STRERROR_OR_EOF(-EPERM));
45 }
46+#endif /* __GLIBC__ */
47
48 TEST(PROTECT_ERRNO) {
49 errno = 12;
50--
512.34.1
52
diff --git a/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch
deleted file mode 100644
index 6ca196489b..0000000000
--- a/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From e427f03de2c56e868bb0f24aa231315b2dae1b71 Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Fri, 7 Aug 2020 15:19:27 +0000
4Subject: [PATCH 19/26] Handle missing LOCK_EX
5
6Upstream-Status: Inappropriate [musl specific]
7Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
8---
9 src/partition/makefs.c | 1 +
10 1 file changed, 1 insertion(+)
11
12diff --git a/src/partition/makefs.c b/src/partition/makefs.c
13index fd924d2231..b97580fdcc 100644
14--- a/src/partition/makefs.c
15+++ b/src/partition/makefs.c
16@@ -6,6 +6,7 @@
17 #include <sys/stat.h>
18 #include <sys/types.h>
19 #include <unistd.h>
20+#include <sys/file.h>
21
22 #include "alloc-util.h"
23 #include "blockdev-util.h"
24--
252.27.0
26
diff --git a/meta/recipes-core/systemd/systemd/0019-errno-util-Make-STRERROR-portable-for-musl.patch b/meta/recipes-core/systemd/systemd/0019-errno-util-Make-STRERROR-portable-for-musl.patch
new file mode 100644
index 0000000000..56083cc7b3
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0019-errno-util-Make-STRERROR-portable-for-musl.patch
@@ -0,0 +1,41 @@
1From 28fa1d5f56c6ddee9e336e6f2051c55e9f2f98b4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 23 Jan 2023 23:39:46 -0800
4Subject: [PATCH 19/26] errno-util: Make STRERROR portable for musl
5
6Sadly, systemd has decided to use yet another GNU extention in a macro
7lets make this such that we can use XSI compliant strerror_r() for
8non-glibc hosts
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/basic/errno-util.h | 10 +++++++++-
15 1 file changed, 9 insertions(+), 1 deletion(-)
16
17diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h
18index 48b76e4bf7..6e7653e2d9 100644
19--- a/src/basic/errno-util.h
20+++ b/src/basic/errno-util.h
21@@ -15,8 +15,16 @@
22 * https://stackoverflow.com/questions/34880638/compound-literal-lifetime-and-if-blocks
23 *
24 * Note that we use the GNU variant of strerror_r() here. */
25-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN)
26+static inline const char * STRERROR(int errnum);
27
28+static inline const char * STRERROR(int errnum) {
29+#ifdef __GLIBC__
30+ return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN);
31+#else
32+ static __thread char buf[ERRNO_BUF_LEN];
33+ return strerror_r(abs(errnum), buf, ERRNO_BUF_LEN) ? "unknown error" : buf;
34+#endif
35+}
36 /* A helper to print an error message or message for functions that return 0 on EOF.
37 * Note that we can't use ({ … }) to define a temporary variable, so errnum is
38 * evaluated twice. */
39--
402.34.1
41
diff --git a/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
deleted file mode 100644
index f74de43849..0000000000
--- a/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 9abbc5e69e21aef0d4d4567e69302fa660b76c53 Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Fri, 7 Aug 2020 15:20:17 +0000
4Subject: [PATCH 20/26] Fix incompatible pointer type struct sockaddr_un *
5
6| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c: In function 'cant_be_in_netns':
7| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:4893:25: error: passing argument 2 of 'connect' from incompatible pointer type [-Werror=incompatible-pointer-types]
8| 4893 | if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
9| | ^~~~~~
10| | |
11| | struct sockaddr_un *
12| In file included from ../../../../../../workspace/sources/systemd/src/systemd/sd-daemon.h:22,
13| from ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:21:
14| /home/ubuntu/poky/build/tmp/work/core2-64-poky-linux-musl/systemd/1_246-r0/recipe-sysroot/usr/include/sys/socket.h:384:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
15| 384 | int connect (int, const struct sockaddr *, socklen_t);
16| | ^~~~~~~~~~~~~~~~~~~~~~~
17| cc1: some warnings being treated as errors
18
19Upstream-Status: Inappropriate [musl specific]
20Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
21---
22 src/nspawn/nspawn.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
26index 0842731c18..3528b7ff14 100644
27--- a/src/nspawn/nspawn.c
28+++ b/src/nspawn/nspawn.c
29@@ -5084,7 +5084,7 @@ static int cant_be_in_netns(void) {
30 if (fd < 0)
31 return log_error_errno(errno, "Failed to allocate udev control socket: %m");
32
33- if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
34+ if (connect(fd, (struct sockaddr *)&sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
35
36 if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno))
37 return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
38--
392.27.0
40
diff --git a/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch b/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch
new file mode 100644
index 0000000000..16df44cd86
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch
@@ -0,0 +1,39 @@
1From 66de8a53849f76f5596327c38ae5f002b9f534cd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 2 Aug 2023 12:06:27 -0700
4Subject: [PATCH 20/26] sd-event: Make malloc_trim() conditional on glibc
5
6musl does not have this API
7
8Upstream-Status: Inappropriate [musl-specific]
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 src/libsystemd/sd-event/sd-event.c | 4 +++-
12 1 file changed, 3 insertions(+), 1 deletion(-)
13
14diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
15index 7aea7d2581..d3f4001f53 100644
16--- a/src/libsystemd/sd-event/sd-event.c
17+++ b/src/libsystemd/sd-event/sd-event.c
18@@ -1881,7 +1881,7 @@ _public_ int sd_event_add_exit(
19 }
20
21 _public_ int sd_event_trim_memory(void) {
22- int r;
23+ int r = 0;
24
25 /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
26 * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
27@@ -1895,7 +1895,9 @@ _public_ int sd_event_trim_memory(void) {
28
29 usec_t before_timestamp = now(CLOCK_MONOTONIC);
30 hashmap_trim_pools();
31+#ifdef __GLIBC__
32 r = malloc_trim(0);
33+#endif
34 usec_t after_timestamp = now(CLOCK_MONOTONIC);
35
36 if (r > 0)
37--
382.34.1
39
diff --git a/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch b/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch
new file mode 100644
index 0000000000..7ab56ef8fb
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch
@@ -0,0 +1,57 @@
1From 93d13363c605fb2de484f38f3726f8fbad1c3540 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 2 Aug 2023 12:20:40 -0700
4Subject: [PATCH 21/26] shared: Do not use malloc_info on musl
5
6Upstream-Status: Inappropriate [musl-specific]
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 src/shared/bus-util.c | 5 +++--
10 src/shared/common-signal.c | 4 ++--
11 2 files changed, 5 insertions(+), 4 deletions(-)
12
13diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
14index ff80e580fc..a628a29d0c 100644
15--- a/src/shared/bus-util.c
16+++ b/src/shared/bus-util.c
17@@ -787,15 +787,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
18 _cleanup_close_ int fd = -EBADF;
19 size_t dump_size;
20 FILE *f;
21- int r;
22+ int r = 0;
23
24 assert(message);
25
26 f = memstream_init(&m);
27 if (!f)
28 return -ENOMEM;
29-
30+#ifdef __GLIBC__
31 r = RET_NERRNO(malloc_info(/* options= */ 0, f));
32+#endif
33 if (r < 0)
34 return r;
35
36diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
37index 8e70e365dd..9e782caec9 100644
38--- a/src/shared/common-signal.c
39+++ b/src/shared/common-signal.c
40@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
41 log_oom();
42 break;
43 }
44-
45+#ifdef __GLIBC__
46 if (malloc_info(0, f) < 0) {
47 log_error_errno(errno, "Failed to invoke malloc_info(): %m");
48 break;
49 }
50-
51+#endif
52 (void) memstream_dump(LOG_INFO, &m);
53 break;
54 }
55--
562.34.1
57
diff --git a/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch
deleted file mode 100644
index fa6652a5bf..0000000000
--- a/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 1f5bc54bed0b365e7e448c26f6c792dbe8b3b198 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 16:53:06 +0800
4Subject: [PATCH 21/26] test-json.c: define M_PIl
5
6Fix the following compile failure:
7src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'?
8
9Upstream-Status: Inappropriate [musl specific]
10
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12---
13 src/test/test-json.c | 4 ++++
14 1 file changed, 4 insertions(+)
15
16diff --git a/src/test/test-json.c b/src/test/test-json.c
17index 1d4b11945e..572c8cf9d0 100644
18--- a/src/test/test-json.c
19+++ b/src/test/test-json.c
20@@ -13,6 +13,10 @@
21 #include "tests.h"
22 #include "util.h"
23
24+#ifndef M_PIl
25+#define M_PIl 3.141592653589793238462643383279502884L
26+#endif
27+
28 static void test_tokenizer(const char *data, ...) {
29 unsigned line = 0, column = 0;
30 void *state = NULL;
31--
322.27.0
33
diff --git a/meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch b/meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch
new file mode 100644
index 0000000000..d06967f8d5
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch
@@ -0,0 +1,56 @@
1From 5b8df64993b68a5a4af0f214d8cae77f4e716593 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 2 Jan 2024 11:03:27 +0800
4Subject: [PATCH 22/26] avoid missing LOCK_EX declaration
5
6This only happens on MUSL. Include sys/file.h to avoid compilation
7error about missing LOCK_EX declaration.
8
9Upstream-Status: Inappropriate [musl specific]
10
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12---
13 src/basic/fd-util.h | 1 +
14 src/core/exec-invoke.c | 1 +
15 src/shared/dev-setup.h | 1 +
16 3 files changed, 3 insertions(+)
17
18diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
19index 93b254c680..5f0b1a816d 100644
20--- a/src/basic/fd-util.h
21+++ b/src/basic/fd-util.h
22@@ -6,6 +6,7 @@
23 #include <stdbool.h>
24 #include <stdio.h>
25 #include <sys/socket.h>
26+#include <sys/file.h>
27
28 #include "macro.h"
29 #include "missing_fcntl.h"
30diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c
31index 9d636f5529..6be43caa57 100644
32--- a/src/core/exec-invoke.c
33+++ b/src/core/exec-invoke.c
34@@ -5,6 +5,7 @@
35 #include <sys/ioctl.h>
36 #include <sys/mount.h>
37 #include <sys/prctl.h>
38+#include <sys/file.h>
39
40 #if HAVE_PAM
41 #include <security/pam_appl.h>
42diff --git a/src/shared/dev-setup.h b/src/shared/dev-setup.h
43index 92ba6cf764..ba01a0ae55 100644
44--- a/src/shared/dev-setup.h
45+++ b/src/shared/dev-setup.h
46@@ -2,6 +2,7 @@
47 #pragma once
48
49 #include <sys/types.h>
50+#include <sys/file.h>
51
52 int dev_setup(const char *prefix, uid_t uid, gid_t gid);
53
54--
552.34.1
56
diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
deleted file mode 100644
index 675fd20f11..0000000000
--- a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
+++ /dev/null
@@ -1,413 +0,0 @@
1From 564dba5ad0cd884e3f69fa19ca64095413578ea5 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Fri, 1 Mar 2019 15:22:15 +0800
4Subject: [PATCH 22/26] do not disable buffer in writing files
5
6Do not disable buffer in writing files, otherwise we get
7failure at boot for musl like below.
8
9 [!!!!!!] Failed to allocate manager object.
10
11And there will be other failures, critical or not critical.
12This is specific to musl.
13
14Upstream-Status: Inappropriate [musl]
15
16Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
17[Rebased for v242]
18Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21---
22 src/basic/cgroup-util.c | 10 +++++-----
23 src/basic/procfs-util.c | 4 ++--
24 src/basic/smack-util.c | 2 +-
25 src/basic/util.c | 2 +-
26 src/binfmt/binfmt.c | 6 +++---
27 src/core/main.c | 4 ++--
28 src/core/smack-setup.c | 8 ++++----
29 src/hibernate-resume/hibernate-resume.c | 2 +-
30 src/libsystemd/sd-device/sd-device.c | 2 +-
31 src/login/logind-dbus.c | 2 +-
32 src/nspawn/nspawn-cgroup.c | 2 +-
33 src/nspawn/nspawn.c | 6 +++---
34 src/shared/cgroup-setup.c | 4 ++--
35 src/shared/sysctl-util.c | 2 +-
36 src/sleep/sleep.c | 8 ++++----
37 src/udev/udevadm-trigger.c | 2 +-
38 src/udev/udevd.c | 2 +-
39 src/vconsole/vconsole-setup.c | 2 +-
40 18 files changed, 35 insertions(+), 35 deletions(-)
41
42diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
43index bb960f183c..cb804c5f4b 100644
44--- a/src/basic/cgroup-util.c
45+++ b/src/basic/cgroup-util.c
46@@ -759,7 +759,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
47
48 sc = strstrip(contents);
49 if (isempty(sc)) {
50- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
51+ r = write_string_file(fs, agent, 0);
52 if (r < 0)
53 return r;
54 } else if (!path_equal(sc, agent))
55@@ -777,7 +777,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
56
57 sc = strstrip(contents);
58 if (streq(sc, "0")) {
59- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
60+ r = write_string_file(fs, "1", 0);
61 if (r < 0)
62 return r;
63
64@@ -804,7 +804,7 @@ int cg_uninstall_release_agent(const char *controller) {
65 if (r < 0)
66 return r;
67
68- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
69+ r = write_string_file(fs, "0", 0);
70 if (r < 0)
71 return r;
72
73@@ -814,7 +814,7 @@ int cg_uninstall_release_agent(const char *controller) {
74 if (r < 0)
75 return r;
76
77- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
78+ r = write_string_file(fs, "", 0);
79 if (r < 0)
80 return r;
81
82@@ -1646,7 +1646,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
83 if (r < 0)
84 return r;
85
86- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
87+ return write_string_file(p, value, 0);
88 }
89
90 int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
91diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
92index 8f9eee8d36..480f8cc0b4 100644
93--- a/src/basic/procfs-util.c
94+++ b/src/basic/procfs-util.c
95@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
96 * decrease it, as threads-max is the much more relevant sysctl. */
97 if (limit > pid_max-1) {
98 sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
99- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
100+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
101 if (r < 0)
102 return r;
103 }
104
105 sprintf(buffer, "%" PRIu64, limit);
106- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
107+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
108 if (r < 0) {
109 uint64_t threads_max;
110
111diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
112index 3362ee3924..80c0f2a52e 100644
113--- a/src/basic/smack-util.c
114+++ b/src/basic/smack-util.c
115@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
116 return 0;
117
118 p = procfs_file_alloca(pid, "attr/current");
119- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
120+ r = write_string_file(p, label, 0);
121 if (r < 0)
122 return r;
123
124diff --git a/src/basic/util.c b/src/basic/util.c
125index f98ecf3858..13e0f7431f 100644
126--- a/src/basic/util.c
127+++ b/src/basic/util.c
128@@ -267,7 +267,7 @@ void disable_coredumps(void) {
129 if (detect_container() > 0)
130 return;
131
132- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
133+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
134 if (r < 0)
135 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
136 }
137diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
138index 43ed2f385b..37a6f578f7 100644
139--- a/src/binfmt/binfmt.c
140+++ b/src/binfmt/binfmt.c
141@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) {
142 if (!fn)
143 return log_oom();
144
145- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
146+ return write_string_file(fn, "-1", 0);
147 }
148
149 static int apply_rule(const char *rule) {
150@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) {
151
152 (void) delete_rule(rule);
153
154- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
155+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
156 if (r < 0)
157 return log_error_errno(r, "Failed to add binary format: %m");
158
159@@ -223,7 +223,7 @@ static int run(int argc, char *argv[]) {
160 }
161
162 /* Flush out all rules */
163- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
164+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
165
166 STRV_FOREACH(f, files) {
167 k = apply_file(*f, true);
168diff --git a/src/core/main.c b/src/core/main.c
169index a280b756ff..334532cd42 100644
170--- a/src/core/main.c
171+++ b/src/core/main.c
172@@ -1382,7 +1382,7 @@ static int bump_unix_max_dgram_qlen(void) {
173 if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
174 return 0;
175
176- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
177+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
178 if (r < 0)
179 return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
180 "Failed to bump AF_UNIX datagram queue length, ignoring: %m");
181@@ -1666,7 +1666,7 @@ static void initialize_core_pattern(bool skip_setup) {
182 if (getpid_cached() != 1)
183 return;
184
185- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
186+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
187 if (r < 0)
188 log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern);
189 }
190diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
191index 1fe592af70..603942a000 100644
192--- a/src/core/smack-setup.c
193+++ b/src/core/smack-setup.c
194@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) {
195 }
196
197 #ifdef SMACK_RUN_LABEL
198- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
199+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
200 if (r < 0)
201 log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
202- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
203+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
204 if (r < 0)
205 log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
206 r = write_string_file("/sys/fs/smackfs/netlabel",
207- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
208+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
209 if (r < 0)
210 log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
211- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
212+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
213 if (r < 0)
214 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
215 #endif
216diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
217index d8f91f4e66..a088e6e2d8 100644
218--- a/src/hibernate-resume/hibernate-resume.c
219+++ b/src/hibernate-resume/hibernate-resume.c
220@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
221 return EXIT_FAILURE;
222 }
223
224- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
225+ r = write_string_file("/sys/power/resume", major_minor, 0);
226 if (r < 0) {
227 log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
228 return EXIT_FAILURE;
229diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
230index d06f90ce1d..43d0a58750 100644
231--- a/src/libsystemd/sd-device/sd-device.c
232+++ b/src/libsystemd/sd-device/sd-device.c
233@@ -1976,7 +1976,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
234 if (!value)
235 return -ENOMEM;
236
237- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
238+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
239 if (r < 0) {
240 if (r == -ELOOP)
241 return -EINVAL;
242diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
243index 7d757aa286..a5d9da5b7e 100644
244--- a/src/login/logind-dbus.c
245+++ b/src/login/logind-dbus.c
246@@ -1330,7 +1330,7 @@ static int trigger_device(Manager *m, sd_device *d) {
247 if (!t)
248 return -ENOMEM;
249
250- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
251+ (void) write_string_file(t, "change", 0);
252 }
253
254 return 0;
255diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
256index cb01b25bc6..e92051268b 100644
257--- a/src/nspawn/nspawn-cgroup.c
258+++ b/src/nspawn/nspawn-cgroup.c
259@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
260 fn = strjoina(tree, cgroup, "/cgroup.procs");
261
262 sprintf(pid_string, PID_FMT, pid);
263- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
264+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
265 if (r < 0) {
266 log_error_errno(r, "Failed to move process: %m");
267 goto finish;
268diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
269index 3528b7ff14..11b0c20f95 100644
270--- a/src/nspawn/nspawn.c
271+++ b/src/nspawn/nspawn.c
272@@ -2667,7 +2667,7 @@ static int reset_audit_loginuid(void) {
273 if (streq(p, "4294967295"))
274 return 0;
275
276- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
277+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
278 if (r < 0) {
279 log_error_errno(r,
280 "Failed to reset audit login UID. This probably means that your kernel is too\n"
281@@ -3920,13 +3920,13 @@ static int setup_uid_map(pid_t pid) {
282
283 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
284 xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range);
285- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
286+ r = write_string_file(uid_map, line, 0);
287 if (r < 0)
288 return log_error_errno(r, "Failed to write UID map: %m");
289
290 /* We always assign the same UID and GID ranges */
291 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
292- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
293+ r = write_string_file(uid_map, line, 0);
294 if (r < 0)
295 return log_error_errno(r, "Failed to write GID map: %m");
296
297diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
298index f197f715c7..077f893177 100644
299--- a/src/shared/cgroup-setup.c
300+++ b/src/shared/cgroup-setup.c
301@@ -267,7 +267,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
302
303 xsprintf(c, PID_FMT "\n", pid);
304
305- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
306+ r = write_string_file(fs, c, 0);
307 if (r < 0)
308 return r;
309
310@@ -799,7 +799,7 @@ int cg_enable_everywhere(
311 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
312 }
313
314- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
315+ r = write_string_stream(f, s, 0);
316 if (r < 0) {
317 log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
318 FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
319diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c
320index 670c33108b..7c7c3dcfb6 100644
321--- a/src/shared/sysctl-util.c
322+++ b/src/shared/sysctl-util.c
323@@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
324
325 log_debug("Setting '%s' to '%s'", p, value);
326
327- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
328+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0);
329 }
330
331 int sysctl_read(const char *property, char **content) {
332diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
333index 39ab554290..d0e566645d 100644
334--- a/src/sleep/sleep.c
335+++ b/src/sleep/sleep.c
336@@ -48,7 +48,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
337 assert(hibernate_location->swap);
338
339 xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
340- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
341+ r = write_string_file("/sys/power/resume", resume_str, 0);
342 if (r < 0)
343 return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
344 hibernate_location->swap->device, resume_str);
345@@ -75,7 +75,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
346 }
347
348 xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
349- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
350+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
351 if (r < 0)
352 return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
353 hibernate_location->swap->device, offset_str);
354@@ -92,7 +92,7 @@ static int write_mode(char **modes) {
355 STRV_FOREACH(mode, modes) {
356 int k;
357
358- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
359+ k = write_string_file("/sys/power/disk", *mode, 0);
360 if (k >= 0)
361 return 0;
362
363@@ -114,7 +114,7 @@ static int write_state(FILE **f, char **states) {
364 STRV_FOREACH(state, states) {
365 int k;
366
367- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
368+ k = write_string_stream(*f, *state, 0);
369 if (k >= 0)
370 return 0;
371 log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
372diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
373index 5c74184c33..65f528314e 100644
374--- a/src/udev/udevadm-trigger.c
375+++ b/src/udev/udevadm-trigger.c
376@@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set **settle_s
377 if (!filename)
378 return log_oom();
379
380- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER);
381+ r = write_string_file(filename, action, 0);
382 if (r < 0) {
383 bool ignore = IN_SET(r, -ENOENT, -ENODEV);
384
385diff --git a/src/udev/udevd.c b/src/udev/udevd.c
386index d24b8d4398..d123a43904 100644
387--- a/src/udev/udevd.c
388+++ b/src/udev/udevd.c
389@@ -1192,7 +1192,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) {
390
391 filename = strjoina(syspath, "/uevent");
392 log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath);
393- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
394+ r = write_string_file(filename, "change", 0);
395 if (r < 0)
396 return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename);
397 return 0;
398diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
399index b28e2853e1..115b7233a0 100644
400--- a/src/vconsole/vconsole-setup.c
401+++ b/src/vconsole/vconsole-setup.c
402@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
403 static int toggle_utf8_sysfs(bool utf8) {
404 int r;
405
406- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
407+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
408 if (r < 0)
409 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
410
411--
4122.27.0
413
diff --git a/meta/recipes-core/systemd/systemd/0023-include-signal.h-to-avoid-the-undeclared-error.patch b/meta/recipes-core/systemd/systemd/0023-include-signal.h-to-avoid-the-undeclared-error.patch
new file mode 100644
index 0000000000..c8bcd9e355
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0023-include-signal.h-to-avoid-the-undeclared-error.patch
@@ -0,0 +1,27 @@
1From e39afec7e5a2f3a9de7202affab4d0340ba879d7 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 2 Jul 2024 22:18:47 -0700
4Subject: [PATCH 23/26] include signal.h to avoid the 'undeclared' error
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
9---
10 src/basic/pidref.h | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/src/basic/pidref.h b/src/basic/pidref.h
14index 42ddf4e50b..b9cf53680f 100644
15--- a/src/basic/pidref.h
16+++ b/src/basic/pidref.h
17@@ -3,6 +3,7 @@
18
19 typedef struct PidRef PidRef;
20
21+#include <signal.h>
22 #include "macro.h"
23 #include "process-util.h"
24
25--
262.34.1
27
diff --git a/meta/recipes-core/systemd/systemd/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch b/meta/recipes-core/systemd/systemd/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch
new file mode 100644
index 0000000000..9532e6b9af
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch
@@ -0,0 +1,48 @@
1From 5a4334fde21b896cd75b2d1a56e06a4f365e9c4d Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 2 Jul 2024 22:44:31 -0700
4Subject: [PATCH 24/26] undef stdin for references using stdin as a struct
5 member
6
7In musl stdio.h, we have:
8include/stdio.h:#define stdin (stdin)
9
10This causes error when a struct member is also named stdin. undef it.
11
12Upstream-Status: Inappropriate [musl specific]
13
14Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
15---
16 src/shared/edit-util.c | 2 ++
17 src/systemctl/systemctl-edit.c | 2 ++
18 2 files changed, 4 insertions(+)
19
20diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
21index e37609c2e1..1b212ae7b4 100644
22--- a/src/shared/edit-util.c
23+++ b/src/shared/edit-util.c
24@@ -3,6 +3,8 @@
25 #include <errno.h>
26 #include <stdio.h>
27
28+#undef stdin
29+
30 #include "alloc-util.h"
31 #include "copy.h"
32 #include "edit-util.h"
33diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
34index c42a31153d..7695ceeead 100644
35--- a/src/systemctl/systemctl-edit.c
36+++ b/src/systemctl/systemctl-edit.c
37@@ -13,6 +13,8 @@
38 #include "systemctl.h"
39 #include "terminal-util.h"
40
41+#undef stdin
42+
43 int verb_cat(int argc, char *argv[], void *userdata) {
44 _cleanup_hashmap_free_ Hashmap *cached_id_map = NULL, *cached_name_map = NULL;
45 _cleanup_(lookup_paths_done) LookupPaths lp = {};
46--
472.34.1
48
diff --git a/meta/recipes-core/systemd/systemd/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch b/meta/recipes-core/systemd/systemd/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch
new file mode 100644
index 0000000000..d791ad2da1
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch
@@ -0,0 +1,288 @@
1From a90044320eecda424ed678d283ef60806c70fcda Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 2 Jul 2024 23:23:57 -0700
4Subject: [PATCH 25/26] adjust header inclusion order to avoid redeclaration
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
9---
10 src/basic/parse-util.c | 3 ++-
11 src/libsystemd-network/ndisc-option.c | 6 +++---
12 src/libsystemd-network/sd-radv.c | 5 +++--
13 src/network/netdev/l2tp-tunnel.c | 9 ++++-----
14 src/network/netdev/l2tp-tunnel.h | 6 +++---
15 src/network/netdev/wireguard.c | 2 +-
16 src/network/networkctl-link-info.c | 4 ++--
17 src/network/networkd-bridge-mdb.c | 3 ++-
18 src/network/networkd-route.c | 8 ++++----
19 src/resolve/resolved-dns-stream.c | 5 +++--
20 src/resolve/resolved-manager.c | 5 +++--
21 src/shared/conf-parser.c | 3 ++-
22 12 files changed, 32 insertions(+), 27 deletions(-)
23
24diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
25index faa5344921..0fc9d12c89 100644
26--- a/src/basic/parse-util.c
27+++ b/src/basic/parse-util.c
28@@ -2,7 +2,6 @@
29
30 #include <errno.h>
31 #include <inttypes.h>
32-#include <linux/ipv6.h>
33 #include <net/if.h>
34 #include <stdio.h>
35 #include <stdlib.h>
36@@ -20,6 +19,8 @@
37 #include "string-util.h"
38 #include "strv.h"
39
40+#include <linux/ipv6.h>
41+
42 int parse_boolean(const char *v) {
43 if (!v)
44 return -EINVAL;
45diff --git a/src/libsystemd-network/ndisc-option.c b/src/libsystemd-network/ndisc-option.c
46index 3aab51f51b..feeb4c78e5 100644
47--- a/src/libsystemd-network/ndisc-option.c
48+++ b/src/libsystemd-network/ndisc-option.c
49@@ -1,8 +1,5 @@
50 /* SPDX-License-Identifier: LGPL-2.1-or-later */
51
52-#include <linux/ipv6.h>
53-#include <netinet/icmp6.h>
54-
55 #include "dns-resolver-internal.h"
56 #include "dns-domain.h"
57 #include "ether-addr-util.h"
58@@ -16,6 +13,9 @@
59 #include "strv.h"
60 #include "unaligned.h"
61
62+#include <linux/ipv6.h>
63+#include <netinet/icmp6.h>
64+
65 /* RFC does not say anything about the maximum number of options, but let's limit the number of options for
66 * safety. Typically, the number of options in an ICMPv6 message should be only a few. */
67 #define MAX_OPTIONS 128
68diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c
69index f241929ad5..7cef3c3f71 100644
70--- a/src/libsystemd-network/sd-radv.c
71+++ b/src/libsystemd-network/sd-radv.c
72@@ -3,8 +3,6 @@
73 Copyright © 2017 Intel Corporation. All rights reserved.
74 ***/
75
76-#include <linux/ipv6.h>
77-#include <netinet/icmp6.h>
78 #include <netinet/in.h>
79 #include <arpa/inet.h>
80
81@@ -29,6 +27,9 @@
82 #include "strv.h"
83 #include "unaligned.h"
84
85+#include <linux/ipv6.h>
86+#include <netinet/icmp6.h>
87+
88 int sd_radv_new(sd_radv **ret) {
89 _cleanup_(sd_radv_unrefp) sd_radv *ra = NULL;
90
91diff --git a/src/network/netdev/l2tp-tunnel.c b/src/network/netdev/l2tp-tunnel.c
92index c87e44797b..437b40c114 100644
93--- a/src/network/netdev/l2tp-tunnel.c
94+++ b/src/network/netdev/l2tp-tunnel.c
95@@ -1,10 +1,5 @@
96 /* SPDX-License-Identifier: LGPL-2.1-or-later */
97
98-#include <netinet/in.h>
99-#include <linux/if_arp.h>
100-#include <linux/l2tp.h>
101-#include <linux/genetlink.h>
102-
103 #include "conf-parser.h"
104 #include "hashmap.h"
105 #include "l2tp-tunnel.h"
106@@ -17,6 +12,10 @@
107 #include "string-table.h"
108 #include "string-util.h"
109
110+#include <netinet/in.h>
111+#include <linux/l2tp.h>
112+#include <linux/genetlink.h>
113+
114 static const char* const l2tp_l2spec_type_table[_NETDEV_L2TP_L2SPECTYPE_MAX] = {
115 [NETDEV_L2TP_L2SPECTYPE_NONE] = "none",
116 [NETDEV_L2TP_L2SPECTYPE_DEFAULT] = "default",
117diff --git a/src/network/netdev/l2tp-tunnel.h b/src/network/netdev/l2tp-tunnel.h
118index c558ed49de..8419ef34c5 100644
119--- a/src/network/netdev/l2tp-tunnel.h
120+++ b/src/network/netdev/l2tp-tunnel.h
121@@ -1,13 +1,13 @@
122 /* SPDX-License-Identifier: LGPL-2.1-or-later */
123 #pragma once
124
125-#include <netinet/in.h>
126-#include <linux/l2tp.h>
127-
128 #include "in-addr-util.h"
129 #include "netdev.h"
130 #include "networkd-util.h"
131
132+#include <netinet/in.h>
133+#include <linux/l2tp.h>
134+
135 typedef enum L2tpL2specType {
136 NETDEV_L2TP_L2SPECTYPE_NONE = L2TP_L2SPECTYPE_NONE,
137 NETDEV_L2TP_L2SPECTYPE_DEFAULT = L2TP_L2SPECTYPE_DEFAULT,
138diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
139index 5182783f45..79b21cb4ba 100644
140--- a/src/network/netdev/wireguard.c
141+++ b/src/network/netdev/wireguard.c
142@@ -5,9 +5,9 @@
143
144 /* Make sure the net/if.h header is included before any linux/ one */
145 #include <net/if.h>
146+#include <netinet/in.h>
147 //#include <linux/if_arp.h>
148 #include <linux/ipv6_route.h>
149-#include <netinet/in.h>
150 #include <sys/ioctl.h>
151
152 #include "sd-resolve.h"
153diff --git a/src/network/networkctl-link-info.c b/src/network/networkctl-link-info.c
154index f356d3c231..216c442de1 100644
155--- a/src/network/networkctl-link-info.c
156+++ b/src/network/networkctl-link-info.c
157@@ -1,7 +1,5 @@
158 /* SPDX-License-Identifier: LGPL-2.1-or-later */
159
160-#include <linux/if_tunnel.h>
161-
162 #include "bus-common-errors.h"
163 #include "bus-error.h"
164 #include "bus-util.h"
165@@ -16,6 +14,8 @@
166 #include "strxcpyx.h"
167 #include "wifi-util.h"
168
169+#include <linux/if_tunnel.h>
170+
171 /* use 128 kB for receive socket kernel queue, we shouldn't need more here */
172 #define RCVBUF_SIZE (128*1024)
173
174diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
175index 358ca4d294..fe87f7c093 100644
176--- a/src/network/networkd-bridge-mdb.c
177+++ b/src/network/networkd-bridge-mdb.c
178@@ -2,7 +2,6 @@
179
180 /* Make sure the net/if.h header is included before any linux/ one */
181 #include <net/if.h>
182-#include <linux/if_bridge.h>
183
184 #include "netlink-util.h"
185 #include "networkd-bridge-mdb.h"
186@@ -13,6 +12,8 @@
187 #include "string-util.h"
188 #include "vlan-util.h"
189
190+#include <linux/if_bridge.h>
191+
192 #define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U
193
194 /* remove MDB entry. */
195diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
196index 0f3f79ec4f..325743bebf 100644
197--- a/src/network/networkd-route.c
198+++ b/src/network/networkd-route.c
199@@ -1,9 +1,5 @@
200 /* SPDX-License-Identifier: LGPL-2.1-or-later */
201
202-#include <linux/if.h>
203-#include <linux/ipv6_route.h>
204-#include <linux/nexthop.h>
205-
206 #include "alloc-util.h"
207 #include "event-util.h"
208 #include "netlink-util.h"
209@@ -21,6 +17,10 @@
210 #include "vrf.h"
211 #include "wireguard.h"
212
213+#include <linux/if.h>
214+#include <linux/ipv6_route.h>
215+#include <linux/nexthop.h>
216+
217 static Route* route_detach_impl(Route *route) {
218 assert(route);
219 assert(!!route->network + !!route->manager + !!route->wireguard <= 1);
220diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c
221index e57af66221..f66d8f0606 100644
222--- a/src/resolve/resolved-dns-stream.c
223+++ b/src/resolve/resolved-dns-stream.c
224@@ -1,7 +1,5 @@
225 /* SPDX-License-Identifier: LGPL-2.1-or-later */
226
227-#include <linux/if_arp.h>
228-#include <netinet/tcp.h>
229 #include <unistd.h>
230
231 #include "alloc-util.h"
232@@ -12,6 +10,9 @@
233 #include "resolved-dns-stream.h"
234 #include "resolved-manager.h"
235
236+//#include <linux/if_arp.h>
237+#include <netinet/tcp.h>
238+
239 #define DNS_STREAMS_MAX 128
240
241 #define DNS_QUERIES_PER_STREAM 32
242diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
243index dbaad81734..b988e75851 100644
244--- a/src/resolve/resolved-manager.c
245+++ b/src/resolve/resolved-manager.c
246@@ -1,8 +1,6 @@
247 /* SPDX-License-Identifier: LGPL-2.1-or-later */
248
249 #include <fcntl.h>
250-#include <linux/ipv6.h>
251-#include <netinet/in.h>
252 #include <poll.h>
253 #include <sys/ioctl.h>
254 #include <sys/stat.h>
255@@ -46,6 +44,9 @@
256 #include "utf8.h"
257 #include "varlink-util.h"
258
259+#include <linux/ipv6.h>
260+#include <netinet/in.h>
261+
262 #define SEND_TIMEOUT_USEC (200 * USEC_PER_MSEC)
263
264 static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {
265diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
266index eaa8a5f11c..03379e7474 100644
267--- a/src/shared/conf-parser.c
268+++ b/src/shared/conf-parser.c
269@@ -2,7 +2,6 @@
270
271 #include <errno.h>
272 #include <limits.h>
273-#include <linux/ipv6.h>
274 #include <stdint.h>
275 #include <stdio.h>
276 #include <stdlib.h>
277@@ -47,6 +46,8 @@
278 #include "time-util.h"
279 #include "utf8.h"
280
281+#include <linux/ipv6.h>
282+
283 DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(config_file_hash_ops_fclose,
284 char, path_hash_func, path_compare,
285 FILE, safe_fclose);
286--
2872.34.1
288
diff --git a/meta/recipes-core/systemd/systemd/0026-build-path.c-avoid-boot-time-segfault-for-musl.patch b/meta/recipes-core/systemd/systemd/0026-build-path.c-avoid-boot-time-segfault-for-musl.patch
new file mode 100644
index 0000000000..a7549ee151
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0026-build-path.c-avoid-boot-time-segfault-for-musl.patch
@@ -0,0 +1,31 @@
1From f2a7cf1d2a2bc2516a180809efd85c828cd9c7f4 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 3 Jul 2024 07:18:42 -0700
4Subject: [PATCH 26/26] build-path.c: avoid boot time segfault for musl
5
6This function, at runtime, should return -ENOEXEC. For musl, it
7somehow segfaults. I think it's related to getauxval, but it's
8really does not matter, just return -ENOEXEC.
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13---
14 src/basic/build-path.c | 1 +
15 1 file changed, 1 insertion(+)
16
17diff --git a/src/basic/build-path.c b/src/basic/build-path.c
18index b5972658df..4ef551034e 100644
19--- a/src/basic/build-path.c
20+++ b/src/basic/build-path.c
21@@ -151,6 +151,7 @@ int get_build_exec_dir(char **ret) {
22 */
23
24 static int runpath_cached = -ERRNO_MAX-1;
25+ return -ENOEXEC;
26 if (runpath_cached == -ERRNO_MAX-1) {
27 const char *runpath = NULL;
28
29--
302.34.1
31
diff --git a/meta/recipes-core/systemd/systemd/0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch b/meta/recipes-core/systemd/systemd/0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch
deleted file mode 100644
index 94a4c307b5..0000000000
--- a/meta/recipes-core/systemd/systemd/0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch
+++ /dev/null
@@ -1,97 +0,0 @@
1From 297aba739cd689e4dc9f43bb1422ec88d481099a Mon Sep 17 00:00:00 2001
2From: Paul Gortmaker <paul.gortmaker@windriver.com>
3Date: Wed, 13 Jan 2021 21:09:33 +0000
4Subject: [PATCH] proc: dont trigger mount error with invalid options on old
5 kernels
6
7As of commit 4e39995371738b04d98d27b0d34ea8fe09ec9fab ("core: introduce
8ProtectProc= and ProcSubset= to expose hidepid= and subset= procfs
9mount options") kernels older than v5.8 generate multple warnings at
10boot, as seen in this Yocto build from today:
11
12 qemux86-64 login: root
13 [ 65.829009] proc: Bad value for 'hidepid'
14 root@qemux86-64:~# dmesg|grep proc:
15 [ 16.990706] proc: Bad value for 'hidepid'
16 [ 28.060178] proc: Bad value for 'hidepid'
17 [ 28.874229] proc: Bad value for 'hidepid'
18 [ 32.685107] proc: Bad value for 'hidepid'
19 [ 65.829009] proc: Bad value for 'hidepid'
20 root@qemux86-64:~#
21
22The systemd maintainer has dismissed this as something people should
23simply ignore[1] and has no interest in trying to avoid it by
24proactively checking the kernel version, so people can safely assume
25that they will never see this version check commit upstream.
26
27However, as can be seen above, telling people to just ignore it is not
28an option, as we'll end up answering the same question and dealing with
29the same bug over and over again.
30
31The commit that triggers this is systemd v247-rc1~378^2~3 -- so any
32systemd 247 and above plus kernel v5.7 or older will need this.
33
34[1] https://github.com/systemd/systemd/issues/16896
35
36Upstream-Status: Denied [https://github.com/systemd/systemd/issues/16896]
37Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
38
39Index: git/src/core/namespace.c
40===================================================================
41--- git.orig/src/core/namespace.c
42+++ git/src/core/namespace.c
43@@ -4,7 +4,9 @@
44 #include <linux/loop.h>
45 #include <sched.h>
46 #include <stdio.h>
47+#include <stdlib.h>
48 #include <sys/mount.h>
49+#include <sys/utsname.h>
50 #include <unistd.h>
51 #include <linux/fs.h>
52
53@@ -860,13 +862,32 @@ static int mount_sysfs(const MountEntry
54
55 static int mount_procfs(const MountEntry *m, const NamespaceInfo *ns_info) {
56 const char *entry_path;
57- int r;
58+ int r, major, minor;
59+ struct utsname uts;
60+ bool old = false;
61
62 assert(m);
63 assert(ns_info);
64
65 entry_path = mount_entry_path(m);
66
67+ /* If uname says that the system is older than v5.8, then the textual hidepid= stuff is not
68+ * supported by the kernel, and thus the per-instance hidepid= neither, which means we
69+ * really don't want to use it, since it would affect our host's /proc * mount. Hence let's
70+ * gracefully fallback to a classic, unrestricted version. */
71+
72+ r = uname(&uts);
73+ if (r < 0)
74+ return errno;
75+
76+ major = atoi(uts.release);
77+ minor = atoi(strchr(uts.release, '.') + 1);
78+
79+ if (major < 5 || (major == 5 && minor < 8)) {
80+ log_debug("Pre v5.8 kernel detected [v%d.%d] - skipping hidepid=", major, minor);
81+ old = true;
82+ }
83+
84 /* Mount a new instance, so that we get the one that matches our user namespace, if we are running in
85 * one. i.e we don't reuse existing mounts here under any condition, we want a new instance owned by
86 * our user namespace and with our hidepid= settings applied. Hence, let's get rid of everything
87@@ -875,8 +896,8 @@ static int mount_procfs(const MountEntry
88 (void) mkdir_p_label(entry_path, 0755);
89 (void) umount_recursive(entry_path, 0);
90
91- if (ns_info->protect_proc != PROTECT_PROC_DEFAULT ||
92- ns_info->proc_subset != PROC_SUBSET_ALL) {
93+ if (!old && (ns_info->protect_proc != PROTECT_PROC_DEFAULT ||
94+ ns_info->proc_subset != PROC_SUBSET_ALL)) {
95 _cleanup_free_ char *opts = NULL;
96
97 /* Starting with kernel 5.8 procfs' hidepid= logic is truly per-instance (previously it
diff --git a/meta/recipes-core/systemd/systemd_247.3.bb b/meta/recipes-core/systemd/systemd_247.3.bb
deleted file mode 100644
index c0073ad7b0..0000000000
--- a/meta/recipes-core/systemd/systemd_247.3.bb
+++ /dev/null
@@ -1,762 +0,0 @@
1require systemd.inc
2
3PROVIDES = "udev"
4
5PE = "1"
6
7DEPENDS = "intltool-native gperf-native libcap util-linux"
8
9SECTION = "base/shell"
10
11inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check
12
13# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
14# that we don't build both udev and systemd in world builds.
15REQUIRED_DISTRO_FEATURES = "systemd"
16
17SRC_URI += "file://touchscreen.rules \
18 file://00-create-volatile.conf \
19 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
20 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
21 file://init \
22 file://99-default.preset \
23 file://systemd-pager.sh \
24 file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
25 file://0003-implment-systemd-sysv-install-for-OE.patch \
26 file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
27 file://0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch \
28 file://0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch \
29 file://0001-analyze-resolve-executable-path-if-it-is-relative.patch \
30 "
31
32# patches needed by musl
33SRC_URI_append_libc-musl = " ${SRC_URI_MUSL}"
34SRC_URI_MUSL = "\
35 file://0002-don-t-use-glibc-specific-qsort_r.patch \
36 file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \
37 file://0004-add-fallback-parse_printf_format-implementation.patch \
38 file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \
39 file://0006-Include-netinet-if_ether.h.patch \
40 file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
41 file://0008-add-missing-FTW_-macros-for-musl.patch \
42 file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \
43 file://0010-Use-uintmax_t-for-handling-rlim_t.patch \
44 file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \
45 file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
46 file://0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
47 file://0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
48 file://0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
49 file://0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \
50 file://0017-missing_type.h-add-__compar_d_fn_t-definition.patch \
51 file://0018-avoid-redefinition-of-prctl_mm_map-structure.patch \
52 file://0019-Handle-missing-LOCK_EX.patch \
53 file://0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch \
54 file://0021-test-json.c-define-M_PIl.patch \
55 file://0022-do-not-disable-buffer-in-writing-files.patch \
56 file://0025-Handle-__cpu_mask-usage.patch \
57 file://0026-Handle-missing-gshadow.patch \
58 "
59
60PAM_PLUGINS = " \
61 pam-plugin-unix \
62 pam-plugin-loginuid \
63 pam-plugin-keyinit \
64"
65
66PACKAGECONFIG ??= " \
67 ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit', d)} \
68 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
69 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
70 backlight \
71 binfmt \
72 gshadow \
73 hibernate \
74 hostnamed \
75 idn \
76 ima \
77 kmod \
78 localed \
79 logind \
80 machined \
81 myhostname \
82 networkd \
83 nss \
84 nss-mymachines \
85 nss-resolve \
86 quotacheck \
87 randomseed \
88 resolved \
89 set-time-epoch \
90 sysusers \
91 sysvinit \
92 timedated \
93 timesyncd \
94 userdb \
95 utmp \
96 vconsole \
97 xz \
98"
99
100PACKAGECONFIG_remove_libc-musl = " \
101 gshadow \
102 idn \
103 localed \
104 myhostname \
105 nss \
106 nss-mymachines \
107 nss-resolve \
108 sysusers \
109 userdb \
110 utmp \
111"
112
113CFLAGS_append_libc-musl = " -D__UAPI_DEF_ETHHDR=0 "
114
115# Some of the dependencies are weak-style recommends - if not available at runtime,
116# systemd won't fail but the library-related feature will be skipped with a warning.
117
118# Use the upstream systemd serial-getty@.service and rely on
119# systemd-getty-generator instead of using the OE-core specific
120# systemd-serialgetty.bb - not enabled by default.
121PACKAGECONFIG[serial-getty-generator] = ""
122
123PACKAGECONFIG[acl] = "-Dacl=true,-Dacl=false,acl"
124PACKAGECONFIG[audit] = "-Daudit=true,-Daudit=false,audit"
125PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false"
126PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false"
127PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2"
128PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid"
129PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false"
130PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup"
131PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus"
132PACKAGECONFIG[efi] = "-Defi=true,-Defi=false"
133PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi"
134PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils"
135PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false"
136# Sign the journal for anti-tampering
137PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt"
138PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls"
139PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false"
140PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false"
141PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false"
142PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
143PACKAGECONFIG[ima] = "-Dima=true,-Dima=false"
144# importd requires journal-upload/xz/zlib/bzip2/gcrypt
145PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false"
146# Update NAT firewall rules
147PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables"
148PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl"
149PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod"
150PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig"
151PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn"
152PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2"
153PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false"
154PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false"
155PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4"
156PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false"
157PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
158PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd"
159PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname"
160PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false"
161PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false"
162PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false"
163PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false"
164PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false"
165PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl"
166PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}"
167PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2"
168PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false"
169# If polkit is disabled and networkd+hostnamed are in use, enabling this option and
170# using dbus-broker will allow networkd to be authorized to change the
171# hostname without acquiring additional privileges
172PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit"
173PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false"
174PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode"
175PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false"
176PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false"
177PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false"
178PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false"
179# libseccomp is found in meta-security
180PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp"
181PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell"
182PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
183PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
184PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d"
185# When enabled use reproducble build timestamp if set as time epoch,
186# or build time if not. When disabled, time epoch is unset.
187def build_epoch(d):
188 epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
189 return '-Dtime-epoch=%d' % int(epoch)
190PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
191PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
192PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
193PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"
194PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true"
195PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false"
196PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false"
197PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind"
198PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup"
199PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false"
200# Verify keymaps on locale change
201PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon"
202PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz"
203PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib"
204
205# Helper variables to clarify locations. This mirrors the logic in systemd's
206# build system.
207rootprefix ?= "${root_prefix}"
208rootlibdir ?= "${base_libdir}"
209rootlibexecdir = "${rootprefix}/lib"
210
211# This links udev statically with systemd helper library.
212# Otherwise udev package would depend on systemd package (which has the needed shared library),
213# and always pull it into images.
214EXTRA_OEMESON += "-Dlink-udev-shared=false"
215
216EXTRA_OEMESON += "-Dnobody-user=nobody \
217 -Dnobody-group=nobody \
218 -Drootlibdir=${rootlibdir} \
219 -Drootprefix=${rootprefix} \
220 -Ddefault-locale=C \
221 -Dmode=release \
222 -Dsystem-alloc-uid-min=101 \
223 -Dsystem-uid-max=999 \
224 -Dsystem-alloc-gid-min=101 \
225 -Dsystem-gid-max=999 \
226 "
227
228# Hardcode target binary paths to avoid using paths from sysroot
229EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
230 -Dkmod-path=${base_bindir}/kmod \
231 -Dmount-path=${base_bindir}/mount \
232 -Dquotacheck-path=${sbindir}/quotacheck \
233 -Dquotaon-path=${sbindir}/quotaon \
234 -Dsulogin-path=${base_sbindir}/sulogin \
235 -Dnologin-path=${base_sbindir}/nologin \
236 -Dumount-path=${base_bindir}/umount"
237
238do_install() {
239 meson_do_install
240 install -d ${D}/${base_sbindir}
241 if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
242 # Provided by a separate recipe
243 rm ${D}${systemd_unitdir}/system/serial-getty* -f
244 fi
245
246 # Provide support for initramfs
247 [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
248 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
249
250 install -d ${D}${sysconfdir}/udev/rules.d/
251 install -d ${D}${sysconfdir}/tmpfiles.d
252 for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do
253 install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
254 done
255
256 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
257
258 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
259 install -d ${D}${sysconfdir}/init.d
260 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
261 sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
262 install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
263 fi
264
265 chown root:systemd-journal ${D}/${localstatedir}/log/journal
266
267 # Delete journal README, as log can be symlinked inside volatile.
268 rm -f ${D}/${localstatedir}/log/README
269
270 # journal-remote creates this at start
271 rm -rf ${D}/${localstatedir}/log/journal/remote
272
273 install -d ${D}${systemd_unitdir}/system/graphical.target.wants
274 install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
275 install -d ${D}${systemd_unitdir}/system/poweroff.target.wants
276 install -d ${D}${systemd_unitdir}/system/reboot.target.wants
277 install -d ${D}${systemd_unitdir}/system/rescue.target.wants
278
279 # Create symlinks for systemd-update-utmp-runlevel.service
280 if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then
281 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service
282 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service
283 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service
284 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service
285 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service
286 fi
287
288 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
289 # for existence else it fails
290 if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then
291 ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf', d)}
292 fi
293 if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then
294 echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
295 echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
296 echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
297 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
298 else
299 sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
300 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
301 fi
302 if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
303 rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf
304 rm -r ${D}${sysconfdir}/X11
305 fi
306
307 # If polkit is setup fixup permissions and ownership
308 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
309 if [ -d ${D}${datadir}/polkit-1/rules.d ]; then
310 chmod 700 ${D}${datadir}/polkit-1/rules.d
311 chown polkitd:root ${D}${datadir}/polkit-1/rules.d
312 fi
313 fi
314
315 # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to
316 # request hostname changes via DBUS without elevating its privileges
317 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then
318 install -d ${D}${systemd_unitdir}/system/systemd-hostnamed.service.d/
319 install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_unitdir}/system/systemd-hostnamed.service.d/
320 install -d ${D}${datadir}/dbus-1/system.d/
321 install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/
322 fi
323
324 # create link for existing udev rules
325 ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
326
327 # duplicate udevadm for postinst script
328 install -d ${D}${libexecdir}
329 ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm
330
331 # install default policy for presets
332 # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
333 install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset
334
335 # add a profile fragment to disable systemd pager with busybox less
336 install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh
337}
338
339python populate_packages_prepend (){
340 systemdlibdir = d.getVar("rootlibdir")
341 do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
342}
343PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*"
344
345PACKAGE_BEFORE_PN = "\
346 ${PN}-gui \
347 ${PN}-vconsole-setup \
348 ${PN}-initramfs \
349 ${PN}-analyze \
350 ${PN}-kernel-install \
351 ${PN}-rpm-macros \
352 ${PN}-binfmt \
353 ${PN}-zsh-completion \
354 ${PN}-container \
355 ${PN}-journal-gatewayd \
356 ${PN}-journal-upload \
357 ${PN}-journal-remote \
358 ${PN}-extra-utils \
359 ${PN}-udev-rules \
360 udev \
361 udev-hwdb \
362"
363
364SUMMARY_${PN}-container = "Tools for containers and VMs"
365DESCRIPTION_${PN}-container = "Systemd tools to spawn and manage containers and virtual machines."
366
367SUMMARY_${PN}-journal-gatewayd = "HTTP server for journal events"
368DESCRIPTION_${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default."
369
370SUMMARY_${PN}-journal-upload = "Send journal messages over the network"
371DESCRIPTION_${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL."
372
373SUMMARY_${PN}-journal-remote = "Receive journal messages over the network"
374DESCRIPTION_${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files."
375
376SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \
377 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
378 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
379 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
380"
381SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
382
383USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
384 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \
385 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
386 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
387"
388GROUPADD_PARAM_${PN} = "-r systemd-journal;"
389GROUPADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}"
390USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}"
391USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}"
392USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}"
393USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}"
394USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}"
395USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy"
396USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway"
397USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote"
398USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload"
399
400FILES_${PN}-analyze = "${bindir}/systemd-analyze"
401
402FILES_${PN}-initramfs = "/init"
403RDEPENDS_${PN}-initramfs = "${PN}"
404
405FILES_${PN}-gui = "${bindir}/systemadm"
406
407FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
408 ${systemd_unitdir}/system/systemd-vconsole-setup.service \
409 ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
410
411RDEPENDS_${PN}-kernel-install += "bash"
412FILES_${PN}-kernel-install = "${bindir}/kernel-install \
413 ${sysconfdir}/kernel/ \
414 ${exec_prefix}/lib/kernel \
415 "
416FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
417 "
418
419FILES_${PN}-zsh-completion = "${datadir}/zsh/site-functions"
420
421FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
422 ${exec_prefix}/lib/binfmt.d \
423 ${rootlibexecdir}/systemd/systemd-binfmt \
424 ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \
425 ${systemd_unitdir}/system/systemd-binfmt.service"
426RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
427
428RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
429
430
431FILES_${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \
432 ${systemd_system_unitdir}/systemd-journal-gatewayd.service \
433 ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \
434 ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \
435 ${datadir}/systemd/gatewayd/browse.html \
436 "
437SYSTEMD_SERVICE_${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket"
438
439FILES_${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \
440 ${systemd_system_unitdir}/systemd-journal-upload.service \
441 ${sysconfdir}/systemd/journal-upload.conf \
442 "
443SYSTEMD_SERVICE_${PN}-journal-upload = "systemd-journal-upload.service"
444
445FILES_${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \
446 ${sysconfdir}/systemd/journal-remote.conf \
447 ${systemd_system_unitdir}/systemd-journal-remote.service \
448 ${systemd_system_unitdir}/systemd-journal-remote.socket \
449 "
450SYSTEMD_SERVICE_${PN}-journal-remote = "systemd-journal-remote.socket"
451
452
453FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \
454 ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \
455 ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \
456 ${base_bindir}/machinectl \
457 ${bindir}/systemd-nspawn \
458 ${nonarch_libdir}/systemd/import-pubring.gpg \
459 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \
460 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \
461 ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \
462 ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \
463 ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \
464 ${systemd_system_unitdir}/machine.slice \
465 ${systemd_system_unitdir}/machines.target \
466 ${systemd_system_unitdir}/org.freedesktop.import1.busname \
467 ${systemd_system_unitdir}/org.freedesktop.machine1.busname \
468 ${systemd_system_unitdir}/systemd-importd.service \
469 ${systemd_system_unitdir}/systemd-machined.service \
470 ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \
471 ${systemd_system_unitdir}/var-lib-machines.mount \
472 ${rootlibexecdir}/systemd/systemd-import \
473 ${rootlibexecdir}/systemd/systemd-importd \
474 ${rootlibexecdir}/systemd/systemd-machined \
475 ${rootlibexecdir}/systemd/systemd-pull \
476 ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \
477 ${systemd_system_unitdir}/systemd-nspawn@.service \
478 ${libdir}/libnss_mymachines.so.2 \
479 ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \
480 ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \
481 ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \
482 ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \
483 ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \
484 ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \
485 "
486
487RRECOMMENDS_${PN}-container += "\
488 ${PN}-journal-upload \
489 ${PN}-journal-remote \
490 ${PN}-journal-gatewayd \
491 "
492
493FILES_${PN}-extra-utils = "\
494 ${base_bindir}/systemd-escape \
495 ${base_bindir}/systemd-inhibit \
496 ${bindir}/systemd-detect-virt \
497 ${bindir}/systemd-dissect \
498 ${bindir}/systemd-path \
499 ${bindir}/systemd-run \
500 ${bindir}/systemd-cat \
501 ${bindir}/systemd-delta \
502 ${bindir}/systemd-cgls \
503 ${bindir}/systemd-cgtop \
504 ${bindir}/systemd-stdio-bridge \
505 ${base_bindir}/systemd-ask-password \
506 ${base_bindir}/systemd-tty-ask-password-agent \
507 ${systemd_unitdir}/system/systemd-ask-password-console.path \
508 ${systemd_unitdir}/system/systemd-ask-password-console.service \
509 ${systemd_unitdir}/system/systemd-ask-password-wall.path \
510 ${systemd_unitdir}/system/systemd-ask-password-wall.service \
511 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \
512 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \
513 ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \
514 ${rootlibexecdir}/systemd/systemd-resolve-host \
515 ${rootlibexecdir}/systemd/systemd-ac-power \
516 ${rootlibexecdir}/systemd/systemd-activate \
517 ${rootlibexecdir}/systemd/systemd-bus-proxyd \
518 ${systemd_unitdir}/system/systemd-bus-proxyd.service \
519 ${systemd_unitdir}/system/systemd-bus-proxyd.socket \
520 ${rootlibexecdir}/systemd/systemd-socket-proxyd \
521 ${rootlibexecdir}/systemd/systemd-reply-password \
522 ${rootlibexecdir}/systemd/systemd-sleep \
523 ${rootlibexecdir}/systemd/system-sleep \
524 ${systemd_unitdir}/system/systemd-hibernate.service \
525 ${systemd_unitdir}/system/systemd-hybrid-sleep.service \
526 ${systemd_unitdir}/system/systemd-suspend.service \
527 ${systemd_unitdir}/system/sleep.target \
528 ${rootlibexecdir}/systemd/systemd-initctl \
529 ${systemd_unitdir}/system/systemd-initctl.service \
530 ${systemd_unitdir}/system/systemd-initctl.socket \
531 ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \
532 ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \
533 ${rootlibexecdir}/systemd/systemd-cgroups-agent \
534"
535
536FILES_${PN}-udev-rules = "\
537 ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \
538 ${rootlibexecdir}/udev/rules.d/71-seat.rules \
539 ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \
540 ${rootlibexecdir}/udev/rules.d/99-systemd.rules \
541"
542
543CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \
544 ${sysconfdir}/systemd/journald.conf \
545 ${sysconfdir}/systemd/logind.conf \
546 ${sysconfdir}/systemd/networkd.conf \
547 ${sysconfdir}/systemd/pstore.conf \
548 ${sysconfdir}/systemd/resolved.conf \
549 ${sysconfdir}/systemd/sleep.conf \
550 ${sysconfdir}/systemd/system.conf \
551 ${sysconfdir}/systemd/timesyncd.conf \
552 ${sysconfdir}/systemd/user.conf \
553"
554
555FILES_${PN} = " ${base_bindir}/* \
556 ${base_sbindir}/shutdown \
557 ${base_sbindir}/halt \
558 ${base_sbindir}/poweroff \
559 ${base_sbindir}/runlevel \
560 ${base_sbindir}/telinit \
561 ${base_sbindir}/resolvconf \
562 ${base_sbindir}/reboot \
563 ${base_sbindir}/init \
564 ${datadir}/dbus-1/services \
565 ${datadir}/dbus-1/system-services \
566 ${datadir}/polkit-1 \
567 ${datadir}/${BPN} \
568 ${datadir}/factory \
569 ${sysconfdir}/dbus-1/ \
570 ${sysconfdir}/modules-load.d/ \
571 ${sysconfdir}/pam.d/ \
572 ${sysconfdir}/profile.d/ \
573 ${sysconfdir}/sysctl.d/ \
574 ${sysconfdir}/systemd/ \
575 ${sysconfdir}/tmpfiles.d/ \
576 ${sysconfdir}/xdg/ \
577 ${sysconfdir}/init.d/README \
578 ${sysconfdir}/resolv-conf.systemd \
579 ${sysconfdir}/X11/xinit/xinitrc.d/* \
580 ${rootlibexecdir}/systemd/* \
581 ${libdir}/pam.d \
582 ${nonarch_libdir}/pam.d \
583 ${systemd_unitdir}/* \
584 ${base_libdir}/security/*.so \
585 /cgroup \
586 ${bindir}/systemd* \
587 ${bindir}/busctl \
588 ${bindir}/coredumpctl \
589 ${bindir}/localectl \
590 ${bindir}/hostnamectl \
591 ${bindir}/resolvectl \
592 ${bindir}/timedatectl \
593 ${bindir}/bootctl \
594 ${bindir}/oomctl \
595 ${exec_prefix}/lib/tmpfiles.d/*.conf \
596 ${exec_prefix}/lib/systemd \
597 ${exec_prefix}/lib/modules-load.d \
598 ${exec_prefix}/lib/sysctl.d \
599 ${exec_prefix}/lib/sysusers.d \
600 ${exec_prefix}/lib/environment.d \
601 ${localstatedir} \
602 ${rootlibexecdir}/modprobe.d/systemd.conf \
603 ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \
604 ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \
605 ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \
606 ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \
607 ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \
608 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '${datadir}/dbus-1/system.d/org.freedesktop.hostname1_no_polkit.conf', '', d)} \
609 ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \
610 ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \
611 ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \
612 ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \
613 ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \
614 "
615
616FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
617
618RDEPENDS_${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck"
619RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}"
620RDEPENDS_${PN} += "volatile-binds"
621
622RRECOMMENDS_${PN} += "systemd-extra-utils \
623 udev-hwdb \
624 e2fsprogs-e2fsck \
625 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \
626 os-release \
627 systemd-conf \
628"
629
630INSANE_SKIP_${PN} += "dev-so libdir"
631INSANE_SKIP_${PN}-dbg += "libdir"
632INSANE_SKIP_${PN}-doc += " libdir"
633
634RPROVIDES_udev = "hotplug"
635
636RDEPENDS_udev-hwdb += "udev"
637
638FILES_udev += "${base_sbindir}/udevd \
639 ${rootlibexecdir}/systemd/network/99-default.link \
640 ${rootlibexecdir}/systemd/systemd-udevd \
641 ${rootlibexecdir}/udev/accelerometer \
642 ${rootlibexecdir}/udev/ata_id \
643 ${rootlibexecdir}/udev/cdrom_id \
644 ${rootlibexecdir}/udev/collect \
645 ${rootlibexecdir}/udev/fido_id \
646 ${rootlibexecdir}/udev/findkeyboards \
647 ${rootlibexecdir}/udev/keyboard-force-release.sh \
648 ${rootlibexecdir}/udev/keymap \
649 ${rootlibexecdir}/udev/mtd_probe \
650 ${rootlibexecdir}/udev/scsi_id \
651 ${rootlibexecdir}/udev/v4l_id \
652 ${rootlibexecdir}/udev/keymaps \
653 ${rootlibexecdir}/udev/rules.d/50-udev-default.rules \
654 ${rootlibexecdir}/udev/rules.d/60-autosuspend.rules \
655 ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \
656 ${rootlibexecdir}/udev/rules.d/60-block.rules \
657 ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \
658 ${rootlibexecdir}/udev/rules.d/60-drm.rules \
659 ${rootlibexecdir}/udev/rules.d/60-evdev.rules \
660 ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \
661 ${rootlibexecdir}/udev/rules.d/60-input-id.rules \
662 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
663 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
664 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
665 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
666 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
667 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
668 ${rootlibexecdir}/udev/rules.d/60-serial.rules \
669 ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \
670 ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \
671 ${rootlibexecdir}/udev/rules.d/70-joystick.rules \
672 ${rootlibexecdir}/udev/rules.d/70-mouse.rules \
673 ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \
674 ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \
675 ${rootlibexecdir}/udev/rules.d/75-net-description.rules \
676 ${rootlibexecdir}/udev/rules.d/75-probe_mtd.rules \
677 ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \
678 ${rootlibexecdir}/udev/rules.d/80-drivers.rules \
679 ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \
680 ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \
681 ${sysconfdir}/udev \
682 ${sysconfdir}/init.d/systemd-udevd \
683 ${systemd_unitdir}/system/*udev* \
684 ${systemd_unitdir}/system/*.wants/*udev* \
685 ${base_bindir}/systemd-hwdb \
686 ${base_bindir}/udevadm \
687 ${base_sbindir}/udevadm \
688 ${libexecdir}/${MLPREFIX}udevadm \
689 ${datadir}/bash-completion/completions/udevadm \
690 ${systemd_unitdir}/system/systemd-hwdb-update.service \
691 "
692
693FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \
694 "
695
696RCONFLICTS_${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"
697
698INITSCRIPT_PACKAGES = "udev"
699INITSCRIPT_NAME_udev = "systemd-udevd"
700INITSCRIPT_PARAMS_udev = "start 03 S ."
701
702python __anonymous() {
703 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
704 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
705}
706
707python do_warn_musl() {
708 if d.getVar('TCLIBC') == "musl":
709 bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.")
710}
711addtask warn_musl before do_configure
712
713ALTERNATIVE_${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}"
714
715ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd"
716ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
717ALTERNATIVE_PRIORITY[resolv-conf] ?= "50"
718
719ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
720ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
721ALTERNATIVE_PRIORITY[halt] ?= "300"
722
723ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
724ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
725ALTERNATIVE_PRIORITY[reboot] ?= "300"
726
727ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
728ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
729ALTERNATIVE_PRIORITY[shutdown] ?= "300"
730
731ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
732ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
733ALTERNATIVE_PRIORITY[poweroff] ?= "300"
734
735ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
736ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
737ALTERNATIVE_PRIORITY[runlevel] ?= "300"
738
739pkg_postinst_${PN}_libc-glibc () {
740 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
741 -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
742 -i $D${sysconfdir}/nsswitch.conf
743}
744
745pkg_prerm_${PN}_libc-glibc () {
746 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
747 -e '/^hosts:/s/\s*myhostname//' \
748 -i $D${sysconfdir}/nsswitch.conf
749}
750
751PACKAGE_WRITE_DEPS += "qemu-native"
752pkg_postinst_udev-hwdb () {
753 if test -n "$D"; then
754 $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}"
755 else
756 udevadm hwdb --update
757 fi
758}
759
760pkg_prerm_udev-hwdb () {
761 rm -f $D${sysconfdir}/udev/hwdb.bin
762}
diff --git a/meta/recipes-core/systemd/systemd_257.6.bb b/meta/recipes-core/systemd/systemd_257.6.bb
new file mode 100644
index 0000000000..5f7f20c434
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd_257.6.bb
@@ -0,0 +1,940 @@
1require systemd.inc
2
3PROVIDES = "udev"
4
5PE = "1"
6
7DEPENDS = "gperf-native libcap util-linux python3-jinja2-native"
8
9SECTION = "base/shell"
10
11inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives systemd gettext bash-completion manpages features_check mime
12
13# unmerged-usr support is deprecated upstream, taints the system and will be
14# removed in the near future. Fail the build if it is not enabled.
15REQUIRED_DISTRO_FEATURES += "usrmerge"
16
17# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
18# that we don't build both udev and systemd in world builds.
19REQUIRED_DISTRO_FEATURES += "systemd"
20
21SRC_URI += " \
22 file://touchscreen.rules \
23 file://00-create-volatile.conf \
24 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
25 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
26 file://init \
27 file://99-default.preset \
28 file://systemd-pager.sh \
29 file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
30 file://0002-implment-systemd-sysv-install-for-OE.patch \
31 file://0001-Do-not-create-var-log-README.patch \
32 "
33
34# patches needed by musl
35SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}"
36SRC_URI_MUSL = "\
37 file://0003-missing_type.h-add-comparison_fn_t.patch \
38 file://0004-add-fallback-parse_printf_format-implementation.patch \
39 file://0005-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
40 file://0006-add-missing-FTW_-macros-for-musl.patch \
41 file://0007-Use-uintmax_t-for-handling-rlim_t.patch \
42 file://0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
43 file://0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
44 file://0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
45 file://0011-avoid-redefinition-of-prctl_mm_map-structure.patch \
46 file://0012-do-not-disable-buffer-in-writing-files.patch \
47 file://0013-Handle-__cpu_mask-usage.patch \
48 file://0014-Handle-missing-gshadow.patch \
49 file://0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \
50 file://0016-pass-correct-parameters-to-getdents64.patch \
51 file://0017-Adjust-for-musl-headers.patch \
52 file://0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \
53 file://0019-errno-util-Make-STRERROR-portable-for-musl.patch \
54 file://0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch \
55 file://0021-shared-Do-not-use-malloc_info-on-musl.patch \
56 file://0022-avoid-missing-LOCK_EX-declaration.patch \
57 file://0023-include-signal.h-to-avoid-the-undeclared-error.patch \
58 file://0024-undef-stdin-for-references-using-stdin-as-a-struct-m.patch \
59 file://0025-adjust-header-inclusion-order-to-avoid-redeclaration.patch \
60 file://0026-build-path.c-avoid-boot-time-segfault-for-musl.patch \
61 "
62
63PAM_PLUGINS = " \
64 pam-plugin-unix \
65 pam-plugin-loginuid \
66 pam-plugin-keyinit \
67 pam-plugin-namespace \
68"
69
70PACKAGECONFIG ??= " \
71 ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit apparmor efi ldconfig pam pni-names selinux smack polkit seccomp', d)} \
72 ${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'coredump elfutils', '', d)} \
73 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
74 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
75 ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit', 'link-udev-shared', d)} \
76 backlight \
77 binfmt \
78 gshadow \
79 hibernate \
80 hostnamed \
81 idn \
82 ima \
83 kmod \
84 localed \
85 logind \
86 machined \
87 myhostname \
88 networkd \
89 nss \
90 nss-mymachines \
91 nss-resolve \
92 quotacheck \
93 randomseed \
94 resolved \
95 serial-getty-generator \
96 set-time-epoch \
97 sysusers \
98 timedated \
99 timesyncd \
100 userdb \
101 utmp \
102 vconsole \
103 wheel-group \
104 zstd \
105"
106
107PACKAGECONFIG:remove:libc-musl = " \
108 gshadow \
109 idn \
110 localed \
111 myhostname \
112 nss \
113 nss-mymachines \
114 nss-resolve \
115 sysusers \
116 userdb \
117 utmp \
118"
119
120# https://github.com/seccomp/libseccomp/issues/347
121PACKAGECONFIG:remove:mipsarch = "seccomp"
122
123TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE"
124
125# Some of the dependencies are weak-style recommends - if not available at runtime,
126# systemd won't fail but the library-related feature will be skipped with a warning.
127
128# Use the upstream systemd serial-getty@.service and rely on
129# systemd-getty-generator instead of using the OE-core specific
130# systemd-serialgetty.bb - not enabled by default.
131PACKAGECONFIG[serial-getty-generator] = ""
132
133PACKAGECONFIG[acl] = "-Dacl=enabled,-Dacl=disabled,acl"
134PACKAGECONFIG[audit] = "-Daudit=enabled,-Daudit=disabled,audit"
135PACKAGECONFIG[apparmor] = "-Dapparmor=enabled,-Dapparmor=disabled,apparmor"
136PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false"
137PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false"
138PACKAGECONFIG[bpf-framework] = "-Dbpf-framework=enabled,-Dbpf-framework=disabled,clang-native bpftool-native libbpf,libbpf"
139PACKAGECONFIG[bzip2] = "-Dbzip2=enabled,-Dbzip2=disabled,bzip2"
140PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false"
141PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=enabled,-Dlibcryptsetup=disabled,cryptsetup,,cryptsetup"
142PACKAGECONFIG[cryptsetup-plugins] = "-Dlibcryptsetup-plugins=enabled,-Dlibcryptsetup-plugins=disabled,cryptsetup,,cryptsetup"
143PACKAGECONFIG[tpm2] = "-Dtpm2=enabled,-Dtpm2=disabled,tpm2-tss,tpm2-tss libtss2 libtss2-tcti-device"
144# If multiple compression libraries are enabled, the format to use for compression is chosen implicitly,
145# so if you want to compress with e.g. lz4 you cannot enable zstd, so you cannot read zstd-compressed journal files.
146# This option allows to enable all compression formats for reading, but choosing a specific one for writing.
147PACKAGECONFIG[default-compression-lz4] = "-Dlz4=true -Ddefault-compression=lz4,,lz4"
148PACKAGECONFIG[default-compression-xz] = "-Dxz=true -Ddefault-compression=xz,,xz"
149PACKAGECONFIG[default-compression-zstd] = "-Dzstd=true -Ddefault-compression=zstd,,zstd"
150PACKAGECONFIG[dbus] = "-Ddbus=enabled,-Ddbus=disabled,dbus"
151PACKAGECONFIG[efi] = "-Defi=true -Dbootloader=enabled,-Defi=false -Dbootloader=disabled,python3-pyelftools-native"
152PACKAGECONFIG[elfutils] = "-Delfutils=enabled,-Delfutils=disabled,elfutils,,libelf libdw"
153PACKAGECONFIG[fido] = "-Dlibfido2=enabled,-Dlibfido2=disabled,libfido2"
154PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false"
155PACKAGECONFIG[repart] = "-Drepart=enabled,-Drepart=disabled"
156PACKAGECONFIG[homed] = "-Dhomed=enabled,-Dhomed=disabled"
157# Sign the journal for anti-tampering
158PACKAGECONFIG[gcrypt] = "-Dgcrypt=enabled,-Dgcrypt=disabled,libgcrypt"
159PACKAGECONFIG[gnutls] = "-Dgnutls=enabled,-Dgnutls=disabled,gnutls"
160PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false"
161PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false"
162PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false"
163PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
164PACKAGECONFIG[ima] = "-Dima=true,-Dima=false"
165# importd requires journal-upload/xz/zlib/bzip2/gcrypt
166PACKAGECONFIG[importd] = "-Dimportd=enabled,-Dimportd=disabled,glib-2.0"
167# Update NAT firewall rules
168PACKAGECONFIG[iptc] = "-Dlibiptc=enabled,-Dlibiptc=disabled,iptables"
169PACKAGECONFIG[journal-color] = ",,,less"
170PACKAGECONFIG[journal-upload] = "-Dlibcurl=enabled,-Dlibcurl=disabled,curl"
171PACKAGECONFIG[kmod] = "-Dkmod=enabled,-Dkmod=disabled,kmod,libkmod"
172PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig"
173PACKAGECONFIG[libidn] = "-Dlibidn=enabled,-Dlibidn=disabled,libidn,,libidn"
174PACKAGECONFIG[libidn2] = "-Dlibidn2=enabled,-Dlibidn2=disabled,libidn2,,libidn2"
175# Link udev shared with systemd helper library.
176# If enabled the udev package depends on the systemd package (which has the needed shared library).
177PACKAGECONFIG[link-udev-shared] = "-Dlink-udev-shared=true,-Dlink-udev-shared=false"
178PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false"
179PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false"
180PACKAGECONFIG[lz4] = "-Dlz4=enabled,-Dlz4=disabled,lz4"
181PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false"
182PACKAGECONFIG[manpages] = "-Dman=enabled,-Dman=disabled,python3-lxml-native libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
183PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=enabled,-Dmicrohttpd=disabled,libmicrohttpd"
184PACKAGECONFIG[mountfsd] = "-Dmountfsd=true,-Dmountfsd=false"
185PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname"
186PACKAGECONFIG[nsresourced] = "-Dnsresourced=true,-Dnsresourced=false"
187PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false"
188PACKAGECONFIG[no-dns-fallback] = "-Ddns-servers="
189PACKAGECONFIG[no-ntp-fallback] = "-Dntp-servers="
190PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false,,libnss-systemd"
191PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=enabled,-Dnss-mymachines=disabled"
192PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=enabled,-Dnss-resolve=disabled"
193PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false"
194PACKAGECONFIG[openssl] = "-Dopenssl=enabled,-Dopenssl=disabled,openssl"
195PACKAGECONFIG[p11kit] = "-Dp11kit=enabled,-Dp11kit=disabled,p11-kit"
196PACKAGECONFIG[pam] = "-Dpam=enabled,-Dpam=disabled,libpam,${PAM_PLUGINS}"
197PACKAGECONFIG[pcre2] = "-Dpcre2=enabled,-Dpcre2=disabled,libpcre2"
198PACKAGECONFIG[polkit] = "-Dpolkit=enabled,-Dpolkit=disabled"
199# If polkit is disabled and networkd+hostnamed are in use, enabling this option and
200# using dbus-broker will allow networkd to be authorized to change the
201# hostname without acquiring additional privileges
202PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit"
203PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false"
204PACKAGECONFIG[pstore] = "-Dpstore=true,-Dpstore=false"
205PACKAGECONFIG[pni-names] = ",,,"
206PACKAGECONFIG[qrencode] = "-Dqrencode=enabled,-Dqrencode=disabled,qrencode,,qrencode"
207PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false"
208PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false"
209PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false"
210PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false"
211PACKAGECONFIG[seccomp] = "-Dseccomp=enabled,-Dseccomp=disabled,libseccomp"
212PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux,initscripts-sushell"
213PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
214PACKAGECONFIG[sysext] = "-Dsysext=true, -Dsysext=false"
215PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
216PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d"
217# When enabled use reproducible build timestamp if set as time epoch,
218# or build time if not. When disabled, time epoch is unset.
219def build_epoch(d):
220 epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
221 return '-Dtime-epoch=%d' % int(epoch)
222PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
223PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
224PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
225PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true"
226PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false"
227PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false"
228PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind"
229PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup"
230PACKAGECONFIG[wheel-group] = "-Dwheel-group=true, -Dwheel-group=false"
231PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false"
232# Verify keymaps on locale change
233PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=enabled,-Dxkbcommon=disabled,libxkbcommon"
234PACKAGECONFIG[xz] = "-Dxz=enabled,-Dxz=disabled,xz"
235PACKAGECONFIG[zlib] = "-Dzlib=enabled,-Dzlib=disabled,zlib"
236PACKAGECONFIG[zstd] = "-Dzstd=enabled,-Dzstd=disabled,zstd"
237
238RESOLV_CONF ??= ""
239
240# bpf-framework: pass the recipe-sysroot to the compiler used to build
241# the eBPFs, so that it can find needed system includes in there.
242CFLAGS:append = " --sysroot=${STAGING_DIR_TARGET}"
243LDFLAGS:append:aarch64 = " ${@bb.utils.contains('PACKAGECONFIG', 'openssl', '-Wl,-z,gcs-report-dynamic=none', '', d)}"
244
245EXTRA_OEMESON += "-Dnobody-user=nobody \
246 -Dnobody-group=nogroup \
247 -Ddefault-locale=C \
248 -Dmode=release \
249 -Dsystem-alloc-uid-min=101 \
250 -Dsystem-uid-max=999 \
251 -Dsystem-alloc-gid-min=101 \
252 -Dsystem-gid-max=999 \
253 ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', '-Ddefault-mdns=no -Ddefault-llmnr=no', '', d)} \
254 "
255
256# Hardcode target binary paths to avoid using paths from sysroot or worse
257# it pokes for these binaries on build host and encodes that distro assumption
258# into target
259EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
260 -Dkmod-path=${base_bindir}/kmod \
261 -Dmount-path=${base_bindir}/mount \
262 -Dquotacheck-path=${sbindir}/quotacheck \
263 -Dquotaon-path=${sbindir}/quotaon \
264 -Dsulogin-path=${base_sbindir}/sulogin \
265 -Dnologin-path=${base_sbindir}/nologin \
266 -Dumount-path=${base_bindir}/umount \
267 -Dloadkeys-path=${bindir}/loadkeys \
268 -Dsetfont-path=${bindir}/setfont"
269
270# The 60 seconds is watchdog's default vaule.
271WATCHDOG_TIMEOUT ??= "60"
272
273# To make use of the hardware watchdog it is sufficient to set WATCHDOG_RUNTIME_SEC
274# (RuntimeWatchdogSec= option in /etc/systemd/system.conf) to a value like 20s
275# and the watchdog is enabled. (defaults is no hardware watchdog use)
276WATCHDOG_RUNTIME_SEC ??= ""
277
278do_install() {
279 meson_do_install
280
281 if ${@bb.utils.contains('PACKAGECONFIG', 'sysusers', 'true', 'false', d)}; then
282 # Change the root user's home directory in /lib/sysusers.d/basic.conf.
283 # This is done merely for backward compatibility with previous systemd recipes.
284 # systemd hardcodes root user's HOME to be "/root". Changing to use other values
285 # may have unexpected runtime behaviors.
286 if [ "${ROOT_HOME}" != "/root" ]; then
287 bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
288 sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
289 fi
290 fi
291 install -d ${D}/${base_sbindir}
292
293 if ! ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'true', 'false', d)}; then
294 # Remove the serial-getty generator and instead use explicit services
295 # created by the systemd-serialgetty recipe
296 find ${D} -name \*getty-generator\* -delete
297 fi
298
299 # Provide support for initramfs
300 [ ! -e ${D}/init ] && ln -s ${nonarch_libdir}/systemd/systemd ${D}/init
301 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${nonarch_libdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
302
303 install -d ${D}${sysconfdir}/udev/rules.d/
304 install -d ${D}${nonarch_libdir}/tmpfiles.d
305 for rule in $(find ${UNPACKDIR} -maxdepth 1 -type f -name "*.rules"); do
306 install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
307 done
308
309 install -m 0644 ${UNPACKDIR}/00-create-volatile.conf ${D}${nonarch_libdir}/tmpfiles.d/
310
311 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
312 install -d ${D}${sysconfdir}/init.d
313 install -m 0755 ${UNPACKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
314 sed -i s%@UDEVD@%${nonarch_libdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
315 install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
316 fi
317
318 if ${@bb.utils.contains('FILESYSTEM_PERMS_TABLES', 'files/fs-perms-volatile-log.txt', 'true', 'false', d)}; then
319 # base-files recipe provides /var/log which is a symlink to /var/volatile/log
320 rm -rf ${D}${localstatedir}/log
321 printf 'L\t\t%s/log\t\t-\t-\t-\t-\t%s/volatile/log\n' "${localstatedir}" \
322 "${localstatedir}" >>${D}${nonarch_libdir}/tmpfiles.d/00-create-volatile.conf
323 elif [ -e ${D}${localstatedir}/log/journal ]; then
324 chown root:systemd-journal ${D}${localstatedir}/log/journal
325
326 # journal-remote creates this at start
327 rm -rf ${D}${localstatedir}/log/journal/remote
328 fi
329
330 # if the user requests /tmp be on persistent storage (i.e. not volatile)
331 # then don't use a tmpfs for /tmp
332 if ! ${@bb.utils.contains('FILESYSTEM_PERMS_TABLES', 'files/fs-perms-volatile-tmp.txt', 'true', 'false', d)}; then
333 rm -f ${D}${nonarch_libdir}/systemd/system/tmp.mount
334 rm -f ${D}${nonarch_libdir}/systemd/system/local-fs.target.wants/tmp.mount
335 fi
336
337 install -d ${D}${systemd_system_unitdir}/graphical.target.wants
338 install -d ${D}${systemd_system_unitdir}/multi-user.target.wants
339 install -d ${D}${systemd_system_unitdir}/poweroff.target.wants
340 install -d ${D}${systemd_system_unitdir}/reboot.target.wants
341 install -d ${D}${systemd_system_unitdir}/rescue.target.wants
342
343 # Create symlinks for systemd-update-utmp-runlevel.service
344 if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)} && ${@bb.utils.contains('PACKAGECONFIG', 'sysvinit', 'true', 'false', d)}; then
345 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service
346 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service
347 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/poweroff.target.wants/systemd-update-utmp-runlevel.service
348 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/reboot.target.wants/systemd-update-utmp-runlevel.service
349 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service
350 fi
351
352 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
353 # for existence else it fails
354 if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ] &&
355 ! ${@bb.utils.contains('PACKAGECONFIG', 'networkd', 'true', 'false', d)}; then
356 echo 'd /run/systemd/netif/links 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
357 fi
358 if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then
359 echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
360 echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
361 echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
362 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
363 else
364 resolv_conf="${@bb.utils.contains('RESOLV_CONF', 'stub-resolv', 'run/systemd/resolve/stub-resolv.conf', 'run/systemd/resolve/resolv.conf', d)}"
365 sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../${resolv_conf}%g" ${D}${exec_prefix}/lib/tmpfiles.d/systemd-resolve.conf
366 ln -s ../${resolv_conf} ${D}${sysconfdir}/resolv-conf.systemd
367 fi
368 if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
369 rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf
370 rm -r ${D}${sysconfdir}/X11
371 fi
372
373 # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to
374 # request hostname changes via DBUS without elevating its privileges
375 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then
376 install -d ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/
377 install -m 0644 ${UNPACKDIR}/00-hostnamed-network-user.conf ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/
378 install -d ${D}${datadir}/dbus-1/system.d/
379 install -m 0644 ${UNPACKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/
380 fi
381
382 # create link for existing udev rules
383 ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
384
385 # install default policy for presets
386 # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
387 install -Dm 0644 ${UNPACKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset
388
389 # add a profile fragment to disable systemd pager with busybox less
390 install -Dm 0644 ${UNPACKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh
391
392 if [ -n "${WATCHDOG_TIMEOUT}" ]; then
393 sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \
394 ${D}/${sysconfdir}/systemd/system.conf
395 fi
396
397 if [ -n "${WATCHDOG_RUNTIME_SEC}" ]; then
398 sed -i -e 's/#RuntimeWatchdogSec=off/RuntimeWatchdogSec=${WATCHDOG_RUNTIME_SEC}/' \
399 ${D}/${sysconfdir}/systemd/system.conf
400 fi
401
402 if ${@bb.utils.contains('PACKAGECONFIG', 'pni-names', 'true', 'false', d)}; then
403 if ! grep -q '^NamePolicy=.*mac' ${D}${nonarch_libdir}/systemd/network/99-default.link; then
404 sed -i '/^NamePolicy=/s/$/ mac/' ${D}${nonarch_libdir}/systemd/network/99-default.link
405 fi
406 if ! grep -q 'AlternativeNamesPolicy=.*mac' ${D}${nonarch_libdir}/systemd/network/99-default.link; then
407 sed -i '/AlternativeNamesPolicy=/s/$/ mac/' ${D}${nonarch_libdir}/systemd/network/99-default.link
408 fi
409 else
410 # Actively disable Predictable Network Interface Names
411 sed -i 's/^NamePolicy=.*/NamePolicy=/;s/^AlternativeNamesPolicy=.*/AlternativeNamesPolicy=/' ${D}${nonarch_libdir}/systemd/network/99-default.link
412 fi
413}
414
415python populate_packages:prepend (){
416 systemdlibdir = d.getVar("libdir")
417 do_split_packages(d, systemdlibdir, r'^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
418}
419PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*"
420
421PACKAGE_BEFORE_PN = "\
422 ${PN}-analyze \
423 ${PN}-binfmt \
424 ${PN}-container \
425 ${PN}-crypt \
426 ${PN}-extra-utils \
427 ${PN}-gui \
428 ${PN}-initramfs \
429 ${PN}-journal-gatewayd \
430 ${PN}-journal-upload \
431 ${PN}-journal-remote \
432 ${PN}-kernel-install \
433 ${PN}-mime \
434 ${PN}-networkd \
435 ${PN}-rpm-macros \
436 ${PN}-udev-rules \
437 ${PN}-vconsole-setup \
438 ${PN}-zsh-completion \
439 libsystemd-shared \
440 udev \
441 udev-bash-completion \
442 udev-hwdb \
443"
444
445SUMMARY:${PN}-container = "Tools for containers and VMs"
446DESCRIPTION:${PN}-container = "Systemd tools to spawn and manage containers and virtual machines."
447
448SUMMARY:${PN}-journal-gatewayd = "HTTP server for journal events"
449DESCRIPTION:${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default."
450
451SUMMARY:${PN}-journal-upload = "Send journal messages over the network"
452DESCRIPTION:${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL."
453
454SUMMARY:${PN}-journal-remote = "Receive journal messages over the network"
455DESCRIPTION:${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files."
456
457SUMMARY:libsystemd-shared = "Systemd shared library"
458
459SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \
460 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
461 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
462 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
463 ${@bb.utils.contains('PACKAGECONFIG', 'networkd', '${PN}-networkd', '', d)} \
464"
465SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service"
466
467USERADD_PACKAGES = "${PN} \
468 udev \
469 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
470 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
471 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
472 ${@bb.utils.contains('PACKAGECONFIG', 'networkd', '${PN}-networkd', '', d)} \
473"
474GROUPADD_PARAM:${PN} = "-r systemd-journal;"
475GROUPADD_PARAM:udev = "-r render"
476GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}"
477USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}"
478USERADD_PARAM:${PN}-networkd = "--system -d / -M --shell /sbin/nologin systemd-network"
479USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${datadir}/polkit-1 polkitd;', '', d)}"
480USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}"
481USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}"
482USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'oomd', '--system -d / -M --shell /sbin/nologin systemd-oom;', '', d)}"
483USERADD_PARAM:${PN}-journal-gatewayd = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway"
484USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote"
485USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload"
486
487FILES:${PN}-analyze = "${bindir}/systemd-analyze"
488
489FILES:${PN}-crypt = "${bindir}/systemd-cryptenroll \
490 ${libdir}/cryptsetup \
491 "
492RRECOMMENDS:${PN} += "${PN}-crypt"
493
494FILES:${PN}-initramfs = "/init"
495RDEPENDS:${PN}-initramfs = "${PN}"
496
497FILES:${PN}-gui = "${bindir}/systemadm"
498
499FILES:${PN}-vconsole-setup = "${nonarch_libdir}/systemd/systemd-vconsole-setup \
500 ${systemd_system_unitdir}/systemd-vconsole-setup.service \
501 ${systemd_system_unitdir}/sysinit.target.wants/systemd-vconsole-setup.service"
502
503RDEPENDS:${PN}-kernel-install += "bash"
504FILES:${PN}-kernel-install = "${bindir}/kernel-install \
505 ${sysconfdir}/kernel/ \
506 ${exec_prefix}/lib/kernel \
507 "
508FILES:${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
509 "
510
511FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions"
512
513FILES:${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
514 ${exec_prefix}/lib/binfmt.d \
515 ${nonarch_libdir}/systemd/systemd-binfmt \
516 ${systemd_system_unitdir}/proc-sys-fs-binfmt_misc.* \
517 ${systemd_system_unitdir}/systemd-binfmt.service"
518RRECOMMENDS:${PN}-binfmt = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', 'kernel-module-binfmt-misc', '', d)}"
519
520RDEPENDS:${PN}-vconsole-setup = "${@bb.utils.contains('PACKAGECONFIG', 'vconsole', 'kbd kbd-consolefonts kbd-keymaps', '', d)}"
521
522FILES:${PN}-journal-gatewayd = "${nonarch_libdir}/systemd/systemd-journal-gatewayd \
523 ${systemd_system_unitdir}/systemd-journal-gatewayd.service \
524 ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \
525 ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \
526 ${datadir}/systemd/gatewayd/browse.html \
527 "
528SYSTEMD_SERVICE:${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket"
529
530FILES:${PN}-journal-upload = "${nonarch_libdir}/systemd/systemd-journal-upload \
531 ${systemd_system_unitdir}/systemd-journal-upload.service \
532 ${sysconfdir}/systemd/journal-upload.conf \
533 "
534SYSTEMD_SERVICE:${PN}-journal-upload = "systemd-journal-upload.service"
535
536FILES:${PN}-journal-remote = "${nonarch_libdir}/systemd/systemd-journal-remote \
537 ${nonarch_libdir}/sysusers.d/systemd-remote.conf \
538 ${sysconfdir}/systemd/journal-remote.conf \
539 ${systemd_system_unitdir}/systemd-journal-remote.service \
540 ${systemd_system_unitdir}/systemd-journal-remote.socket \
541 "
542SYSTEMD_SERVICE:${PN}-journal-remote = "systemd-journal-remote.socket"
543
544FILES:${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \
545 ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \
546 ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \
547 ${base_bindir}/machinectl \
548 ${bindir}/systemd-nspawn \
549 ${nonarch_libdir}/systemd/import-pubring.gpg \
550 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \
551 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \
552 ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \
553 ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \
554 ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \
555 ${systemd_system_unitdir}/machine.slice \
556 ${systemd_system_unitdir}/machines.target \
557 ${systemd_system_unitdir}/org.freedesktop.import1.busname \
558 ${systemd_system_unitdir}/org.freedesktop.machine1.busname \
559 ${systemd_system_unitdir}/systemd-importd.service \
560 ${systemd_system_unitdir}/systemd-machined.service \
561 ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \
562 ${systemd_system_unitdir}/var-lib-machines.mount \
563 ${nonarch_libdir}/systemd/systemd-import \
564 ${nonarch_libdir}/systemd/systemd-importd \
565 ${nonarch_libdir}/systemd/systemd-machined \
566 ${nonarch_libdir}/systemd/systemd-pull \
567 ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \
568 ${exec_prefix}/lib/tmpfiles.d/README \
569 ${systemd_system_unitdir}/systemd-nspawn@.service \
570 ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \
571 ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \
572 ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \
573 ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \
574 ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \
575 ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \
576 "
577
578RDEPENDS:${PN}-container = "${@bb.utils.contains('PACKAGECONFIG', 'nss-mymachines', 'libnss-mymachines', '', d)}"
579
580# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox.
581RRECOMMENDS:${PN}-container += "\
582 ${PN}-journal-gatewayd \
583 ${PN}-journal-remote \
584 ${PN}-journal-upload \
585 kernel-module-dm-mod \
586 kernel-module-loop \
587 kernel-module-tun \
588 tar \
589 "
590
591FILES:${PN}-extra-utils = "\
592 ${base_bindir}/systemd-escape \
593 ${base_bindir}/systemd-inhibit \
594 ${bindir}/systemd-detect-virt \
595 ${bindir}/systemd-dissect \
596 ${bindir}/systemd-path \
597 ${bindir}/systemd-run \
598 ${bindir}/systemd-cat \
599 ${bindir}/systemd-creds \
600 ${bindir}/systemd-delta \
601 ${bindir}/systemd-cgls \
602 ${bindir}/systemd-cgtop \
603 ${bindir}/systemd-stdio-bridge \
604 ${base_sbindir}/mount.ddi \
605 ${systemd_system_unitdir}/initrd.target.wants/systemd-pcrphase-initrd.path \
606 ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase.path \
607 ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase-sysinit.path \
608 ${nonarch_libdir}/systemd/systemd-resolve-host \
609 ${nonarch_libdir}/systemd/systemd-ac-power \
610 ${nonarch_libdir}/systemd/systemd-activate \
611 ${nonarch_libdir}/systemd/systemd-measure \
612 ${nonarch_libdir}/systemd/systemd-pcrphase \
613 ${nonarch_libdir}/systemd/systemd-socket-proxyd \
614 ${nonarch_libdir}/systemd/systemd-sleep \
615 ${nonarch_libdir}/systemd/system-sleep \
616 ${systemd_system_unitdir}/systemd-hibernate.service \
617 ${systemd_system_unitdir}/systemd-hybrid-sleep.service \
618 ${systemd_system_unitdir}/systemd-pcrphase-initrd.service \
619 ${systemd_system_unitdir}/systemd-pcrphase.service \
620 ${systemd_system_unitdir}/systemd-pcrphase-sysinit.service \
621 ${systemd_system_unitdir}/systemd-suspend.service \
622 ${systemd_system_unitdir}/sleep.target \
623 ${nonarch_libdir}/systemd/systemd-initctl \
624 ${systemd_system_unitdir}/systemd-initctl.service \
625 ${systemd_system_unitdir}/systemd-initctl.socket \
626 ${systemd_system_unitdir}/sockets.target.wants/systemd-initctl.socket \
627 ${nonarch_libdir}/systemd/system-generators/systemd-gpt-auto-generator \
628 ${nonarch_libdir}/systemd/systemd-cgroups-agent \
629"
630
631FILES:${PN}-mime = "${MIMEDIR}"
632RRECOMMENDS:${PN} += "${PN}-mime"
633
634FILES:${PN}-networkd = "\
635 ${bindir}/networkctl \
636 ${datadir}/dbus-1/system-services/org.freedesktop.network1.service \
637 ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \
638 ${datadir}/polkit-1/actions/org.freedesktop.network1.policy \
639 ${nonarch_libdir}/sysusers.d/systemd-network.conf \
640 ${nonarch_libdir}/tmpfiles.d/systemd-network.conf \
641 ${sysconfdir}/systemd/networkd.conf \
642 ${systemd_system_unitdir}/systemd-networkd* \
643 ${systemd_unitdir}/network/*.network \
644 ${systemd_unitdir}/network/*.network.example \
645 ${systemd_unitdir}/networkd.conf \
646 ${systemd_unitdir}/systemd-networkd* \
647"
648# systemd-networkd-persistent-storage.service BindsTo=systemd-networkd.service
649# systemd-networkd.service has Also=systemd-networkd-wait-online.service
650SYSTEMD_SERVICE:${PN}-networkd = "systemd-networkd.service"
651CONFFILES:${PN}-networkd = "${sysconfdir}/systemd/networkd.conf"
652RDEPENDS:${PN}-networkd += "${PN}"
653RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '${PN}-networkd', '', d)}"
654
655FILES:${PN}-udev-rules = "\
656 ${nonarch_libdir}/udev/rules.d/70-uaccess.rules \
657 ${nonarch_libdir}/udev/rules.d/71-seat.rules \
658 ${nonarch_libdir}/udev/rules.d/73-seat-late.rules \
659 ${nonarch_libdir}/udev/rules.d/99-systemd.rules \
660"
661
662CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \
663 ${sysconfdir}/systemd/journald.conf \
664 ${sysconfdir}/systemd/logind.conf \
665 ${sysconfdir}/systemd/pstore.conf \
666 ${sysconfdir}/systemd/resolved.conf \
667 ${sysconfdir}/systemd/sleep.conf \
668 ${sysconfdir}/systemd/system.conf \
669 ${sysconfdir}/systemd/timesyncd.conf \
670 ${sysconfdir}/systemd/user.conf \
671"
672
673FILES:${PN} = " ${base_bindir}/* \
674 ${base_sbindir}/shutdown \
675 ${base_sbindir}/halt \
676 ${base_sbindir}/poweroff \
677 ${base_sbindir}/runlevel \
678 ${base_sbindir}/telinit \
679 ${base_sbindir}/resolvconf \
680 ${base_sbindir}/reboot \
681 ${base_sbindir}/init \
682 ${datadir}/dbus-1/services \
683 ${datadir}/dbus-1/system-services \
684 ${datadir}/polkit-1 \
685 ${datadir}/${BPN} \
686 ${datadir}/factory \
687 ${sysconfdir}/credstore/ \
688 ${sysconfdir}/credstore.encrypted/ \
689 ${sysconfdir}/dbus-1/ \
690 ${sysconfdir}/modules-load.d/ \
691 ${sysconfdir}/pam.d/ \
692 ${sysconfdir}/profile.d/ \
693 ${sysconfdir}/sysctl.d/ \
694 ${sysconfdir}/systemd/ \
695 ${sysconfdir}/tmpfiles.d/ \
696 ${sysconfdir}/xdg/ \
697 ${sysconfdir}/init.d/README \
698 ${sysconfdir}/resolv-conf.systemd \
699 ${sysconfdir}/X11/xinit/xinitrc.d/* \
700 ${sysconfdir}/ssh/ssh_config.d/20-systemd-ssh-proxy.conf \
701 ${sysconfdir}/ssh/sshd_config.d/20-systemd-userdb.conf \
702 ${nonarch_libdir}/systemd/* \
703 ${libdir}/systemd/libsystemd-core* \
704 ${libdir}/pam.d \
705 ${nonarch_libdir}/pam.d \
706 ${systemd_unitdir}/* \
707 ${base_libdir}/security/*.so \
708 /cgroup \
709 ${bindir}/systemd* \
710 ${bindir}/busctl \
711 ${bindir}/coredumpctl \
712 ${bindir}/localectl \
713 ${bindir}/hostnamectl \
714 ${bindir}/resolvectl \
715 ${bindir}/timedatectl \
716 ${bindir}/bootctl \
717 ${bindir}/oomctl \
718 ${bindir}/userdbctl \
719 ${exec_prefix}/lib/credstore \
720 ${exec_prefix}/lib/tmpfiles.d/*.conf \
721 ${exec_prefix}/lib/systemd \
722 ${exec_prefix}/lib/modules-load.d \
723 ${exec_prefix}/lib/sysctl.d \
724 ${exec_prefix}/lib/sysusers.d \
725 ${exec_prefix}/lib/environment.d \
726 ${exec_prefix}/lib/pcrlock.d \
727 ${localstatedir} \
728 ${nonarch_libdir}/modprobe.d/systemd.conf \
729 ${nonarch_libdir}/modprobe.d/README \
730 ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \
731 ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \
732 ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \
733 ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \
734 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '${datadir}/dbus-1/system.d/org.freedesktop.hostname1_no_polkit.conf', '', d)} \
735 ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \
736 ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \
737 ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \
738 ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \
739 ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \
740 ${datadir}/dbus-1/system.d/org.freedesktop.home1.conf \
741 "
742
743FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
744
745RDEPENDS:${PN} += "kmod ${VIRTUAL-RUNTIME_dbus} util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck util-linux-swaponoff util-linux-mkswap"
746RDEPENDS:${PN} += "systemd-serialgetty"
747RDEPENDS:${PN} += "volatile-binds"
748
749RRECOMMENDS:${PN} += "${PN}-extra-utils \
750 udev-hwdb \
751 e2fsprogs-e2fsck \
752 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \
753 os-release \
754 systemd-conf \
755 ${@bb.utils.contains('PACKAGECONFIG', 'logind', 'pam-plugin-umask', '', d)} \
756"
757
758INSANE_SKIP:${PN} += "dev-so libdir"
759INSANE_SKIP:${PN}-dbg += "libdir"
760INSANE_SKIP:${PN}-doc += " libdir"
761INSANE_SKIP:libsystemd-shared += "libdir"
762
763FILES:libsystemd-shared = "${libdir}/systemd/libsystemd-shared*.so"
764
765RPROVIDES:udev = "hotplug"
766
767RDEPENDS:udev-bash-completion += "bash-completion"
768RDEPENDS:udev-hwdb += "udev"
769
770FILES:udev += "${base_sbindir}/udevd \
771 ${nonarch_libdir}/systemd/network/99-default.link \
772 ${nonarch_libdir}/systemd/systemd-udevd \
773 ${nonarch_libdir}/udev/accelerometer \
774 ${nonarch_libdir}/udev/ata_id \
775 ${nonarch_libdir}/udev/cdrom_id \
776 ${nonarch_libdir}/udev/collect \
777 ${nonarch_libdir}/udev/dmi_memory_id \
778 ${nonarch_libdir}/udev/fido_id \
779 ${nonarch_libdir}/udev/findkeyboards \
780 ${nonarch_libdir}/udev/iocost \
781 ${nonarch_libdir}/udev/keyboard-force-release.sh \
782 ${nonarch_libdir}/udev/keymap \
783 ${nonarch_libdir}/udev/mtd_probe \
784 ${nonarch_libdir}/udev/scsi_id \
785 ${nonarch_libdir}/udev/v4l_id \
786 ${nonarch_libdir}/udev/keymaps \
787 ${nonarch_libdir}/udev/rules.d/50-udev-default.rules \
788 ${nonarch_libdir}/udev/rules.d/60-autosuspend.rules \
789 ${nonarch_libdir}/udev/rules.d/60-autosuspend-chromiumos.rules \
790 ${nonarch_libdir}/udev/rules.d/60-block.rules \
791 ${nonarch_libdir}/udev/rules.d/60-cdrom_id.rules \
792 ${nonarch_libdir}/udev/rules.d/60-dmi-id.rules \
793 ${nonarch_libdir}/udev/rules.d/60-drm.rules \
794 ${nonarch_libdir}/udev/rules.d/60-evdev.rules \
795 ${nonarch_libdir}/udev/rules.d/60-fido-id.rules \
796 ${nonarch_libdir}/udev/rules.d/60-infiniband.rules \
797 ${nonarch_libdir}/udev/rules.d/60-input-id.rules \
798 ${nonarch_libdir}/udev/rules.d/60-persistent-alsa.rules \
799 ${nonarch_libdir}/udev/rules.d/60-persistent-input.rules \
800 ${nonarch_libdir}/udev/rules.d/60-persistent-storage.rules \
801 ${nonarch_libdir}/udev/rules.d/60-persistent-storage-mtd.rules \
802 ${nonarch_libdir}/udev/rules.d/60-persistent-storage-tape.rules \
803 ${nonarch_libdir}/udev/rules.d/60-persistent-v4l.rules \
804 ${nonarch_libdir}/udev/rules.d/60-sensor.rules \
805 ${nonarch_libdir}/udev/rules.d/60-serial.rules \
806 ${nonarch_libdir}/udev/rules.d/61-autosuspend-manual.rules \
807 ${nonarch_libdir}/udev/rules.d/64-btrfs.rules \
808 ${nonarch_libdir}/udev/rules.d/70-camera.rules \
809 ${nonarch_libdir}/udev/rules.d/70-joystick.rules \
810 ${nonarch_libdir}/udev/rules.d/70-memory.rules \
811 ${nonarch_libdir}/udev/rules.d/70-mouse.rules \
812 ${nonarch_libdir}/udev/rules.d/70-power-switch.rules \
813 ${nonarch_libdir}/udev/rules.d/70-touchpad.rules \
814 ${nonarch_libdir}/udev/rules.d/75-net-description.rules \
815 ${nonarch_libdir}/udev/rules.d/75-probe_mtd.rules \
816 ${nonarch_libdir}/udev/rules.d/78-sound-card.rules \
817 ${nonarch_libdir}/udev/rules.d/80-drivers.rules \
818 ${nonarch_libdir}/udev/rules.d/80-net-setup-link.rules \
819 ${nonarch_libdir}/udev/rules.d/81-net-dhcp.rules \
820 ${nonarch_libdir}/udev/rules.d/90-vconsole.rules \
821 ${nonarch_libdir}/udev/rules.d/90-iocost.rules \
822 ${nonarch_libdir}/udev/rules.d/README \
823 ${sysconfdir}/udev \
824 ${sysconfdir}/init.d/systemd-udevd \
825 ${systemd_system_unitdir}/*udev* \
826 ${systemd_system_unitdir}/*.wants/*udev* \
827 ${base_bindir}/systemd-hwdb \
828 ${base_bindir}/udevadm \
829 ${base_sbindir}/udevadm \
830 ${systemd_system_unitdir}/systemd-hwdb-update.service \
831 "
832
833FILES:udev-bash-completion = "${datadir}/bash-completion/completions/udevadm"
834FILES:udev-hwdb = "${nonarch_libdir}/udev/hwdb.d \
835 "
836
837RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"
838
839INITSCRIPT_PACKAGES = "udev"
840INITSCRIPT_NAME:udev = "systemd-udevd"
841INITSCRIPT_PARAMS:udev = "start 03 S ."
842
843python __anonymous() {
844 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
845 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
846
847 if bb.utils.contains('DISTRO_FEATURES', 'systemd-resolved', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'nss-resolve resolved', True, False, d):
848 bb.error("DISTRO_FEATURES[systemd-resolved] requires PACKAGECONFIG[nss-resolve, resolved]")
849
850 if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d):
851 bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]")
852
853 if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d):
854 bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]")
855}
856
857python do_warn_musl() {
858 if d.getVar('TCLIBC') == "musl":
859 bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.")
860}
861addtask warn_musl before do_configure
862
863ALTERNATIVE:${PN} = "halt reboot shutdown poweroff \
864 ${@bb.utils.contains('PACKAGECONFIG', 'sysvinit', 'runlevel', '', d)} \
865 ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}"
866
867ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd"
868ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
869ALTERNATIVE_PRIORITY[resolv-conf] ?= "50"
870
871ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
872ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
873ALTERNATIVE_PRIORITY[halt] ?= "300"
874
875ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
876ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
877ALTERNATIVE_PRIORITY[reboot] ?= "300"
878
879ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
880ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
881ALTERNATIVE_PRIORITY[shutdown] ?= "300"
882
883ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
884ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
885ALTERNATIVE_PRIORITY[poweroff] ?= "300"
886
887ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
888ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
889ALTERNATIVE_PRIORITY[runlevel] ?= "300"
890
891pkg_postinst:${PN}:append () {
892 if ${@bb.utils.contains('PACKAGECONFIG', 'set-time-epoch', 'true', 'false', d)}; then
893 touch $D${nonarch_libdir}/clock-epoch
894 fi
895}
896
897pkg_postinst:${PN}:libc-glibc () {
898 if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then
899 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
900 -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
901 -i $D${sysconfdir}/nsswitch.conf
902 fi
903 if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then
904 sed -e 's#\(^passwd:.*\)#\1 systemd#' \
905 -e 's#\(^group:.*\)#\1 systemd#' \
906 -e 's#\(^shadow:.*\)#\1 systemd#' \
907 -i $D${sysconfdir}/nsswitch.conf
908 fi
909}
910
911pkg_prerm:${PN}:libc-glibc () {
912 if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then
913 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
914 -e '/^hosts:/s/\s*myhostname//' \
915 -i $D${sysconfdir}/nsswitch.conf
916 fi
917 if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then
918 sed -e '/^passwd:/s#\s*systemd##' \
919 -e '/^group:/s#\s*systemd##' \
920 -e '/^shadow:/s#\s*systemd##' \
921 -i $D${sysconfdir}/nsswitch.conf
922 fi
923}
924
925PACKAGE_WRITE_DEPS += "qemuwrapper-cross"
926
927pkg_postinst:udev-hwdb () {
928 if test -n "$D"; then
929 $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \
930 rootlibexecdir="${nonarch_libdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" base_bindir="${base_bindir}"
931 else
932 systemd-hwdb update
933 fi
934}
935
936pkg_prerm:udev-hwdb () {
937 rm -f $D${sysconfdir}/udev/hwdb.bin
938}
939
940require dlopen-deps.inc