diff options
Diffstat (limited to 'meta/recipes-core/systemd')
70 files changed, 3361 insertions, 3067 deletions
diff --git a/meta/recipes-core/systemd/systemd-boot-native_256.5.bb b/meta/recipes-core/systemd/systemd-boot-native_256.5.bb new file mode 100644 index 0000000000..73db59b14e --- /dev/null +++ b/meta/recipes-core/systemd/systemd-boot-native_256.5.bb @@ -0,0 +1,15 @@ +require systemd.inc + +inherit native + +deltask do_configure +deltask do_compile + +do_install () { + install -Dm 0755 ${S}/src/ukify/ukify.py ${D}${bindir}/ukify +} +addtask install after do_unpack + +PACKAGES = "${PN}" + +FILES:${PN} = "${bindir}/ukify" diff --git a/meta/recipes-core/systemd/systemd-boot_243.bb b/meta/recipes-core/systemd/systemd-boot_243.bb deleted file mode 100644 index 515abc289b..0000000000 --- a/meta/recipes-core/systemd/systemd-boot_243.bb +++ /dev/null @@ -1,70 +0,0 @@ -require systemd.inc -FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" - -require conf/image-uefi.conf - -DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native" - -# NOTE: These three patches are in theory not needed, but we haven't -# figured out how to correctly pass efi-cc parameter if it's an array. -SRC_URI += "file://0001-Revert-meson-use-an-array-option-for-efi-cc.patch \ - file://0001-Revert-meson-print-EFI-CC-configuration-nicely.patch \ - file://0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch \ - file://0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch \ - " - -inherit meson pkgconfig gettext -inherit deploy - -EFI_CC ?= "${CC}" -EXTRA_OEMESON += "-Defi=true \ - -Dgnu-efi=true \ - -Defi-includedir=${STAGING_INCDIR}/efi \ - -Defi-ldsdir=${STAGING_LIBDIR} \ - -Defi-libdir=${STAGING_LIBDIR} \ - -Dman=false \ - -Defi-cc='${EFI_CC}' \ - -Defi-ld='${LD}' \ - -Defi-objcopy='${OBJCOPY}' \ - " - -# install to the image as boot*.efi if its the EFI_PROVIDER, -# otherwise install as the full name. -# This allows multiple bootloaders to coexist in a single image. -python __anonymous () { - import re - target = d.getVar('TARGET_ARCH') - prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-" - systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE") - d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage) - prefix = "systemd-" if prefix == "" else "" - d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix) -} - -FILES_${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" - -RDEPENDS_${PN} += "virtual/systemd-bootconf" - -# Imported from the old gummiboot recipe -TUNE_CCARGS_remove = "-mfpmath=sse" -COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux" -COMPATIBLE_HOST_x86-x32 = "null" - -do_compile() { - SYSTEMD_BOOT_EFI_ARCH="ia32" - if [ "${TARGET_ARCH}" = "x86_64" ]; then - SYSTEMD_BOOT_EFI_ARCH="x64" - fi - - ninja src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} -} - -do_install() { - install -d ${D}${EFI_FILES_PATH} - install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE} -} - -do_deploy () { - install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR} -} -addtask deploy before do_build after do_compile diff --git a/meta/recipes-core/systemd/systemd-boot_256.5.bb b/meta/recipes-core/systemd/systemd-boot_256.5.bb new file mode 100644 index 0000000000..9a6d8e9d6e --- /dev/null +++ b/meta/recipes-core/systemd/systemd-boot_256.5.bb @@ -0,0 +1,67 @@ +require systemd.inc +FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" + +require conf/image-uefi.conf + +DEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native python3-pyelftools-native" + +inherit meson pkgconfig gettext +inherit deploy + +LDFLAGS =+ "${@ " ".join(d.getVar('LD').split()[1:])} " + +EFI_LD = "bfd" +LDFLAGS += "-fuse-ld=${EFI_LD}" + +do_write_config[vardeps] += "EFI_LD" +do_write_config:append() { + cat >${WORKDIR}/meson-${PN}.cross <<EOF +[binaries] +c_ld = ${@meson_array('EFI_LD', d)} +EOF +} + +MESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross" + +MESON_TARGET = "systemd-boot" + +EXTRA_OEMESON += "-Defi=true \ + -Dbootloader=true \ + -Dman=false \ + " + +# install to the image as boot*.efi if its the EFI_PROVIDER, +# otherwise install as the full name. +# This allows multiple bootloaders to coexist in a single image. +python __anonymous () { + import re + target = d.getVar('TARGET_ARCH') + prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-" + systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE") + d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage) + prefix = "systemd-" if prefix == "" else "" + d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix) +} + +FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" + +RDEPENDS:${PN} += "virtual-systemd-bootconf" + +CFLAGS:append:libc-musl = " -D__DEFINED_wchar_t" + +COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux" +COMPATIBLE_HOST:x86-x32 = "null" + +do_install() { + install -d ${D}${EFI_FILES_PATH} + install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE} +} + +do_deploy () { + install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR} + install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR} + install ${B}/src/boot/efi/addon*.efi.stub ${DEPLOYDIR} +} + +addtask deploy before do_build after do_compile + diff --git a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb index d13b8c518f..0ec49365d0 100644 --- a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb +++ b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb @@ -2,17 +2,18 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" SUMMARY = "Basic systemd-boot configuration files" -RPROVIDES_${PN} += "virtual/systemd-bootconf" +RPROVIDES:${PN} += "virtual-systemd-bootconf" PACKAGE_ARCH = "${MACHINE_ARCH}" inherit systemd-boot-cfg -S = "${WORKDIR}" +S = "${WORKDIR}/sources" +UNPACKDIR = "${S}" LABELS = "boot" ROOT ?= "root=/dev/sda2" -APPEND_append = " ${ROOT}" +APPEND:append = " ${ROOT}" python do_configure() { bb.build.exec_func('build_efi_cfg', d) @@ -29,4 +30,4 @@ do_install() { install *.conf ${D}/boot/loader/entries/ } -FILES_${PN} = "/boot/loader/* /boot/loader/entries/*" +FILES:${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 faa428b589..b929545823 100644 --- a/meta/recipes-core/systemd/systemd-compat-units.bb +++ b/meta/recipes-core/systemd/systemd-compat-units.bb @@ -2,17 +2,20 @@ SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts" HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd" LICENSE = "MIT" -PR = "r29" PACKAGE_WRITE_DEPS += "systemd-systemctl-native" -S = "${WORKDIR}" +S = "${WORKDIR}/sources" +UNPACKDIR = "${S}" inherit features_check -ALLOW_EMPTY_${PN} = "1" +INHIBIT_DEFAULT_DEPS = "1" -REQUIRED_DISTRO_FEATURES = "systemd" +ALLOW_EMPTY:${PN} = "1" + +REQUIRED_DISTRO_FEATURES += "systemd" +REQUIRED_DISTRO_FEATURES += "usrmerge" SYSTEMD_DISABLED_SYSV_SERVICES = " \ busybox-udhcpc \ @@ -23,9 +26,10 @@ SYSTEMD_DISABLED_SYSV_SERVICES = " \ syslog.busybox \ " -pkg_postinst_${PN} () { +pkg_postinst:${PN} () { - cd $D${sysconfdir}/init.d || exit 0 + test -d $D${sysconfdir}/init.d || exit 0 + cd $D${sysconfdir}/init.d echo "Disabling the following sysv scripts: " @@ -36,7 +40,7 @@ pkg_postinst_${PN} () { fi for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do - if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service ] ; then + if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_system_unitdir}/$i.service ] ; then echo -n "$i: " systemctl $OPTS mask $i.service fi @@ -44,4 +48,4 @@ pkg_postinst_${PN} () { echo } -RDEPENDS_${PN} = "systemd" +RDEPENDS:${PN} = "systemd" diff --git a/meta/recipes-core/systemd/systemd-conf/wired.network b/meta/recipes-core/systemd/systemd-conf/wired.network index ff807ba31f..7406287248 100644 --- a/meta/recipes-core/systemd/systemd-conf/wired.network +++ b/meta/recipes-core/systemd/systemd-conf/wired.network @@ -1,10 +1,13 @@ [Match] -Name=en* eth* +Type=ether +Name=!veth* KernelCommandLine=!nfsroot +KernelCommandLine=!ip [Network] DHCP=yes [DHCP] +UseMTU=yes RouteMetric=10 ClientIdentifier=mac diff --git a/meta/recipes-core/systemd/systemd-conf_1.0.bb b/meta/recipes-core/systemd/systemd-conf_1.0.bb new file mode 100644 index 0000000000..b8bea0c25b --- /dev/null +++ b/meta/recipes-core/systemd/systemd-conf_1.0.bb @@ -0,0 +1,49 @@ +SUMMARY = "Systemd system configuration" +DESCRIPTION = "Systemd may require slightly different configuration for \ +different machines. For example, qemu machines require a longer \ +DefaultTimeoutStartSec setting." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +inherit features_check +REQUIRED_DISTRO_FEATURES += "usrmerge" + +PE = "1" + +PACKAGECONFIG ??= "dhcp-ethernet" +PACKAGECONFIG[dhcp-ethernet] = "" + +SRC_URI = "\ + file://journald.conf \ + file://logind.conf \ + file://system.conf \ + file://system.conf-qemuall \ + file://wired.network \ +" + +S = "${WORKDIR}/sources" +UNPACKDIR = "${S}" + +do_install() { + install -D -m0644 ${S}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf + install -D -m0644 ${S}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf + install -D -m0644 ${S}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf + + if ${@bb.utils.contains('PACKAGECONFIG', 'dhcp-ethernet', 'true', 'false', d)}; then + install -D -m0644 ${S}/wired.network ${D}${systemd_unitdir}/network/80-wired.network + fi +} + +# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52 +do_install:append:qemuall() { + install -D -m0644 ${S}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +FILES:${PN} = "\ + ${systemd_unitdir}/journald.conf.d/ \ + ${systemd_unitdir}/logind.conf.d/ \ + ${systemd_unitdir}/system.conf.d/ \ + ${systemd_unitdir}/network/ \ +" diff --git a/meta/recipes-core/systemd/systemd-conf_243.bb b/meta/recipes-core/systemd/systemd-conf_243.bb deleted file mode 100644 index d9ec023bfd..0000000000 --- a/meta/recipes-core/systemd/systemd-conf_243.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "Systemd system configuration" -DESCRIPTION = "Systemd may require slightly different configuration for \ -different machines. For example, qemu machines require a longer \ -DefaultTimeoutStartSec setting." -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - -SRC_URI = "\ - file://journald.conf \ - file://logind.conf \ - file://system.conf \ - file://system.conf-qemuall \ - file://wired.network \ -" - -do_install() { - install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf - install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf - install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf - install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network -} - -# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52 -do_install_append_qemuall() { - install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf - - # Do not install wired.network for qemu bsps - rm -rf ${D}${systemd_unitdir}/network -} - -PACKAGE_ARCH = "${MACHINE_ARCH}" - -FILES_${PN} = "\ - ${systemd_unitdir}/journald.conf.d/ \ - ${systemd_unitdir}/logind.conf.d/ \ - ${systemd_unitdir}/system.conf.d/ \ - ${systemd_unitdir}/network/ \ -" 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..8df7ff7cf1 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,9 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda PACKAGE_ARCH = "${MACHINE_ARCH}" -PR = "r19" -inherit systemd -SYSTEMD_SERVICE_${PN} = "" +inherit systemd features_check +REQUIRED_DISTRO_FEATURES += "usrmerge" +SYSTEMD_SERVICE:${PN} = "" -ALLOW_EMPTY_${PN} = "1" +ALLOW_EMPTY:${PN} = "1" diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb index 044c6c5b67..9035b8c335 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty.bb +++ b/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -1,27 +1,30 @@ SUMMARY = "Serial terminal support for systemd" HOMEPAGE = "https://www.freedesktop.org/wiki/Software/systemd/" -LICENSE = "GPLv2+" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" -PR = "r5" SERIAL_CONSOLES ?= "115200;ttyS0" +SERIAL_TERM ?= "linux" SRC_URI = "file://serial-getty@.service" -S = "${WORKDIR}" +S = "${WORKDIR}/sources" +UNPACKDIR = "${S}" # As this package is tied to systemd, only build it when we're also building systemd. inherit features_check -REQUIRED_DISTRO_FEATURES = "systemd" +REQUIRED_DISTRO_FEATURES += "systemd" +REQUIRED_DISTRO_FEATURES += "usrmerge" do_install() { if [ ! -z "${SERIAL_CONSOLES}" ] ; then default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` - install -d ${D}${systemd_unitdir}/system/ + install -d ${D}${systemd_system_unitdir}/ install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ - install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/ - sed -i -e s/\@BAUDRATE\@/$default_baudrate/g ${D}${systemd_unitdir}/system/serial-getty@.service + install -m 0644 ${S}/serial-getty@.service ${D}${systemd_system_unitdir}/ + sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_system_unitdir}/serial-getty@.service + sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_system_unitdir}/serial-getty@.service tmp="${SERIAL_CONSOLES}" for entry in $tmp ; do @@ -29,14 +32,14 @@ do_install() { ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'` if [ "$baudrate" = "$default_baudrate" ] ; then # enable the service - ln -sf ${systemd_unitdir}/system/serial-getty@.service \ + ln -sf ${systemd_system_unitdir}/serial-getty@.service \ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service else # install custom service file for the non-default baudrate - install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service - sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service + install -m 0644 ${S}/serial-getty@.service ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service + sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service # enable the service - ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \ + ln -sf ${systemd_system_unitdir}/serial-getty$baudrate@.service \ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service fi done @@ -44,7 +47,7 @@ do_install() { } # This is a machine specific file -FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}" +FILES:${PN} = "${systemd_system_unitdir}/*.service ${sysconfdir}" PACKAGE_ARCH = "${MACHINE_ARCH}" -ALLOW_EMPTY_${PN} = "1" +ALLOW_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 index 15af16a9f8..b16fe1188e 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service +++ b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1+ +# # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it @@ -11,7 +13,7 @@ Documentation=man:agetty(8) man:systemd-getty-generator(8) Documentation=http://0pointer.de/blog/projects/serial-console.html PartOf=dev-%i.device ConditionPathExists=/dev/%i -After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service +After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target After=rc-local.service # If additional gettys are spawned during boot then we should make @@ -20,12 +22,17 @@ After=rc-local.service Before=getty.target IgnoreOnIsolate=yes +# IgnoreOnIsolate causes issues with sulogin, if someone isolates +# rescue.target or starts rescue.service from multi-user.target or +# graphical.target. +Conflicts=rescue.service +Before=rescue.service + [Service] -Environment="TERM=xterm" +Environment="TERM=@TERM@" ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM Type=idle Restart=always -RestartSec=0 UtmpIdentifier=%I TTYPath=/dev/%I TTYReset=yes diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb b/meta/recipes-core/systemd/systemd-systemctl-native.bb index fadc8433d8..ffa024caef 100644 --- a/meta/recipes-core/systemd/systemd-systemctl-native.bb +++ b/meta/recipes-core/systemd/systemd-systemctl-native.bb @@ -3,15 +3,15 @@ SUMMARY = "Wrapper for enabling systemd services" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" -PR = "r6" inherit native SRC_URI = "file://systemctl" -S = "${WORKDIR}" +S = "${WORKDIR}/sources" +UNPACKDIR = "${S}" do_install() { install -d ${D}${bindir} - install -m 0755 ${WORKDIR}/systemctl ${D}${bindir} + install -m 0755 ${S}/systemctl ${D}${bindir} } diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index ebac863739..2229bc7b6d 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -11,6 +11,7 @@ import re import sys from collections import namedtuple +from itertools import chain from pathlib import Path version = 1.0 @@ -25,12 +26,19 @@ locations = list() class SystemdFile(): """Class representing a single systemd configuration file""" - def __init__(self, root, path): + + _clearable_keys = ['WantedBy'] + + def __init__(self, root, path, instance_unit_name): self.sections = dict() self._parse(root, path) dirname = os.path.basename(path.name) + ".d" for location in locations: - for path2 in sorted((root / location / "system" / dirname).glob("*.conf")): + files = (root / location / "system" / dirname).glob("*.conf") + if instance_unit_name: + inst_dirname = instance_unit_name + ".d" + files = chain(files, (root / location / "system" / inst_dirname).glob("*.conf")) + for path2 in sorted(files): self._parse(root, path2) def _parse(self, root, path): @@ -75,6 +83,14 @@ class SystemdFile(): v = m.group('value') if k not in section: section[k] = list() + + # If we come across a "key=" line for a "clearable key", then + # forget all preceding assignments. This works because we are + # processing files in correct parse order. + if k in self._clearable_keys and not v: + del section[k] + continue + section[k].extend(v.split()) def get(self, section, prop): @@ -160,7 +176,9 @@ def add_link(path, target): class SystemdUnitNotFoundError(Exception): - pass + def __init__(self, path, unit): + self.path = path + self.unit = unit class SystemdUnit(): @@ -172,29 +190,34 @@ class SystemdUnit(): def _path_for_unit(self, unit): for location in locations: path = self.root / location / "system" / unit - if path.exists(): + if path.exists() or path.is_symlink(): return path raise SystemdUnitNotFoundError(self.root, unit) - def _process_deps(self, config, service, location, prop, dirstem): + def _process_deps(self, config, service, location, prop, dirstem, instance): systemdir = self.root / SYSCONFDIR / "systemd" / "system" target = ROOT / location.relative_to(self.root) try: for dependent in config.get('Install', prop): + # expand any %i to instance (ignoring escape sequence %%) + dependent = re.sub("([^%](%%)*)%i", "\\g<1>{}".format(instance), dependent) wants = systemdir / "{}.{}".format(dependent, dirstem) / service add_link(wants, target) except KeyError: pass - def enable(self): + def enable(self, units_enabled=[]): # if we're enabling an instance, first extract the actual instance # then figure out what the template unit is template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit) + instance_unit_name = None if template: instance = template.group('instance') + if instance != "": + instance_unit_name = self.unit unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1) else: instance = None @@ -206,7 +229,7 @@ class SystemdUnit(): # ignore aliases return - config = SystemdFile(self.root, path) + config = SystemdFile(self.root, path, instance_unit_name) if instance == "": try: default_instance = config.get('Install', 'DefaultInstance')[0] @@ -219,12 +242,17 @@ class SystemdUnit(): else: service = self.unit - self._process_deps(config, service, path, 'WantedBy', 'wants') - self._process_deps(config, service, path, 'RequiredBy', 'requires') + self._process_deps(config, service, path, 'WantedBy', 'wants', instance) + self._process_deps(config, service, path, 'RequiredBy', 'requires', instance) try: for also in config.get('Install', 'Also'): - SystemdUnit(self.root, also).enable() + try: + units_enabled.append(unit) + if also not in units_enabled: + SystemdUnit(self.root, also).enable(units_enabled) + except SystemdUnitNotFoundError as e: + sys.exit("Error: Systemctl also enable issue with %s (%s)" % (service, e.unit)) except KeyError: pass @@ -265,7 +293,10 @@ def preset_all(root): state = presets.state(service) if state == "enable" or state is None: - SystemdUnit(root, service).enable() + try: + SystemdUnit(root, service).enable() + except SystemdUnitNotFoundError: + sys.exit("Error: Systemctl preset_all issue in %s" % service) # If we populate the systemd links we also create /etc/machine-id, which # allows systemd to boot with the filesystem read-only before generating @@ -282,7 +313,7 @@ def main(): sys.exit("Python 3.4 or greater is required") parser = argparse.ArgumentParser() - parser.add_argument('command', nargs=1, choices=['enable', 'mask', + parser.add_argument('command', nargs='?', choices=['enable', 'mask', 'preset-all']) parser.add_argument('service', nargs=argparse.REMAINDER) parser.add_argument('--root') @@ -300,13 +331,23 @@ def main(): locations.append(BASE_LIBDIR / "systemd") locations.append(LIBDIR / "systemd") - command = args.command[0] + command = args.command + if not command: + parser.print_help() + return 0 + if command == "mask": for service in args.service: - SystemdUnit(root, service).mask() + try: + SystemdUnit(root, service).mask() + except SystemdUnitNotFoundError as e: + sys.exit("Error: Systemctl main mask issue in %s (%s)" % (service, e.unit)) elif command == "enable": for service in args.service: - SystemdUnit(root, service).enable() + try: + SystemdUnit(root, service).enable() + except SystemdUnitNotFoundError as e: + sys.exit("Error: Systemctl main enable issue in %s (%s)" % (service, e.unit)) elif command == "preset-all": if len(args.service) != 0: sys.exit("Too many arguments.") diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc index 6965b3b482..83dcd65a83 100644 --- a/meta/recipes-core/systemd/systemd.inc +++ b/meta/recipes-core/systemd/systemd.inc @@ -10,14 +10,13 @@ state, maintains mount and automount points and implements an \ elaborate transactional dependency-based service control logic. It can \ work as a drop-in replacement for sysvinit." -LICENSE = "GPLv2 & LGPLv2.1" +LICENSE = "GPL-2.0-only & LGPL-2.1-or-later" +LICENSE:libsystemd = "LGPL-2.1-or-later" LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" -SRCREV = "fab6f010ac6c3bc93a10868de722d7c8c3622eb9" -SRCBRANCH = "v243-stable" -SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH}" +SRCREV = "b45730389ba025489ec8d445bc91534fef515c28" +SRCBRANCH = "v256-stable" +SRC_URI = "git://github.com/systemd/systemd.git;protocol=https;branch=${SRCBRANCH}" S = "${WORKDIR}/git" - -PV_append = ".2" diff --git a/meta/recipes-core/systemd/systemd/00-create-volatile.conf b/meta/recipes-core/systemd/systemd/00-create-volatile.conf index 87cbe1e7d3..043b2ef1d8 100644 --- a/meta/recipes-core/systemd/systemd/00-create-volatile.conf +++ b/meta/recipes-core/systemd/systemd/00-create-volatile.conf @@ -3,5 +3,7 @@ # inside /var/log. +d /run/lock 1777 - - - d /var/volatile/log - - - - d /var/volatile/tmp 1777 - - +L /var/tmp - - - - /var/volatile/tmp diff --git a/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf new file mode 100644 index 0000000000..6b224ba9b9 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf @@ -0,0 +1,6 @@ +[Service] +# By running with these options instead of root, networkd is allowed to request +# a hostname change via DBUS when policykit is not present +User=systemd-network +Group=systemd-hostname +AmbientCapabilities=CAP_SYS_ADMIN diff --git a/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch b/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch deleted file mode 100644 index e2e19ba068..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 527413ec243564a89ffaad6368d446de44415970 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Tue, 27 Feb 2018 21:42:23 -0800 -Subject: [PATCH] Fix to run efi_cc and efi_ld correctly when cross-compiling - -When cross-compiling, efi_cc and efi_ld may take the form of -'xxx-gcc --sysroot=xxx', and this would cause run_command and -the alike fail. - -Fix to split them to make commands run correctly. - -Upstream-Status: Pending - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/boot/efi/meson.build | 16 +++++++++++++--- - 1 file changed, 13 insertions(+), 3 deletions(-) - -diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build -index 992a3ba4c..9f9ec4911 100644 ---- a/src/boot/efi/meson.build -+++ b/src/boot/efi/meson.build -@@ -157,7 +157,7 @@ if have_gnu_efi - o_file = custom_target(file + '.o', - input : file, - output : file + '.o', -- command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@'] -+ command : efi_cc.split() + ['-c', '@INPUT@', '-o', '@OUTPUT@'] - + compile_args, - depend_files : efi_headers) - if (common_sources + systemd_boot_sources).contains(file) -@@ -168,7 +168,17 @@ if have_gnu_efi - endif - endforeach - -- libgcc_file_name = run_command(efi_cc, '-print-libgcc-file-name').stdout().strip() -+ find_libgcc_cmd_all = efi_cc + ' -print-libgcc-file-name' -+ find_libgcc_cmd = find_libgcc_cmd_all.split()[0] -+ find_libgcc_args = [] -+ cmd_args_all = find_libgcc_cmd_all.split() -+ foreach arg : cmd_args_all -+ if arg != find_libgcc_cmd -+ find_libgcc_args += arg -+ endif -+ endforeach -+ -+ libgcc_file_name = run_command(find_libgcc_cmd, find_libgcc_args).stdout().strip() - systemd_boot_efi_name = 'systemd-boot@0@.efi'.format(EFI_MACHINE_TYPE_NAME) - stub_efi_name = 'linux@0@.efi.stub'.format(EFI_MACHINE_TYPE_NAME) - no_undefined_symbols = find_program('no-undefined-symbols.sh') -@@ -179,7 +189,7 @@ if have_gnu_efi - tuple[0], - input : tuple[2], - output : tuple[0], -- command : [efi_ld, '-o', '@OUTPUT@'] + -+ command : efi_ld.split() + ['-o', '@OUTPUT@'] + - efi_ldflags + tuple[2] + - ['-lefi', '-lgnuefi', libgcc_file_name]) - --- -2.13.0 - diff --git a/meta/recipes-core/systemd/systemd/0001-Revert-meson-print-EFI-CC-configuration-nicely.patch b/meta/recipes-core/systemd/systemd/0001-Revert-meson-print-EFI-CC-configuration-nicely.patch deleted file mode 100644 index ed14e25bce..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Revert-meson-print-EFI-CC-configuration-nicely.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0bf530aac152630500939db31f98d933158fdabd Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Tue, 26 Feb 2019 14:27:49 +0800 -Subject: [PATCH] Revert "meson: print EFI CC configuration nicely" - -This reverts commit c512dfb9ac948ddb1ced0dab07b9dac88b198293. - -This patch is here because we haven't figured out how to pass -parameter to efi-cc if it's an array in systemd-boot recipe. - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/meson.build b/meson.build -index 70fb218..30df834 100644 ---- a/meson.build -+++ b/meson.build -@@ -3138,7 +3138,7 @@ if conf.get('ENABLE_EFI') == 1 - if have_gnu_efi - status += [ - 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME), -- 'EFI CC @0@'.format(' '.join(efi_cc)), -+ 'EFI CC @0@'.format(efi_cc), - 'EFI lib directory: @0@'.format(efi_libdir), - 'EFI lds directory: @0@'.format(efi_ldsdir), - 'EFI include directory: @0@'.format(efi_incdir)] --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0001-Revert-meson-use-an-array-option-for-efi-cc.patch b/meta/recipes-core/systemd/systemd/0001-Revert-meson-use-an-array-option-for-efi-cc.patch deleted file mode 100644 index 0d2ebf62bd..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Revert-meson-use-an-array-option-for-efi-cc.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0030dcbac1a9177ef7a28af209ac67149b899f5f Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Tue, 26 Feb 2019 14:17:25 +0800 -Subject: [PATCH] Revert "meson: use an array option for efi-cc" - -This reverts commit 595343fb4c99c2679d347ef7c19debfbfed6342e. - -This patch is here because we haven't figured out how to pass -parameter to efi-cc if it's an array in systemd-boot recipe. - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - meson_options.txt | 2 +- - src/boot/efi/meson.build | 11 ++++++----- - 2 files changed, 7 insertions(+), 6 deletions(-) - -diff --git a/meson_options.txt b/meson_options.txt -index 044bb79..3d28bfd 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -292,7 +292,7 @@ option('dbus', type : 'combo', choices : ['auto', 'true', 'false'], - - option('gnu-efi', type : 'combo', choices : ['auto', 'true', 'false'], - description : 'gnu-efi support for sd-boot') --option('efi-cc', type : 'array', -+option('efi-cc', type : 'string', - description : 'the compiler to use for EFI modules') - option('efi-ld', type : 'string', - description : 'the linker to use for EFI modules') -diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build -index 2140151..d8db3a1 100644 ---- a/src/boot/efi/meson.build -+++ b/src/boot/efi/meson.build -@@ -34,8 +34,8 @@ stub_sources = ''' - - if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false' - efi_cc = get_option('efi-cc') -- if efi_cc.length() == 0 -- efi_cc = cc.cmd_array() -+ if efi_cc == '' -+ efi_cc = ' '.join(cc.cmd_array()) - endif - efi_ld = get_option('efi-ld') - if efi_ld == '' -@@ -57,7 +57,8 @@ if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false' - - efi_libdir = get_option('efi-libdir') - if efi_libdir == '' -- ret = run_command(efi_cc + ['-print-multi-os-directory']) -+ cmd = 'cd /usr/lib/$(@0@ -print-multi-os-directory) && pwd'.format(efi_cc) -+ ret = run_command('sh', '-c', cmd) - if ret.returncode() == 0 - path = join_paths('/usr/lib', ret.stdout().strip()) - ret = run_command('realpath', '-e', path) -@@ -152,7 +153,7 @@ if have_gnu_efi - o_file = custom_target(file + '.o', - input : file, - output : file + '.o', -- command : efi_cc + ['-c', '@INPUT@', '-o', '@OUTPUT@'] -+ command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@'] - + compile_args, - depend_files : efi_headers) - if (common_sources + systemd_boot_sources).contains(file) -@@ -163,7 +164,7 @@ if have_gnu_efi - endif - endforeach - -- libgcc_file_name = run_command(efi_cc + ['-print-libgcc-file-name']).stdout().strip() -+ libgcc_file_name = run_command(efi_cc, '-print-libgcc-file-name').stdout().strip() - systemd_boot_efi_name = 'systemd-boot@0@.efi'.format(EFI_MACHINE_TYPE_NAME) - stub_efi_name = 'linux@0@.efi.stub'.format(EFI_MACHINE_TYPE_NAME) - no_undefined_symbols = find_program('no-undefined-symbols.sh') --- -2.7.4 - 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 73e65ff798..4ffcb2ed46 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,7 +1,7 @@ -From 98254e4798e79d52ac6b562616cd244120f6e239 Mon Sep 17 00:00:00 2001 +From ca94c86736ca7917e6c50d09d6c6ba56ba139709 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Thu, 21 Feb 2019 16:23:24 +0800 -Subject: [PATCH 1/5] binfmt: Don't install dependency links at install time +Subject: [PATCH 01/27] binfmt: Don't install dependency links at install time for the binfmt services use [Install] blocks so that they get created when the service is enabled @@ -19,40 +19,36 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com> [rebased for systemd 243] Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - units/meson.build | 6 ++---- + units/meson.build | 2 -- units/proc-sys-fs-binfmt_misc.automount | 3 +++ units/systemd-binfmt.service.in | 4 ++++ - 3 files changed, 9 insertions(+), 4 deletions(-) + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/units/meson.build b/units/meson.build -index e1ee9f86c3..6bb7771b36 100644 +index b231341a1f..b613a188a4 100644 --- a/units/meson.build +++ b/units/meson.build -@@ -46,8 +46,7 @@ units = [ - ['poweroff.target', '', - 'runlevel0.target'], - ['printer.target', ''], -- ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT', -- 'sysinit.target.wants/'], -+ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'], - ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], - ['reboot.target', '', - 'runlevel6.target ctrl-alt-del.target'], -@@ -130,8 +129,7 @@ in_units = [ - ['systemd-ask-password-console.service', ''], - ['systemd-ask-password-wall.service', ''], - ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'], -- ['systemd-binfmt.service', 'ENABLE_BINFMT', -- 'sysinit.target.wants/'], -+ ['systemd-binfmt.service', 'ENABLE_BINFMT'], - ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'], - ['systemd-boot-check-no-failures.service', ''], - ['systemd-boot-system-token.service', 'ENABLE_EFI', +@@ -156,7 +156,6 @@ units = [ + { + 'file' : 'proc-sys-fs-binfmt_misc.automount', + 'conditions' : ['ENABLE_BINFMT'], +- 'symlinks' : ['sysinit.target.wants/'], + }, + { + 'file' : 'proc-sys-fs-binfmt_misc.mount', +@@ -258,7 +257,6 @@ units = [ + { + 'file' : 'systemd-binfmt.service.in', + 'conditions' : ['ENABLE_BINFMT'], +- 'symlinks' : ['sysinit.target.wants/'], + }, + { + 'file' : 'systemd-bless-boot.service.in', diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount -index 30a6bc9918..4231f3b70f 100644 +index 7ec21e76c9..fee4d1345f 100644 --- a/units/proc-sys-fs-binfmt_misc.automount +++ b/units/proc-sys-fs-binfmt_misc.automount -@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/ +@@ -22,3 +22,6 @@ Before=shutdown.target [Automount] Where=/proc/sys/fs/binfmt_misc @@ -60,21 +56,24 @@ index 30a6bc9918..4231f3b70f 100644 +[Install] +WantedBy=sysinit.target diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in -index e940c7c9ad..6be7f5cc9b 100644 +index 318bf8efc2..6ef684861d 100644 --- a/units/systemd-binfmt.service.in +++ b/units/systemd-binfmt.service.in -@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm - Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems +@@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html + Documentation=https://systemd.io/API_FILE_SYSTEMS DefaultDependencies=no Conflicts=shutdown.target +Wants=proc-sys-fs-binfmt_misc.automount After=proc-sys-fs-binfmt_misc.automount - Before=sysinit.target shutdown.target - ConditionPathIsReadWrite=/proc/sys/ -@@ -28,3 +29,6 @@ Type=oneshot - RemainAfterExit=yes - ExecStart=@rootlibexecdir@/systemd-binfmt + After=proc-sys-fs-binfmt_misc.mount + After=local-fs.target +@@ -31,3 +32,6 @@ RemainAfterExit=yes + ExecStart={{LIBEXECDIR}}/systemd-binfmt + ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister TimeoutSec=90s + +[Install] +WantedBy=sysinit.target +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch deleted file mode 100644 index 2f4daf8665..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch +++ /dev/null @@ -1,413 +0,0 @@ -From 85e3c3046562ec24fc2f09ebfd08bf9f168091d5 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Fri, 1 Mar 2019 15:22:15 +0800 -Subject: [PATCH] do not disable buffer in writing files - -Do not disable buffer in writing files, otherwise we get -failure at boot for musl like below. - - [!!!!!!] Failed to allocate manager object. - -And there will be other failures, critical or not critical. -This is specific to musl. - -Upstream-Status: Inappropriate [musl] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[Rebased for v242] -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - src/basic/cgroup-util.c | 14 +++++++------- - src/basic/procfs-util.c | 4 ++-- - src/basic/smack-util.c | 2 +- - src/basic/util.c | 2 +- - src/binfmt/binfmt.c | 6 +++--- - src/core/main.c | 4 ++-- - src/core/smack-setup.c | 8 ++++---- - src/hibernate-resume/hibernate-resume.c | 2 +- - src/libsystemd/sd-device/sd-device.c | 2 +- - src/login/logind-dbus.c | 2 +- - src/nspawn/nspawn-cgroup.c | 2 +- - src/nspawn/nspawn.c | 6 +++--- - src/shared/sysctl-util.c | 2 +- - src/sleep/sleep.c | 10 +++++----- - src/udev/udevadm-trigger.c | 2 +- - src/udev/udevd.c | 2 +- - src/vconsole/vconsole-setup.c | 2 +- - 17 files changed, 36 insertions(+), 36 deletions(-) - -diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c -index 7b5839ccd6..18f6e8ffc8 100644 ---- a/src/basic/cgroup-util.c -+++ b/src/basic/cgroup-util.c -@@ -860,7 +860,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { - - xsprintf(c, PID_FMT "\n", pid); - -- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, c, 0); - if (r < 0) - return r; - -@@ -1142,7 +1142,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { - - sc = strstrip(contents); - if (isempty(sc)) { -- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, agent, 0); - if (r < 0) - return r; - } else if (!path_equal(sc, agent)) -@@ -1160,7 +1160,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { - - sc = strstrip(contents); - if (streq(sc, "0")) { -- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, "1", 0); - if (r < 0) - return r; - -@@ -1187,7 +1187,7 @@ int cg_uninstall_release_agent(const char *controller) { - if (r < 0) - return r; - -- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, "0", 0); - if (r < 0) - return r; - -@@ -1197,7 +1197,7 @@ int cg_uninstall_release_agent(const char *controller) { - if (r < 0) - return r; - -- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, "", 0); - if (r < 0) - return r; - -@@ -2053,7 +2053,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri - if (r < 0) - return r; - -- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); -+ return write_string_file(p, value, 0); - } - - int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { -@@ -2697,7 +2697,7 @@ int cg_enable_everywhere( - return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); - } - -- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_stream(f, s, 0); - if (r < 0) { - log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", - FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); -diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c -index 42ce53d5aa..57512532a6 100644 ---- a/src/basic/procfs-util.c -+++ b/src/basic/procfs-util.c -@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) { - * decrease it, as threads-max is the much more relevant sysctl. */ - if (limit > pid_max-1) { - sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ -- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); - if (r < 0) - return r; - } - - sprintf(buffer, "%" PRIu64, limit); -- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); - if (r < 0) { - uint64_t threads_max; - -diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c -index 123d00e13e..e7ea78f349 100644 ---- a/src/basic/smack-util.c -+++ b/src/basic/smack-util.c -@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { - return 0; - - p = procfs_file_alloca(pid, "attr/current"); -- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(p, label, 0); - if (r < 0) - return r; - -diff --git a/src/basic/util.c b/src/basic/util.c -index 93d610bc98..97dca64f73 100644 ---- a/src/basic/util.c -+++ b/src/basic/util.c -@@ -294,7 +294,7 @@ void disable_coredumps(void) { - if (detect_container() > 0) - return; - -- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); - if (r < 0) - log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); - } -diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c -index aa9d811f2e..8c7f2dae7a 100644 ---- a/src/binfmt/binfmt.c -+++ b/src/binfmt/binfmt.c -@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) { - if (!fn) - return log_oom(); - -- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); -+ return write_string_file(fn, "-1", 0); - } - - static int apply_rule(const char *rule) { -@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) { - - (void) delete_rule(rule); - -- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); - if (r < 0) - return log_error_errno(r, "Failed to add binary format: %m"); - -@@ -213,7 +213,7 @@ static int run(int argc, char *argv[]) { - } - - /* Flush out all rules */ -- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); -+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); - - STRV_FOREACH(f, files) { - k = apply_file(*f, true); -diff --git a/src/core/main.c b/src/core/main.c -index bcce7178a8..4199cedab9 100644 ---- a/src/core/main.c -+++ b/src/core/main.c -@@ -1285,7 +1285,7 @@ static int bump_unix_max_dgram_qlen(void) { - if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) - return 0; - -- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); -+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); - if (r < 0) - return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, - "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); -@@ -1509,7 +1509,7 @@ static void initialize_core_pattern(bool skip_setup) { - if (getpid_cached() != 1) - return; - -- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); - if (r < 0) - log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); - } -diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c -index b95e6239d4..fdbdaaaccb 100644 ---- a/src/core/smack-setup.c -+++ b/src/core/smack-setup.c -@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) { - } - - #ifdef SMACK_RUN_LABEL -- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); - if (r < 0) - log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); -- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); - if (r < 0) - log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); - r = write_string_file("/sys/fs/smackfs/netlabel", -- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); -+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0); - if (r < 0) - log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); -- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); - if (r < 0) - log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); - #endif -diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c -index 17e7cd1a00..87a7667716 100644 ---- a/src/hibernate-resume/hibernate-resume.c -+++ b/src/hibernate-resume/hibernate-resume.c -@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { - return EXIT_FAILURE; - } - -- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/power/resume", major_minor, 0); - if (r < 0) { - log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); - return EXIT_FAILURE; -diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c -index c4a7f2f3d3..bcac758284 100644 ---- a/src/libsystemd/sd-device/sd-device.c -+++ b/src/libsystemd/sd-device/sd-device.c -@@ -1849,7 +1849,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, - if (!value) - return -ENOMEM; - -- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); -+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); - if (r < 0) { - if (r == -ELOOP) - return -EINVAL; -diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c -index 30b9a66334..cc1d577933 100644 ---- a/src/login/logind-dbus.c -+++ b/src/login/logind-dbus.c -@@ -1325,7 +1325,7 @@ static int trigger_device(Manager *m, sd_device *d) { - if (!t) - return -ENOMEM; - -- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER); -+ (void) write_string_file(t, "change", 0); - } - - return 0; -diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c -index 0462b46413..7c53d41483 100644 ---- a/src/nspawn/nspawn-cgroup.c -+++ b/src/nspawn/nspawn-cgroup.c -@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { - fn = strjoina(tree, cgroup, "/cgroup.procs"); - - sprintf(pid_string, PID_FMT, pid); -- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); -+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755); - if (r < 0) { - log_error_errno(r, "Failed to move process: %m"); - goto finish; -diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index 2aec8041f0..841542f2f3 100644 ---- a/src/nspawn/nspawn.c -+++ b/src/nspawn/nspawn.c -@@ -2357,7 +2357,7 @@ static int reset_audit_loginuid(void) { - if (streq(p, "4294967295")) - return 0; - -- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/self/loginuid", "4294967295", 0); - if (r < 0) { - log_error_errno(r, - "Failed to reset audit login UID. This probably means that your kernel is too\n" -@@ -3566,13 +3566,13 @@ static int setup_uid_map(pid_t pid) { - - xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); - xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range); -- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(uid_map, line, 0); - if (r < 0) - return log_error_errno(r, "Failed to write UID map: %m"); - - /* We always assign the same UID and GID ranges */ - xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); -- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(uid_map, line, 0); - if (r < 0) - return log_error_errno(r, "Failed to write GID map: %m"); - -diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c -index 93bdcf11bf..68cddb7a9f 100644 ---- a/src/shared/sysctl-util.c -+++ b/src/shared/sysctl-util.c -@@ -88,7 +88,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c - - log_debug("Setting '%s' to '%s'", p, value); - -- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); -+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); - } - - int sysctl_read(const char *property, char **content) { -diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c -index b9fe96635d..f168d7f890 100644 ---- a/src/sleep/sleep.c -+++ b/src/sleep/sleep.c -@@ -54,7 +54,7 @@ static int write_hibernate_location_info(void) { - - /* if it's a swap partition, we just write the disk to /sys/power/resume */ - if (streq(type, "partition")) { -- r = write_string_file("/sys/power/resume", device, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/power/resume", device, 0); - if (r < 0) - return log_debug_errno(r, "Failed to write partition device to /sys/power/resume: %m"); - -@@ -98,14 +98,14 @@ static int write_hibernate_location_info(void) { - - offset = fiemap->fm_extents[0].fe_physical / page_size(); - xsprintf(offset_str, "%" PRIu64, offset); -- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/power/resume_offset", offset_str, 0); - if (r < 0) - return log_debug_errno(r, "Failed to write offset '%s': %m", offset_str); - - log_debug("Wrote calculated resume_offset value to /sys/power/resume_offset: %s", offset_str); - - xsprintf(device_str, "%lx", (unsigned long)stb.st_dev); -- r = write_string_file("/sys/power/resume", device_str, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/power/resume", device_str, 0); - if (r < 0) - return log_debug_errno(r, "Failed to write device '%s': %m", device_str); - -@@ -121,7 +121,7 @@ static int write_mode(char **modes) { - STRV_FOREACH(mode, modes) { - int k; - -- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER); -+ k = write_string_file("/sys/power/disk", *mode, 0); - if (k >= 0) - return 0; - -@@ -140,7 +140,7 @@ static int write_state(FILE **f, char **states) { - STRV_FOREACH(state, states) { - int k; - -- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); -+ k = write_string_stream(*f, *state, 0); - if (k >= 0) - return 0; - log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); -diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c -index 77d95e513f..25ce4abfb1 100644 ---- a/src/udev/udevadm-trigger.c -+++ b/src/udev/udevadm-trigger.c -@@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set *settle_se - if (!filename) - return log_oom(); - -- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(filename, action, 0); - if (r < 0) { - log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_ERR, r, - "Failed to write '%s' to '%s': %m", action, filename); -diff --git a/src/udev/udevd.c b/src/udev/udevd.c -index cb5123042a..ea309a9e7f 100644 ---- a/src/udev/udevd.c -+++ b/src/udev/udevd.c -@@ -1113,7 +1113,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) { - - filename = strjoina(syspath, "/uevent"); - log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath); -- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(filename, "change", 0); - if (r < 0) - return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename); - return 0; -diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c -index 75d052ae70..5a15c939d8 100644 ---- a/src/vconsole/vconsole-setup.c -+++ b/src/vconsole/vconsole-setup.c -@@ -117,7 +117,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { - static int toggle_utf8_sysfs(bool utf8) { - int r; - -- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); - if (r < 0) - return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); - diff --git a/meta/recipes-core/systemd/systemd/0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch b/meta/recipes-core/systemd/systemd/0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch deleted file mode 100644 index 7d764b4115..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 3f37ad5e083dcad51c21c1050b2829b70d240b52 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Tue, 6 Aug 2019 03:10:20 +0000 -Subject: [PATCH] meson: Add -Defi-objcopy option to specify objcopy - -This helps in cross compiling for x86 target on a aarch64 host e.g. -Fixes -TOPDIR/build/tmp/hosttools/objcopy:src/boot/efi/systemd_boot.so: Invalid bfd target - -Upstream-Status: Pending -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - meson_options.txt | 2 ++ - src/boot/efi/meson.build | 5 ++++- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/meson_options.txt b/meson_options.txt -index d4ec37dda2..dc1c96e112 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -296,6 +296,8 @@ option('efi-cc', type : 'array', - description : 'the compiler to use for EFI modules') - option('efi-ld', type : 'string', - description : 'the linker to use for EFI modules') -+option('efi-objcopy', type : 'string', -+ description : 'the objcopy to use for EFI') - option('efi-libdir', type : 'string', - description : 'path to the EFI lib directory') - option('efi-ldsdir', type : 'string', -diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build -index 0ae3191635..5a7137bc84 100644 ---- a/src/boot/efi/meson.build -+++ b/src/boot/efi/meson.build -@@ -88,7 +88,10 @@ if have_gnu_efi - output : 'efi_config.h', - configuration : efi_conf) - -- objcopy = find_program('objcopy') -+ objcopy = get_option('efi-objcopy') -+ if objcopy == '' -+ objcopy = find_program('objcopy', required: true) -+ endif - - efi_ldsdir = get_option('efi-ldsdir') - arch_lds = 'elf_@0@_efi.lds'.format(gnu_efi_path_arch) --- -2.17.1 - diff --git a/meta/recipes-core/systemd/systemd/0001-unit-file.c-consider-symlink-on-filesystems-like-NFS.patch b/meta/recipes-core/systemd/systemd/0001-unit-file.c-consider-symlink-on-filesystems-like-NFS.patch deleted file mode 100644 index ba20a0bb46..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-unit-file.c-consider-symlink-on-filesystems-like-NFS.patch +++ /dev/null @@ -1,42 +0,0 @@ -From d0122c077d2d8fd0fd29b463c501e7ddf9177ff3 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Tue, 24 Sep 2019 17:04:50 +0800 -Subject: [PATCH] unit-file.c: consider symlink on filesystems like NFS - -Some filesystems do not fully support readdir, according to the manual, -so we should also consider DT_UNKNOWN to correctly handle symlinks. - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - -Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/13637] ---- - src/shared/unit-file.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/shared/unit-file.c b/src/shared/unit-file.c -index 4a5f23e6c1..8373103000 100644 ---- a/src/shared/unit-file.c -+++ b/src/shared/unit-file.c -@@ -247,6 +247,7 @@ int unit_file_build_name_map( - _cleanup_free_ char *_filename_free = NULL, *simplified = NULL; - const char *suffix, *dst = NULL; - bool valid_unit_name; -+ struct stat sb; - - valid_unit_name = unit_name_is_valid(de->d_name, UNIT_NAME_ANY); - -@@ -279,7 +280,10 @@ int unit_file_build_name_map( - if (hashmap_contains(ids, de->d_name)) - continue; - -- if (de->d_type == DT_LNK) { -+ if (de->d_type == DT_LNK || -+ (de->d_type == DT_UNKNOWN && -+ lstat(filename, &sb) == 0 && -+ (sb.st_mode & S_IFMT) == S_IFLNK)) { - /* We don't explicitly check for alias loops here. unit_ids_map_get() which - * limits the number of hops should be used to access the map. */ - --- -2.17.1 - 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 c6213ab88e..0000000000 --- a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 1eb84534dea05d41afed1d898cba212ad7d310dd Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 13:41:41 +0800 -Subject: [PATCH 02/24] don't use glibc-specific qsort_r - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -[Rebased for v241] -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[Rebased for v242] -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> ---- - src/basic/sort-util.h | 14 -------------- - src/libsystemd/sd-hwdb/hwdb-util.c | 19 ++++++++++++++----- - src/shared/format-table.c | 36 ++++++++++++++++++++++++------------ - 3 files changed, 38 insertions(+), 31 deletions(-) - -diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h -index e029f8646e..27d68b341c 100644 ---- a/src/basic/sort-util.h -+++ b/src/basic/sort-util.h -@@ -54,17 +54,3 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, __compar_fn - int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \ - qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \ - }) -- --static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) { -- if (nmemb <= 1) -- return; -- -- assert(base); -- qsort_r(base, nmemb, size, compar, userdata); --} -- --#define typesafe_qsort_r(p, n, func, userdata) \ -- ({ \ -- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \ -- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \ -- }) -diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c -index c83575c7c8..72f8f3a050 100644 ---- a/src/libsystemd/sd-hwdb/hwdb-util.c -+++ b/src/libsystemd/sd-hwdb/hwdb-util.c -@@ -128,9 +128,13 @@ static void trie_free(struct trie *trie) { - - DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); - --static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) { -- return strcmp(trie->strings->buf + a->key_off, -- trie->strings->buf + b->key_off); -+static struct trie *trie_node_add_value_trie; -+static int trie_values_cmp(const void *v1, const void *v2) { -+ const struct trie_value_entry *a = v1; -+ const struct trie_value_entry *b = v2; -+ -+ return strcmp(trie_node_add_value_trie->strings->buf + a->key_off, -+ trie_node_add_value_trie->strings->buf + b->key_off); - } - - static int trie_node_add_value(struct trie *trie, struct trie_node *node, -@@ -158,7 +162,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, - .value_off = v, - }; - -- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie); -+ trie_node_add_value_trie = trie; -+ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); -+ trie_node_add_value_trie = NULL; -+ - if (val) { - /* At this point we have 2 identical properties on the same match-string. - * Since we process files in order, we just replace the previous value. */ -@@ -184,7 +191,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, - .line_number = line_number, - }; - node->values_count++; -- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie); -+ trie_node_add_value_trie = trie; -+ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); -+ trie_node_add_value_trie = NULL; - return 0; - } - -diff --git a/src/shared/format-table.c b/src/shared/format-table.c -index a5c0a99b08..d595cbe372 100644 ---- a/src/shared/format-table.c -+++ b/src/shared/format-table.c -@@ -850,31 +850,33 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t - return CMP(index_a, index_b); - } - --static int table_data_compare(const size_t *a, const size_t *b, Table *t) { -+static Table *user_table; -+static int table_data_compare(const void *x, const void *y) { -+ const size_t *a = x, *b=y; - size_t i; - int r; - -- assert(t); -- assert(t->sort_map); -+ assert(user_table); -+ assert(user_table->sort_map); - - /* Make sure the header stays at the beginning */ -- if (*a < t->n_columns && *b < t->n_columns) -+ if (*a < user_table->n_columns && *b < user_table->n_columns) - return 0; -- if (*a < t->n_columns) -+ if (*a < user_table->n_columns) - return -1; -- if (*b < t->n_columns) -+ if (*b < user_table->n_columns) - return 1; - - /* Order other lines by the sorting map */ -- for (i = 0; i < t->n_sort_map; i++) { -+ for (i = 0; i < user_table->n_sort_map; i++) { - TableData *d, *dd; - -- d = t->data[*a + t->sort_map[i]]; -- dd = t->data[*b + t->sort_map[i]]; -+ d = user_table->data[*a + user_table->sort_map[i]]; -+ dd = user_table->data[*b + user_table->sort_map[i]]; - - r = cell_data_compare(d, *a, dd, *b); - if (r != 0) -- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r; -+ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r; - } - - /* Order identical lines by the order there were originally added in */ -@@ -1107,7 +1109,12 @@ int table_print(Table *t, FILE *f) { - for (i = 0; i < n_rows; i++) - sorted[i] = i * t->n_columns; - -- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); -+ if (n_rows <= 1) -+ return 0; -+ assert(sorted); -+ user_table = t; -+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare); -+ user_table = NULL; - } - - if (t->display_map) -@@ -1534,7 +1541,12 @@ int table_to_json(Table *t, JsonVariant **ret) { - for (i = 0; i < n_rows; i++) - sorted[i] = i * t->n_columns; - -- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); -+ if (n_rows <= 1) -+ return 0; -+ assert(sorted); -+ user_table = t; -+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare); -+ user_table = NULL; - } - - if (t->display_map) --- -2.11.0 - 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 6695d56804..36cc5678c0 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 @@ -From 47864989388bcd04d647ecf618ad7e260399dbb6 Mon Sep 17 00:00:00 2001 +From 40ae40de3db990a7e56694f24fc625b1b71a98f7 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Sat, 5 Sep 2015 06:31:47 +0000 -Subject: [PATCH 3/5] implment systemd-sysv-install for OE +Subject: [PATCH 02/27] implment systemd-sysv-install for OE Use update-rc.d for enabling/disabling and status command to check the status of the sysv service @@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON -index 8c16cf9..9f078a1 100755 +index cb58d8243b..000bdf6165 100755 --- a/src/systemctl/systemd-sysv-install.SKELETON +++ b/src/systemctl/systemd-sysv-install.SKELETON -@@ -32,17 +32,17 @@ case "$1" in +@@ -34,17 +34,17 @@ case "$1" in enable) # call the command to enable SysV init script $NAME here # (consider optional $ROOT) @@ -39,5 +39,5 @@ index 8c16cf9..9f078a1 100755 *) usage ;; -- -2.7.4 +2.45.1 diff --git a/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch b/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch deleted file mode 100644 index dcae668dcb..0000000000 --- a/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch +++ /dev/null @@ -1,25 +0,0 @@ -Include sys/wait.h - -Fixes: -src/login/logind-brightness.c:158:85: error: 'WEXITED' undeclared (first use in this function); did you mean 'WIFEXITED'? - 158 | r = sd_event_add_child(w->manager->event, &w->child_event_source, w->child, WEXITED, on_brightness_writer_exit, w); - | ^~~~~~~ - -Upstream-Status: Pending - -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - src/login/logind-brightness.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/login/logind-brightness.c b/src/login/logind-brightness.c -index 8dfa97d7ae..bddd4a2727 100644 ---- a/src/login/logind-brightness.c -+++ b/src/login/logind-brightness.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <sys/wait.h> - #include "bus-util.h" - #include "device-util.h" - #include "hash-funcs.h" diff --git a/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch b/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch deleted file mode 100644 index 49a334d090..0000000000 --- a/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch +++ /dev/null @@ -1,63 +0,0 @@ -From bdbafe18c3bf99b3b691cd52b9ccff60f313892d Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Wed, 27 Jun 2018 16:09:24 +0800 -Subject: [PATCH 2/5] use lnr wrapper instead of looking for --relative option - for ln - -Remove file manually to avoid the 'File Exists' error when creating -symlink. This is because the original 'ln' command uses '-f' option. - -Upstream-Status: Inappropriate [OE-Specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - meson.build | 4 ---- - tools/meson-make-symlink.sh | 3 ++- - units/meson-add-wants.sh | 7 ++++++- - 3 files changed, 8 insertions(+), 6 deletions(-) - -diff --git a/meson.build b/meson.build -index e5ceb1e169..79b762faeb 100644 ---- a/meson.build -+++ b/meson.build -@@ -579,10 +579,6 @@ endforeach - - conf.set_quoted('TELINIT', get_option('telinit-path')) - --if run_command('ln', '--relative', '--help').returncode() != 0 -- error('ln does not support --relative (added in coreutils 8.16)') --endif -- - ############################################################ - - gperf = find_program('gperf') -diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh -index da0d13a341..90bc0a93c2 100755 ---- a/tools/meson-make-symlink.sh -+++ b/tools/meson-make-symlink.sh -@@ -8,5 +8,6 @@ mkdir -vp "$(dirname "${DESTDIR:-}$2")" - if [ "$(dirname $1)" = . ]; then - ln -vfs -T "$1" "${DESTDIR:-}$2" - else -- ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2" -+ rm -f "${DESTDIR:-}$2" -+ lnr "${DESTDIR:-}$1" "${DESTDIR:-}$2" - fi -diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh -index a483d75b86..3c01c523f1 100755 ---- a/units/meson-add-wants.sh -+++ b/units/meson-add-wants.sh -@@ -25,4 +25,9 @@ case "$target" in - ;; - esac - --ln -vfs --relative "$unitpath" "$dir" -+if [ -d "$dir" ]; then -+ rm -f "$dir/$unit" -+ lnr "$unitpath" "$dir/$unit" -+else -+ lnr "$unitpath" "$dir" -+fi diff --git a/meta/recipes-core/systemd/systemd/0003-coredump-set-ProtectHome-to-read-only.patch b/meta/recipes-core/systemd/systemd/0003-coredump-set-ProtectHome-to-read-only.patch new file mode 100644 index 0000000000..feb1178d23 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0003-coredump-set-ProtectHome-to-read-only.patch @@ -0,0 +1,38 @@ +From 4ac1755be2d6c141fae7e57c42936e507c5b54e3 Mon Sep 17 00:00:00 2001 +From: Etienne Cordonnier <ecordonnier@snap.com> +Date: Fri, 6 Sep 2024 10:36:28 +0200 +Subject: [PATCH] coredump: set ProtectHome to read-only + +In https://github.com/systemd/systemd/pull/5283/commits/924453c22599cc246746a0233b2f52a27ade0819 +ProtectHome was set to true for systemd-coredump in order to reduce risk, since an attacker could craft a malicious binary in order to compromise systemd-coredump. +At that point the object analysis was done in the main systemd-coredump process. +Because of this systemd-coredump is unable to product symbolicated call-stacks for binaries running under /home ("n/a" is shown instead of function names). + +However, later in https://github.com/systemd/systemd/commit/61aea456c12c54f49c4a76259af130e576130ce9 systemd-coredump was changed to do the object analysis in a forked process, +covering those security concerns. + +Let's set ProtectHome to read-only so that systemd-coredump produces symbolicated call-stacks for processes running under /home. + +Upstream-Status: Backport [https://github.com/systemd/systemd/commit/4ac1755be2d6c141fae7e57c42936e507c5b54e3] + +Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> +--- + units/systemd-coredump@.service.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/units/systemd-coredump@.service.in b/units/systemd-coredump@.service.in +index 012c60d2f6..fa3206d07b 100644 +--- a/units/systemd-coredump@.service.in ++++ b/units/systemd-coredump@.service.in +@@ -28,7 +28,7 @@ PrivateDevices=yes + PrivateNetwork=yes + PrivateTmp=yes + ProtectControlGroups=yes +-ProtectHome=yes ++ProtectHome=read-only + ProtectHostname=yes + ProtectKernelModules=yes + ProtectKernelTunables=yes +-- +2.43.0 + 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 2e39f7a2e1..0000000000 --- a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch +++ /dev/null @@ -1,63 +0,0 @@ -From a9421d55102fc84f77f7c21a2479fcd00652b896 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 13:55:12 +0800 -Subject: [PATCH 03/24] missing_type.h: add __compare_fn_t and comparison_fn_t - -Make it work with musl where comparison_fn_t and __compare_fn_t -is not provided. - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[Rebased for v242] -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> ---- - src/basic/missing_type.h | 9 +++++++++ - src/basic/sort-util.h | 1 + - src/journal/catalog.c | 1 + - 3 files changed, 11 insertions(+) - -diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h -index bf8a6caa1b..2134fe5095 100644 ---- a/src/basic/missing_type.h -+++ b/src/basic/missing_type.h -@@ -10,3 +10,12 @@ - #if !HAVE_CHAR16_T - #define char16_t uint16_t - #endif -+ -+#ifndef __GLIBC__ -+typedef int (*comparison_fn_t)(const void *, const void *); -+#endif -+ -+#ifndef __COMPAR_FN_T -+#define __COMPAR_FN_T -+typedef int (*__compar_fn_t)(const void *, const void *); -+#endif -diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h -index e029f86..7247d40 100644 ---- a/src/basic/sort-util.h -+++ b/src/basic/sort-util.h -@@ -4,6 +4,7 @@ - #include <stdlib.h> - - #include "macro.h" -+#include "missing.h" - - void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, - __compar_d_fn_t compar, void *arg); -diff --git a/src/journal/catalog.c b/src/journal/catalog.c -index 7beffc1e1a..4818a2e5cc 100644 ---- a/src/journal/catalog.c -+++ b/src/journal/catalog.c -@@ -29,6 +29,7 @@ - #include "string-util.h" - #include "strv.h" - #include "tmpfile-util.h" -+#include "missing.h" - - const char * const catalog_file_dirs[] = { - "/usr/local/lib/systemd/catalog/", --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch b/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch deleted file mode 100644 index 7ee0d48fa6..0000000000 --- a/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch +++ /dev/null @@ -1,27 +0,0 @@ -Include signal.h - -Fixes several signal set related errors: -src/basic/copy.c:92:19: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration] -src/basic/copy.c:93:19: error: implicit declaration of function 'sigaddset' [-Werror=implicit-function-declaration] -src/basic/copy.c:93:34: error: 'SIGINT' undeclared (first use in this function) -src/basic/copy.c:95:13: error: implicit declaration of function 'sigtimedwait' [-Werror=implicit-function-declaration] - -Upstream-Status: Pending - -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - src/basic/copy.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/basic/copy.c b/src/basic/copy.c -index ca311e021e..3cf7fc1697 100644 ---- a/src/basic/copy.c -+++ b/src/basic/copy.c -@@ -12,6 +12,7 @@ - #include <sys/xattr.h> - #include <time.h> - #include <unistd.h> -+#include <signal.h> - - #include "alloc-util.h" - #include "btrfs-util.h" diff --git a/meta/recipes-core/systemd/systemd/0004-missing_type.h-add-comparison_fn_t.patch b/meta/recipes-core/systemd/systemd/0004-missing_type.h-add-comparison_fn_t.patch new file mode 100644 index 0000000000..f4456f3c15 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0004-missing_type.h-add-comparison_fn_t.patch @@ -0,0 +1,61 @@ +From 34b7e1ed3b9a896db6fad435fd141c385c7337d1 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 13:55:12 +0800 +Subject: [PATCH 04/27] missing_type.h: add comparison_fn_t + +Make it work with musl where comparison_fn_t and is not provided. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[Rebased for v244] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v242] +Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +[Rebased for v250, Drop __compare_fn_t] +Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com> +--- + src/basic/missing_type.h | 4 ++++ + src/basic/sort-util.h | 1 + + src/libsystemd/sd-journal/catalog.c | 1 + + 3 files changed, 6 insertions(+) + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index 1d17705c35..fc33b76ec1 100644 +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -10,3 +10,7 @@ + #if !HAVE_CHAR16_T + # define char16_t uint16_t + #endif ++ ++#ifndef __GLIBC__ ++typedef int (*comparison_fn_t)(const void *, const void *); ++#endif +diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h +index 9c818bd747..ef10c8be2c 100644 +--- a/src/basic/sort-util.h ++++ b/src/basic/sort-util.h +@@ -4,6 +4,7 @@ + #include <stdlib.h> + + #include "macro.h" ++#include "missing_type.h" + + /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the + * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that +diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c +index a0b673f65f..29dd2fee16 100644 +--- a/src/libsystemd/sd-journal/catalog.c ++++ b/src/libsystemd/sd-journal/catalog.c +@@ -29,6 +29,7 @@ + #include "string-util.h" + #include "strv.h" + #include "tmpfile-util.h" ++#include "missing_type.h" + + const char * const catalog_file_dirs[] = { + "/usr/local/lib/systemd/catalog/", +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch b/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch deleted file mode 100644 index f9c5996ffb..0000000000 --- a/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch +++ /dev/null @@ -1,34 +0,0 @@ -From dc0a6a9fe4da9738efaba942233ad39da625a918 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Thu, 21 Feb 2019 16:28:21 +0800 -Subject: [PATCH 4/5] rules: whitelist hd* devices - -qemu by default emulates IDE and the linux-yocto kernel(s) use -CONFIG_IDE instead of the more modern libsata, so disks appear as -/dev/hd*. Patch rejected upstream because CONFIG_IDE is deprecated. - -Upstream-Status: Denied [https://github.com/systemd/systemd/pull/1276] - -Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> -[rebased for systemd 241] -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - rules/60-persistent-storage.rules | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules -index 7802b1c94f..c0534ae26a 100644 ---- a/rules/60-persistent-storage.rules -+++ b/rules/60-persistent-storage.rules -@@ -7,7 +7,7 @@ ACTION=="remove", GOTO="persistent_storage_end" - ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}=="1", GOTO="persistent_storage_end" - - SUBSYSTEM!="block", GOTO="persistent_storage_end" --KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|ubi*|scm*|pmem*|nbd*|zd*", GOTO="persistent_storage_end" -+KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|ubi*|scm*|pmem*|nbd*|zd*|hd*", GOTO="persistent_storage_end" - - # ignore partitions that span the entire disk - TEST=="whole_disk", GOTO="persistent_storage_end" diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0005-add-fallback-parse_printf_format-implementation.patch index a2aad40ac2..b0865b32af 100644 --- a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch +++ b/meta/recipes-core/systemd/systemd/0005-add-fallback-parse_printf_format-implementation.patch @@ -1,7 +1,7 @@ -From 7bcf3b166694090497a0acd2c5299e4e04fcc9b6 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 14:04:21 +0800 -Subject: [PATCH 04/24] add fallback parse_printf_format implementation +From 4a4005583e2debe491850229aa5ae2a97770532d Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Sat, 22 May 2021 20:26:24 +0200 +Subject: [PATCH 05/27] add fallback parse_printf_format implementation Upstream-Status: Inappropriate [musl specific] @@ -11,44 +11,44 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com> [rebased for systemd 243] Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - meson.build | 1 + - src/basic/meson.build | 5 + - src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++++++++++ - src/basic/parse-printf-format.h | 57 +++++++++ - src/basic/stdio-util.h | 2 +- - src/journal/journal-send.c | 2 +- + meson.build | 1 + + src/basic/meson.build | 5 + + src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++ + src/basic/parse-printf-format.h | 57 +++++ + src/basic/stdio-util.h | 2 +- + src/libsystemd/sd-journal/journal-send.c | 2 +- 6 files changed, 338 insertions(+), 2 deletions(-) create mode 100644 src/basic/parse-printf-format.c create mode 100644 src/basic/parse-printf-format.h diff --git a/meson.build b/meson.build -index 79b762faeb..7f8c679411 100644 +index 52723bef09..e20bf3af8a 100644 --- a/meson.build +++ b/meson.build -@@ -613,6 +613,7 @@ endif - foreach header : ['crypt.h', +@@ -753,6 +753,7 @@ foreach header : ['crypt.h', 'linux/memfd.h', + 'linux/time_types.h', 'linux/vm_sockets.h', + 'printf.h', 'sys/auxv.h', - 'valgrind/memcheck.h', - 'valgrind/valgrind.h', + 'sys/sdt.h', + 'threads.h', diff --git a/src/basic/meson.build b/src/basic/meson.build -index d6caf28f14..32c1acf349 100644 +index 9a214575a5..b49b6ade56 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build -@@ -312,6 +312,11 @@ foreach item : [['af', af_list_txt, 'af', ''], - endforeach +@@ -189,6 +189,11 @@ endforeach basic_sources += generated_gperf_headers -+ + +if conf.get('HAVE_PRINTF_H') != 1 + basic_sources += [files('parse-printf-format.c')] +endif + - basic_gcrypt_sources = files( - 'gcrypt-util.c', - 'gcrypt-util.h') ++ + ############################################################ + + arch_list = [ diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c new file mode 100644 index 0000000000..49437e5445 @@ -392,11 +392,11 @@ index 0000000000..47be7522d7 + +#endif /* HAVE_PRINTF_H */ diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h -index c3b9448d4f..2937aa13b1 100644 +index 0a2239d022..43a765dacd 100644 --- a/src/basic/stdio-util.h +++ b/src/basic/stdio-util.h -@@ -1,13 +1,13 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ +@@ -1,12 +1,12 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include <printf.h> @@ -405,24 +405,23 @@ index c3b9448d4f..2937aa13b1 100644 #include <sys/types.h> #include "macro.h" - #include "memory-util.h" +#include "parse-printf-format.h" - #define snprintf_ok(buf, len, fmt, ...) \ - ((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len)) -diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c -index 5ef11fa1a4..6384ab620c 100644 ---- a/src/journal/journal-send.c -+++ b/src/journal/journal-send.c + _printf_(3, 4) + static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) { +diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c +index 7d02b57d7b..75e8e08add 100644 +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c @@ -2,7 +2,6 @@ #include <errno.h> #include <fcntl.h> -#include <printf.h> #include <stddef.h> - #include <sys/socket.h> #include <sys/un.h> -@@ -21,6 +20,7 @@ + #include <unistd.h> +@@ -28,6 +27,7 @@ #include "stdio-util.h" #include "string-util.h" #include "tmpfile-util.h" @@ -430,3 +429,6 @@ index 5ef11fa1a4..6384ab620c 100644 #define SNDBUF_SIZE (8*1024*1024) +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0005-rules-watch-metadata-changes-in-ide-devices.patch b/meta/recipes-core/systemd/systemd/0005-rules-watch-metadata-changes-in-ide-devices.patch deleted file mode 100644 index 96175b5b5e..0000000000 --- a/meta/recipes-core/systemd/systemd/0005-rules-watch-metadata-changes-in-ide-devices.patch +++ /dev/null @@ -1,45 +0,0 @@ -From d1bccc721dd8f43fee29c5df0e9b78345e69f4b6 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Thu, 21 Feb 2019 16:38:38 +0800 -Subject: [PATCH 5/5] rules: watch metadata changes in ide devices - -Formatting IDE storage does not trigger "change" uevents. As a result -clients using udev API don't get any updates afterwards and get outdated -information about the device. -... -root@qemux86-64:~# mkfs.ext4 -F /dev/hda1 -Creating filesystem with 262144 4k blocks and 65536 inodes -Filesystem UUID: 98791eb2-2bf3-47ad-b4d8-4cf7e914eee2 - -root@qemux86-64:~# ls /dev/disk/by-uuid/98791eb2-2bf3-47ad-b4d8-4cf7e914eee2 -ls: cannot access '/dev/disk/by-uuid/98791eb2-2bf3-47ad-b4d8-4cf7e914eee2': No such file or directory -... -Include hd* in a match for watch option assignment. - -Upstream-Status: Denied - -qemu by default emulates IDE and the linux-yocto kernel(s) use -CONFIG_IDE instead of the more modern libsata, so disks appear as -/dev/hd*. A similar patch rejected by upstream because CONFIG_IDE -is deprecated. - -Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> -[rebased for systemd 241] -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - rules/60-block.rules | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/rules/60-block.rules b/rules/60-block.rules -index 3134ab995e..cd72a494a1 100644 ---- a/rules/60-block.rules -+++ b/rules/60-block.rules -@@ -9,5 +9,5 @@ ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", - - # watch metadata changes, caused by tools closing the device node which was opened for writing - ACTION!="remove", SUBSYSTEM=="block", \ -- KERNEL=="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|ubi*|scm*|pmem*|nbd*|zd*", \ -+ KERNEL=="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|ubi*|scm*|pmem*|nbd*|zd*|hd*", \ - OPTIONS+="watch" 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 adfc3b7861..0000000000 --- a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch +++ /dev/null @@ -1,442 +0,0 @@ -From 399fd3eda3045636a70da438a0fd1406cc332ed1 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 14:18:21 +0800 -Subject: [PATCH 05/24] src/basic/missing.h: check for missing strndupa - -include missing.h for definition of strndupa - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[Rebased for v242] -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - meson.build | 1 + - src/backlight/backlight.c | 1 + - src/basic/env-util.c | 1 + - src/basic/missing_stdlib.h | 12 ++++++++++++ - src/basic/mkdir.c | 1 + - src/basic/parse-util.c | 1 + - src/basic/proc-cmdline.c | 1 + - src/basic/procfs-util.c | 1 + - src/basic/time-util.c | 1 + - src/core/dbus-cgroup.c | 1 + - src/core/dbus-util.c | 1 + - src/core/kmod-setup.c | 1 + - src/core/service.c | 1 + - src/journal/journalctl.c | 1 + - src/libsystemd/sd-bus/bus-message.c | 1 + - src/libsystemd/sd-bus/bus-objects.c | 1 + - src/libsystemd/sd-bus/test-bus-benchmark.c | 1 + - src/locale/keymap-util.c | 1 + - src/login/pam_systemd.c | 1 + - src/network/generator/network-generator.c | 1 + - src/nspawn/nspawn-settings.c | 1 + - src/shared/dns-domain.c | 1 + - src/shared/journal-importer.c | 1 + - src/shared/logs-show.c | 1 + - src/shared/pager.c | 1 + - src/shared/path-lookup.c | 1 + - src/shared/uid-range.c | 1 + - src/socket-proxy/socket-proxyd.c | 1 + - src/test/test-hexdecoct.c | 1 + - src/udev/udev-builtin-path_id.c | 1 + - src/udev/udev-event.c | 1 + - src/udev/udev-rules.c | 1 + - 32 files changed, 43 insertions(+) - -diff --git a/meson.build b/meson.build -index 7f8c679411..81c061b768 100644 ---- a/meson.build -+++ b/meson.build -@@ -506,6 +506,7 @@ foreach ident : [ - #include <unistd.h>'''], - ['get_mempolicy', '''#include <stdlib.h> - #include <unistd.h>'''], -+ ['strndupa' , '''#include <string.h>'''], - ] - - have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') -diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c -index dfd6805398..c2b2ace6ec 100644 ---- a/src/backlight/backlight.c -+++ b/src/backlight/backlight.c -@@ -17,6 +17,7 @@ - #include "string-util.h" - #include "strv.h" - #include "util.h" -+#include "missing.h" - - static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) { - const char *subsystem, *sysname, *value; -diff --git a/src/basic/env-util.c b/src/basic/env-util.c -index a6503cf2b6..ceef9a62c8 100644 ---- a/src/basic/env-util.c -+++ b/src/basic/env-util.c -@@ -16,6 +16,7 @@ - #include "string-util.h" - #include "strv.h" - #include "utf8.h" -+#include "missing.h" - - #define VALID_CHARS_ENV_NAME \ - DIGITS LETTERS \ -diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h -index 188a8d4406..1e16ec287a 100644 ---- a/src/basic/missing_stdlib.h -+++ b/src/basic/missing_stdlib.h -@@ -11,3 +11,15 @@ - # error "neither secure_getenv nor __secure_getenv are available" - # endif - #endif -+ -+/* string.h */ -+#if ! HAVE_STRNDUPA -+#define strndupa(s, n) \ -+ ({ \ -+ const char *__old = (s); \ -+ size_t __len = strnlen(__old, (n)); \ -+ char *__new = (char *)alloca(__len + 1); \ -+ __new[__len] = '\0'; \ -+ (char *)memcpy(__new, __old, __len); \ -+ }) -+#endif -diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c -index 6b82eab640..51c6b78615 100644 ---- a/src/basic/mkdir.c -+++ b/src/basic/mkdir.c -@@ -14,6 +14,7 @@ - #include "stat-util.h" - #include "stdio-util.h" - #include "user-util.h" -+#include "missing.h" - - int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags, mkdir_func_t _mkdir) { - struct stat st; -diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c -index 115a1494a2..07a34bfd53 100644 ---- a/src/basic/parse-util.c -+++ b/src/basic/parse-util.c -@@ -20,6 +20,7 @@ - #include "process-util.h" - #include "stat-util.h" - #include "string-util.h" -+#include "missing.h" - - int parse_boolean(const char *v) { - if (!v) -diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c -index 09169cf963..f411ba897f 100644 ---- a/src/basic/proc-cmdline.c -+++ b/src/basic/proc-cmdline.c -@@ -15,6 +15,7 @@ - #include "string-util.h" - #include "util.h" - #include "virt.h" -+#include "missing.h" - - int proc_cmdline(char **ret) { - const char *e; -diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c -index 7aaf95bfce..42ce53d5aa 100644 ---- a/src/basic/procfs-util.c -+++ b/src/basic/procfs-util.c -@@ -11,6 +11,7 @@ - #include "procfs-util.h" - #include "stdio-util.h" - #include "string-util.h" -+#include "missing.h" - - int procfs_tasks_get_limit(uint64_t *ret) { - _cleanup_free_ char *value = NULL; -diff --git a/src/basic/time-util.c b/src/basic/time-util.c -index 3018e81acb..4e2b3b66c1 100644 ---- a/src/basic/time-util.c -+++ b/src/basic/time-util.c -@@ -28,6 +28,7 @@ - #include "string-util.h" - #include "strv.h" - #include "time-util.h" -+#include "missing.h" - - static clockid_t map_clock_id(clockid_t c) { - -diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c -index 2f2313c599..c9937f9d62 100644 ---- a/src/core/dbus-cgroup.c -+++ b/src/core/dbus-cgroup.c -@@ -15,6 +15,7 @@ - #include "fileio.h" - #include "limits-util.h" - #include "path-util.h" -+#include "missing.h" - - static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_cgroup_device_policy, cgroup_device_policy, CGroupDevicePolicy); - -diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c -index 7862beaacb..19f6968cfe 100644 ---- a/src/core/dbus-util.c -+++ b/src/core/dbus-util.c -@@ -7,6 +7,7 @@ - #include "unit-printf.h" - #include "user-util.h" - #include "unit.h" -+#include "missing.h" - - int bus_property_get_triggered_unit( - sd_bus *bus, -diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c -index a91cfebc67..a45961013f 100644 ---- a/src/core/kmod-setup.c -+++ b/src/core/kmod-setup.c -@@ -11,6 +11,7 @@ - #include "kmod-setup.h" - #include "macro.h" - #include "string-util.h" -+#include "missing.h" - - #if HAVE_KMOD - #include <libkmod.h> -diff --git a/src/core/service.c b/src/core/service.c -index 73b3c9c316..ef74f00a08 100644 ---- a/src/core/service.c -+++ b/src/core/service.c -@@ -43,6 +43,7 @@ - #include "unit.h" - #include "utf8.h" - #include "util.h" -+#include "missing.h" - - static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { - [SERVICE_DEAD] = UNIT_INACTIVE, -diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c -index 6d6bb1cf63..6666349a35 100644 ---- a/src/journal/journalctl.c -+++ b/src/journal/journalctl.c -@@ -70,6 +70,7 @@ - #include "unit-name.h" - #include "user-util.h" - #include "varlink.h" -+#include "missing.h" - - #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE) - -diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c -index eb029e4453..f31fe9d5a8 100644 ---- a/src/libsystemd/sd-bus/bus-message.c -+++ b/src/libsystemd/sd-bus/bus-message.c -@@ -21,6 +21,7 @@ - #include "strv.h" - #include "time-util.h" - #include "utf8.h" -+#include "missing.h" - - static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored); - -diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c -index ae643cacc7..1b752271a5 100644 ---- a/src/libsystemd/sd-bus/bus-objects.c -+++ b/src/libsystemd/sd-bus/bus-objects.c -@@ -13,6 +13,7 @@ - #include "set.h" - #include "string-util.h" - #include "strv.h" -+#include "missing.h" - - static int node_vtable_get_userdata( - sd_bus *bus, -diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c -index 8de0a859ee..4fd0a2e692 100644 ---- a/src/libsystemd/sd-bus/test-bus-benchmark.c -+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c -@@ -14,6 +14,7 @@ - #include "missing_resource.h" - #include "time-util.h" - #include "util.h" -+#include "missing.h" - - #define MAX_SIZE (2*1024*1024) - -diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c -index f8c36c94f5..41f5606aea 100644 ---- a/src/locale/keymap-util.c -+++ b/src/locale/keymap-util.c -@@ -22,6 +22,7 @@ - #include "string-util.h" - #include "strv.h" - #include "tmpfile-util.h" -+#include "missing.h" - - static bool startswith_comma(const char *s, const char *prefix) { - s = startswith(s, prefix); -diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c -index 3f762cbbc3..005cfea658 100644 ---- a/src/login/pam_systemd.c -+++ b/src/login/pam_systemd.c -@@ -28,6 +28,7 @@ - #include "hostname-util.h" - #include "login-util.h" - #include "macro.h" -+#include "missing.h" - #include "parse-util.h" - #include "path-util.h" - #include "process-util.h" -diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c -index 0b5af33566..9c808cd014 100644 ---- a/src/network/generator/network-generator.c -+++ b/src/network/generator/network-generator.c -@@ -13,6 +13,7 @@ - #include "string-table.h" - #include "string-util.h" - #include "strv.h" -+#include "missing.h" - - /* - # .network -diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c -index 3a99736813..279fea4d88 100644 ---- a/src/nspawn/nspawn-settings.c -+++ b/src/nspawn/nspawn-settings.c -@@ -16,6 +16,7 @@ - #include "strv.h" - #include "user-util.h" - #include "util.h" -+#include "missing.h" - - Settings *settings_new(void) { - Settings *s; -diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c -index f62ad0a0f5..f1a27e158d 100644 ---- a/src/shared/dns-domain.c -+++ b/src/shared/dns-domain.c -@@ -24,6 +24,7 @@ - #include "string-util.h" - #include "strv.h" - #include "utf8.h" -+#include "missing.h" - - int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) { - const char *n; -diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c -index 7c4fc7021d..a6ff2214df 100644 ---- a/src/shared/journal-importer.c -+++ b/src/shared/journal-importer.c -@@ -14,6 +14,7 @@ - #include "parse-util.h" - #include "string-util.h" - #include "unaligned.h" -+#include "missing.h" - - enum { - IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */ -diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c -index b615c70dff..75b26e9c21 100644 ---- a/src/shared/logs-show.c -+++ b/src/shared/logs-show.c -@@ -39,6 +39,7 @@ - #include "time-util.h" - #include "utf8.h" - #include "util.h" -+#include "missing.h" - - /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */ - #define PRINT_LINE_THRESHOLD 3 -diff --git a/src/shared/pager.c b/src/shared/pager.c -index 7c20b100b4..e4209d3a95 100644 ---- a/src/shared/pager.c -+++ b/src/shared/pager.c -@@ -25,6 +25,7 @@ - #include "strv.h" - #include "terminal-util.h" - #include "util.h" -+#include "missing.h" - - static pid_t pager_pid = 0; - -diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c -index 6bf0ff0316..f6c8009cd2 100644 ---- a/src/shared/path-lookup.c -+++ b/src/shared/path-lookup.c -@@ -20,6 +20,7 @@ - #include "tmpfile-util.h" - #include "user-util.h" - #include "util.h" -+#include "missing.h" - - int xdg_user_runtime_dir(char **ret, const char *suffix) { - const char *e; -diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c -index 7cb7d8a477..8b12b91084 100644 ---- a/src/shared/uid-range.c -+++ b/src/shared/uid-range.c -@@ -9,6 +9,7 @@ - #include "sort-util.h" - #include "uid-range.h" - #include "user-util.h" -+#include "missing.h" - - static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { - assert(range); -diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c -index abbbc9f2d6..6179b5851e 100644 ---- a/src/socket-proxy/socket-proxyd.c -+++ b/src/socket-proxy/socket-proxyd.c -@@ -28,6 +28,7 @@ - #include "socket-util.h" - #include "string-util.h" - #include "util.h" -+#include "missing.h" - - #define BUFFER_SIZE (256 * 1024) - -diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c -index 52217429b1..a05e7782f6 100644 ---- a/src/test/test-hexdecoct.c -+++ b/src/test/test-hexdecoct.c -@@ -6,6 +6,7 @@ - #include "hexdecoct.h" - #include "macro.h" - #include "string-util.h" -+#include "missing.h" - - static void test_hexchar(void) { - assert_se(hexchar(0xa) == 'a'); -diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c -index e8f1ce1354..8693cb02a4 100644 ---- a/src/udev/udev-builtin-path_id.c -+++ b/src/udev/udev-builtin-path_id.c -@@ -23,6 +23,7 @@ - #include "strv.h" - #include "sysexits.h" - #include "udev-builtin.h" -+#include "missing.h" - - _printf_(2,3) - static void path_prepend(char **path, const char *fmt, ...) { -diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c -index 8cfa2cdf23..b0670c77ec 100644 ---- a/src/udev/udev-event.c -+++ b/src/udev/udev-event.c -@@ -35,6 +35,7 @@ - #include "udev-util.h" - #include "udev-watch.h" - #include "user-util.h" -+#include "missing.h" - - typedef struct Spawn { - sd_device *device; -diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c -index 1642f10535..fe2aa75478 100644 ---- a/src/udev/udev-rules.c -+++ b/src/udev/udev-rules.c -@@ -28,6 +28,7 @@ - #include "udev-event.h" - #include "udev-rules.h" - #include "user-util.h" -+#include "missing.h" - - #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") - 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 6d73d715ce..0000000000 --- a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch +++ /dev/null @@ -1,227 +0,0 @@ -Include netinet/if_ether.h - -Fixes -/path/to/systemd/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr' - struct ethhdr { - ^~~~~~ - -and related arphdr, arpreq, and arpreq_old errors -/path/to/systemd/recipe-sysroot/usr/include/net/if_arp.h:22:8: error: redefinition of 'struct arphdr' - struct arphdr { - ^~~~~~ - -The latter requires removing some includes of net/if_arp.h to avoid -conflicting with netinet/if_ether.h. - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - src/libsystemd-network/sd-dhcp6-client.c | 1 - - src/libsystemd/sd-netlink/netlink-types.c | 1 + - src/machine/machine-dbus.c | 1 + - src/network/netdev/macsec.c | 1 + - src/network/netdev/netdev.c | 1 + - src/network/networkd-brvlan.c | 1 + - src/network/networkd-dhcp-common.c | 1 + - src/network/networkd-dhcp4.c | 2 +- - src/network/networkd-dhcp6.c | 2 +- - src/network/networkd-link.c | 2 +- - src/network/networkd-network.c | 1 + - src/shared/ethtool-util.c | 1 + - src/shared/ethtool-util.h | 1 + - src/udev/net/link-config.c | 1 + - src/udev/udev-builtin-net_setup_link.c | 1 + - 15 files changed, 14 insertions(+), 4 deletions(-) - -diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c -index d7a5349c70..68b41dfb6c 100644 ---- a/src/libsystemd-network/sd-dhcp6-client.c -+++ b/src/libsystemd-network/sd-dhcp6-client.c -@@ -6,7 +6,6 @@ - #include <errno.h> - #include <string.h> - #include <sys/ioctl.h> --#include <linux/if_arp.h> - #include <linux/if_infiniband.h> - - #include "sd-dhcp6-client.h" -diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c -index de9b8b21ab..f64f6500f7 100644 ---- a/src/libsystemd/sd-netlink/netlink-types.c -+++ b/src/libsystemd/sd-netlink/netlink-types.c -@@ -3,6 +3,7 @@ - #include <netinet/in.h> - #include <stdint.h> - #include <sys/socket.h> -+#include <netinet/if_ether.h> - #include <linux/can/vxcan.h> - #include <linux/netlink.h> - #include <linux/rtnetlink.h> -diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c -index 0d58b5eb8b..01093c1f62 100644 ---- a/src/machine/machine-dbus.c -+++ b/src/machine/machine-dbus.c -@@ -4,6 +4,7 @@ - #include <string.h> - #include <sys/mount.h> - #include <sys/wait.h> -+#include <netinet/if_ether.h> - - /* When we include libgen.h because we need dirname() we immediately - * undefine basename() since libgen.h defines it as a macro to the POSIX -diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c -index cf281e75a6..269dc618ff 100644 ---- a/src/network/netdev/macsec.c -+++ b/src/network/netdev/macsec.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <netinet/in.h> - #include <linux/if_ether.h> - #include <linux/if_macsec.h> -diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c -index 7735b455b7..ed4eda4a44 100644 ---- a/src/network/netdev/netdev.c -+++ b/src/network/netdev/netdev.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <net/if.h> - #include <netinet/in.h> - -diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c -index c3c5d535ac..ebea408c89 100644 ---- a/src/network/networkd-brvlan.c -+++ b/src/network/networkd-brvlan.c -@@ -4,6 +4,7 @@ - ***/ - - #include <netinet/in.h> -+#include <netinet/if_ether.h> - #include <linux/if_bridge.h> - #include <stdbool.h> - -diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c -index 626b975839..42fe92f320 100644 ---- a/src/network/networkd-dhcp-common.c -+++ b/src/network/networkd-dhcp-common.c -@@ -1,6 +1,7 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - - #include "networkd-dhcp-common.h" -+#include <netinet/if_ether.h> - #include "networkd-network.h" - #include "parse-util.h" - #include "string-table.h" -diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c -index 662770b50e..c6ab62a94d 100644 ---- a/src/network/networkd-dhcp4.c -+++ b/src/network/networkd-dhcp4.c -@@ -1,8 +1,8 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <netinet/in.h> - #include <linux/if.h> --#include <linux/if_arp.h> - - #include "alloc-util.h" - #include "hostname-util.h" -diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c -index 8ad736a82b..f41b4d834e 100644 ---- a/src/network/networkd-dhcp6.c -+++ b/src/network/networkd-dhcp6.c -@@ -3,9 +3,9 @@ - Copyright © 2014 Intel Corporation. All rights reserved. - ***/ - -+#include <netinet/if_ether.h> - #include <netinet/in.h> - #include <linux/if.h> --#include <linux/if_arp.h> - #include "sd-radv.h" - - #include "sd-dhcp6-client.h" -diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c -index f5bb78890a..f13a36b791 100644 ---- a/src/network/networkd-link.c -+++ b/src/network/networkd-link.c -@@ -1,8 +1,8 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <netinet/in.h> - #include <linux/if.h> --#include <linux/if_arp.h> - #include <unistd.h> - - #include "alloc-util.h" -diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c -index 2b8d0eb2fb..2f79ef25cd 100644 ---- a/src/network/networkd-network.c -+++ b/src/network/networkd-network.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <net/if.h> - #include <netinet/in.h> - #include <linux/netdevice.h> -diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c -index b0961df72e..53fcbbd84b 100644 ---- a/src/shared/ethtool-util.c -+++ b/src/shared/ethtool-util.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <net/if.h> - #include <sys/ioctl.h> - #include <linux/ethtool.h> -diff --git a/src/shared/ethtool-util.h b/src/shared/ethtool-util.h -index 8b32b243f3..262b819976 100644 ---- a/src/shared/ethtool-util.h -+++ b/src/shared/ethtool-util.h -@@ -2,6 +2,7 @@ - #pragma once - - #include <macro.h> -+#include <netinet/if_ether.h> - #include <linux/ethtool.h> - - #include "conf-parser.h" -diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c -index d44af64d5e..fd052f1591 100644 ---- a/src/udev/net/link-config.c -+++ b/src/udev/net/link-config.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <linux/netdevice.h> - #include <netinet/ether.h> - -diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c -index ee3ca9fa38..9aa4e82874 100644 ---- a/src/udev/udev-builtin-net_setup_link.c -+++ b/src/udev/udev-builtin-net_setup_link.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include "device-util.h" - #include "alloc-util.h" - #include "link-config.h" 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/0006-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch index 34f7f5fb74..e7a0abcf9a 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/0006-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch @@ -1,7 +1,7 @@ -From f8a239b182158ca0a537ba053cb0e6bad9c3a2fb Mon Sep 17 00:00:00 2001 +From ed836c3478e1193e99e37d50db96d124796a3322 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 14:56:21 +0800 -Subject: [PATCH 07/24] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not +Subject: [PATCH 06/27] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined If the standard library doesn't provide brace @@ -24,10 +24,10 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com> 3 files changed, 38 insertions(+) diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c -index b335af8d97..2cdfc11f16 100644 +index 802ca8c655..23818a67c6 100644 --- a/src/basic/glob-util.c +++ b/src/basic/glob-util.c -@@ -14,6 +14,12 @@ +@@ -12,6 +12,12 @@ #include "path-util.h" #include "strv.h" @@ -40,7 +40,7 @@ index b335af8d97..2cdfc11f16 100644 static void closedir_wrapper(void* v) { (void) closedir(v); } -@@ -21,6 +27,7 @@ static void closedir_wrapper(void* v) { +@@ -19,6 +25,7 @@ static void closedir_wrapper(void* v) { int safe_glob(const char *path, int flags, glob_t *pglob) { int k; @@ -48,7 +48,7 @@ index b335af8d97..2cdfc11f16 100644 /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */ assert(!(flags & GLOB_ALTDIRFUNC)); -@@ -34,9 +41,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { +@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { pglob->gl_lstat = lstat; if (!pglob->gl_stat) pglob->gl_stat = stat; @@ -64,12 +64,12 @@ index b335af8d97..2cdfc11f16 100644 return -ENOENT; if (k == GLOB_NOSPACE) diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c -index b4f41445fe..f0d474ed14 100644 +index 49d71f15c7..0a49ebcc17 100644 --- a/src/test/test-glob-util.c +++ b/src/test/test-glob-util.c -@@ -13,6 +13,12 @@ - #include "rm-rf.h" - #include "tmpfile-util.h" +@@ -34,6 +34,12 @@ TEST(glob_first) { + ASSERT_NULL(first); + } +/* Don't fail if the standard library + * doesn't provide brace expansion */ @@ -77,10 +77,10 @@ index b4f41445fe..f0d474ed14 100644 +#define GLOB_BRACE 0 +#endif + - static void test_glob_exists(void) { + TEST(glob_exists) { char name[] = "/tmp/test-glob_exists.XXXXXX"; - int fd = -1; -@@ -40,11 +46,13 @@ static void test_glob_no_dot(void) { + int fd = -EBADF; +@@ -61,11 +67,13 @@ TEST(glob_no_dot) { const char *fn; _cleanup_globfree_ glob_t g = { @@ -94,7 +94,7 @@ index b4f41445fe..f0d474ed14 100644 }; int r; -@@ -52,11 +60,19 @@ static void test_glob_no_dot(void) { +@@ -73,11 +81,19 @@ TEST(glob_no_dot) { assert_se(mkdtemp(template)); fn = strjoina(template, "/*"); @@ -115,12 +115,12 @@ index b4f41445fe..f0d474ed14 100644 (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c -index 3c30612af1..14bc428085 100644 +index 807925f199..b4f86fc611 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c -@@ -63,6 +63,12 @@ - #include "umask-util.h" +@@ -73,6 +73,12 @@ #include "user-util.h" + #include "virt.h" +/* Don't fail if the standard library + * doesn't provide brace expansion */ @@ -131,23 +131,26 @@ index 3c30612af1..14bc428085 100644 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates * them in the file system. This is intended to be used to create * properly owned directories beneath /tmp, /var/tmp, /run, which are -@@ -1853,7 +1859,9 @@ finish: +@@ -2570,7 +2576,9 @@ finish: - static int glob_item(Item *i, action_t action) { + static int glob_item(Context *c, Item *i, action_t action) { _cleanup_globfree_ glob_t g = { +#ifdef GLOB_ALTDIRFUNC .gl_opendir = (void *(*)(const char *)) opendir_nomod, +#endif }; - int r = 0, k; - char **fn; -@@ -1873,7 +1881,9 @@ static int glob_item(Item *i, action_t action) { + int r; + +@@ -2598,7 +2606,9 @@ static int glob_item_recursively( + fdaction_t action) { - static int glob_item_recursively(Item *i, fdaction_t action) { _cleanup_globfree_ glob_t g = { +#ifdef GLOB_ALTDIRFUNC .gl_opendir = (void *(*)(const char *)) opendir_nomod, +#endif }; - int r = 0, k; - char **fn; + int r; + +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0007-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0007-add-missing-FTW_-macros-for-musl.patch new file mode 100644 index 0000000000..474a7d38d8 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0007-add-missing-FTW_-macros-for-musl.patch @@ -0,0 +1,44 @@ +From 8320725f1a9088623da8753c7077473b98a63107 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 15:00:06 +0800 +Subject: [PATCH 07/27] add missing FTW_ macros for musl + +This is to avoid build failures like below for musl. + + locale-util.c:296:24: error: 'FTW_STOP' undeclared + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/basic/missing_type.h | 4 ++++ + src/test/test-recurse-dir.c | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index fc33b76ec1..34a36d83f0 100644 +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -14,3 +14,7 @@ + #ifndef __GLIBC__ + typedef int (*comparison_fn_t)(const void *, const void *); + #endif ++ ++#ifndef FTW_CONTINUE ++#define FTW_CONTINUE 0 ++#endif +diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c +index 8684d064ec..70fc2b5376 100644 +--- a/src/test/test-recurse-dir.c ++++ b/src/test/test-recurse-dir.c +@@ -8,6 +8,7 @@ + #include "recurse-dir.h" + #include "strv.h" + #include "tests.h" ++#include "missing_type.h" + + static char **list_nftw = NULL; + +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0008-Use-uintmax_t-for-handling-rlim_t.patch index d6eda9c038..c8598ed2ea 100644 --- a/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch +++ b/meta/recipes-core/systemd/systemd/0008-Use-uintmax_t-for-handling-rlim_t.patch @@ -1,7 +1,7 @@ -From e3f847bd0338d27aff3335b42661d8a4b66b965e Mon Sep 17 00:00:00 2001 +From 41abe1a4136babfe5df63e9561dcf29d3c8fe6e9 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 15:12:41 +0800 -Subject: [PATCH 11/24] Use uintmax_t for handling rlim_t +Subject: [PATCH 08/27] Use uintmax_t for handling rlim_t PRIu{32,64} is not right format to represent rlim_t type therefore use %ju and typecast the rlim_t variables to @@ -22,16 +22,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> --- src/basic/format-util.h | 8 +------- - src/basic/rlimit-util.c | 10 +++++----- + src/basic/rlimit-util.c | 12 ++++++------ src/core/execute.c | 4 ++-- - 3 files changed, 8 insertions(+), 14 deletions(-) + 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/basic/format-util.h b/src/basic/format-util.h -index dece5d3..dbb87bc 100644 +index ba7cff6a8b..2736abb07b 100644 --- a/src/basic/format-util.h +++ b/src/basic/format-util.h -@@ -42,13 +42,7 @@ - # define PRI_TIMEX "li" +@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t)); + # error Unknown timex member size #endif -#if SIZEOF_RLIM_T == 8 @@ -46,30 +46,39 @@ index dece5d3..dbb87bc 100644 #if SIZEOF_DEV_T == 8 # define DEV_FMT "%" PRIu64 diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c -index 74b3a02..b02c03c 100644 +index a9f7b87f28..059c67731d 100644 --- a/src/basic/rlimit-util.c +++ b/src/basic/rlimit-util.c -@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { +@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) { + fixed.rlim_max == highest.rlim_max) + return 0; + +- 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); ++ 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); + + return RET_NERRNO(setrlimit(resource, &fixed)); + } +@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) - s = strdup("infinity"); + r = free_and_strdup(&s, "infinity"); else if (rl->rlim_cur >= RLIM_INFINITY) -- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); -+ (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); +- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); ++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); else if (rl->rlim_max >= RLIM_INFINITY) -- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); -+ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); +- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); ++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); else if (rl->rlim_cur == rl->rlim_max) -- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur); -+ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); +- r = asprintf(&s, RLIM_FMT, rl->rlim_cur); ++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); else -- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); -+ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); - - if (!s) +- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); ++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); + if (r < 0) return -ENOMEM; -@@ -404,7 +404,7 @@ int rlimit_nofile_safe(void) { - rl.rlim_cur = FD_SETSIZE; +@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) { + rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open()); + rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max); if (setrlimit(RLIMIT_NOFILE, &rl) < 0) - return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur); + return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur); @@ -77,11 +86,11 @@ index 74b3a02..b02c03c 100644 return 1; } diff --git a/src/core/execute.c b/src/core/execute.c -index a708231..e2b8748 100644 +index 513e95e09d..0e269617f8 100644 --- a/src/core/execute.c +++ b/src/core/execute.c -@@ -4220,9 +4220,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { - for (i = 0; i < RLIM_NLIMITS; i++) +@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { + for (unsigned i = 0; i < RLIM_NLIMITS; i++) if (c->rlimit[i]) { fprintf(f, "%sLimit%s: " RLIM_FMT "\n", - prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); @@ -93,5 +102,5 @@ index a708231..e2b8748 100644 if (c->ioprio_set) { -- -2.7.4 +2.45.1 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 d5f2349f2b..0000000000 --- a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 6cd17c753d2c0a90fc791f69bbc694cbc8556a4f Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 15:00:06 +0800 -Subject: [PATCH 08/24] add missing FTW_ macros for musl - -This is to avoid build failures like below for musl. - - locale-util.c:296:24: error: 'FTW_STOP' undeclared - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/missing_type.h | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h -index c487e65..23602eb 100644 ---- a/src/basic/missing_type.h -+++ b/src/basic/missing_type.h -@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const void *, const void *); - #define __COMPAR_FN_T - typedef int (*__compar_fn_t)(const void *, const void *); - #endif -+ -+#ifndef FTW_ACTIONRETVAL -+#define FTW_ACTIONRETVAL 16 -+#endif -+ -+#ifndef FTW_CONTINUE -+#define FTW_CONTINUE 0 -+#endif -+ -+#ifndef FTW_STOP -+#define FTW_STOP 1 -+#endif -+ -+#ifndef FTW_SKIP_SUBTREE -+#define FTW_SKIP_SUBTREE 2 -+#endif -+ -+#ifndef FTW_SKIP_SIBLINGS -+#define FTW_SKIP_SIBLINGS 3 -+#endif --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch index fd407f604d..851dcbd553 100644 --- a/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch +++ b/meta/recipes-core/systemd/systemd/0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch @@ -1,7 +1,7 @@ -From 48c628f532f6025c2d1646b6819cd81eb789d7fb Mon Sep 17 00:00:00 2001 +From 8af5d1e3c0dc7e71f7a4aee0f539a5d772d47354 Mon Sep 17 00:00:00 2001 From: Andre McCurdy <armccurdy@gmail.com> Date: Tue, 10 Oct 2017 14:33:30 -0700 -Subject: [PATCH 15/24] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() +Subject: [PATCH 09/27] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to do and it's not portable (not supported by musl). See: @@ -26,19 +26,18 @@ Upstream-Status: Inappropriate [musl specific] Signed-off-by: Andre McCurdy <armccurdy@gmail.com> --- - src/basic/fs-util.h | 22 +++++++++++++++++++++- + src/basic/fs-util.h | 21 ++++++++++++++++++++- src/shared/base-filesystem.c | 6 +++--- - 2 files changed, 24 insertions(+), 4 deletions(-) + 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h -index 7ad030b..d4cb1e9 100644 +index 3e2db95304..d5747416b0 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h -@@ -32,7 +32,27 @@ int fchmod_opath(int fd, mode_t m); - +@@ -49,8 +49,27 @@ int futimens_opath(int fd, const struct timespec ts[2]); int fd_warn_permissions(const char *path, int fd); + int stat_warn_permissions(const char *path, const struct stat *st); --#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) +/* + Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to + do and it's not portable (not supported by musl). See: @@ -58,25 +57,26 @@ index 7ad030b..d4cb1e9 100644 + or why it needs to return success for broken symlinks. Maybe just historical + and not actually necessary or desired behaviour? +*/ -+ -+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0) + #define laccess(path, mode) \ +- RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)) ++ RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0)) int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); - int touch(const char *path); + diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c -index 89d7a7d..34b4ad5 100644 +index a4e2dae245..67aa8ea1f2 100644 --- a/src/shared/base-filesystem.c +++ b/src/shared/base-filesystem.c -@@ -53,7 +53,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { - return log_error_errno(errno, "Failed to open root file system: %m"); +@@ -145,7 +145,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) { + /* The "root" parameter is decoration only – it's only used as part of log messages */ - for (i = 0; i < ELEMENTSOF(table); i ++) { + for (size_t i = 0; i < ELEMENTSOF(table); i++) { - if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) + if (faccessat(fd, table[i].dir, F_OK, 0) >= 0) continue; - if (table[i].target) { -@@ -61,7 +61,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { + if (table[i].target) { /* Create as symlink? */ +@@ -153,7 +153,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) { /* check if one of the targets exists */ NULSTR_FOREACH(s, table[i].target) { @@ -85,7 +85,7 @@ index 89d7a7d..34b4ad5 100644 continue; /* check if a specific file exists at the target path */ -@@ -72,7 +72,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { +@@ -164,7 +164,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) { if (!p) return log_oom(); @@ -95,5 +95,5 @@ index 89d7a7d..34b4ad5 100644 } -- -2.7.4 +2.45.1 diff --git a/meta/recipes-core/systemd/systemd/0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch new file mode 100644 index 0000000000..162650725d --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch @@ -0,0 +1,34 @@ +From ea8e85d92f67a7af8577a4ce7c67c7aaee65d10c Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sun, 27 May 2018 08:36:44 -0700 +Subject: [PATCH 10/27] Define glibc compatible basename() for non-glibc + systems + +Fixes builds with musl, even though systemd is adamant about +using non-posix basename implementation, we have a way out + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/basic/string-util.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/basic/string-util.h b/src/basic/string-util.h +index ff5efbcf55..d1a6bb0e76 100644 +--- a/src/basic/string-util.h ++++ b/src/basic/string-util.h +@@ -26,6 +26,10 @@ + #define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */ + #define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */ + ++#if !defined(__GLIBC__) ++#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) ++#endif ++ + static inline char* strstr_ptr(const char *haystack, const char *needle) { + if (!haystack || !needle) + return NULL; +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch deleted file mode 100644 index 8bacd0289d..0000000000 --- a/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch +++ /dev/null @@ -1,45 +0,0 @@ -From f1f4b4f9684fed185bfa8b9ed409cdf241657e99 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 15:03:47 +0800 -Subject: [PATCH 10/24] fix missing of __register_atfork for non-glibc builds - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/process-util.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/basic/process-util.c b/src/basic/process-util.c -index 78ce43b..aec2daf 100644 ---- a/src/basic/process-util.c -+++ b/src/basic/process-util.c -@@ -22,6 +22,9 @@ - #if HAVE_VALGRIND_VALGRIND_H - #include <valgrind/valgrind.h> - #endif -+#ifndef __GLIBC__ -+#include <pthread.h> -+#endif - - #include "alloc-util.h" - #include "architecture.h" -@@ -1160,11 +1163,15 @@ void reset_cached_pid(void) { - cached_pid = CACHED_PID_UNSET; - } - -+#ifdef __GLIBC__ - /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc - * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against - * libpthread, as it is part of glibc anyway. */ - extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle); - extern void* __dso_handle _weak_; -+#else -+#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child) -+#endif - - pid_t getpid_cached(void) { - static bool installed = false; --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0011-Do-not-disable-buffering-when-writing-to-oom_score_a.patch index 24e24e8e5a..60cec6dc7e 100644 --- a/meta/recipes-core/systemd/systemd/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch +++ b/meta/recipes-core/systemd/systemd/0011-Do-not-disable-buffering-when-writing-to-oom_score_a.patch @@ -1,7 +1,7 @@ -From c7a4efb8bccb52e1714c151929c23e12bde59b82 Mon Sep 17 00:00:00 2001 +From 7c8634c441401b034cd4bcf4b916a7042076fca8 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Wed, 4 Jul 2018 15:00:44 +0800 -Subject: [PATCH 17/24] Do not disable buffering when writing to oom_score_adj +Subject: [PATCH 11/27] Do not disable buffering when writing to oom_score_adj On musl, disabling buffering when writing to oom_score_adj will cause the following error. @@ -24,15 +24,18 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/process-util.c b/src/basic/process-util.c -index b1c08fcade..0a7a1f7d89 100644 +index c9d968dee0..7d6d3ce7db 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c -@@ -1474,7 +1474,7 @@ int set_oom_score_adjust(int value) { - sprintf(t, "%i", value); +@@ -1816,7 +1816,7 @@ int set_oom_score_adjust(int value) { + xsprintf(t, "%i", value); return write_string_file("/proc/self/oom_score_adj", t, - WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); + WRITE_STRING_FILE_VERIFY_ON_FAILURE); } - static const char *const ioprio_class_table[] = { + int get_oom_score_adjust(int *ret) { +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0012-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch index 5901772998..aa3c45cb5f 100644 --- a/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +++ b/meta/recipes-core/systemd/systemd/0012-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch @@ -1,7 +1,7 @@ -From fffb2810611b4a26f5c6c0958093b5b3b7d4cd99 Mon Sep 17 00:00:00 2001 +From 4a2df0bba1741914617ca1271e2bc68a5d9e5dac Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Tue, 10 Jul 2018 15:40:17 +0800 -Subject: [PATCH 18/24] distinguish XSI-compliant strerror_r from GNU-specifi +Subject: [PATCH 12/27] distinguish XSI-compliant strerror_r from GNU-specifi strerror_r XSI-compliant strerror_r and GNU-specifi strerror_r are different. @@ -19,32 +19,15 @@ Upstream-Status: Inappropriate [musl specific] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> --- - src/journal/journal-send.c | 5 +++++ - src/libsystemd/sd-bus/bus-error.c | 5 +++++ - 2 files changed, 10 insertions(+) - -diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c -index 3fea912..4f1e592 100644 ---- a/src/journal/journal-send.c -+++ b/src/journal/journal-send.c -@@ -337,7 +337,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove - char* j; - - errno = 0; -+#ifndef __GLIBC__ -+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); -+ j = buffer + 8 + k; -+#else - j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); -+#endif - if (errno == 0) { - char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; - + src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++- + src/libsystemd/sd-journal/journal-send.c | 5 +++++ + 2 files changed, 15 insertions(+), 1 deletion(-) + diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c -index dc95237..bdda30f 100644 +index f415797700..a5c6e9a3bd 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c -@@ -379,7 +379,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { +@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { return; errno = 0; @@ -57,6 +40,37 @@ index dc95237..bdda30f 100644 if (errno == ERANGE || strlen(x) >= k - 1) { free(m); k *= 2; +@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static + + if (e && e->message) + return e->message; +- ++#ifndef __GLIBC__ ++ strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++ return buf; ++#else + return strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++#endif + } + + static bool map_ok(const sd_bus_error_map *map) { +diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c +index 75e8e08add..41e5c7c2b8 100644 +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c +@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove + char* j; + + errno = 0; ++#ifndef __GLIBC__ ++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++ j = buffer + 8 + k; ++#else + j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++#endif + if (errno == 0) { + char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; + -- -2.7.4 +2.45.1 diff --git a/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch b/meta/recipes-core/systemd/systemd/0013-avoid-redefinition-of-prctl_mm_map-structure.patch index cdddf83890..c48bd58383 100644 --- a/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch +++ b/meta/recipes-core/systemd/systemd/0013-avoid-redefinition-of-prctl_mm_map-structure.patch @@ -1,7 +1,7 @@ -From 3fbf61d54b82fc9bf21d8039bfd89dc9efc5bbcd Mon Sep 17 00:00:00 2001 +From 846b8f16cf07d9187261e06701a75eb208caa707 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 15:44:54 +0800 -Subject: [PATCH 21/24] avoid redefinition of prctl_mm_map structure +Subject: [PATCH 13/27] avoid redefinition of prctl_mm_map structure Fix the following compile failure: error: redefinition of 'struct prctl_mm_map' @@ -14,19 +14,19 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 1 file changed, 2 insertions(+) diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h -index f80cd17..47e4893 100644 +index 2c9f9f6c50..65a984b564 100644 --- a/src/basic/missing_prctl.h +++ b/src/basic/missing_prctl.h @@ -1,7 +1,9 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#ifdef __GLIBC__ #include <linux/prctl.h> +#endif - /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ - #ifndef PR_CAP_AMBIENT + #include "macro.h" + -- -2.11.0 +2.45.1 diff --git a/meta/recipes-core/systemd/systemd/0014-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0014-do-not-disable-buffer-in-writing-files.patch new file mode 100644 index 0000000000..e624c2d71e --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0014-do-not-disable-buffer-in-writing-files.patch @@ -0,0 +1,572 @@ +From 88694101bcac461c39049962ce97ce579cc07e13 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Fri, 1 Mar 2019 15:22:15 +0800 +Subject: [PATCH 14/27] do not disable buffer in writing files + +Do not disable buffer in writing files, otherwise we get +failure at boot for musl like below. + + [!!!!!!] Failed to allocate manager object. + +And there will be other failures, critical or not critical. +This is specific to musl. + +Upstream-Status: Inappropriate [musl] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v242] +Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +[rebased for systemd 254] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 255.1] +--- + src/basic/cgroup-util.c | 12 ++++++------ + src/basic/namespace-util.c | 4 ++-- + src/basic/procfs-util.c | 4 ++-- + src/basic/sysctl-util.c | 2 +- + src/binfmt/binfmt.c | 6 +++--- + src/core/cgroup.c | 2 +- + src/core/main.c | 2 +- + src/core/smack-setup.c | 8 ++++---- + src/home/homework.c | 2 +- + src/libsystemd/sd-device/sd-device.c | 2 +- + src/nspawn/nspawn-cgroup.c | 2 +- + src/nspawn/nspawn.c | 6 +++--- + src/shared/binfmt-util.c | 2 +- + src/shared/cgroup-setup.c | 6 +++--- + src/shared/coredump-util.c | 4 ++-- + src/shared/hibernate-util.c | 4 ++-- + src/shared/smack-util.c | 2 +- + src/shared/watchdog.c | 2 +- + src/sleep/sleep.c | 4 ++-- + src/storagetm/storagetm.c | 24 ++++++++++++------------ + src/udev/udev-rules.c | 1 - + src/vconsole/vconsole-setup.c | 2 +- + 22 files changed, 51 insertions(+), 52 deletions(-) + +diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c +index 553ee6075a..a3704baf6a 100644 +--- a/src/basic/cgroup-util.c ++++ b/src/basic/cgroup-util.c +@@ -457,7 +457,7 @@ int cg_kill_kernel_sigkill(const char *path) { + if (r < 0) + return r; + +- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(killfile, "1", 0); + if (r < 0) + return log_debug_errno(r, "Failed to write to cgroup.kill for cgroup '%s': %m", path); + +@@ -885,7 +885,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { + + sc = strstrip(contents); + if (isempty(sc)) { +- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, agent, 0); + if (r < 0) + return r; + } else if (!path_equal(sc, agent)) +@@ -903,7 +903,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { + + sc = strstrip(contents); + if (streq(sc, "0")) { +- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "1", 0); + if (r < 0) + return r; + +@@ -930,7 +930,7 @@ int cg_uninstall_release_agent(const char *controller) { + if (r < 0) + return r; + +- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "0", 0); + if (r < 0) + return r; + +@@ -940,7 +940,7 @@ int cg_uninstall_release_agent(const char *controller) { + if (r < 0) + return r; + +- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "", 0); + if (r < 0) + return r; + +@@ -1833,7 +1833,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri + if (r < 0) + return r; + +- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file(p, value, 0); + } + + int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { +diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c +index 5b4e43f921..42a84ded55 100644 +--- a/src/basic/namespace-util.c ++++ b/src/basic/namespace-util.c +@@ -325,12 +325,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) { + freeze(); + + xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); +- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, uid_map, 0); + if (r < 0) + return log_debug_errno(r, "Failed to write UID map: %m"); + + xsprintf(path, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, gid_map, 0); + if (r < 0) + return log_debug_errno(r, "Failed to write GID map: %m"); + +diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c +index d7cfcd9105..58fb5918a3 100644 +--- a/src/basic/procfs-util.c ++++ b/src/basic/procfs-util.c +@@ -63,13 +63,13 @@ int procfs_tasks_set_limit(uint64_t limit) { + * decrease it, as threads-max is the much more relevant sysctl. */ + if (limit > pid_max-1) { + sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ +- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); + if (r < 0) + return r; + } + + sprintf(buffer, "%" PRIu64, limit); +- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); + if (r < 0) { + uint64_t threads_max; + +diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c +index 9a1933f579..7d6fc65ee1 100644 +--- a/src/basic/sysctl-util.c ++++ b/src/basic/sysctl-util.c +@@ -58,7 +58,7 @@ int sysctl_write(const char *property, const char *value) { + + log_debug("Setting '%s' to '%s'", p, value); + +- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); ++ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); + } + + int sysctl_writef(const char *property, const char *format, ...) { +diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c +index d21f3f79ff..258607cc7e 100644 +--- a/src/binfmt/binfmt.c ++++ b/src/binfmt/binfmt.c +@@ -30,7 +30,7 @@ static bool arg_unregister = false; + + static int delete_rule(const char *rulename) { + const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename); +- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file(fn, "-1", 0); + } + + static int apply_rule(const char *filename, unsigned line, const char *rule) { +@@ -58,7 +58,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) { + if (r >= 0) + log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename); + +- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); + if (r < 0) + return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m", + filename, line, rulename); +@@ -248,7 +248,7 @@ static int run(int argc, char *argv[]) { + return r; + + /* Flush out all rules */ +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m"); + else +diff --git a/src/core/cgroup.c b/src/core/cgroup.c +index 34fd2a250c..cb1a6d01eb 100644 +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -5173,7 +5173,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) { + freezer_state_to_string(u->freezer_state), + freezer_state_to_string(next)); + +- r = write_string_file(path, one_zero(target == FREEZER_FROZEN), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, one_zero(target == FREEZER_FROZEN), 0); + if (r < 0) + return r; + +diff --git a/src/core/main.c b/src/core/main.c +index 4b8a315d86..051a31ba84 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1789,7 +1789,7 @@ static void initialize_core_pattern(bool skip_setup) { + if (getpid_cached() != 1) + return; + +- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); + if (r < 0) + log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", + arg_early_core_pattern); +diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c +index 7ea902b6f9..1aef2988d0 100644 +--- a/src/core/smack-setup.c ++++ b/src/core/smack-setup.c +@@ -321,17 +321,17 @@ int mac_smack_setup(bool *loaded_policy) { + } + + #if HAVE_SMACK_RUN_LABEL +- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); +- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); + r = write_string_file("/sys/fs/smackfs/netlabel", +- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ "0.0.0.0/0 " SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); +- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); + #endif +diff --git a/src/home/homework.c b/src/home/homework.c +index 482db23dbc..ed6b8d271f 100644 +--- a/src/home/homework.c ++++ b/src/home/homework.c +@@ -302,8 +302,8 @@ static void drop_caches_now(void) { + /* Drop file system caches now. See https://docs.kernel.org/admin-guide/sysctl/vm.html + * for details. We write "3" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but + * not more. */ ++ r = write_string_file("/proc/sys/vm/drop_caches", "3\n", 0); + +- r = write_string_file("/proc/sys/vm/drop_caches", "3\n", WRITE_STRING_FILE_DISABLE_BUFFER); + if (r < 0) + log_warning_errno(r, "Failed to drop caches, ignoring: %m"); + else +diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c +index d8d151835c..268cb65ec7 100644 +--- a/src/libsystemd/sd-device/sd-device.c ++++ b/src/libsystemd/sd-device/sd-device.c +@@ -2499,7 +2499,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, + if (!value) + return -ENOMEM; + +- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); ++ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); + if (r < 0) { + /* On failure, clear cache entry, as we do not know how it fails. */ + device_remove_cached_sysattr_value(device, sysattr); +diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c +index 4f28b4a225..c93c2c33b5 100644 +--- a/src/nspawn/nspawn-cgroup.c ++++ b/src/nspawn/nspawn-cgroup.c +@@ -93,7 +93,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { + fn = strjoina(tree, cgroup, "/cgroup.procs"); + + sprintf(pid_string, PID_FMT, pid); +- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); ++ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755); + if (r < 0) { + log_error_errno(r, "Failed to move process: %m"); + goto finish; +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index 5842d3ba8f..44ff9d946c 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -2741,7 +2741,7 @@ static int reset_audit_loginuid(void) { + if (streq(p, "4294967295")) + return 0; + +- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/self/loginuid", "4294967295", 0); + if (r < 0) { + log_error_errno(r, + "Failed to reset audit login UID. This probably means that your kernel is too\n" +@@ -4450,7 +4450,7 @@ static int setup_uid_map( + return log_oom(); + + xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); +- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, s, 0); + if (r < 0) + return log_error_errno(r, "Failed to write UID map: %m"); + +@@ -4460,7 +4460,7 @@ static int setup_uid_map( + return log_oom(); + + xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, s, 0); + if (r < 0) + return log_error_errno(r, "Failed to write GID map: %m"); + +diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c +index a26175474b..1413a9c72c 100644 +--- a/src/shared/binfmt-util.c ++++ b/src/shared/binfmt-util.c +@@ -46,7 +46,7 @@ int disable_binfmt(void) { + return 0; + } + +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m"); + +diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c +index 093b6d0d22..89d0ac612b 100644 +--- a/src/shared/cgroup-setup.c ++++ b/src/shared/cgroup-setup.c +@@ -364,7 +364,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { + + xsprintf(c, PID_FMT "\n", pid); + +- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, c, 0); + if (r == -EOPNOTSUPP && cg_is_threaded(path) > 0) + /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */ + return -EUCLEAN; +@@ -395,7 +395,7 @@ int cg_fd_attach(int fd, pid_t pid) { + + xsprintf(c, PID_FMT "\n", pid); + +- return write_string_file_at(fd, "cgroup.procs", c, WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file_at(fd, "cgroup.procs", c, 0); + } + + int cg_attach_fallback(const char *controller, const char *path, pid_t pid) { +@@ -974,7 +974,7 @@ int cg_enable_everywhere( + return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); + } + +- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_stream(f, s, 0); + if (r < 0) { + log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", + FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); +diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c +index 805503f366..01a7ccb291 100644 +--- a/src/shared/coredump-util.c ++++ b/src/shared/coredump-util.c +@@ -163,7 +163,7 @@ int set_coredump_filter(uint64_t value) { + xsprintf(t, "0x%"PRIx64, value); + + return write_string_file("/proc/self/coredump_filter", t, +- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); ++ 0); + } + + /* Turn off core dumps but only if we're running outside of a container. */ +@@ -173,7 +173,7 @@ void disable_coredumps(void) { + if (detect_container() > 0) + return; + +- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); + if (r < 0) + log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); + } +diff --git a/src/shared/hibernate-util.c b/src/shared/hibernate-util.c +index 7c21157580..06ab74b04c 100644 +--- a/src/shared/hibernate-util.c ++++ b/src/shared/hibernate-util.c +@@ -495,7 +495,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { + + /* We write the offset first since it's safer. Note that this file is only available in 4.17+, so + * fail gracefully if it doesn't exist and we're only overwriting it with 0. */ +- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume_offset", offset_str, 0); + if (r == -ENOENT) { + if (offset != 0) + return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), +@@ -511,7 +511,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { + log_debug("Wrote resume_offset=%s for device '%s' to /sys/power/resume_offset.", + offset_str, device); + +- r = write_string_file("/sys/power/resume", devno_str, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume", devno_str, 0); + if (r < 0) + return log_error_errno(r, + "Failed to write device '%s' (%s) to /sys/power/resume: %m", +diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c +index 1f88e724d0..feb18b320a 100644 +--- a/src/shared/smack-util.c ++++ b/src/shared/smack-util.c +@@ -113,7 +113,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { + return 0; + + p = procfs_file_alloca(pid, "attr/current"); +- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(p, label, 0); + if (r < 0) + return r; + +diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c +index 810c5b5206..be0d127ff3 100644 +--- a/src/shared/watchdog.c ++++ b/src/shared/watchdog.c +@@ -93,7 +93,7 @@ static int watchdog_set_pretimeout_governor(const char *governor) { + + r = write_string_file(sys_fn, + governor, +- WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); ++ WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); + if (r < 0) + return log_error_errno(r, "Failed to set watchdog pretimeout_governor to '%s': %m", governor); + +diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c +index 0402bb07f3..a6cbb45340 100644 +--- a/src/sleep/sleep.c ++++ b/src/sleep/sleep.c +@@ -139,7 +139,7 @@ static int write_state(int fd, char * const *states) { + if (k < 0) + return RET_GATHER(r, k); + +- k = write_string_stream(f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); ++ k = write_string_stream(f, *state, 0); + if (k >= 0) { + log_debug("Using sleep state '%s'.", *state); + return 0; +@@ -157,7 +157,7 @@ static int write_mode(const char *path, char * const *modes) { + assert(path); + + STRV_FOREACH(mode, modes) { +- r = write_string_file(path, *mode, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, *mode, 0); + if (r >= 0) { + log_debug("Using sleep mode '%s' for %s.", *mode, path); + return 0; +diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c +index 1bb8eec316..cf9b4c4a21 100644 +--- a/src/storagetm/storagetm.c ++++ b/src/storagetm/storagetm.c +@@ -186,7 +186,7 @@ static int nvme_subsystem_unlink(NvmeSubsystem *s) { + if (!enable_fn) + return log_oom(); + +- r = write_string_file_at(namespaces_fd, enable_fn, "0", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(namespaces_fd, enable_fn, "0", 0); + if (r < 0) + log_warning_errno(r, "Failed to disable namespace '%s' of NVME subsystem '%s', ignoring: %m", e->d_name, s->name); + +@@ -254,7 +254,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { + _cleanup_free_ char *truncated = strndup(w, 40); /* kernel refuses more than 40 chars (as per nvme spec) */ + + /* The default string stored in 'attr_model' is "Linux" btw. */ +- r = write_string_file_at(subsystem_fd, "attr_model", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(subsystem_fd, "attr_model", truncated, 0); + if (r < 0) + log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", w); + } +@@ -268,7 +268,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { + return log_oom(); + + /* The default string stored in 'attr_firmware' is `uname -r` btw, but truncated to 8 chars. */ +- r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, 0); + if (r < 0) + log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", truncated); + } +@@ -295,7 +295,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { + if (!truncated) + return log_oom(); + +- r = write_string_file_at(subsystem_fd, "attr_serial", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(subsystem_fd, "attr_serial", truncated, 0); + if (r < 0) + log_warning_errno(r, "Failed to set serial of subsystem to '%s', ignoring: %m", truncated); + } +@@ -345,7 +345,7 @@ static int nvme_namespace_write_metadata(int namespace_fd, sd_device *device, co + id = id128_digest(j, l); + } + +- r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), 0); + if (r < 0) + log_warning_errno(r, "Failed to set uuid of namespace to '%s', ignoring: %m", SD_ID128_TO_UUID_STRING(id)); + +@@ -408,7 +408,7 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi + if (subsystem_fd < 0) + return log_error_errno(subsystem_fd, "Failed to create NVME subsystem '%s': %m", j); + +- r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", 0); + if (r < 0) + return log_error_errno(r, "Failed to set 'attr_allow_any_host' flag: %m"); + +@@ -423,11 +423,11 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi + + /* We use /proc/$PID/fd/$FD rather than /proc/self/fd/$FD, because this string is visible to others + * via configfs, and by including the PID it's clear to who the stuff belongs. */ +- r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), 0); + if (r < 0) + return log_error_errno(r, "Failed to write 'device_path' attribute: %m"); + +- r = write_string_file_at(namespace_fd, "enable", "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(namespace_fd, "enable", "1", 0); + if (r < 0) + return log_error_errno(r, "Failed to write 'enable' attribute: %m"); + +@@ -557,19 +557,19 @@ static int nvme_port_add_portnr( + return 0; + } + +- r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), 0); + if (r < 0) + return log_error_errno(r, "Failed to set address family on NVME port %" PRIu16 ": %m", portnr); + +- r = write_string_file_at(port_fd, "addr_trtype", "tcp", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(port_fd, "addr_trtype", "tcp", 0); + if (r < 0) + return log_error_errno(r, "Failed to set transport type on NVME port %" PRIu16 ": %m", portnr); + +- r = write_string_file_at(port_fd, "addr_trsvcid", fname, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(port_fd, "addr_trsvcid", fname, 0); + if (r < 0) + return log_error_errno(r, "Failed to set IP port on NVME port %" PRIu16 ": %m", portnr); + +- r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", 0); + if (r < 0) + return log_error_errno(r, "Failed to set IP address on NVME port %" PRIu16 ": %m", portnr); + +diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c +index 581bbaf345..cdf648a2d1 100644 +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -2706,7 +2706,6 @@ static int udev_rule_apply_token_to_event( + log_event_debug(dev, token, "Writing ATTR{'%s'}=\"%s\".", buf, value); + r = write_string_file(buf, value, + WRITE_STRING_FILE_VERIFY_ON_FAILURE | +- WRITE_STRING_FILE_DISABLE_BUFFER | + WRITE_STRING_FILE_AVOID_NEWLINE | + WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); + if (r < 0) +diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c +index ba742dda69..6f20e81615 100644 +--- a/src/vconsole/vconsole-setup.c ++++ b/src/vconsole/vconsole-setup.c +@@ -277,7 +277,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { + static int toggle_utf8_sysfs(bool utf8) { + int r; + +- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); + if (r < 0) + return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); + +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch deleted file mode 100644 index 914589dbd3..0000000000 --- a/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch +++ /dev/null @@ -1,42 +0,0 @@ -From d3d65d4036670cbd5129fe55c09ca391286ef4b3 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Wed, 28 Feb 2018 21:25:22 -0800 -Subject: [PATCH 14/24] test-sizeof.c: Disable tests for missing typedefs in - musl - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/test/test-sizeof.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c -index 35b0876..e78e7ca 100644 ---- a/src/test/test-sizeof.c -+++ b/src/test/test-sizeof.c -@@ -41,8 +41,10 @@ int main(void) { - info(unsigned); - info(long unsigned); - info(long long unsigned); -+#ifdef __GLIBC__ - info(__syscall_ulong_t); - info(__syscall_slong_t); -+#endif - - info(float); - info(double); -@@ -60,7 +62,9 @@ int main(void) { - info(ssize_t); - info(time_t); - info(usec_t); -+#ifdef __GLIBC__ - info(__time_t); -+#endif - info(pid_t); - info(uid_t); - info(gid_t); --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch b/meta/recipes-core/systemd/systemd/0015-Handle-__cpu_mask-usage.patch index 0f75e8c12d..86003db4de 100644 --- a/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch +++ b/meta/recipes-core/systemd/systemd/0015-Handle-__cpu_mask-usage.patch @@ -1,4 +1,7 @@ -Handle __cpu_mask usage +From c1cbec8571855b8480d56dcad2ab81aea0782bd4 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Fri, 13 Sep 2019 19:26:27 -0400 +Subject: [PATCH 15/27] Handle __cpu_mask usage Fixes errors: @@ -21,7 +24,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com> 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h -index 27812dfd59..f698f9df83 100644 +index 618fe1b0a3..46c92077b0 100644 --- a/src/shared/cpu-set-util.h +++ b/src/shared/cpu-set-util.h @@ -6,6 +6,8 @@ @@ -34,17 +37,17 @@ index 27812dfd59..f698f9df83 100644 typedef struct CPUSet { cpu_set_t *set; diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c -index a710db5370..d1601ad929 100644 +index ea0c58770e..b65c0bd370 100644 --- a/src/test/test-sizeof.c +++ b/src/test/test-sizeof.c @@ -1,6 +1,5 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include <sched.h> #include <stdio.h> #include <string.h> - -@@ -8,6 +7,7 @@ + #include <sys/resource.h> +@@ -12,6 +11,7 @@ #include <float.h> #include "time-util.h" @@ -52,3 +55,6 @@ index a710db5370..d1601ad929 100644 /* Print information about various types. Useful when diagnosing * gcc diagnostics on an unfamiliar architecture. */ +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch deleted file mode 100644 index d5565698aa..0000000000 --- a/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch +++ /dev/null @@ -1,34 +0,0 @@ -From af76c973e41929360a6e021f2ff9a7fc1d7994e9 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sun, 27 May 2018 08:36:44 -0700 -Subject: [PATCH 16/24] Define glibc compatible basename() for non-glibc - systems - -Fixes builds with musl, even though systemd is adamant about -using non-posix basename implementation, we have a way out - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/machine/machine-dbus.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c -index 7a558df..eca7d4b 100644 ---- a/src/machine/machine-dbus.c -+++ b/src/machine/machine-dbus.c -@@ -11,6 +11,10 @@ - #include <libgen.h> - #undef basename - -+#if !defined(__GLIBC__) -+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) -+#endif -+ - #include "alloc-util.h" - #include "bus-common-errors.h" - #include "bus-internal.h" --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0016-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0016-Handle-missing-gshadow.patch new file mode 100644 index 0000000000..6c7b233f95 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0016-Handle-missing-gshadow.patch @@ -0,0 +1,172 @@ +From 8b540d8240bbc3f917de9ca8d3b62f28c3424d91 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan <alex.kiernan@gmail.com> +Date: Tue, 10 Mar 2020 11:05:20 +0000 +Subject: [PATCH 16/27] Handle missing gshadow + +gshadow usage is now present in the userdb code. Mask all uses of it to +allow compilation on musl + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[Rebased for v247] +Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> +--- + src/shared/user-record-nss.c | 20 ++++++++++++++++++++ + src/shared/user-record-nss.h | 4 ++++ + src/shared/userdb.c | 7 ++++++- + 3 files changed, 30 insertions(+), 1 deletion(-) + +diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c +index ffb5721466..4d01815c8c 100644 +--- a/src/shared/user-record-nss.c ++++ b/src/shared/user-record-nss.c +@@ -286,8 +286,10 @@ int nss_group_to_group_record( + if (isempty(grp->gr_name)) + return -EINVAL; + ++#if ENABLE_GSHADOW + if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name)) + return -EINVAL; ++#endif + + g = group_record_new(); + if (!g) +@@ -303,6 +305,7 @@ int nss_group_to_group_record( + + g->gid = grp->gr_gid; + ++#if ENABLE_GSHADOW + if (sgrp) { + if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) { + g->hashed_password = strv_new(sgrp->sg_passwd); +@@ -318,6 +321,7 @@ int nss_group_to_group_record( + if (r < 0) + return r; + } ++#endif + + r = json_build(&g->json, JSON_BUILD_OBJECT( + JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), +@@ -344,6 +348,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re + assert(ret_sgrp); + assert(ret_buffer); + ++#if ENABLE_GSHADOW + for (;;) { + _cleanup_free_ char *buf = NULL; + struct sgrp sgrp, *result; +@@ -372,6 +377,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re + buflen *= 2; + buf = mfree(buf); + } ++#else ++ return -ESRCH; ++#endif + } + + int nss_group_record_by_name( +@@ -382,7 +390,9 @@ int nss_group_record_by_name( + _cleanup_free_ char *sbuf = NULL; + _cleanup_free_ struct group *result = NULL; + bool incomplete = false; ++#if ENABLE_GSHADOW + struct sgrp sgrp, *sresult = NULL; ++#endif + int r; + + assert(name); +@@ -391,6 +401,7 @@ int nss_group_record_by_name( + if (r < 0) + return r; + ++#if ENABLE_GSHADOW + if (with_shadow) { + r = nss_sgrp_for_group(result, &sgrp, &sbuf); + if (r < 0) { +@@ -402,6 +413,9 @@ int nss_group_record_by_name( + incomplete = true; + + r = nss_group_to_group_record(result, sresult, ret); ++#else ++ r = nss_group_to_group_record(result, NULL, ret); ++#endif + if (r < 0) + return r; + +@@ -418,13 +432,16 @@ int nss_group_record_by_gid( + _cleanup_free_ char *sbuf = NULL; + _cleanup_free_ struct group *result = NULL; + bool incomplete = false; ++#if ENABLE_GSHADOW + struct sgrp sgrp, *sresult = NULL; ++#endif + int r; + + r = getgrgid_malloc(gid, &result); + if (r < 0) + return r; + ++#if ENABLE_GSHADOW + if (with_shadow) { + r = nss_sgrp_for_group(result, &sgrp, &sbuf); + if (r < 0) { +@@ -436,6 +453,9 @@ int nss_group_record_by_gid( + incomplete = true; + + r = nss_group_to_group_record(result, sresult, ret); ++#else ++ r = nss_group_to_group_record(result, NULL, ret); ++#endif + if (r < 0) + return r; + +diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h +index 22ab04d6ee..4e52e7a911 100644 +--- a/src/shared/user-record-nss.h ++++ b/src/shared/user-record-nss.h +@@ -2,7 +2,11 @@ + #pragma once + + #include <grp.h> ++#if ENABLE_GSHADOW + #include <gshadow.h> ++#else ++struct sgrp; ++#endif + #include <pwd.h> + #include <shadow.h> + +diff --git a/src/shared/userdb.c b/src/shared/userdb.c +index 75dece3442..5628e1410f 100644 +--- a/src/shared/userdb.c ++++ b/src/shared/userdb.c +@@ -1038,13 +1038,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { + if (gr) { + _cleanup_free_ char *buffer = NULL; + bool incomplete = false; ++#if ENABLE_GSHADOW + struct sgrp sgrp; +- ++#endif + if (streq_ptr(gr->gr_name, "root")) + iterator->synthesize_root = false; + if (gr->gr_gid == GID_NOBODY) + iterator->synthesize_nobody = false; + ++#if ENABLE_GSHADOW + if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) { + r = nss_sgrp_for_group(gr, &sgrp, &buffer); + if (r < 0) { +@@ -1057,6 +1059,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { + } + + r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); ++#else ++ r = nss_group_to_group_record(gr, NULL, ret); ++#endif + if (r < 0) + return r; + +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch b/meta/recipes-core/systemd/systemd/0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch new file mode 100644 index 0000000000..a7a641e0ad --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch @@ -0,0 +1,42 @@ +From 45bb63a1727097683acad23f270968026671ec6a Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 12 Apr 2021 23:44:53 -0700 +Subject: [PATCH 17/27] missing_syscall.h: Define MIPS ABI defines for musl + +musl does not define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32, _MIPS_SIM_ABI64 +unlike glibc where these are provided by libc headers, therefore define +them here in case they are undefined + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/basic/missing_syscall.h | 6 ++++++ + src/shared/base-filesystem.c | 1 + + 2 files changed, 7 insertions(+) + +--- a/src/basic/missing_syscall.h ++++ b/src/basic/missing_syscall.h +@@ -20,6 +20,12 @@ + #include <asm/sgidefs.h> + #endif + ++#ifndef _MIPS_SIM_ABI32 ++#define _MIPS_SIM_ABI32 1 ++#define _MIPS_SIM_NABI32 2 ++#define _MIPS_SIM_ABI64 3 ++#endif ++ + #include "macro.h" + #include "missing_keyctl.h" + #include "missing_sched.h" +--- a/src/shared/base-filesystem.c ++++ b/src/shared/base-filesystem.c +@@ -20,6 +20,7 @@ + #include "string-util.h" + #include "umask-util.h" + #include "user-util.h" ++#include "missing_syscall.h" + + typedef struct BaseFilesystem { + const char *dir; /* directory or symlink to create */ diff --git a/meta/recipes-core/systemd/systemd/0018-pass-correct-parameters-to-getdents64.patch b/meta/recipes-core/systemd/systemd/0018-pass-correct-parameters-to-getdents64.patch new file mode 100644 index 0000000000..b4b6be0e75 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0018-pass-correct-parameters-to-getdents64.patch @@ -0,0 +1,37 @@ +From 78a59a540d425e677d5652d9b72d7b175e36f4dd Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 15:15:11 -0800 +Subject: [PATCH 18/27] pass correct parameters to getdents64 + +Fixes +../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] + n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +../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] + n = getdents64(fd, &buffer, sizeof(buffer)); + ^~~~~~~ + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com> +--- + src/basic/recurse-dir.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c +index 776733148b..d37419658c 100644 +--- a/src/basic/recurse-dir.c ++++ b/src/basic/recurse-dir.c +@@ -56,7 +56,7 @@ int readdir_all(int dir_fd, + bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX); + assert(bs > de->buffer_size); + +- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); ++ n = getdents64(dir_fd, (struct dirent*)((uint8_t*) de->buffer + de->buffer_size), bs - de->buffer_size); + if (n < 0) + return -errno; + if (n == 0) +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0019-Adjust-for-musl-headers.patch b/meta/recipes-core/systemd/systemd/0019-Adjust-for-musl-headers.patch new file mode 100644 index 0000000000..44eebe16b3 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0019-Adjust-for-musl-headers.patch @@ -0,0 +1,526 @@ +From 585e04673da62a8bf50e00fd6c1ae9ffc66c3b2f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 22:19:37 -0800 +Subject: [PATCH 19/27] Adjust for musl headers + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +[Rebased for v255.1] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/libsystemd-network/sd-dhcp6-client.c | 2 +- + src/network/netdev/bareudp.c | 2 +- + src/network/netdev/batadv.c | 2 +- + src/network/netdev/bond.c | 2 +- + src/network/netdev/bridge.c | 3 ++- + src/network/netdev/dummy.c | 2 +- + src/network/netdev/geneve.c | 2 +- + src/network/netdev/ifb.c | 2 +- + src/network/netdev/ipoib.c | 2 +- + src/network/netdev/ipvlan.c | 2 +- + src/network/netdev/macsec.c | 2 +- + src/network/netdev/macvlan.c | 2 +- + src/network/netdev/netdev.c | 2 +- + src/network/netdev/netdevsim.c | 2 +- + src/network/netdev/nlmon.c | 2 +- + src/network/netdev/tunnel.c | 2 +- + src/network/netdev/vcan.c | 2 +- + src/network/netdev/veth.c | 2 +- + src/network/netdev/vlan.c | 2 +- + src/network/netdev/vrf.c | 2 +- + src/network/netdev/vxcan.c | 2 +- + src/network/netdev/vxlan.c | 2 +- + src/network/netdev/wireguard.c | 2 +- + src/network/netdev/xfrm.c | 2 +- + src/network/networkd-dhcp-common.c | 3 ++- + src/network/networkd-dhcp-prefix-delegation.c | 3 ++- + src/network/networkd-dhcp-server.c | 2 +- + src/network/networkd-dhcp4.c | 2 +- + src/network/networkd-ipv6ll.c | 2 +- + src/network/networkd-link.c | 2 +- + src/network/networkd-ndisc.c | 2 +- + src/network/networkd-setlink.c | 2 +- + src/network/networkd-sysctl.c | 2 +- + src/shared/linux/ethtool.h | 3 ++- + src/shared/netif-util.c | 2 +- + src/udev/udev-builtin-net_id.c | 2 +- + 36 files changed, 40 insertions(+), 36 deletions(-) + +diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c +index 3e992d7cad..c7e1ff4dbf 100644 +--- a/src/libsystemd-network/sd-dhcp6-client.c ++++ b/src/libsystemd-network/sd-dhcp6-client.c +@@ -5,7 +5,7 @@ + + #include <errno.h> + #include <sys/ioctl.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_infiniband.h> + + #include "sd-dhcp6-client.h" +diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c +index 1df886573b..c8b6714726 100644 +--- a/src/network/netdev/bareudp.c ++++ b/src/network/netdev/bareudp.c +@@ -2,7 +2,7 @@ + * Copyright © 2020 VMware, Inc. */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "bareudp.h" + #include "netlink-util.h" +diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c +index 26da0231d4..2e8002af8c 100644 +--- a/src/network/netdev/batadv.c ++++ b/src/network/netdev/batadv.c +@@ -3,7 +3,7 @@ + #include <inttypes.h> + #include <netinet/in.h> + #include <linux/genetlink.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "batadv.h" + #include "fileio.h" +diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c +index 52a7f126b6..74ca0812db 100644 +--- a/src/network/netdev/bond.c ++++ b/src/network/netdev/bond.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "bond.h" +diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c +index d426c0c501..14432adb95 100644 +--- a/src/network/netdev/bridge.c ++++ b/src/network/netdev/bridge.c +@@ -2,7 +2,8 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> +-#include <linux/if_arp.h> ++#include <netinet/in.h> ++//#include <linux/if_arp.h> + #include <linux/if_bridge.h> + #include <netinet/in.h> + +diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c +index 00df1d2787..77b506b422 100644 +--- a/src/network/netdev/dummy.c ++++ b/src/network/netdev/dummy.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "dummy.h" + +diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c +index 22c2b00e1b..1d762c4911 100644 +--- a/src/network/netdev/geneve.c ++++ b/src/network/netdev/geneve.c +@@ -2,7 +2,7 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <netinet/in.h> + + #include "alloc-util.h" +diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c +index d7ff44cb9e..e037629ae4 100644 +--- a/src/network/netdev/ifb.c ++++ b/src/network/netdev/ifb.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright © 2019 VMware, Inc. */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "ifb.h" + +diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c +index d5fe299b7b..c9c8002eac 100644 +--- a/src/network/netdev/ipoib.c ++++ b/src/network/netdev/ipoib.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_link.h> + + #include "ipoib.h" +diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c +index 51ae64341d..46460efabd 100644 +--- a/src/network/netdev/ipvlan.c ++++ b/src/network/netdev/ipvlan.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "ipvlan.h" +diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c +index 4b9f19cc95..6c4951a7e6 100644 +--- a/src/network/netdev/macsec.c ++++ b/src/network/netdev/macsec.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_ether.h> + #include <linux/if_macsec.h> + #include <linux/genetlink.h> +diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c +index 21933d3970..a4ace19dc6 100644 +--- a/src/network/netdev/macvlan.c ++++ b/src/network/netdev/macvlan.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "macvlan.h" +diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c +index 2b411425ba..fe00200135 100644 +--- a/src/network/netdev/netdev.c ++++ b/src/network/netdev/netdev.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <unistd.h> + + #include "alloc-util.h" +diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c +index 15d5c132f9..a3ffa48b15 100644 +--- a/src/network/netdev/netdevsim.c ++++ b/src/network/netdev/netdevsim.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "netdevsim.h" + +diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c +index ff372092e6..eef66811f4 100644 +--- a/src/network/netdev/nlmon.c ++++ b/src/network/netdev/nlmon.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "nlmon.h" + +diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c +index db84e7cf6e..93d5642962 100644 +--- a/src/network/netdev/tunnel.c ++++ b/src/network/netdev/tunnel.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/fou.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_tunnel.h> + #include <linux/ip.h> + #include <linux/ip6_tunnel.h> +diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c +index 380547ee1e..137c1adf8a 100644 +--- a/src/network/netdev/vcan.c ++++ b/src/network/netdev/vcan.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vcan.h" + +diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c +index 78555286d1..e7eff072e4 100644 +--- a/src/network/netdev/veth.c ++++ b/src/network/netdev/veth.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> + #include <errno.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/veth.h> + #include <netinet/in.h> + +diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c +index 60e49a5b8a..266fd58813 100644 +--- a/src/network/netdev/vlan.c ++++ b/src/network/netdev/vlan.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> + #include <errno.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_vlan.h> + + #include "parse-util.h" +diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c +index 24079a7203..33ff17ea82 100644 +--- a/src/network/netdev/vrf.c ++++ b/src/network/netdev/vrf.c +@@ -2,8 +2,8 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> +-#include <linux/if_arp.h> + #include <netinet/in.h> ++//#include <linux/if_arp.h> + + #include "vrf.h" + +diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c +index c0343f45b6..f9e718f40b 100644 +--- a/src/network/netdev/vxcan.c ++++ b/src/network/netdev/vxcan.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <linux/can/vxcan.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vxcan.h" + +diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c +index 37f65967a6..bdd8848a02 100644 +--- a/src/network/netdev/vxlan.c ++++ b/src/network/netdev/vxlan.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "alloc-util.h" +diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c +index fed1be8d11..94b659fd23 100644 +--- a/src/network/netdev/wireguard.c ++++ b/src/network/netdev/wireguard.c +@@ -5,7 +5,7 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/ipv6_route.h> + #include <netinet/in.h> + #include <sys/ioctl.h> +diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c +index 905bfc0bdf..39e34dbb3b 100644 +--- a/src/network/netdev/xfrm.c ++++ b/src/network/netdev/xfrm.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "missing_network.h" + #include "xfrm.h" +diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c +index 9f0268d934..8cd605ab4a 100644 +--- a/src/network/networkd-dhcp-common.c ++++ b/src/network/networkd-dhcp-common.c +@@ -1,7 +1,8 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> ++#include <net/if.h> + + #include "bus-error.h" + #include "bus-locator.h" +diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c +index 2e660b7763..b8dd6240a0 100644 +--- a/src/network/networkd-dhcp-prefix-delegation.c ++++ b/src/network/networkd-dhcp-prefix-delegation.c +@@ -1,6 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/ipv6_route.h> + + #include "dhcp6-lease-internal.h" + #include "hashmap.h" +@@ -20,6 +19,8 @@ + #include "strv.h" + #include "tunnel.h" + ++#include <linux/ipv6_route.h> ++ + bool link_dhcp_pd_is_enabled(Link *link) { + assert(link); + +diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c +index c35102af74..3be469ae16 100644 +--- a/src/network/networkd-dhcp-server.c ++++ b/src/network/networkd-dhcp-server.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if.h> + + #include "sd-dhcp-server.h" +diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c +index 4dd6044b18..15a598f9db 100644 +--- a/src/network/networkd-dhcp4.c ++++ b/src/network/networkd-dhcp4.c +@@ -3,7 +3,7 @@ + #include <netinet/in.h> + #include <netinet/ip.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "dhcp-client-internal.h" +diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c +index 32229a3fc7..662a345d6e 100644 +--- a/src/network/networkd-ipv6ll.c ++++ b/src/network/networkd-ipv6ll.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "in-addr-util.h" + #include "networkd-address.h" +diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c +index 6b0f09926a..81f44f6e6a 100644 +--- a/src/network/networkd-link.c ++++ b/src/network/networkd-link.c +@@ -4,7 +4,7 @@ + #include <net/if.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_link.h> + #include <linux/netdevice.h> + #include <sys/socket.h> +diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c +index 7cafe1f6a3..07c293c9a6 100644 +--- a/src/network/networkd-ndisc.c ++++ b/src/network/networkd-ndisc.c +@@ -6,7 +6,7 @@ + #include <arpa/inet.h> + #include <netinet/icmp6.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "sd-ndisc.h" + +diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c +index 058bc00ba1..bb0a430a0b 100644 +--- a/src/network/networkd-setlink.c ++++ b/src/network/networkd-setlink.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_bridge.h> + + #include "missing_network.h" +diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c +index 68c23e0eb7..e177c49d9b 100644 +--- a/src/network/networkd-sysctl.c ++++ b/src/network/networkd-sysctl.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "af-list.h" + #include "missing_network.h" +diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h +index 3d1da515c0..3fca9a4faf 100644 +--- a/src/shared/linux/ethtool.h ++++ b/src/shared/linux/ethtool.h +@@ -16,7 +16,8 @@ + + #include <linux/const.h> + #include <linux/types.h> +-#include <linux/if_ether.h> ++#include <netinet/if_ether.h> ++//#include <linux/if_ether.h> + + #include <limits.h> /* for INT_MAX */ + +diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c +index 8adc2c89c8..1977e28d7f 100644 +--- a/src/shared/netif-util.c ++++ b/src/shared/netif-util.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "arphrd-util.h" + #include "device-util.h" +diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c +index 384a1f31cb..c94bb70afb 100644 +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -19,7 +19,7 @@ + #include <stdarg.h> + #include <unistd.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/netdevice.h> + #include <linux/pci_regs.h> + +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch deleted file mode 100644 index 35cc66ff66..0000000000 --- a/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 969ab9e68249fd383f4b513b1c9306bdac4ae9b2 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 15:18:00 +0800 -Subject: [PATCH 19/24] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP - -for currently unknown reasons they get exported to the shared libries -even without being listed in the sym file - -Upstream-Status: Pending - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -[Rebased for v241] -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/libsystemd/sd-bus/bus-error.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c -index bdda30f..e21853c 100644 ---- a/src/libsystemd/sd-bus/bus-error.c -+++ b/src/libsystemd/sd-bus/bus-error.c -@@ -54,8 +54,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { - }; - - /* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */ --extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[]; --extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[]; -+extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_; -+extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_; - - /* Additional maps registered with sd_bus_error_add_map() are in this - * NULL terminated array */ --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch deleted file mode 100644 index 753d5116ac..0000000000 --- a/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 75c06e3e2a4760b36fffd95cdf5535b8ad73c481 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 15:27:54 +0800 -Subject: [PATCH 20/24] missing_type.h: add __compar_d_fn_t definition - -Fix the following compile failure: -src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'? - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/missing_type.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h -index 7d7c1e4..85902ab 100644 ---- a/src/basic/missing_type.h -+++ b/src/basic/missing_type.h -@@ -13,6 +13,7 @@ - - #ifndef __GLIBC__ - typedef int (*comparison_fn_t)(const void *, const void *); -+typedef int (*__compar_d_fn_t) (const void *, const void *, void *); - #endif - - #ifndef __COMPAR_FN_T --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0020-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch b/meta/recipes-core/systemd/systemd/0020-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch new file mode 100644 index 0000000000..b3fbfee08d --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0020-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch @@ -0,0 +1,52 @@ +From e01f0c444423eb65d176713735ff8cefb3068f3d Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 8 Nov 2022 13:31:34 -0800 +Subject: [PATCH 20/27] test-bus-error: strerror() is assumed to be GNU + specific version mark it so + +Upstream-Status: Inappropriate [Upstream systemd only supports glibc] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/libsystemd/sd-bus/test-bus-error.c | 2 ++ + src/test/test-errno-util.c | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-bus/test-bus-error.c b/src/libsystemd/sd-bus/test-bus-error.c +index 91045c06c2..a06b9bac0c 100644 +--- a/src/libsystemd/sd-bus/test-bus-error.c ++++ b/src/libsystemd/sd-bus/test-bus-error.c +@@ -99,7 +99,9 @@ TEST(error) { + assert_se(!sd_bus_error_is_set(&error)); + assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY); + assert_se(streq(error.name, "System.Error.EBUSY")); ++#ifdef __GLIBC__ + assert_se(streq(error.message, STRERROR(EBUSY))); ++#endif + assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY")); + assert_se(sd_bus_error_get_errno(&error) == EBUSY); + assert_se(sd_bus_error_is_set(&error)); +diff --git a/src/test/test-errno-util.c b/src/test/test-errno-util.c +index ab463bd1b3..e2ebcaaf33 100644 +--- a/src/test/test-errno-util.c ++++ b/src/test/test-errno-util.c +@@ -4,7 +4,7 @@ + #include "stdio-util.h" + #include "string-util.h" + #include "tests.h" +- ++#ifdef __GLIBC__ + TEST(strerror_not_threadsafe) { + /* Just check that strerror really is not thread-safe. */ + log_info("strerror(%d) → %s", 200, strerror(200)); +@@ -46,6 +46,7 @@ TEST(STRERROR_OR_ELSE) { + log_info("STRERROR_OR_ELSE(EPERM, \"EOF\") → %s", STRERROR_OR_EOF(EPERM)); + log_info("STRERROR_OR_ELSE(-EPERM, \"EOF\") → %s", STRERROR_OR_EOF(-EPERM)); + } ++#endif /* __GLIBC__ */ + + TEST(PROTECT_ERRNO) { + errno = 12; +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0021-errno-util-Make-STRERROR-portable-for-musl.patch b/meta/recipes-core/systemd/systemd/0021-errno-util-Make-STRERROR-portable-for-musl.patch new file mode 100644 index 0000000000..6e899d0905 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0021-errno-util-Make-STRERROR-portable-for-musl.patch @@ -0,0 +1,42 @@ +From d2f632dd6a8cca0fbdd6568ce84004335c004f58 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 23 Jan 2023 23:39:46 -0800 +Subject: [PATCH 21/27] errno-util: Make STRERROR portable for musl + +Sadly, systemd has decided to use yet another GNU extention in a macro +lets make this such that we can use XSI compliant strerror_r() for +non-glibc hosts + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/basic/errno-util.h | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h +index 48b76e4bf7..6e7653e2d9 100644 +--- a/src/basic/errno-util.h ++++ b/src/basic/errno-util.h +@@ -15,8 +15,16 @@ + * https://stackoverflow.com/questions/34880638/compound-literal-lifetime-and-if-blocks + * + * Note that we use the GNU variant of strerror_r() here. */ +-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN) +- ++static inline const char * STRERROR(int errnum); ++ ++static inline const char * STRERROR(int errnum) { ++#ifdef __GLIBC__ ++ return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN); ++#else ++ static __thread char buf[ERRNO_BUF_LEN]; ++ return strerror_r(abs(errnum), buf, ERRNO_BUF_LEN) ? "unknown error" : buf; ++#endif ++} + /* A helper to print an error message or message for functions that return 0 on EOF. + * Note that we can't use ({ … }) to define a temporary variable, so errnum is + * evaluated twice. */ +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch b/meta/recipes-core/systemd/systemd/0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch new file mode 100644 index 0000000000..ed7e3ea586 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch @@ -0,0 +1,39 @@ +From 4a3ed5aaaf108d3a07f24997698906e801ba2412 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 2 Aug 2023 12:06:27 -0700 +Subject: [PATCH 22/27] sd-event: Make malloc_trim() conditional on glibc + +musl does not have this API + +Upstream-Status: Inappropriate [musl-specific] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/libsystemd/sd-event/sd-event.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c +index a1305ef014..b8a73da2a3 100644 +--- a/src/libsystemd/sd-event/sd-event.c ++++ b/src/libsystemd/sd-event/sd-event.c +@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit( + } + + _public_ int sd_event_trim_memory(void) { +- int r; ++ int r = 0; + + /* A default implementation of a memory pressure callback. Simply releases our own allocation caches + * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a +@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) { + + usec_t before_timestamp = now(CLOCK_MONOTONIC); + hashmap_trim_pools(); ++#ifdef __GLIBC__ + r = malloc_trim(0); ++#endif + usec_t after_timestamp = now(CLOCK_MONOTONIC); + + if (r > 0) +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0023-shared-Do-not-use-malloc_info-on-musl.patch b/meta/recipes-core/systemd/systemd/0023-shared-Do-not-use-malloc_info-on-musl.patch new file mode 100644 index 0000000000..b8583c7af7 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0023-shared-Do-not-use-malloc_info-on-musl.patch @@ -0,0 +1,57 @@ +From d3880d167d8dfafbb8ee62f7737a869f9525f303 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 2 Aug 2023 12:20:40 -0700 +Subject: [PATCH 23/27] shared: Do not use malloc_info on musl + +Upstream-Status: Inappropriate [musl-specific] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/shared/bus-util.c | 5 +++-- + src/shared/common-signal.c | 4 ++-- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c +index 30f9602b1e..5308f168db 100644 +--- a/src/shared/bus-util.c ++++ b/src/shared/bus-util.c +@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat + _cleanup_close_ int fd = -EBADF; + size_t dump_size; + FILE *f; +- int r; ++ int r = 0; + + assert(message); + + f = memstream_init(&m); + if (!f) + return -ENOMEM; +- ++#ifdef __GLIBC__ + r = RET_NERRNO(malloc_info(/* options= */ 0, f)); ++#endif + if (r < 0) + return r; + +diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c +index 8e70e365dd..9e782caec9 100644 +--- a/src/shared/common-signal.c ++++ b/src/shared/common-signal.c +@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo + log_oom(); + break; + } +- ++#ifdef __GLIBC__ + if (malloc_info(0, f) < 0) { + log_error_errno(errno, "Failed to invoke malloc_info(): %m"); + break; + } +- ++#endif + (void) memstream_dump(LOG_INFO, &m); + break; + } +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0024-avoid-missing-LOCK_EX-declaration.patch b/meta/recipes-core/systemd/systemd/0024-avoid-missing-LOCK_EX-declaration.patch new file mode 100644 index 0000000000..6804c7c62e --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0024-avoid-missing-LOCK_EX-declaration.patch @@ -0,0 +1,56 @@ +From ca2a736627f8ee8dd9dbbf5b3149d4c8493833ff Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 2 Jan 2024 11:03:27 +0800 +Subject: [PATCH 24/27] avoid missing LOCK_EX declaration + +This only happens on MUSL. Include sys/file.h to avoid compilation +error about missing LOCK_EX declaration. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/basic/fd-util.h | 1 + + src/core/exec-invoke.c | 1 + + src/shared/dev-setup.h | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h +index af17481dd8..fa20bfa30f 100644 +--- a/src/basic/fd-util.h ++++ b/src/basic/fd-util.h +@@ -6,6 +6,7 @@ + #include <stdbool.h> + #include <stdio.h> + #include <sys/socket.h> ++#include <sys/file.h> + + #include "macro.h" + #include "missing_fcntl.h" +diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c +index ee8db04e76..2aff654f0f 100644 +--- a/src/core/exec-invoke.c ++++ b/src/core/exec-invoke.c +@@ -4,6 +4,7 @@ + #include <sys/ioctl.h> + #include <sys/mount.h> + #include <sys/prctl.h> ++#include <sys/file.h> + + #if HAVE_PAM + #include <security/pam_appl.h> +diff --git a/src/shared/dev-setup.h b/src/shared/dev-setup.h +index 5339bc4e5e..0697495f23 100644 +--- a/src/shared/dev-setup.h ++++ b/src/shared/dev-setup.h +@@ -2,6 +2,7 @@ + #pragma once + + #include <sys/types.h> ++#include <sys/file.h> + + int lock_dev_console(void); + +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch b/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch deleted file mode 100644 index 0e5629d37b..0000000000 --- a/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 902412c271e0c5d9cb93b10ec0fb5b119b393474 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 16:53:06 +0800 -Subject: [PATCH 24/24] test-json.c: define M_PIl - -Fix the following compile failure: -src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'? - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/test/test-json.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/test/test-json.c b/src/test/test-json.c -index 9b8a2a9..efc746c 100644 ---- a/src/test/test-json.c -+++ b/src/test/test-json.c -@@ -11,6 +11,10 @@ - #include "tests.h" - #include "util.h" - -+#ifndef M_PIl -+#define M_PIl 3.141592653589793238462643383279502884L -+#endif -+ - static void test_tokenizer(const char *data, ...) { - unsigned line = 0, column = 0; - void *state = NULL; --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0025-include-signal.h-to-avoid-the-undeclared-error.patch b/meta/recipes-core/systemd/systemd/0025-include-signal.h-to-avoid-the-undeclared-error.patch new file mode 100644 index 0000000000..5cfb112d67 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0025-include-signal.h-to-avoid-the-undeclared-error.patch @@ -0,0 +1,27 @@ +From ecf124ab2e488a71741fe443ff4863f7ed172968 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 2 Jul 2024 22:18:47 -0700 +Subject: [PATCH 25/27] include signal.h to avoid the 'undeclared' error + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/basic/pidref.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/basic/pidref.h b/src/basic/pidref.h +index 9920ebb9b3..2fdd4ff50f 100644 +--- a/src/basic/pidref.h ++++ b/src/basic/pidref.h +@@ -1,6 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + #pragma once + ++#include <signal.h> + #include "macro.h" + + /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */ +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch b/meta/recipes-core/systemd/systemd/0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch new file mode 100644 index 0000000000..ca1a525a0a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch @@ -0,0 +1,48 @@ +From 787606c6ff822fb3fe41ba951ee289bbf6d4def3 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 2 Jul 2024 22:44:31 -0700 +Subject: [PATCH 26/27] undef stdin for references using stdin as a struct + member + +In musl stdio.h, we have: +include/stdio.h:#define stdin (stdin) + +This causes error when a struct member is also named stdin. undef it. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/shared/edit-util.c | 2 ++ + src/systemctl/systemctl-edit.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c +index cfb2828f4e..1794a7b269 100644 +--- a/src/shared/edit-util.c ++++ b/src/shared/edit-util.c +@@ -3,6 +3,8 @@ + #include <errno.h> + #include <stdio.h> + ++#undef stdin ++ + #include "alloc-util.h" + #include "copy.h" + #include "edit-util.h" +diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c +index 15398f8364..e7d53ca9a1 100644 +--- a/src/systemctl/systemctl-edit.c ++++ b/src/systemctl/systemctl-edit.c +@@ -13,6 +13,8 @@ + #include "systemctl.h" + #include "terminal-util.h" + ++#undef stdin ++ + int verb_cat(int argc, char *argv[], void *userdata) { + _cleanup_hashmap_free_ Hashmap *cached_id_map = NULL, *cached_name_map = NULL; + _cleanup_(lookup_paths_done) LookupPaths lp = {}; +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch b/meta/recipes-core/systemd/systemd/0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch new file mode 100644 index 0000000000..1be075d606 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch @@ -0,0 +1,76 @@ +From cf94d43572770007f95b832f477aa5a03624a1e5 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 2 Jul 2024 23:23:57 -0700 +Subject: [PATCH 27/27] adjust header inclusion order to avoid redeclaration + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/network/netdev/wireguard.c | 2 +- + src/network/networkd-bridge-mdb.c | 3 ++- + src/network/networkd-route.c | 6 +++--- + 3 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c +index 94b659fd23..a78ad5762d 100644 +--- a/src/network/netdev/wireguard.c ++++ b/src/network/netdev/wireguard.c +@@ -5,9 +5,9 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> ++#include <netinet/in.h> + //#include <linux/if_arp.h> + #include <linux/ipv6_route.h> +-#include <netinet/in.h> + #include <sys/ioctl.h> + + #include "sd-resolve.h" +diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c +index 7ff4a18846..fe1a9cf888 100644 +--- a/src/network/networkd-bridge-mdb.c ++++ b/src/network/networkd-bridge-mdb.c +@@ -2,7 +2,6 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include <net/if.h> +-#include <linux/if_bridge.h> + + #include "netlink-util.h" + #include "networkd-bridge-mdb.h" +@@ -13,6 +12,8 @@ + #include "string-util.h" + #include "vlan-util.h" + ++#include <linux/if_bridge.h> ++ + #define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U + + /* remove MDB entry. */ +diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c +index d596fd81e6..0dc0d2a7a3 100644 +--- a/src/network/networkd-route.c ++++ b/src/network/networkd-route.c +@@ -1,8 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/ipv6_route.h> +-#include <linux/nexthop.h> +- + #include "alloc-util.h" + #include "event-util.h" + #include "netlink-util.h" +@@ -20,6 +17,9 @@ + #include "vrf.h" + #include "wireguard.h" + ++#include <linux/ipv6_route.h> ++#include <linux/nexthop.h> ++ + static Route* route_detach_impl(Route *route) { + assert(route); + assert(!!route->network + !!route->manager + !!route->wireguard <= 1); +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/0028-build-path.c-avoid-boot-time-segfault-for-musl.patch b/meta/recipes-core/systemd/systemd/0028-build-path.c-avoid-boot-time-segfault-for-musl.patch new file mode 100644 index 0000000000..501728cbc8 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0028-build-path.c-avoid-boot-time-segfault-for-musl.patch @@ -0,0 +1,31 @@ +From 0e4379088b1cf607b605b785f6f23943ebeb6584 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Wed, 3 Jul 2024 07:18:42 -0700 +Subject: [PATCH 28/28] build-path.c: avoid boot time segfault for musl + +This function, at runtime, should return -ENOEXEC. For musl, it +somehow segfaults. I think it's related to getauxval, but it's +really does not matter, just return -ENOEXEC. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/basic/build-path.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/basic/build-path.c b/src/basic/build-path.c +index b5972658df..4ef551034e 100644 +--- a/src/basic/build-path.c ++++ b/src/basic/build-path.c +@@ -151,6 +151,7 @@ int get_build_exec_dir(char **ret) { + */ + + static int runpath_cached = -ERRNO_MAX-1; ++ return -ENOEXEC; + if (runpath_cached == -ERRNO_MAX-1) { + const char *runpath = NULL; + +-- +2.45.1 + diff --git a/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf new file mode 100644 index 0000000000..f4d0271cdb --- /dev/null +++ b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf @@ -0,0 +1,11 @@ +<?xml version="1.0"?> <!--*-nxml-*--> +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> + +<busconfig> + <policy group="systemd-hostname"> + <allow own="org.freedesktop.hostname1"/> + <allow send_destination="org.freedesktop.hostname1"/> + <allow receive_sender="org.freedesktop.hostname1"/> + </policy> +</busconfig> diff --git a/meta/recipes-core/systemd/systemd/systemd-pager.sh b/meta/recipes-core/systemd/systemd/systemd-pager.sh new file mode 100644 index 0000000000..86e3e0ab78 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pager.sh @@ -0,0 +1,7 @@ +# Systemd expect a color capable pager, however the less provided +# by busybox is not. This make many interaction with systemd pretty +# annoying. As a workaround we disable the systemd pager if less +# is not the GNU version. +if ! less -V > /dev/null 2>&1 ; then + export SYSTEMD_PAGER= +fi diff --git a/meta/recipes-core/systemd/systemd_243.bb b/meta/recipes-core/systemd/systemd_243.bb deleted file mode 100644 index ac7a5f86b3..0000000000 --- a/meta/recipes-core/systemd/systemd_243.bb +++ /dev/null @@ -1,682 +0,0 @@ -require systemd.inc - -PROVIDES = "udev" - -PE = "1" - -DEPENDS = "intltool-native gperf-native libcap util-linux" - -SECTION = "base/shell" - -inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check - -# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so -# that we don't build both udev and systemd in world builds. -REQUIRED_DISTRO_FEATURES = "systemd" - -SRC_URI += "file://touchscreen.rules \ - file://00-create-volatile.conf \ - file://init \ - file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ - file://0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch \ - file://0003-implment-systemd-sysv-install-for-OE.patch \ - file://0004-rules-whitelist-hd-devices.patch \ - file://0005-rules-watch-metadata-changes-in-ide-devices.patch \ - file://0001-unit-file.c-consider-symlink-on-filesystems-like-NFS.patch \ - file://99-default.preset \ - " - -# patches needed by musl -SRC_URI_append_libc-musl = " ${SRC_URI_MUSL}" -SRC_URI_MUSL = "\ - file://0002-don-t-use-glibc-specific-qsort_r.patch \ - file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \ - file://0004-add-fallback-parse_printf_format-implementation.patch \ - file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \ - file://0006-Include-netinet-if_ether.h.patch \ - file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch \ - file://0008-add-missing-FTW_-macros-for-musl.patch \ - file://0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch \ - file://0011-Use-uintmax_t-for-handling-rlim_t.patch \ - file://0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ - file://0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ - file://0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ - file://0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ - file://0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ - file://0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ - file://0020-missing_type.h-add-__compar_d_fn_t-definition.patch \ - file://0021-avoid-redefinition-of-prctl_mm_map-structure.patch \ - file://0024-test-json.c-define-M_PIl.patch \ - file://0001-do-not-disable-buffer-in-writing-files.patch \ - file://0002-src-login-brightness.c-include-sys-wait.h.patch \ - file://0003-src-basic-copy.c-include-signal.h.patch \ - file://0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch \ - " - -PAM_PLUGINS = " \ - pam-plugin-unix \ - pam-plugin-loginuid \ - pam-plugin-keyinit \ -" - -PACKAGECONFIG ??= " \ - ${@bb.utils.filter('DISTRO_FEATURES', 'efi ldconfig pam selinux usrmerge polkit', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ - acl \ - backlight \ - binfmt \ - gshadow \ - hibernate \ - hostnamed \ - idn \ - ima \ - kmod \ - localed \ - logind \ - machined \ - myhostname \ - networkd \ - nss \ - nss-mymachines \ - nss-resolve \ - quotacheck \ - randomseed \ - resolved \ - set-time-epoch \ - smack \ - sysusers \ - timedated \ - timesyncd \ - utmp \ - vconsole \ - xz \ -" - -PACKAGECONFIG_remove_libc-musl = " \ - gshadow \ - idn \ - localed \ - myhostname \ - nss \ - nss-mymachines \ - nss-resolve \ - resolved \ - smack \ - sysusers \ - utmp \ -" - -# Use the upstream systemd serial-getty@.service and rely on -# systemd-getty-generator instead of using the OE-core specific -# systemd-serialgetty.bb - not enabled by default. -PACKAGECONFIG[serial-getty-generator] = "" - -PACKAGECONFIG[acl] = "-Dacl=true,-Dacl=false,acl" -PACKAGECONFIG[audit] = "-Daudit=true,-Daudit=false,audit" -PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false" -PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false" -PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2" -PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid" -PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false" -PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup" -PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus" -PACKAGECONFIG[efi] = "-Defi=true,-Defi=false" -PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi" -PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils" -PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false" -# Sign the journal for anti-tampering -PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt" -PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls" -PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false" -PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false" -PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false" -PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" -PACKAGECONFIG[ima] = "-Dima=true,-Dima=false" -# importd requires curl/xz/zlib/bzip2/gcrypt -PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false" -# Update NAT firewall rules -PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables" -PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl" -PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod" -PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig" -PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn" -PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false" -PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false" -PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4" -PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false" -PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" -PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd" -PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname" -PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false" -PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false" -PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false" -PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false" -PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl" -PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}" -PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2" -PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false" -PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false" -PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode" -PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false" -PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false" -PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false" -PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false" -# libseccomp is found in meta-security -PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp" -PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell" -PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false" -PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false" -# When enabled use reproducble build timestamp if set as time epoch, -# or build time if not. When disabled, time epoch is unset. -def build_epoch(d): - epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1" - return '-Dtime-epoch=%d' % int(epoch) -PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0" -PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false" -PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false" -PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true" -PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true" -PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false" -PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind" -PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup" -# Verify keymaps on locale change -PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon" -PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz" -PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib" - -# Helper variables to clarify locations. This mirrors the logic in systemd's -# build system. -rootprefix ?= "${root_prefix}" -rootlibdir ?= "${base_libdir}" -rootlibexecdir = "${rootprefix}/lib" - -# This links udev statically with systemd helper library. -# Otherwise udev package would depend on systemd package (which has the needed shared library), -# and always pull it into images. -EXTRA_OEMESON += "-Dlink-udev-shared=false" - -EXTRA_OEMESON += "-Dnobody-user=nobody \ - -Dnobody-group=nobody \ - -Drootlibdir=${rootlibdir} \ - -Drootprefix=${rootprefix} \ - -Dsysvrcnd-path=${sysconfdir} \ - -Ddefault-locale=C \ - " - -# Hardcode target binary paths to avoid using paths from sysroot -EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \ - -Dkmod-path=${base_bindir}/kmod \ - -Dmount-path=${base_bindir}/mount \ - -Dquotacheck-path=${sbindir}/quotacheck \ - -Dquotaon-path=${sbindir}/quotaon \ - -Dsulogin-path=${base_sbindir}/sulogin \ - -Dnologin-path=${base_sbindir}/nologin \ - -Dumount-path=${base_bindir}/umount" - -do_install() { - meson_do_install - install -d ${D}/${base_sbindir} - if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then - # Provided by a separate recipe - rm ${D}${systemd_unitdir}/system/serial-getty* -f - fi - - # Provide support for initramfs - [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init - [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd - - install -d ${D}${sysconfdir}/udev/rules.d/ - install -d ${D}${sysconfdir}/tmpfiles.d - install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/ - - install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ - - if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd - sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd - fi - - chown root:systemd-journal ${D}/${localstatedir}/log/journal - - # Delete journal README, as log can be symlinked inside volatile. - rm -f ${D}/${localstatedir}/log/README - - # journal-remote creates this at start - rm -rf ${D}/${localstatedir}/log/journal/remote - - install -d ${D}${systemd_unitdir}/system/graphical.target.wants - install -d ${D}${systemd_unitdir}/system/multi-user.target.wants - install -d ${D}${systemd_unitdir}/system/poweroff.target.wants - install -d ${D}${systemd_unitdir}/system/reboot.target.wants - install -d ${D}${systemd_unitdir}/system/rescue.target.wants - - # Create symlinks for systemd-update-utmp-runlevel.service - if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service - fi - - # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it - # for existence else it fails - if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then - ${@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)} - fi - if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then - echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf - echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf - echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf - ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd - else - 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 - ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd - fi - install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install - - # If polkit is setup fixup permissions and ownership - if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then - if [ -d ${D}${datadir}/polkit-1/rules.d ]; then - chmod 700 ${D}${datadir}/polkit-1/rules.d - chown polkitd:root ${D}${datadir}/polkit-1/rules.d - fi - fi - - # create link for existing udev rules - ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm - - # duplicate udevadm for postinst script - install -d ${D}${libexecdir} - ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm - - # install default policy for presets - # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto - install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset - - # We use package postinsts for the hwdb update, as the update service is - # easily triggered for no reason and will slow down boots. - find ${D} -name systemd-hwdb-update.service -delete -} - -python populate_packages_prepend (){ - systemdlibdir = d.getVar("rootlibdir") - do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) -} -PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*" - -PACKAGES =+ "\ - ${PN}-gui \ - ${PN}-vconsole-setup \ - ${PN}-initramfs \ - ${PN}-analyze \ - ${PN}-kernel-install \ - ${PN}-rpm-macros \ - ${PN}-binfmt \ - ${PN}-zsh-completion \ - ${PN}-container \ - ${PN}-journal-gatewayd \ - ${PN}-journal-upload \ - ${PN}-journal-remote \ - ${PN}-extra-utils \ -" - -SUMMARY_${PN}-container = "Tools for containers and VMs" -DESCRIPTION_${PN}-container = "Systemd tools to spawn and manage containers and virtual machines." - -SUMMARY_${PN}-journal-gatewayd = "HTTP server for journal events" -DESCRIPTION_${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." - -SUMMARY_${PN}-journal-upload = "Send journal messages over the network" -DESCRIPTION_${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL." - -SUMMARY_${PN}-journal-remote = "Receive journal messages over the network" -DESCRIPTION_${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files." - -SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ -" -SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" - -USERADD_PACKAGES = "${PN} ${PN}-extra-utils \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ -" -GROUPADD_PARAM_${PN} = "-r systemd-journal" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /bin/nologin systemd-coredump;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /bin/nologin systemd-resolve;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;', '', d)}" -USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /bin/nologin systemd-bus-proxy" -USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /bin/nologin systemd-journal-gateway" -USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /bin/nologin systemd-journal-remote" -USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /bin/nologin systemd-journal-upload" - -FILES_${PN}-analyze = "${bindir}/systemd-analyze" - -FILES_${PN}-initramfs = "/init" -RDEPENDS_${PN}-initramfs = "${PN}" - -FILES_${PN}-gui = "${bindir}/systemadm" - -FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ - ${systemd_unitdir}/system/systemd-vconsole-setup.service \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service" - -RDEPENDS_${PN}-kernel-install += "bash" -FILES_${PN}-kernel-install = "${bindir}/kernel-install \ - ${sysconfdir}/kernel/ \ - ${exec_prefix}/lib/kernel \ - " -FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ - " - -FILES_${PN}-zsh-completion = "${datadir}/zsh/site-functions" - -FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ - ${exec_prefix}/lib/binfmt.d \ - ${rootlibexecdir}/systemd/systemd-binfmt \ - ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \ - ${systemd_unitdir}/system/systemd-binfmt.service" -RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc" - -RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps" - - -FILES_${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \ - ${systemd_system_unitdir}/systemd-journal-gatewayd.service \ - ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \ - ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \ - ${datadir}/systemd/gatewayd/browse.html \ - " -SYSTEMD_SERVICE_${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket" - -FILES_${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \ - ${systemd_system_unitdir}/systemd-journal-upload.service \ - ${sysconfdir}/systemd/journal-upload.conf \ - " -SYSTEMD_SERVICE_${PN}-journal-upload = "systemd-journal-upload.service" - -FILES_${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ - ${sysconfdir}/systemd/journal-remote.conf \ - ${systemd_system_unitdir}/systemd-journal-remote.service \ - ${systemd_system_unitdir}/systemd-journal-remote.socket \ - " -SYSTEMD_SERVICE_${PN}-remote = "systemd-journal-remote.socket" - - -FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \ - ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \ - ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \ - ${base_bindir}/machinectl \ - ${bindir}/systemd-nspawn \ - ${nonarch_libdir}/systemd/import-pubring.gpg \ - ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \ - ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \ - ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \ - ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \ - ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \ - ${systemd_system_unitdir}/machine.slice \ - ${systemd_system_unitdir}/machines.target \ - ${systemd_system_unitdir}/org.freedesktop.import1.busname \ - ${systemd_system_unitdir}/org.freedesktop.machine1.busname \ - ${systemd_system_unitdir}/systemd-importd.service \ - ${systemd_system_unitdir}/systemd-machined.service \ - ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \ - ${systemd_system_unitdir}/var-lib-machines.mount \ - ${rootlibexecdir}/systemd/systemd-import \ - ${rootlibexecdir}/systemd/systemd-importd \ - ${rootlibexecdir}/systemd/systemd-machined \ - ${rootlibexecdir}/systemd/systemd-pull \ - ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \ - ${systemd_system_unitdir}/systemd-nspawn@.service \ - ${libdir}/libnss_mymachines.so.2 \ - ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \ - ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \ - ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \ - ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \ - ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \ - " - -RRECOMMENDS_${PN}-container += "\ - ${PN}-journal-upload \ - ${PN}-journal-remote \ - ${PN}-journal-gatewayd \ - " - -FILES_${PN}-extra-utils = "\ - ${base_bindir}/systemd-escape \ - ${base_bindir}/systemd-inhibit \ - ${bindir}/systemd-detect-virt \ - ${bindir}/systemd-path \ - ${bindir}/systemd-run \ - ${bindir}/systemd-cat \ - ${bindir}/systemd-delta \ - ${bindir}/systemd-cgls \ - ${bindir}/systemd-cgtop \ - ${bindir}/systemd-stdio-bridge \ - ${base_bindir}/systemd-ask-password \ - ${base_bindir}/systemd-tty-ask-password-agent \ - ${systemd_unitdir}/system/systemd-ask-password-console.path \ - ${systemd_unitdir}/system/systemd-ask-password-console.service \ - ${systemd_unitdir}/system/systemd-ask-password-wall.path \ - ${systemd_unitdir}/system/systemd-ask-password-wall.service \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \ - ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \ - ${rootlibexecdir}/systemd/systemd-resolve-host \ - ${rootlibexecdir}/systemd/systemd-ac-power \ - ${rootlibexecdir}/systemd/systemd-activate \ - ${rootlibexecdir}/systemd/systemd-bus-proxyd \ - ${systemd_unitdir}/system/systemd-bus-proxyd.service \ - ${systemd_unitdir}/system/systemd-bus-proxyd.socket \ - ${rootlibexecdir}/systemd/systemd-socket-proxyd \ - ${rootlibexecdir}/systemd/systemd-reply-password \ - ${rootlibexecdir}/systemd/systemd-sleep \ - ${rootlibexecdir}/systemd/system-sleep \ - ${systemd_unitdir}/system/systemd-hibernate.service \ - ${systemd_unitdir}/system/systemd-hybrid-sleep.service \ - ${systemd_unitdir}/system/systemd-suspend.service \ - ${systemd_unitdir}/system/sleep.target \ - ${rootlibexecdir}/systemd/systemd-initctl \ - ${systemd_unitdir}/system/systemd-initctl.service \ - ${systemd_unitdir}/system/systemd-initctl.socket \ - ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \ - ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \ - ${rootlibexecdir}/systemd/systemd-cgroups-agent \ -" - -CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \ - ${sysconfdir}/systemd/journald.conf \ - ${sysconfdir}/systemd/logind.conf \ - ${sysconfdir}/systemd/system.conf \ - ${sysconfdir}/systemd/user.conf \ - ${sysconfdir}/systemd/resolved.conf \ - ${sysconfdir}/systemd/timesyncd.conf \ -" - -FILES_${PN} = " ${base_bindir}/* \ - ${base_sbindir}/shutdown \ - ${base_sbindir}/halt \ - ${base_sbindir}/poweroff \ - ${base_sbindir}/runlevel \ - ${base_sbindir}/telinit \ - ${base_sbindir}/resolvconf \ - ${base_sbindir}/reboot \ - ${base_sbindir}/init \ - ${datadir}/dbus-1/services \ - ${datadir}/dbus-1/system-services \ - ${datadir}/polkit-1 \ - ${datadir}/${BPN} \ - ${datadir}/factory \ - ${sysconfdir}/dbus-1/ \ - ${sysconfdir}/modules-load.d/ \ - ${sysconfdir}/pam.d/ \ - ${sysconfdir}/sysctl.d/ \ - ${sysconfdir}/systemd/ \ - ${sysconfdir}/tmpfiles.d/ \ - ${sysconfdir}/xdg/ \ - ${sysconfdir}/init.d/README \ - ${sysconfdir}/resolv-conf.systemd \ - ${sysconfdir}/X11/xinit/xinitrc.d/* \ - ${rootlibexecdir}/systemd/* \ - ${systemd_unitdir}/* \ - ${base_libdir}/security/*.so \ - /cgroup \ - ${bindir}/systemd* \ - ${bindir}/busctl \ - ${bindir}/coredumpctl \ - ${bindir}/localectl \ - ${bindir}/hostnamectl \ - ${bindir}/resolvectl \ - ${bindir}/timedatectl \ - ${bindir}/bootctl \ - ${bindir}/kernel-install \ - ${exec_prefix}/lib/tmpfiles.d/*.conf \ - ${exec_prefix}/lib/systemd \ - ${exec_prefix}/lib/modules-load.d \ - ${exec_prefix}/lib/sysctl.d \ - ${exec_prefix}/lib/sysusers.d \ - ${exec_prefix}/lib/environment.d \ - ${localstatedir} \ - ${nonarch_base_libdir}/udev/rules.d/70-uaccess.rules \ - ${nonarch_base_libdir}/udev/rules.d/71-seat.rules \ - ${nonarch_base_libdir}/udev/rules.d/73-seat-late.rules \ - ${nonarch_base_libdir}/udev/rules.d/99-systemd.rules \ - ${nonarch_base_libdir}/modprobe.d/systemd.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \ - " - -FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" - -RDEPENDS_${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) util-linux-agetty util-linux-fsck" -RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" -RDEPENDS_${PN} += "volatile-binds update-rc.d" - -RRECOMMENDS_${PN} += "systemd-extra-utils \ - systemd-compat-units udev-hwdb \ - e2fsprogs-e2fsck \ - kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \ - os-release \ - systemd-conf \ -" - -INSANE_SKIP_${PN} += "dev-so libdir" -INSANE_SKIP_${PN}-dbg += "libdir" -INSANE_SKIP_${PN}-doc += " libdir" - -PACKAGES =+ "udev udev-hwdb" - -RPROVIDES_udev = "hotplug" - -RDEPENDS_udev-hwdb += "udev" - -FILES_udev += "${base_sbindir}/udevd \ - ${rootlibexecdir}/systemd/network/99-default.link \ - ${rootlibexecdir}/systemd/systemd-udevd \ - ${rootlibexecdir}/udev/accelerometer \ - ${rootlibexecdir}/udev/ata_id \ - ${rootlibexecdir}/udev/cdrom_id \ - ${rootlibexecdir}/udev/collect \ - ${rootlibexecdir}/udev/findkeyboards \ - ${rootlibexecdir}/udev/keyboard-force-release.sh \ - ${rootlibexecdir}/udev/keymap \ - ${rootlibexecdir}/udev/mtd_probe \ - ${rootlibexecdir}/udev/scsi_id \ - ${rootlibexecdir}/udev/v4l_id \ - ${rootlibexecdir}/udev/keymaps \ - ${rootlibexecdir}/udev/rules.d/*.rules \ - ${sysconfdir}/udev \ - ${sysconfdir}/init.d/systemd-udevd \ - ${systemd_unitdir}/system/*udev* \ - ${systemd_unitdir}/system/*.wants/*udev* \ - ${base_bindir}/udevadm \ - ${base_sbindir}/udevadm \ - ${libexecdir}/${MLPREFIX}udevadm \ - ${datadir}/bash-completion/completions/udevadm \ - " - -FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d" - -RCONFLICTS_${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}" - -INITSCRIPT_PACKAGES = "udev" -INITSCRIPT_NAME_udev = "systemd-udevd" -INITSCRIPT_PARAMS_udev = "start 03 S ." - -python __anonymous() { - if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): - d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") -} - -python do_warn_musl() { - if d.getVar('TCLIBC') == "musl": - bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.") -} -addtask warn_musl before do_configure - -ALTERNATIVE_${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}" - -ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd" -ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf" -ALTERNATIVE_PRIORITY[resolv-conf] ?= "50" - -ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt" -ALTERNATIVE_PRIORITY[halt] ?= "300" - -ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot" -ALTERNATIVE_PRIORITY[reboot] ?= "300" - -ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown" -ALTERNATIVE_PRIORITY[shutdown] ?= "300" - -ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff" -ALTERNATIVE_PRIORITY[poweroff] ?= "300" - -ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel" -ALTERNATIVE_PRIORITY[runlevel] ?= "300" - -pkg_postinst_${PN}_libc-glibc () { - sed -e '/^hosts:/s/\s*\<myhostname\>//' \ - -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \ - -i $D${sysconfdir}/nsswitch.conf -} - -pkg_prerm_${PN}_libc-glibc () { - sed -e '/^hosts:/s/\s*\<myhostname\>//' \ - -e '/^hosts:/s/\s*myhostname//' \ - -i $D${sysconfdir}/nsswitch.conf -} - -PACKAGE_WRITE_DEPS += "qemu-native" -pkg_postinst_udev-hwdb () { - if test -n "$D"; then - $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} - else - udevadm hwdb --update - fi -} - -pkg_prerm_udev-hwdb () { - rm -f $D${sysconfdir}/udev/hwdb.bin -} diff --git a/meta/recipes-core/systemd/systemd_256.5.bb b/meta/recipes-core/systemd/systemd_256.5.bb new file mode 100644 index 0000000000..68f15ab065 --- /dev/null +++ b/meta/recipes-core/systemd/systemd_256.5.bb @@ -0,0 +1,909 @@ +require systemd.inc + +PROVIDES = "udev" + +PE = "1" + +DEPENDS = "intltool-native gperf-native libcap util-linux python3-jinja2-native" + +SECTION = "base/shell" + +inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check mime + +# unmerged-usr support is deprecated upstream, taints the system and will be +# removed in the near future. Fail the build if it is not enabled. +REQUIRED_DISTRO_FEATURES += "usrmerge" + +# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so +# that we don't build both udev and systemd in world builds. +REQUIRED_DISTRO_FEATURES += "systemd" + +SRC_URI += " \ + file://touchscreen.rules \ + file://00-create-volatile.conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \ + file://init \ + file://99-default.preset \ + file://systemd-pager.sh \ + file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ + file://0002-implment-systemd-sysv-install-for-OE.patch \ + file://0003-coredump-set-ProtectHome-to-read-only.patch \ + " + +# patches needed by musl +SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}" +SRC_URI_MUSL = "\ + file://0004-missing_type.h-add-comparison_fn_t.patch \ + file://0005-add-fallback-parse_printf_format-implementation.patch \ + file://0006-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ + file://0007-add-missing-FTW_-macros-for-musl.patch \ + file://0008-Use-uintmax_t-for-handling-rlim_t.patch \ + file://0009-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ + file://0010-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ + file://0011-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ + file://0012-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ + file://0013-avoid-redefinition-of-prctl_mm_map-structure.patch \ + file://0014-do-not-disable-buffer-in-writing-files.patch \ + file://0015-Handle-__cpu_mask-usage.patch \ + file://0016-Handle-missing-gshadow.patch \ + file://0017-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \ + file://0018-pass-correct-parameters-to-getdents64.patch \ + file://0019-Adjust-for-musl-headers.patch \ + file://0020-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \ + file://0021-errno-util-Make-STRERROR-portable-for-musl.patch \ + file://0022-sd-event-Make-malloc_trim-conditional-on-glibc.patch \ + file://0023-shared-Do-not-use-malloc_info-on-musl.patch \ + file://0024-avoid-missing-LOCK_EX-declaration.patch \ + file://0025-include-signal.h-to-avoid-the-undeclared-error.patch \ + file://0026-undef-stdin-for-references-using-stdin-as-a-struct-m.patch \ + file://0027-adjust-header-inclusion-order-to-avoid-redeclaration.patch \ + file://0028-build-path.c-avoid-boot-time-segfault-for-musl.patch \ + " + +PAM_PLUGINS = " \ + pam-plugin-unix \ + pam-plugin-loginuid \ + pam-plugin-keyinit \ + pam-plugin-namespace \ +" + +PACKAGECONFIG ??= " \ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam pni-names selinux smack usrmerge polkit seccomp', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'coredump elfutils', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit', 'link-udev-shared', d)} \ + backlight \ + binfmt \ + gshadow \ + hibernate \ + hostnamed \ + idn \ + ima \ + kmod \ + localed \ + logind \ + machined \ + myhostname \ + networkd \ + nss \ + nss-mymachines \ + nss-resolve \ + quotacheck \ + randomseed \ + resolved \ + set-time-epoch \ + sysusers \ + timedated \ + timesyncd \ + userdb \ + utmp \ + vconsole \ + wheel-group \ + zstd \ +" + +PACKAGECONFIG:remove:libc-musl = " \ + gshadow \ + idn \ + localed \ + myhostname \ + nss \ + nss-mymachines \ + nss-resolve \ + sysusers \ + userdb \ + utmp \ +" + +# https://github.com/seccomp/libseccomp/issues/347 +PACKAGECONFIG:remove:mipsarch = "seccomp" + +TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE" + +# Some of the dependencies are weak-style recommends - if not available at runtime, +# systemd won't fail but the library-related feature will be skipped with a warning. + +# Use the upstream systemd serial-getty@.service and rely on +# systemd-getty-generator instead of using the OE-core specific +# systemd-serialgetty.bb - not enabled by default. +PACKAGECONFIG[serial-getty-generator] = "" + +PACKAGECONFIG[acl] = "-Dacl=true,-Dacl=false,acl" +PACKAGECONFIG[audit] = "-Daudit=true,-Daudit=false,audit" +PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false" +PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false" +PACKAGECONFIG[bpf-framework] = "-Dbpf-framework=true,-Dbpf-framework=false,clang-native bpftool-native libbpf,libbpf" +PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2" +PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false" +PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup" +PACKAGECONFIG[cryptsetup-plugins] = "-Dlibcryptsetup-plugins=true,-Dlibcryptsetup-plugins=false,cryptsetup,,cryptsetup" +PACKAGECONFIG[tpm2] = "-Dtpm2=true,-Dtpm2=false,tpm2-tss,tpm2-tss libtss2 libtss2-tcti-device" +# If multiple compression libraries are enabled, the format to use for compression is chosen implicitly, +# so if you want to compress with e.g. lz4 you cannot enable zstd, so you cannot read zstd-compressed journal files. +# This option allows to enable all compression formats for reading, but choosing a specific one for writing. +PACKAGECONFIG[default-compression-lz4] = "-Dlz4=true -Ddefault-compression=lz4,,lz4" +PACKAGECONFIG[default-compression-xz] = "-Dxz=true -Ddefault-compression=xz,,xz" +PACKAGECONFIG[default-compression-zstd] = "-Dzstd=true -Ddefault-compression=zstd,,zstd" +PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus" +PACKAGECONFIG[efi] = "-Defi=true -Dbootloader=true,-Defi=false -Dbootloader=false,python3-pyelftools-native" +PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils,,libelf libdw" +PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false" +PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false" +PACKAGECONFIG[homed] = "-Dhomed=true,-Dhomed=false" +# Sign the journal for anti-tampering +PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt" +PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls" +PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false" +PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false" +PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false" +PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" +PACKAGECONFIG[ima] = "-Dima=true,-Dima=false" +# importd requires journal-upload/xz/zlib/bzip2/gcrypt +PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false,glib-2.0" +# Update NAT firewall rules +PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables" +PACKAGECONFIG[journal-color] = ",,,less" +PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl" +PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod,libkmod" +PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig" +PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn" +PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2" +# Link udev shared with systemd helper library. +# If enabled the udev package depends on the systemd package (which has the needed shared library). +PACKAGECONFIG[link-udev-shared] = "-Dlink-udev-shared=true,-Dlink-udev-shared=false" +PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false" +PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false" +PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4" +PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false" +PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" +PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd" +PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname" +PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false" +PACKAGECONFIG[no-dns-fallback] = "-Ddns-servers=" +PACKAGECONFIG[no-ntp-fallback] = "-Dntp-servers=" +PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false,,libnss-systemd" +PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false" +PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false" +PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false" +PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl" +PACKAGECONFIG[p11kit] = "-Dp11kit=true,-Dp11kit=false,p11-kit" +PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}" +PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2" +PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false" +# If polkit is disabled and networkd+hostnamed are in use, enabling this option and +# using dbus-broker will allow networkd to be authorized to change the +# hostname without acquiring additional privileges +PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit" +PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false" +PACKAGECONFIG[pstore] = "-Dpstore=true,-Dpstore=false" +PACKAGECONFIG[pni-names] = ",,," +PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode" +PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false" +PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false" +PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false" +PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false" +PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp" +PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell" +PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false" +PACKAGECONFIG[sysext] = "-Dsysext=true, -Dsysext=false" +PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false" +PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d" +# When enabled use reproducible build timestamp if set as time epoch, +# or build time if not. When disabled, time epoch is unset. +def build_epoch(d): + epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1" + return '-Dtime-epoch=%d' % int(epoch) +PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0" +PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false" +PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false" +PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true" +PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true" +PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false" +PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false" +PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind" +PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup" +PACKAGECONFIG[wheel-group] = "-Dwheel-group=true, -Dwheel-group=false" +PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false" +# Verify keymaps on locale change +PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon" +PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz" +PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib" +PACKAGECONFIG[zstd] = "-Dzstd=true,-Dzstd=false,zstd" + +RESOLV_CONF ??= "" + +# bpf-framework: pass the recipe-sysroot to the compiler used to build +# the eBPFs, so that it can find needed system includes in there. +CFLAGS:append = " --sysroot=${STAGING_DIR_TARGET}" + +# Helper variables to clarify locations. This mirrors the logic in systemd's +# build system. +rootprefix ?= "${root_prefix}" +rootlibdir ?= "${base_libdir}" +rootlibexecdir = "${rootprefix}/lib" + +EXTRA_OEMESON += "-Dnobody-user=nobody \ + -Dnobody-group=nogroup \ + -Drootlibdir=${rootlibdir} \ + -Drootprefix=${rootprefix} \ + -Ddefault-locale=C \ + -Dmode=release \ + -Dsystem-alloc-uid-min=101 \ + -Dsystem-uid-max=999 \ + -Dsystem-alloc-gid-min=101 \ + -Dsystem-gid-max=999 \ + -Dcreate-log-dirs=false \ + ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', '-Ddefault-mdns=no -Ddefault-llmnr=no', '', d)} \ + " + +# Hardcode target binary paths to avoid using paths from sysroot or worse +# it pokes for these binaries on build host and encodes that distro assumption +# into target +EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \ + -Dkmod-path=${base_bindir}/kmod \ + -Dmount-path=${base_bindir}/mount \ + -Dquotacheck-path=${sbindir}/quotacheck \ + -Dquotaon-path=${sbindir}/quotaon \ + -Dsulogin-path=${base_sbindir}/sulogin \ + -Dnologin-path=${base_sbindir}/nologin \ + -Dumount-path=${base_bindir}/umount \ + -Dloadkeys-path=${bindir}/loadkeys \ + -Dsetfont-path=${bindir}/setfont" + +# The 60 seconds is watchdog's default vaule. +WATCHDOG_TIMEOUT ??= "60" + +do_install() { + meson_do_install + + if ${@bb.utils.contains('PACKAGECONFIG', 'sysusers', 'true', 'false', d)}; then + # Change the root user's home directory in /lib/sysusers.d/basic.conf. + # This is done merely for backward compatibility with previous systemd recipes. + # systemd hardcodes root user's HOME to be "/root". Changing to use other values + # may have unexpected runtime behaviors. + if [ "${ROOT_HOME}" != "/root" ]; then + bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd" + sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf + fi + fi + install -d ${D}/${base_sbindir} + if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then + # Provided by a separate recipe + rm ${D}${systemd_system_unitdir}/serial-getty* -f + fi + + # Provide support for initramfs + [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init + [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd + + install -d ${D}${sysconfdir}/udev/rules.d/ + install -d ${D}${nonarch_libdir}/tmpfiles.d + for rule in $(find ${UNPACKDIR} -maxdepth 1 -type f -name "*.rules"); do + install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/ + done + + install -m 0644 ${UNPACKDIR}/00-create-volatile.conf ${D}${nonarch_libdir}/tmpfiles.d/ + + if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${UNPACKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd + sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd + install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install + fi + + if ${@bb.utils.contains('FILESYSTEM_PERMS_TABLES', 'files/fs-perms-volatile-log.txt', 'true', 'false', d)}; then + # base-files recipe provides /var/log which is a symlink to /var/volatile/log + rm -rf ${D}${localstatedir}/log + printf 'L\t\t%s/log\t\t-\t-\t-\t-\t%s/volatile/log\n' "${localstatedir}" \ + "${localstatedir}" >>${D}${nonarch_libdir}/tmpfiles.d/00-create-volatile.conf + elif [ -e ${D}${localstatedir}/log/journal ]; then + chown root:systemd-journal ${D}${localstatedir}/log/journal + + # journal-remote creates this at start + rm -rf ${D}${localstatedir}/log/journal/remote + fi + + # if the user requests /tmp be on persistent storage (i.e. not volatile) + # then don't use a tmpfs for /tmp + if ! ${@bb.utils.contains('FILESYSTEM_PERMS_TABLES', 'files/fs-perms-volatile-tmp.txt', 'true', 'false', d)}; then + rm -f ${D}${rootlibexecdir}/systemd/system/tmp.mount + rm -f ${D}${rootlibexecdir}/systemd/system/local-fs.target.wants/tmp.mount + fi + + install -d ${D}${systemd_system_unitdir}/graphical.target.wants + install -d ${D}${systemd_system_unitdir}/multi-user.target.wants + install -d ${D}${systemd_system_unitdir}/poweroff.target.wants + install -d ${D}${systemd_system_unitdir}/reboot.target.wants + install -d ${D}${systemd_system_unitdir}/rescue.target.wants + + # Create symlinks for systemd-update-utmp-runlevel.service + if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/poweroff.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/reboot.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service + fi + + # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it + # for existence else it fails + if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ] && + ! ${@bb.utils.contains('PACKAGECONFIG', 'networkd', 'true', 'false', d)}; then + echo 'd /run/systemd/netif/links 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf + fi + if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then + echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf + echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf + echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf + ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd + else + resolv_conf="${@bb.utils.contains('RESOLV_CONF', 'stub-resolv', 'run/systemd/resolve/stub-resolv.conf', 'run/systemd/resolve/resolv.conf', d)}" + sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../${resolv_conf}%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf + ln -s ../${resolv_conf} ${D}${sysconfdir}/resolv-conf.systemd + fi + if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then + rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf + rm -r ${D}${sysconfdir}/X11 + fi + + # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to + # request hostname changes via DBUS without elevating its privileges + if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then + install -d ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ + install -m 0644 ${UNPACKDIR}/00-hostnamed-network-user.conf ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ + install -d ${D}${datadir}/dbus-1/system.d/ + install -m 0644 ${UNPACKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/ + fi + + # create link for existing udev rules + ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm + + # install default policy for presets + # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto + install -Dm 0644 ${UNPACKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset + + # add a profile fragment to disable systemd pager with busybox less + install -Dm 0644 ${UNPACKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh + + if [ -n "${WATCHDOG_TIMEOUT}" ]; then + sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \ + ${D}/${sysconfdir}/systemd/system.conf + fi + + if ${@bb.utils.contains('PACKAGECONFIG', 'pni-names', 'true', 'false', d)}; then + if ! grep -q '^NamePolicy=.*mac' ${D}${rootlibexecdir}/systemd/network/99-default.link; then + sed -i '/^NamePolicy=/s/$/ mac/' ${D}${rootlibexecdir}/systemd/network/99-default.link + fi + if ! grep -q 'AlternativeNamesPolicy=.*mac' ${D}${rootlibexecdir}/systemd/network/99-default.link; then + sed -i '/AlternativeNamesPolicy=/s/$/ mac/' ${D}${rootlibexecdir}/systemd/network/99-default.link + fi + fi +} + +python populate_packages:prepend (){ + systemdlibdir = d.getVar("rootlibdir") + do_split_packages(d, systemdlibdir, r'^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) +} +PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*" + +PACKAGE_BEFORE_PN = "\ + ${PN}-analyze \ + ${PN}-binfmt \ + ${PN}-container \ + ${PN}-crypt \ + ${PN}-extra-utils \ + ${PN}-gui \ + ${PN}-initramfs \ + ${PN}-journal-gatewayd \ + ${PN}-journal-upload \ + ${PN}-journal-remote \ + ${PN}-kernel-install \ + ${PN}-mime \ + ${PN}-rpm-macros \ + ${PN}-udev-rules \ + ${PN}-vconsole-setup \ + ${PN}-zsh-completion \ + libsystemd-shared \ + udev \ + udev-bash-completion \ + udev-hwdb \ +" + +SUMMARY:${PN}-container = "Tools for containers and VMs" +DESCRIPTION:${PN}-container = "Systemd tools to spawn and manage containers and virtual machines." + +SUMMARY:${PN}-journal-gatewayd = "HTTP server for journal events" +DESCRIPTION:${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." + +SUMMARY:${PN}-journal-upload = "Send journal messages over the network" +DESCRIPTION:${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL." + +SUMMARY:${PN}-journal-remote = "Receive journal messages over the network" +DESCRIPTION:${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files." + +SUMMARY:libsystemd-shared = "Systemd shared library" + +SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ +" +SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service" + +USERADD_PACKAGES = "${PN} \ + udev \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ +" +GROUPADD_PARAM:${PN} = "-r systemd-journal;" +GROUPADD_PARAM:udev = "-r render" +GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${datadir}/polkit-1 polkitd;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'oomd', '--system -d / -M --shell /sbin/nologin systemd-oom;', '', d)}" +USERADD_PARAM:${PN}-journal-gatewayd = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway" +USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote" +USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload" + +FILES:${PN}-analyze = "${bindir}/systemd-analyze" + +FILES:${PN}-crypt = "${bindir}/systemd-cryptenroll \ + ${libdir}/cryptsetup \ + " +RRECOMMENDS:${PN} += "${PN}-crypt" + +FILES:${PN}-initramfs = "/init" +RDEPENDS:${PN}-initramfs = "${PN}" + +FILES:${PN}-gui = "${bindir}/systemadm" + +FILES:${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ + ${systemd_system_unitdir}/systemd-vconsole-setup.service \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-vconsole-setup.service" + +RDEPENDS:${PN}-kernel-install += "bash" +FILES:${PN}-kernel-install = "${bindir}/kernel-install \ + ${sysconfdir}/kernel/ \ + ${exec_prefix}/lib/kernel \ + " +FILES:${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ + " + +FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions" + +FILES:${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ + ${exec_prefix}/lib/binfmt.d \ + ${rootlibexecdir}/systemd/systemd-binfmt \ + ${systemd_system_unitdir}/proc-sys-fs-binfmt_misc.* \ + ${systemd_system_unitdir}/systemd-binfmt.service" +RRECOMMENDS:${PN}-binfmt = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', 'kernel-module-binfmt-misc', '', d)}" + +RDEPENDS:${PN}-vconsole-setup = "${@bb.utils.contains('PACKAGECONFIG', 'vconsole', 'kbd kbd-consolefonts kbd-keymaps', '', d)}" + + +FILES:${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \ + ${systemd_system_unitdir}/systemd-journal-gatewayd.service \ + ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \ + ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \ + ${datadir}/systemd/gatewayd/browse.html \ + " +SYSTEMD_SERVICE:${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket" + +FILES:${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \ + ${systemd_system_unitdir}/systemd-journal-upload.service \ + ${sysconfdir}/systemd/journal-upload.conf \ + " +SYSTEMD_SERVICE:${PN}-journal-upload = "systemd-journal-upload.service" + +FILES:${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ + ${sysconfdir}/systemd/journal-remote.conf \ + ${systemd_system_unitdir}/systemd-journal-remote.service \ + ${systemd_system_unitdir}/systemd-journal-remote.socket \ + " +SYSTEMD_SERVICE:${PN}-journal-remote = "systemd-journal-remote.socket" + + +FILES:${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \ + ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \ + ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \ + ${base_bindir}/machinectl \ + ${bindir}/systemd-nspawn \ + ${nonarch_libdir}/systemd/import-pubring.gpg \ + ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \ + ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \ + ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \ + ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \ + ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \ + ${systemd_system_unitdir}/machine.slice \ + ${systemd_system_unitdir}/machines.target \ + ${systemd_system_unitdir}/org.freedesktop.import1.busname \ + ${systemd_system_unitdir}/org.freedesktop.machine1.busname \ + ${systemd_system_unitdir}/systemd-importd.service \ + ${systemd_system_unitdir}/systemd-machined.service \ + ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \ + ${systemd_system_unitdir}/var-lib-machines.mount \ + ${rootlibexecdir}/systemd/systemd-import \ + ${rootlibexecdir}/systemd/systemd-importd \ + ${rootlibexecdir}/systemd/systemd-machined \ + ${rootlibexecdir}/systemd/systemd-pull \ + ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \ + ${exec_prefix}/lib/tmpfiles.d/README \ + ${systemd_system_unitdir}/systemd-nspawn@.service \ + ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \ + ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \ + ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \ + ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \ + ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \ + " + +RDEPENDS:${PN}-container = "${@bb.utils.contains('PACKAGECONFIG', 'nss-mymachines', 'libnss-mymachines', '', d)}" + +# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox. +RRECOMMENDS:${PN}-container += "\ + ${PN}-journal-gatewayd \ + ${PN}-journal-remote \ + ${PN}-journal-upload \ + kernel-module-dm-mod \ + kernel-module-loop \ + kernel-module-tun \ + tar \ + " + +FILES:${PN}-extra-utils = "\ + ${base_bindir}/systemd-escape \ + ${base_bindir}/systemd-inhibit \ + ${bindir}/systemd-detect-virt \ + ${bindir}/systemd-dissect \ + ${bindir}/systemd-path \ + ${bindir}/systemd-run \ + ${bindir}/systemd-cat \ + ${bindir}/systemd-creds \ + ${bindir}/systemd-delta \ + ${bindir}/systemd-cgls \ + ${bindir}/systemd-cgtop \ + ${bindir}/systemd-stdio-bridge \ + ${base_bindir}/systemd-ask-password \ + ${base_bindir}/systemd-tty-ask-password-agent \ + ${base_sbindir}/mount.ddi \ + ${systemd_system_unitdir}/initrd.target.wants/systemd-pcrphase-initrd.path \ + ${systemd_system_unitdir}/systemd-ask-password-console.path \ + ${systemd_system_unitdir}/systemd-ask-password-console.service \ + ${systemd_system_unitdir}/systemd-ask-password-wall.path \ + ${systemd_system_unitdir}/systemd-ask-password-wall.service \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-console.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-wall.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase-sysinit.path \ + ${systemd_system_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path \ + ${rootlibexecdir}/systemd/systemd-resolve-host \ + ${rootlibexecdir}/systemd/systemd-ac-power \ + ${rootlibexecdir}/systemd/systemd-activate \ + ${rootlibexecdir}/systemd/systemd-measure \ + ${rootlibexecdir}/systemd/systemd-pcrphase \ + ${rootlibexecdir}/systemd/systemd-socket-proxyd \ + ${rootlibexecdir}/systemd/systemd-reply-password \ + ${rootlibexecdir}/systemd/systemd-sleep \ + ${rootlibexecdir}/systemd/system-sleep \ + ${systemd_system_unitdir}/systemd-hibernate.service \ + ${systemd_system_unitdir}/systemd-hybrid-sleep.service \ + ${systemd_system_unitdir}/systemd-pcrphase-initrd.service \ + ${systemd_system_unitdir}/systemd-pcrphase.service \ + ${systemd_system_unitdir}/systemd-pcrphase-sysinit.service \ + ${systemd_system_unitdir}/systemd-suspend.service \ + ${systemd_system_unitdir}/sleep.target \ + ${rootlibexecdir}/systemd/systemd-initctl \ + ${systemd_system_unitdir}/systemd-initctl.service \ + ${systemd_system_unitdir}/systemd-initctl.socket \ + ${systemd_system_unitdir}/sockets.target.wants/systemd-initctl.socket \ + ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \ + ${rootlibexecdir}/systemd/systemd-cgroups-agent \ +" + +FILES:${PN}-mime = "${MIMEDIR}" +RRECOMMENDS:${PN} += "${PN}-mime" + +FILES:${PN}-udev-rules = "\ + ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \ + ${rootlibexecdir}/udev/rules.d/71-seat.rules \ + ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \ + ${rootlibexecdir}/udev/rules.d/99-systemd.rules \ +" + +CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \ + ${sysconfdir}/systemd/journald.conf \ + ${sysconfdir}/systemd/logind.conf \ + ${sysconfdir}/systemd/networkd.conf \ + ${sysconfdir}/systemd/pstore.conf \ + ${sysconfdir}/systemd/resolved.conf \ + ${sysconfdir}/systemd/sleep.conf \ + ${sysconfdir}/systemd/system.conf \ + ${sysconfdir}/systemd/timesyncd.conf \ + ${sysconfdir}/systemd/user.conf \ +" + +FILES:${PN} = " ${base_bindir}/* \ + ${base_sbindir}/shutdown \ + ${base_sbindir}/halt \ + ${base_sbindir}/poweroff \ + ${base_sbindir}/runlevel \ + ${base_sbindir}/telinit \ + ${base_sbindir}/resolvconf \ + ${base_sbindir}/reboot \ + ${base_sbindir}/init \ + ${datadir}/dbus-1/services \ + ${datadir}/dbus-1/system-services \ + ${datadir}/polkit-1 \ + ${datadir}/${BPN} \ + ${datadir}/factory \ + ${sysconfdir}/credstore/ \ + ${sysconfdir}/credstore.encrypted/ \ + ${sysconfdir}/dbus-1/ \ + ${sysconfdir}/modules-load.d/ \ + ${sysconfdir}/pam.d/ \ + ${sysconfdir}/profile.d/ \ + ${sysconfdir}/sysctl.d/ \ + ${sysconfdir}/systemd/ \ + ${sysconfdir}/tmpfiles.d/ \ + ${sysconfdir}/xdg/ \ + ${sysconfdir}/init.d/README \ + ${sysconfdir}/resolv-conf.systemd \ + ${sysconfdir}/X11/xinit/xinitrc.d/* \ + ${sysconfdir}/ssh/ssh_config.d/20-systemd-ssh-proxy.conf \ + ${sysconfdir}/ssh/sshd_config.d/20-systemd-userdb.conf \ + ${rootlibexecdir}/systemd/* \ + ${rootlibdir}/systemd/libsystemd-core* \ + ${libdir}/pam.d \ + ${nonarch_libdir}/pam.d \ + ${systemd_unitdir}/* \ + ${base_libdir}/security/*.so \ + /cgroup \ + ${bindir}/systemd* \ + ${bindir}/busctl \ + ${bindir}/coredumpctl \ + ${bindir}/localectl \ + ${bindir}/hostnamectl \ + ${bindir}/resolvectl \ + ${bindir}/timedatectl \ + ${bindir}/bootctl \ + ${bindir}/oomctl \ + ${bindir}/userdbctl \ + ${exec_prefix}/lib/credstore \ + ${exec_prefix}/lib/tmpfiles.d/*.conf \ + ${exec_prefix}/lib/systemd \ + ${exec_prefix}/lib/modules-load.d \ + ${exec_prefix}/lib/sysctl.d \ + ${exec_prefix}/lib/sysusers.d \ + ${exec_prefix}/lib/environment.d \ + ${exec_prefix}/lib/pcrlock.d \ + ${localstatedir} \ + ${rootlibexecdir}/modprobe.d/systemd.conf \ + ${rootlibexecdir}/modprobe.d/README \ + ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '${datadir}/dbus-1/system.d/org.freedesktop.hostname1_no_polkit.conf', '', d)} \ + ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.home1.conf \ + " + +FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" + +RDEPENDS:${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck util-linux-swaponoff" +RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" +RDEPENDS:${PN} += "volatile-binds" + +RRECOMMENDS:${PN} += "${PN}-extra-utils \ + udev-hwdb \ + e2fsprogs-e2fsck \ + kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \ + os-release \ + systemd-conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'logind', 'pam-plugin-umask', '', d)} \ +" + +INSANE_SKIP:${PN} += "dev-so libdir" +INSANE_SKIP:${PN}-dbg += "libdir" +INSANE_SKIP:${PN}-doc += " libdir" +INSANE_SKIP:libsystemd-shared += "libdir" + +FILES:libsystemd-shared = "${rootlibdir}/systemd/libsystemd-shared*.so" + +RPROVIDES:udev = "hotplug" +# This can be removed when we parse .note.dlopen in the ELF +RDEPENDS:udev += "libkmod" + +RDEPENDS:udev-bash-completion += "bash-completion" +RDEPENDS:udev-hwdb += "udev" + +FILES:udev += "${base_sbindir}/udevd \ + ${rootlibexecdir}/systemd/network/99-default.link \ + ${rootlibexecdir}/systemd/systemd-udevd \ + ${rootlibexecdir}/udev/accelerometer \ + ${rootlibexecdir}/udev/ata_id \ + ${rootlibexecdir}/udev/cdrom_id \ + ${rootlibexecdir}/udev/collect \ + ${rootlibexecdir}/udev/dmi_memory_id \ + ${rootlibexecdir}/udev/fido_id \ + ${rootlibexecdir}/udev/findkeyboards \ + ${rootlibexecdir}/udev/iocost \ + ${rootlibexecdir}/udev/keyboard-force-release.sh \ + ${rootlibexecdir}/udev/keymap \ + ${rootlibexecdir}/udev/mtd_probe \ + ${rootlibexecdir}/udev/scsi_id \ + ${rootlibexecdir}/udev/v4l_id \ + ${rootlibexecdir}/udev/keymaps \ + ${rootlibexecdir}/udev/rules.d/50-udev-default.rules \ + ${rootlibexecdir}/udev/rules.d/60-autosuspend.rules \ + ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \ + ${rootlibexecdir}/udev/rules.d/60-block.rules \ + ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \ + ${rootlibexecdir}/udev/rules.d/60-dmi-id.rules \ + ${rootlibexecdir}/udev/rules.d/60-drm.rules \ + ${rootlibexecdir}/udev/rules.d/60-evdev.rules \ + ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \ + ${rootlibexecdir}/udev/rules.d/60-infiniband.rules \ + ${rootlibexecdir}/udev/rules.d/60-input-id.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \ + ${rootlibexecdir}/udev/rules.d/60-sensor.rules \ + ${rootlibexecdir}/udev/rules.d/60-serial.rules \ + ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \ + ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \ + ${rootlibexecdir}/udev/rules.d/70-camera.rules \ + ${rootlibexecdir}/udev/rules.d/70-joystick.rules \ + ${rootlibexecdir}/udev/rules.d/70-memory.rules \ + ${rootlibexecdir}/udev/rules.d/70-mouse.rules \ + ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \ + ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \ + ${rootlibexecdir}/udev/rules.d/75-net-description.rules \ + ${rootlibexecdir}/udev/rules.d/75-probe_mtd.rules \ + ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \ + ${rootlibexecdir}/udev/rules.d/80-drivers.rules \ + ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \ + ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \ + ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \ + ${rootlibexecdir}/udev/rules.d/90-iocost.rules \ + ${rootlibexecdir}/udev/rules.d/README \ + ${sysconfdir}/udev \ + ${sysconfdir}/init.d/systemd-udevd \ + ${systemd_system_unitdir}/*udev* \ + ${systemd_system_unitdir}/*.wants/*udev* \ + ${base_bindir}/systemd-hwdb \ + ${base_bindir}/udevadm \ + ${base_sbindir}/udevadm \ + ${systemd_system_unitdir}/systemd-hwdb-update.service \ + " + +FILES:udev-bash-completion = "${datadir}/bash-completion/completions/udevadm" +FILES:udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \ + " + +RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}" + +INITSCRIPT_PACKAGES = "udev" +INITSCRIPT_NAME:udev = "systemd-udevd" +INITSCRIPT_PARAMS:udev = "start 03 S ." + +python __anonymous() { + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") + + if bb.utils.contains('DISTRO_FEATURES', 'systemd-resolved', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'nss-resolve resolved', True, False, d): + bb.error("DISTRO_FEATURES[systemd-resolved] requires PACKAGECONFIG[nss-resolve, resolved]") + + if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d): + bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]") + + if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d): + bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]") +} + +python do_warn_musl() { + if d.getVar('TCLIBC') == "musl": + bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.") +} +addtask warn_musl before do_configure + +ALTERNATIVE:${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}" + +ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd" +ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf" +ALTERNATIVE_PRIORITY[resolv-conf] ?= "50" + +ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt" +ALTERNATIVE_PRIORITY[halt] ?= "300" + +ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot" +ALTERNATIVE_PRIORITY[reboot] ?= "300" + +ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown" +ALTERNATIVE_PRIORITY[shutdown] ?= "300" + +ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff" +ALTERNATIVE_PRIORITY[poweroff] ?= "300" + +ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel" +ALTERNATIVE_PRIORITY[runlevel] ?= "300" + +pkg_postinst:${PN}:libc-glibc () { + if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then + sed -e '/^hosts:/s/\s*\<myhostname\>//' \ + -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \ + -i $D${sysconfdir}/nsswitch.conf + fi + if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then + sed -e 's#\(^passwd:.*\)#\1 systemd#' \ + -e 's#\(^group:.*\)#\1 systemd#' \ + -e 's#\(^shadow:.*\)#\1 systemd#' \ + -i $D${sysconfdir}/nsswitch.conf + fi +} + +pkg_prerm:${PN}:libc-glibc () { + if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then + sed -e '/^hosts:/s/\s*\<myhostname\>//' \ + -e '/^hosts:/s/\s*myhostname//' \ + -i $D${sysconfdir}/nsswitch.conf + fi + if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then + sed -e '/^passwd:/s#\s*systemd##' \ + -e '/^group:/s#\s*systemd##' \ + -e '/^shadow:/s#\s*systemd##' \ + -i $D${sysconfdir}/nsswitch.conf + fi +} + +PACKAGE_WRITE_DEPS += "qemu-native" +pkg_postinst:udev-hwdb () { + if test -n "$D"; then + $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" base_bindir="${base_bindir}" + else + systemd-hwdb update + fi +} + +pkg_prerm:udev-hwdb () { + rm -f $D${sysconfdir}/udev/hwdb.bin +} |