diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-02-26 06:55:05 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-03-15 17:22:49 +0300 |
commit | d7bf8c17eca8f8c89898a7794462c773c449e983 (patch) | |
tree | d18618fca85ca5f0c077032cc7b009344b60f663 /import-layers/yocto-poky/meta/recipes-core/systemd | |
parent | e2b5abdc9f28cdf8578e5b9be803c8e697443c20 (diff) | |
download | openbmc-d7bf8c17eca8f8c89898a7794462c773c449e983.tar.xz |
Yocto 2.4
Move OpenBMC to Yocto 2.4(rocko)
Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I12057b18610d6fb0e6903c60213690301e9b0c67
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-core/systemd')
39 files changed, 1934 insertions, 900 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-boot_234.bb b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-boot_234.bb new file mode 100644 index 0000000000..7b18b25e35 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-boot_234.bb @@ -0,0 +1,43 @@ +require systemd.inc +FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" + +DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native" + +SRC_URI += "file://0007-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch" + +inherit autotools pkgconfig gettext +inherit deploy + +EFI_CC ?= "${CC}" +# Man pages are packaged through the main systemd recipe +EXTRA_OECONF = " --enable-gnuefi \ + --with-efi-includedir=${STAGING_INCDIR} \ + --with-efi-ldsdir=${STAGING_LIBDIR} \ + --with-efi-libdir=${STAGING_LIBDIR} \ + --disable-manpages \ + EFI_CC='${EFI_CC}' \ + " + +# Imported from the old gummiboot recipe +TUNE_CCARGS_remove = "-mfpmath=sse" +COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux" +COMPATIBLE_HOST_linux-gnux32 = "null" + +do_compile() { + SYSTEMD_BOOT_EFI_ARCH="ia32" + if [ "${TARGET_ARCH}" = "x86_64" ]; then + SYSTEMD_BOOT_EFI_ARCH="x64" + fi + + oe_runmake systemd-boot${SYSTEMD_BOOT_EFI_ARCH}.efi +} + +do_install() { + # Bypass systemd installation with a NOP + : +} + +do_deploy () { + install ${B}/systemd-boot*.efi ${DEPLOYDIR} +} +addtask deploy before do_build after do_compile diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-compat-units.bb b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-compat-units.bb index fe9a521d7f..d228a51c19 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-compat-units.bb +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-compat-units.bb @@ -1,5 +1,5 @@ SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts" - +HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd" LICENSE = "MIT" PR = "r29" diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-machine-units_1.0.bb b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-machine-units_1.0.bb new file mode 100644 index 0000000000..02756f43d7 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-machine-units_1.0.bb @@ -0,0 +1,13 @@ +SUMMARY = "Machine specific systemd units" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +PR = "r19" + +inherit systemd +SYSTEMD_SERVICE_${PN} = "" + +ALLOW_EMPTY_${PN} = "1" diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-serialgetty.bb b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-serialgetty.bb index 768b1308f2..d9347163b5 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-serialgetty.bb +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -1,4 +1,5 @@ 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" @@ -38,8 +39,6 @@ do_install() { fi } -RDEPENDS_${PN} = "systemd" - # This is a machine specific file FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}" PACKAGE_ARCH = "${MACHINE_ARCH}" @@ -49,3 +48,5 @@ python () { if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") } + +ALLOW_EMPTY_${PN} = "1" diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-systemctl/systemctl b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-systemctl/systemctl index efad14ce17..6e5a1b7181 100755 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -108,7 +108,7 @@ for service in $services; do # If any new unit types are added to systemd they should be added # to this regular expression. - unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|path\|timer\|snapshot\)\s*$' + unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|target\.wants\|path\|timer\|snapshot\)\s*$' if [ "$action" = "preset" ]; then action=`egrep -sh $service $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '` if [ -z "$action" ]; then diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd.inc b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd.inc index 29e0be6ae5..d99d1506d7 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd.inc +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd.inc @@ -14,10 +14,8 @@ LICENSE = "GPLv2 & LGPLv2.1" LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" -SRCREV = "a1e2ef7ec912902d8142e7cb5830cbfb47dba86c" +SRCREV = "c1edab7ad1e7ccc9be693bedfd464cd1cbffb395" SRC_URI = "git://github.com/systemd/systemd.git;protocol=git" S = "${WORKDIR}/git" - -LDFLAGS_append_libc-uclibc = " -lrt -lssp_nonshared -lssp " diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch new file mode 100644 index 0000000000..35599d44c2 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch @@ -0,0 +1,43 @@ +From 3ca5326485cb19e775af6de615c17be66e44e472 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 24 Oct 2017 23:08:24 -0700 +Subject: [PATCH] Define _PATH_WTMPX and _PATH_UTMPX if not defined + +Musl needs these defines + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + src/shared/utmp-wtmp.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c +index 9750dcd81..bd55d74a1 100644 +--- a/src/shared/utmp-wtmp.c ++++ b/src/shared/utmp-wtmp.c +@@ -27,6 +27,7 @@ + #include <sys/time.h> + #include <sys/utsname.h> + #include <unistd.h> ++#include <utmp.h> + #include <utmpx.h> + + #include "alloc-util.h" +@@ -41,6 +42,13 @@ + #include "util.h" + #include "utmp-wtmp.h" + ++#if defined _PATH_UTMP && !defined _PATH_UTMPX ++# define _PATH_UTMPX _PATH_UTMP ++#endif ++#if defined _PATH_WTMP && !defined _PATH_WTMPX ++# define _PATH_WTMPX _PATH_WTMP ++#endif ++ + int utmp_get_runlevel(int *runlevel, int *previous) { + struct utmpx *found, lookup = { .ut_type = RUN_LVL }; + int r; +-- +2.14.3 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch new file mode 100644 index 0000000000..779dc78fd3 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch @@ -0,0 +1,89 @@ +From b2d4171c6e521cf1e70331fb769234d63a4a6d44 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 27 Oct 2017 13:00:41 -0700 +Subject: [PATCH] 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 +uintmax_t. + +Fixes portablility errors like + +execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=] +| fprintf(f, "%s%s: " RLIM_FMT "\n", +| ^~~~~~~~ +| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); +| ~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/7199] + + src/basic/format-util.h | 8 -------- + src/basic/rlimit-util.c | 8 ++++---- + src/core/execute.c | 8 ++++---- + 3 files changed, 8 insertions(+), 16 deletions(-) + +diff --git a/src/basic/format-util.h b/src/basic/format-util.h +index ae42a8f89..144249cd6 100644 +--- a/src/basic/format-util.h ++++ b/src/basic/format-util.h +@@ -60,14 +60,6 @@ + # define PRI_TIMEX "li" + #endif + +-#if SIZEOF_RLIM_T == 8 +-# define RLIM_FMT "%" PRIu64 +-#elif SIZEOF_RLIM_T == 4 +-# define RLIM_FMT "%" PRIu32 +-#else +-# error Unknown rlim_t size +-#endif +- + #if SIZEOF_DEV_T == 8 + # define DEV_FMT "%" PRIu64 + #elif SIZEOF_DEV_T == 4 +diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c +index ca834df62..41fcebb74 100644 +--- a/src/basic/rlimit-util.c ++++ b/src/basic/rlimit-util.c +@@ -284,13 +284,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { + if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) + s = strdup("infinity"); + else if (rl->rlim_cur >= RLIM_INFINITY) +- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); ++ (void) asprintf(&s, "infinity:%ju", (uintmax_t)rl->rlim_max); + else if (rl->rlim_max >= RLIM_INFINITY) +- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); ++ (void) asprintf(&s, "%ju: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, "%ju", (uintmax_t)rl->rlim_cur); + else +- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); ++ (void) asprintf(&s, "%ju:%ju", (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); + + if (!s) + return -ENOMEM; +diff --git a/src/core/execute.c b/src/core/execute.c +index d72e5bf08..d38946002 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -3443,10 +3443,10 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { + + for (i = 0; i < RLIM_NLIMITS; i++) + if (c->rlimit[i]) { +- fprintf(f, "%s%s: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); +- fprintf(f, "%s%sSoft: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur); ++ fprintf(f, "%s%s: %ju\n", ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max); ++ fprintf(f, "%s%sSoft: %ju\n", ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur); + } + + if (c->ioprio_set) { +-- +2.14.3 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-add-fallback-parse_printf_format-implementation.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-add-fallback-parse_printf_format-implementation.patch new file mode 100644 index 0000000000..e2f7458abe --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-add-fallback-parse_printf_format-implementation.patch @@ -0,0 +1,433 @@ +From 0933ca6251808f856b92b0ce8da8696d5febc333 Mon Sep 17 00:00:00 2001 +From: Emil Renner Berthing <systemd@esmil.dk> +Date: Mon, 23 Oct 2017 10:41:39 -0700 +Subject: [PATCH 01/12] add fallback parse_printf_format implementation + +Signed-off-by: Emil Renner Berthing <systemd@esmil.dk> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + Makefile.am | 4 + + configure.ac | 2 + + 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 +- + 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/Makefile.am b/Makefile.am +index 692d7bb95..3cc8f3451 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -997,6 +997,10 @@ libbasic_la_SOURCES = \ + src/basic/journal-importer.h \ + src/basic/journal-importer.c + ++if !HAVE_PRINTF_H ++libbasic_la_SOURCES += src/basic/parse-printf-format.c ++endif ++ + nodist_libbasic_la_SOURCES = \ + src/basic/errno-from-name.h \ + src/basic/errno-to-name.h \ +diff --git a/configure.ac b/configure.ac +index 60e7df5ee..efcdc6c16 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -308,8 +308,10 @@ AC_CHECK_HEADERS([uchar.h], [], []) + AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])]) + AC_CHECK_HEADERS([linux/btrfs.h], [], []) + AC_CHECK_HEADERS([linux/memfd.h], [], []) ++AC_CHECK_HEADERS([printf.h], [], []) + AC_CHECK_HEADERS([linux/vm_sockets.h], [], [], [#include <sys/socket.h>]) + ++AM_CONDITIONAL(HAVE_PRINTF_H, [test "x$ac_cv_header_printf_h" = xyes]) + # unconditionally pull-in librt with old glibc versions + AC_SEARCH_LIBS([clock_gettime], [rt], [], []) + +diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c +new file mode 100644 +index 000000000..49437e544 +--- /dev/null ++++ b/src/basic/parse-printf-format.c +@@ -0,0 +1,273 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk> ++ ++ With parts from the musl C library ++ Copyright 2005-2014 Rich Felker, et al. ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see <http://www.gnu.org/licenses/>. ++***/ ++ ++#include <stddef.h> ++#include <string.h> ++ ++#include "parse-printf-format.h" ++ ++static const char *consume_nonarg(const char *fmt) ++{ ++ do { ++ if (*fmt == '\0') ++ return fmt; ++ } while (*fmt++ != '%'); ++ return fmt; ++} ++ ++static const char *consume_num(const char *fmt) ++{ ++ for (;*fmt >= '0' && *fmt <= '9'; fmt++) ++ /* do nothing */; ++ return fmt; ++} ++ ++static const char *consume_argn(const char *fmt, size_t *arg) ++{ ++ const char *p = fmt; ++ size_t val = 0; ++ ++ if (*p < '1' || *p > '9') ++ return fmt; ++ do { ++ val = 10*val + (*p++ - '0'); ++ } while (*p >= '0' && *p <= '9'); ++ ++ if (*p != '$') ++ return fmt; ++ *arg = val; ++ return p+1; ++} ++ ++static const char *consume_flags(const char *fmt) ++{ ++ while (1) { ++ switch (*fmt) { ++ case '#': ++ case '0': ++ case '-': ++ case ' ': ++ case '+': ++ case '\'': ++ case 'I': ++ fmt++; ++ continue; ++ } ++ return fmt; ++ } ++} ++ ++enum state { ++ BARE, ++ LPRE, ++ LLPRE, ++ HPRE, ++ HHPRE, ++ BIGLPRE, ++ ZTPRE, ++ JPRE, ++ STOP ++}; ++ ++enum type { ++ NONE, ++ PTR, ++ INT, ++ UINT, ++ ULLONG, ++ LONG, ++ ULONG, ++ SHORT, ++ USHORT, ++ CHAR, ++ UCHAR, ++ LLONG, ++ SIZET, ++ IMAX, ++ UMAX, ++ PDIFF, ++ UIPTR, ++ DBL, ++ LDBL, ++ MAXTYPE ++}; ++ ++static const short pa_types[MAXTYPE] = { ++ [NONE] = PA_INT, ++ [PTR] = PA_POINTER, ++ [INT] = PA_INT, ++ [UINT] = PA_INT, ++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG, ++ [LONG] = PA_INT | PA_FLAG_LONG, ++ [ULONG] = PA_INT | PA_FLAG_LONG, ++ [SHORT] = PA_INT | PA_FLAG_SHORT, ++ [USHORT] = PA_INT | PA_FLAG_SHORT, ++ [CHAR] = PA_CHAR, ++ [UCHAR] = PA_CHAR, ++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG, ++ [SIZET] = PA_INT | PA_FLAG_LONG, ++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG, ++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG, ++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG, ++ [UIPTR] = PA_INT | PA_FLAG_LONG, ++ [DBL] = PA_DOUBLE, ++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE ++}; ++ ++#define S(x) [(x)-'A'] ++#define E(x) (STOP + (x)) ++ ++static const unsigned char states[]['z'-'A'+1] = { ++ { /* 0: bare types */ ++ S('d') = E(INT), S('i') = E(INT), ++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT), ++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), ++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), ++ S('c') = E(CHAR),S('C') = E(INT), ++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR), ++ S('m') = E(NONE), ++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE, ++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE ++ }, { /* 1: l-prefixed */ ++ S('d') = E(LONG), S('i') = E(LONG), ++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG), ++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), ++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), ++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR), ++ S('l') = LLPRE ++ }, { /* 2: ll-prefixed */ ++ S('d') = E(LLONG), S('i') = E(LLONG), ++ S('o') = E(ULLONG),S('u') = E(ULLONG), ++ S('x') = E(ULLONG),S('X') = E(ULLONG), ++ S('n') = E(PTR) ++ }, { /* 3: h-prefixed */ ++ S('d') = E(SHORT), S('i') = E(SHORT), ++ S('o') = E(USHORT),S('u') = E(USHORT), ++ S('x') = E(USHORT),S('X') = E(USHORT), ++ S('n') = E(PTR), ++ S('h') = HHPRE ++ }, { /* 4: hh-prefixed */ ++ S('d') = E(CHAR), S('i') = E(CHAR), ++ S('o') = E(UCHAR),S('u') = E(UCHAR), ++ S('x') = E(UCHAR),S('X') = E(UCHAR), ++ S('n') = E(PTR) ++ }, { /* 5: L-prefixed */ ++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL), ++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL), ++ S('n') = E(PTR) ++ }, { /* 6: z- or t-prefixed (assumed to be same size) */ ++ S('d') = E(PDIFF),S('i') = E(PDIFF), ++ S('o') = E(SIZET),S('u') = E(SIZET), ++ S('x') = E(SIZET),S('X') = E(SIZET), ++ S('n') = E(PTR) ++ }, { /* 7: j-prefixed */ ++ S('d') = E(IMAX), S('i') = E(IMAX), ++ S('o') = E(UMAX), S('u') = E(UMAX), ++ S('x') = E(UMAX), S('X') = E(UMAX), ++ S('n') = E(PTR) ++ } ++}; ++ ++size_t parse_printf_format(const char *fmt, size_t n, int *types) ++{ ++ size_t i = 0; ++ size_t last = 0; ++ ++ memset(types, 0, n); ++ ++ while (1) { ++ size_t arg; ++ unsigned int state; ++ ++ fmt = consume_nonarg(fmt); ++ if (*fmt == '\0') ++ break; ++ if (*fmt == '%') { ++ fmt++; ++ continue; ++ } ++ arg = 0; ++ fmt = consume_argn(fmt, &arg); ++ /* flags */ ++ fmt = consume_flags(fmt); ++ /* width */ ++ if (*fmt == '*') { ++ size_t warg = 0; ++ fmt = consume_argn(fmt+1, &warg); ++ if (warg == 0) ++ warg = ++i; ++ if (warg > last) ++ last = warg; ++ if (warg <= n && types[warg-1] == NONE) ++ types[warg-1] = INT; ++ } else ++ fmt = consume_num(fmt); ++ /* precision */ ++ if (*fmt == '.') { ++ fmt++; ++ if (*fmt == '*') { ++ size_t parg = 0; ++ fmt = consume_argn(fmt+1, &parg); ++ if (parg == 0) ++ parg = ++i; ++ if (parg > last) ++ last = parg; ++ if (parg <= n && types[parg-1] == NONE) ++ types[parg-1] = INT; ++ } else { ++ if (*fmt == '-') ++ fmt++; ++ fmt = consume_num(fmt); ++ } ++ } ++ /* length modifier and conversion specifier */ ++ state = BARE; ++ do { ++ unsigned char c = *fmt++; ++ ++ if (c < 'A' || c > 'z') ++ continue; ++ state = states[state]S(c); ++ if (state == 0) ++ continue; ++ } while (state < STOP); ++ ++ if (state == E(NONE)) ++ continue; ++ ++ if (arg == 0) ++ arg = ++i; ++ if (arg > last) ++ last = arg; ++ if (arg <= n) ++ types[arg-1] = state - STOP; ++ } ++ ++ if (last > n) ++ last = n; ++ for (i = 0; i < last; i++) ++ types[i] = pa_types[types[i]]; ++ ++ return last; ++} +diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h +new file mode 100644 +index 000000000..4371177b0 +--- /dev/null ++++ b/src/basic/parse-printf-format.h +@@ -0,0 +1,57 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk> ++ ++ With parts from the GNU C Library ++ Copyright 1991-2014 Free Software Foundation, Inc. ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see <http://www.gnu.org/licenses/>. ++***/ ++ ++#pragma once ++ ++#include "config.h" ++ ++#ifdef HAVE_PRINTF_H ++#include <printf.h> ++#else ++ ++#include <stddef.h> ++ ++enum { /* C type: */ ++ PA_INT, /* int */ ++ PA_CHAR, /* int, cast to char */ ++ PA_WCHAR, /* wide char */ ++ PA_STRING, /* const char *, a '\0'-terminated string */ ++ PA_WSTRING, /* const wchar_t *, wide character string */ ++ PA_POINTER, /* void * */ ++ PA_FLOAT, /* float */ ++ PA_DOUBLE, /* double */ ++ PA_LAST ++}; ++ ++/* Flag bits that can be set in a type returned by `parse_printf_format'. */ ++#define PA_FLAG_MASK 0xff00 ++#define PA_FLAG_LONG_LONG (1 << 8) ++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG ++#define PA_FLAG_LONG (1 << 9) ++#define PA_FLAG_SHORT (1 << 10) ++#define PA_FLAG_PTR (1 << 11) ++ ++size_t parse_printf_format(const char *fmt, size_t n, int *types); ++ ++#endif /* HAVE_PRINTF_H */ +diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h +index bd1144b4c..c9c95eb54 100644 +--- a/src/basic/stdio-util.h ++++ b/src/basic/stdio-util.h +@@ -19,12 +19,12 @@ + along with systemd; If not, see <http://www.gnu.org/licenses/>. + ***/ + +-#include <printf.h> + #include <stdarg.h> + #include <stdio.h> + #include <sys/types.h> + + #include "macro.h" ++#include "parse-printf-format.h" + + #define xsprintf(buf, fmt, ...) \ + assert_message_se((size_t) snprintf(buf, ELEMENTSOF(buf), fmt, __VA_ARGS__) < ELEMENTSOF(buf), "xsprintf: " #buf "[] must be big enough") +diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c +index 440fba67c..0236c43c4 100644 +--- a/src/journal/journal-send.c ++++ b/src/journal/journal-send.c +@@ -19,7 +19,6 @@ + + #include <errno.h> + #include <fcntl.h> +-#include <printf.h> + #include <stddef.h> + #include <sys/socket.h> + #include <sys/un.h> +@@ -38,6 +37,7 @@ + #include "stdio-util.h" + #include "string-util.h" + #include "util.h" ++#include "parse-printf-format.h" + + #define SNDBUF_SIZE (8*1024*1024) + +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-device.c-Change-the-default-device-timeout-to-2.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-device.c-Change-the-default-device-timeout-to-2.patch index ee2cd6c453..7f1bc447fe 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-device.c-Change-the-default-device-timeout-to-2.patch +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-device.c-Change-the-default-device-timeout-to-2.patch @@ -1,7 +1,7 @@ -From a544d6d15f5c418084f322349aafe341128d5fca Mon Sep 17 00:00:00 2001 +From f1b5a6f717bda6f80a6b5e3e4d50b450f6cc7b09 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Mon, 14 Dec 2015 04:09:19 +0000 -Subject: [PATCH 01/19] core/device.c: Change the default device timeout to 240 +Subject: [PATCH 14/14] core/device.c: Change the default device timeout to 240 sec. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -11,23 +11,24 @@ Upstream-Status: Inappropriate [Specific case QEMU/AB] Signed-off-by: AnÃbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> + --- src/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/device.c b/src/core/device.c -index c572a67..f90774e 100644 +index 77601c552..98bf49ba2 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -112,7 +112,7 @@ static void device_init(Unit *u) { * indefinitely for plugged in devices, something which cannot * happen for the other units since their operations time out * anyway. */ -- u->job_timeout = u->manager->default_timeout_start_usec; -+ u->job_timeout = (240 * USEC_PER_SEC); +- u->job_running_timeout = u->manager->default_timeout_start_usec; ++ u->job_running_timeout = (240 * USEC_PER_SEC); u->ignore_on_isolate = true; } -- -2.10.2 +2.13.2 diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch new file mode 100644 index 0000000000..df100e587d --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch @@ -0,0 +1,69 @@ +From 28dd66ecfce743b1ea9046c7bb501e0fcaeff724 Mon Sep 17 00:00:00 2001 +From: Luca Bruno <luca.bruno@coreos.com> +Date: Sun, 6 Aug 2017 13:24:24 +0000 +Subject: [PATCH] core: evaluate presets after generators have run (#6526) + +This commit moves the first-boot system preset-settings evaluation out +of main and into the manager startup logic itself. Notably, it reverses +the order between generators and presets evaluation, so that any changes +performed by first-boot generators are taken into the account by presets +logic. + +After this change, units created by a generator can be enabled as part +of a preset. + +Upstream-Status: Backport + +Signed-off-by: Catalin Enache <catalin.enache@windriver.com> +--- + src/core/main.c | 12 ++---------- + src/core/manager.c | 8 ++++++++ + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/src/core/main.c b/src/core/main.c +index dfedc3d..11ac9cf 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1809,18 +1809,10 @@ int main(int argc, char *argv[]) { + if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) + log_warning_errno(errno, "Failed to make us a subreaper: %m"); + +- if (arg_system) { ++ if (arg_system) ++ /* Bump up RLIMIT_NOFILE for systemd itself */ + (void) bump_rlimit_nofile(&saved_rlimit_nofile); + +- if (empty_etc) { +- r = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_ENABLE_ONLY, NULL, 0); +- if (r < 0) +- log_full_errno(r == -EEXIST ? LOG_NOTICE : LOG_WARNING, r, "Failed to populate /etc with preset unit settings, ignoring: %m"); +- else +- log_info("Populated /etc with preset unit settings."); +- } +- } +- + r = manager_new(arg_system ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, arg_action == ACTION_TEST, &m); + if (r < 0) { + log_emergency_errno(r, "Failed to allocate manager object: %m"); +diff --git a/src/core/manager.c b/src/core/manager.c +index 1aadb70..fb5e2b5 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -1328,6 +1328,14 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) { + if (r < 0) + return r; + ++ if (m->first_boot && m->unit_file_scope == UNIT_FILE_SYSTEM) { ++ q = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_ENABLE_ONLY, NULL, 0); ++ if (q < 0) ++ log_full_errno(q == -EEXIST ? LOG_NOTICE : LOG_WARNING, q, "Failed to populate /etc with preset unit settings, ignoring: %m"); ++ else ++ log_info("Populated /etc with preset unit settings."); ++ } ++ + lookup_paths_reduce(&m->lookup_paths); + manager_build_unit_path_cache(m); + +-- +2.10.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-load-fragment-refuse-units-with-errors-in-certa.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-load-fragment-refuse-units-with-errors-in-certa.patch deleted file mode 100644 index 80948b2cee..0000000000 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-core-load-fragment-refuse-units-with-errors-in-certa.patch +++ /dev/null @@ -1,329 +0,0 @@ -If a user is created with a strictly-speaking invalid name such as '0day' and a -unit created to run as that user, systemd rejects the username and runs the unit -as root. - -CVE: CVE-2017-1000082 -Upstream-Status: Backport -Signed-off-by: Ross Burton <ross.burton@intel.com> - -From d8e1310e1ed7b6f122bc7eb8ba061fbd088783c0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> -Date: Thu, 6 Jul 2017 13:28:19 -0400 -Subject: [PATCH] core/load-fragment: refuse units with errors in certain - directives - -If an error is encountered in any of the Exec* lines, WorkingDirectory, -SELinuxContext, ApparmorProfile, SmackProcessLabel, Service (in .socket -units), User, or Group, refuse to load the unit. If the config stanza -has support, ignore the failure if '-' is present. - -For those configuration directives, even if we started the unit, it's -pretty likely that it'll do something unexpected (like write files -in a wrong place, or with a wrong context, or run with wrong permissions, -etc). It seems better to refuse to start the unit and have the admin -clean up the configuration without giving the service a chance to mess -up stuff. - -Note that all "security" options that restrict what the unit can do -(Capabilities, AmbientCapabilities, Restrict*, SystemCallFilter, Limit*, -PrivateDevices, Protect*, etc) are _not_ treated like this. Such options are -only supplementary, and are not always available depending on the architecture -and compilation options, so unit authors have to make sure that the service -runs correctly without them anyway. - -Fixes #6237, #6277. - -Signed-off-by: Ross Burton <ross.burton@intel.com> ---- - src/core/load-fragment.c | 104 ++++++++++++++++++++++++++++------------------ - src/test/test-unit-file.c | 14 +++---- - 2 files changed, 70 insertions(+), 48 deletions(-) - -diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c -index cbc826809..2047974f4 100644 ---- a/src/core/load-fragment.c -+++ b/src/core/load-fragment.c -@@ -630,20 +630,28 @@ int config_parse_exec( - - if (isempty(f)) { - /* First word is either "-" or "@" with no command. */ -- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty path in command line, ignoring: \"%s\"", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, 0, -+ "Empty path in command line%s: \"%s\"", -+ ignore ? ", ignoring" : "", rvalue); -+ return ignore ? 0 : -ENOEXEC; - } - if (!string_is_safe(f)) { -- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path contains special characters, ignoring: %s", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, 0, -+ "Executable path contains special characters%s: %s", -+ ignore ? ", ignoring" : "", rvalue); -+ return ignore ? 0 : -ENOEXEC; - } - if (!path_is_absolute(f)) { -- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path is not absolute, ignoring: %s", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, 0, -+ "Executable path is not absolute%s: %s", -+ ignore ? ", ignoring" : "", rvalue); -+ return ignore ? 0 : -ENOEXEC; - } - if (endswith(f, "/")) { -- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path specifies a directory, ignoring: %s", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, 0, -+ "Executable path specifies a directory%s: %s", -+ ignore ? ", ignoring" : "", rvalue); -+ return ignore ? 0 : -ENOEXEC; - } - - if (f == firstword) { -@@ -699,7 +707,7 @@ int config_parse_exec( - if (r == 0) - break; - else if (r < 0) -- return 0; -+ return ignore ? 0 : -ENOEXEC; - - if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) - return log_oom(); -@@ -709,8 +717,10 @@ int config_parse_exec( - } - - if (!n || !n[0]) { -- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty executable name or zeroeth argument, ignoring: %s", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, 0, -+ "Empty executable name or zeroeth argument%s: %s", -+ ignore ? ", ignoring" : "", rvalue); -+ return ignore ? 0 : -ENOEXEC; - } - - nce = new0(ExecCommand, 1); -@@ -1315,8 +1325,10 @@ int config_parse_exec_selinux_context( - - r = unit_name_printf(u, rvalue, &k); - if (r < 0) { -- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m"); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, r, -+ "Failed to resolve specifiers%s: %m", -+ ignore ? ", ignoring" : ""); -+ return ignore ? 0 : -ENOEXEC; - } - - free(c->selinux_context); -@@ -1363,8 +1375,10 @@ int config_parse_exec_apparmor_profile( - - r = unit_name_printf(u, rvalue, &k); - if (r < 0) { -- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m"); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, r, -+ "Failed to resolve specifiers%s: %m", -+ ignore ? ", ignoring" : ""); -+ return ignore ? 0 : -ENOEXEC; - } - - free(c->apparmor_profile); -@@ -1411,8 +1425,10 @@ int config_parse_exec_smack_process_label( - - r = unit_name_printf(u, rvalue, &k); - if (r < 0) { -- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m"); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, r, -+ "Failed to resolve specifiers%s: %m", -+ ignore ? ", ignoring" : ""); -+ return ignore ? 0 : -ENOEXEC; - } - - free(c->smack_process_label); -@@ -1630,19 +1646,19 @@ int config_parse_socket_service( - - r = unit_name_printf(UNIT(s), rvalue, &p); - if (r < 0) { -- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %s", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers: %s", rvalue); -+ return -ENOEXEC; - } - - if (!endswith(p, ".service")) { -- log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service, ignoring: %s", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service: %s", rvalue); -+ return -ENOEXEC; - } - - r = manager_load_unit(UNIT(s)->manager, p, NULL, &error, &x); - if (r < 0) { -- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s, ignoring: %s", rvalue, bus_error_message(&error, r)); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s: %s", rvalue, bus_error_message(&error, r)); -+ return -ENOEXEC; - } - - unit_ref_set(&s->service, x); -@@ -1893,13 +1909,13 @@ int config_parse_user_group( - - r = unit_full_printf(u, rvalue, &k); - if (r < 0) { -- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", rvalue); -+ return -ENOEXEC; - } - - if (!valid_user_group_name_or_id(k)) { -- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k); -+ return -ENOEXEC; - } - - n = k; -@@ -1957,19 +1973,19 @@ int config_parse_user_group_strv( - if (r == -ENOMEM) - return log_oom(); - if (r < 0) { -- log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue); -- break; -+ log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax: %s", rvalue); -+ return -ENOEXEC; - } - - r = unit_full_printf(u, word, &k); - if (r < 0) { -- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", word); -- continue; -+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", word); -+ return -ENOEXEC; - } - - if (!valid_user_group_name_or_id(k)) { -- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k); -- continue; -+ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k); -+ return -ENOEXEC; - } - - r = strv_push(users, k); -@@ -2128,25 +2144,28 @@ int config_parse_working_directory( - - r = unit_full_printf(u, rvalue, &k); - if (r < 0) { -- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in working directory path '%s', ignoring: %m", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, r, -+ "Failed to resolve unit specifiers in working directory path '%s'%s: %m", -+ rvalue, missing_ok ? ", ignoring" : ""); -+ return missing_ok ? 0 : -ENOEXEC; - } - - path_kill_slashes(k); - - if (!utf8_is_valid(k)) { - log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue); -- return 0; -+ return missing_ok ? 0 : -ENOEXEC; - } - - if (!path_is_absolute(k)) { -- log_syntax(unit, LOG_ERR, filename, line, 0, "Working directory path '%s' is not absolute, ignoring.", rvalue); -- return 0; -+ log_syntax(unit, LOG_ERR, filename, line, 0, -+ "Working directory path '%s' is not absolute%s.", -+ rvalue, missing_ok ? ", ignoring" : ""); -+ return missing_ok ? 0 : -ENOEXEC; - } - -- free_and_replace(c->working_directory, k); -- - c->working_directory_home = false; -+ free_and_replace(c->working_directory, k); - } - - c->working_directory_missing_ok = missing_ok; -@@ -4228,8 +4247,11 @@ int unit_load_fragment(Unit *u) { - return r; - - r = load_from_path(u, k); -- if (r < 0) -+ if (r < 0) { -+ if (r == -ENOEXEC) -+ log_unit_notice(u, "Unit configuration has fatal error, unit will not be started."); - return r; -+ } - - if (u->load_state == UNIT_STUB) { - SET_FOREACH(t, u->names, i) { -diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c -index 12f48bf43..fd797b587 100644 ---- a/src/test/test-unit-file.c -+++ b/src/test/test-unit-file.c -@@ -146,7 +146,7 @@ static void test_config_parse_exec(void) { - r = config_parse_exec(NULL, "fake", 4, "section", 1, - "LValue", 0, "/RValue/ argv0 r1", - &c, u); -- assert_se(r == 0); -+ assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); - - log_info("/* honour_argv0 */"); -@@ -161,7 +161,7 @@ static void test_config_parse_exec(void) { - r = config_parse_exec(NULL, "fake", 3, "section", 1, - "LValue", 0, "@/RValue", - &c, u); -- assert_se(r == 0); -+ assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); - - log_info("/* no command, whitespace only, reset */"); -@@ -220,7 +220,7 @@ static void test_config_parse_exec(void) { - "-@/RValue argv0 r1 ; ; " - "/goo/goo boo", - &c, u); -- assert_se(r >= 0); -+ assert_se(r == -ENOEXEC); - c1 = c1->command_next; - check_execcommand(c1, "/RValue", "argv0", "r1", NULL, true); - -@@ -374,7 +374,7 @@ static void test_config_parse_exec(void) { - r = config_parse_exec(NULL, "fake", 4, "section", 1, - "LValue", 0, path, - &c, u); -- assert_se(r == 0); -+ assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); - } - -@@ -401,21 +401,21 @@ static void test_config_parse_exec(void) { - r = config_parse_exec(NULL, "fake", 4, "section", 1, - "LValue", 0, "/path\\", - &c, u); -- assert_se(r == 0); -+ assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); - - log_info("/* missing ending ' */"); - r = config_parse_exec(NULL, "fake", 4, "section", 1, - "LValue", 0, "/path 'foo", - &c, u); -- assert_se(r == 0); -+ assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); - - log_info("/* missing ending ' with trailing backslash */"); - r = config_parse_exec(NULL, "fake", 4, "section", 1, - "LValue", 0, "/path 'foo\\", - &c, u); -- assert_se(r == 0); -+ assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); - - log_info("/* invalid space between modifiers */"); --- -2.11.0 diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-main-skip-many-initialization-steps-when-running-in-.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-main-skip-many-initialization-steps-when-running-in-.patch new file mode 100644 index 0000000000..a033b04b23 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0001-main-skip-many-initialization-steps-when-running-in-.patch @@ -0,0 +1,163 @@ +From dea374e898a749a0474b72b2015cca9009b1432b Mon Sep 17 00:00:00 2001 +From: Lennart Poettering <lennart@poettering.net> +Date: Wed, 13 Sep 2017 10:31:40 +0200 +Subject: [PATCH] main: skip many initialization steps when running in --test + mode + +Most importantly, don't collect open socket activation fds when in +--test mode. This specifically created a problem because we invoke +pager_open() beforehand (which these days makes copies of the original +stdout/stderr in order to be able to restore them when the pager goes +away) and we might mistakenly the fd copies it creates as socket +activation fds. + +Fixes: #6383 + +Upstream-Status: Backport + +Signed-off-by: Catalin Enache <catalin.enache@windriver.com> +--- + src/core/main.c | 108 +++++++++++++++++++++++++++++--------------------------- + 1 file changed, 56 insertions(+), 52 deletions(-) + +diff --git a/src/core/main.c b/src/core/main.c +index 11ac9cf..d1a53a5 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1679,20 +1679,22 @@ int main(int argc, char *argv[]) { + log_close(); + + /* Remember open file descriptors for later deserialization */ +- r = fdset_new_fill(&fds); +- if (r < 0) { +- log_emergency_errno(r, "Failed to allocate fd set: %m"); +- error_message = "Failed to allocate fd set"; +- goto finish; +- } else +- fdset_cloexec(fds, true); ++ if (arg_action == ACTION_RUN) { ++ r = fdset_new_fill(&fds); ++ if (r < 0) { ++ log_emergency_errno(r, "Failed to allocate fd set: %m"); ++ error_message = "Failed to allocate fd set"; ++ goto finish; ++ } else ++ fdset_cloexec(fds, true); + +- if (arg_serialization) +- assert_se(fdset_remove(fds, fileno(arg_serialization)) >= 0); ++ if (arg_serialization) ++ assert_se(fdset_remove(fds, fileno(arg_serialization)) >= 0); + +- if (arg_system) +- /* Become a session leader if we aren't one yet. */ +- setsid(); ++ if (arg_system) ++ /* Become a session leader if we aren't one yet. */ ++ setsid(); ++ } + + /* Move out of the way, so that we won't block unmounts */ + assert_se(chdir("/") == 0); +@@ -1762,56 +1764,58 @@ int main(int argc, char *argv[]) { + arg_action == ACTION_TEST ? " test" : "", getuid(), t); + } + +- if (arg_system && !skip_setup) { +- if (arg_show_status > 0) +- status_welcome(); ++ if (arg_action == ACTION_RUN) { ++ if (arg_system && !skip_setup) { ++ if (arg_show_status > 0) ++ status_welcome(); + +- hostname_setup(); +- machine_id_setup(NULL, arg_machine_id, NULL); +- loopback_setup(); +- bump_unix_max_dgram_qlen(); ++ hostname_setup(); ++ machine_id_setup(NULL, arg_machine_id, NULL); ++ loopback_setup(); ++ bump_unix_max_dgram_qlen(); + +- test_usr(); +- } ++ test_usr(); ++ } + +- if (arg_system && arg_runtime_watchdog > 0 && arg_runtime_watchdog != USEC_INFINITY) +- watchdog_set_timeout(&arg_runtime_watchdog); ++ if (arg_system && arg_runtime_watchdog > 0 && arg_runtime_watchdog != USEC_INFINITY) ++ watchdog_set_timeout(&arg_runtime_watchdog); + +- if (arg_timer_slack_nsec != NSEC_INFINITY) +- if (prctl(PR_SET_TIMERSLACK, arg_timer_slack_nsec) < 0) +- log_error_errno(errno, "Failed to adjust timer slack: %m"); ++ if (arg_timer_slack_nsec != NSEC_INFINITY) ++ if (prctl(PR_SET_TIMERSLACK, arg_timer_slack_nsec) < 0) ++ log_error_errno(errno, "Failed to adjust timer slack: %m"); + +- if (arg_system && !cap_test_all(arg_capability_bounding_set)) { +- r = capability_bounding_set_drop_usermode(arg_capability_bounding_set); +- if (r < 0) { +- log_emergency_errno(r, "Failed to drop capability bounding set of usermode helpers: %m"); +- error_message = "Failed to drop capability bounding set of usermode helpers"; +- goto finish; +- } +- r = capability_bounding_set_drop(arg_capability_bounding_set, true); +- if (r < 0) { +- log_emergency_errno(r, "Failed to drop capability bounding set: %m"); +- error_message = "Failed to drop capability bounding set"; +- goto finish; ++ if (arg_system && !cap_test_all(arg_capability_bounding_set)) { ++ r = capability_bounding_set_drop_usermode(arg_capability_bounding_set); ++ if (r < 0) { ++ log_emergency_errno(r, "Failed to drop capability bounding set of usermode helpers: %m"); ++ error_message = "Failed to drop capability bounding set of usermode helpers"; ++ goto finish; ++ } ++ r = capability_bounding_set_drop(arg_capability_bounding_set, true); ++ if (r < 0) { ++ log_emergency_errno(r, "Failed to drop capability bounding set: %m"); ++ error_message = "Failed to drop capability bounding set"; ++ goto finish; ++ } + } +- } + +- if (arg_syscall_archs) { +- r = enforce_syscall_archs(arg_syscall_archs); +- if (r < 0) { +- error_message = "Failed to set syscall architectures"; +- goto finish; ++ if (arg_syscall_archs) { ++ r = enforce_syscall_archs(arg_syscall_archs); ++ if (r < 0) { ++ error_message = "Failed to set syscall architectures"; ++ goto finish; ++ } + } +- } + +- if (!arg_system) +- /* Become reaper of our children */ +- if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) +- log_warning_errno(errno, "Failed to make us a subreaper: %m"); ++ if (!arg_system) ++ /* Become reaper of our children */ ++ if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) ++ log_warning_errno(errno, "Failed to make us a subreaper: %m"); + +- if (arg_system) +- /* Bump up RLIMIT_NOFILE for systemd itself */ +- (void) bump_rlimit_nofile(&saved_rlimit_nofile); ++ if (arg_system) ++ /* Bump up RLIMIT_NOFILE for systemd itself */ ++ (void) bump_rlimit_nofile(&saved_rlimit_nofile); ++ } + + r = manager_new(arg_system ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, arg_action == ACTION_TEST, &m); + if (r < 0) { +-- +2.10.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0002-src-basic-missing.h-check-for-missing-strndupa.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0002-src-basic-missing.h-check-for-missing-strndupa.patch new file mode 100644 index 0000000000..94c136b0d9 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0002-src-basic-missing.h-check-for-missing-strndupa.patch @@ -0,0 +1,104 @@ +From 585abd891a56409915314304101cac26b42c076b Mon Sep 17 00:00:00 2001 +From: Emil Renner Berthing <systemd@esmil.dk> +Date: Mon, 23 Oct 2017 10:45:46 -0700 +Subject: [PATCH 02/12] src/basic/missing.h: check for missing strndupa + +include missing.h for definition of strndupa + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + configure.ac | 1 + + src/basic/missing.h | 11 +++++++++++ + src/basic/mkdir.c | 1 + + src/basic/parse-util.c | 1 + + src/shared/pager.c | 1 + + src/shared/uid-range.c | 1 + + 6 files changed, 16 insertions(+) + +diff --git a/configure.ac b/configure.ac +index efcdc6c16..cd035a971 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -329,6 +329,7 @@ AC_CHECK_DECLS([ + pivot_root, + name_to_handle_at, + setns, ++ strndupa, + renameat2, + kcmp, + keyctl, +diff --git a/src/basic/missing.h b/src/basic/missing.h +index 04912bf52..8009888ad 100644 +--- a/src/basic/missing.h ++++ b/src/basic/missing.h +@@ -1104,6 +1104,17 @@ typedef int32_t key_serial_t; + #define KEYCTL_DESCRIBE 6 + #endif + ++#if !HAVE_DECL_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 ++ + #ifndef KEYCTL_READ + #define KEYCTL_READ 11 + #endif +diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c +index 6b1a98402..d1388df48 100644 +--- a/src/basic/mkdir.c ++++ b/src/basic/mkdir.c +@@ -28,6 +28,7 @@ + #include "path-util.h" + #include "stat-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, mkdir_func_t _mkdir) { + struct stat st; +diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c +index 4532f222c..7a30a0e06 100644 +--- a/src/basic/parse-util.c ++++ b/src/basic/parse-util.c +@@ -30,6 +30,7 @@ + #include "parse-util.h" + #include "process-util.h" + #include "string-util.h" ++#include "missing.h" + + int parse_boolean(const char *v) { + assert(v); +diff --git a/src/shared/pager.c b/src/shared/pager.c +index 4d7b02c63..854efc0c9 100644 +--- a/src/shared/pager.c ++++ b/src/shared/pager.c +@@ -38,6 +38,7 @@ + #include "string-util.h" + #include "strv.h" + #include "terminal-util.h" ++#include "missing.h" + + static pid_t pager_pid = 0; + +diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c +index b6ec47439..91ce9fb7f 100644 +--- a/src/shared/uid-range.c ++++ b/src/shared/uid-range.c +@@ -24,6 +24,7 @@ + #include "macro.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); +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch deleted file mode 100644 index 951a28d4f8..0000000000 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 8736d9b9bb492f60e8f3a1a7fb5a05ba3201d86b Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 20 Feb 2015 05:29:15 +0000 -Subject: [PATCH 02/19] units: Prefer getty to agetty in console setup systemd - units - -Upstream-Status: Inappropriate [configuration specific] - -Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - units/getty@.service.m4 | 2 +- - units/serial-getty@.service.m4 | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/units/getty@.service.m4 b/units/getty@.service.m4 -index 5b82c13..e729469 100644 ---- a/units/getty@.service.m4 -+++ b/units/getty@.service.m4 -@@ -33,7 +33,7 @@ ConditionPathExists=/dev/tty0 - - [Service] - # the VT is cleared by TTYVTDisallocate --ExecStart=-/sbin/agetty --noclear %I $TERM -+ExecStart=-/sbin/getty -L %I $TERM - Type=idle - Restart=always - RestartSec=0 -diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4 -index 4522d0d..e6d499d 100644 ---- a/units/serial-getty@.service.m4 -+++ b/units/serial-getty@.service.m4 -@@ -22,7 +22,7 @@ Before=getty.target - IgnoreOnIsolate=yes - - [Service] --ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM -+ExecStart=-/sbin/getty -L 115200 %I $TERM - Type=idle - Restart=always - UtmpIdentifier=%I --- -2.10.2 - diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0003-define-exp10-if-missing.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0003-define-exp10-if-missing.patch deleted file mode 100644 index 37c6ac5d10..0000000000 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0003-define-exp10-if-missing.patch +++ /dev/null @@ -1,34 +0,0 @@ -From b383c286f58184575216b2bf6f185ba2ad648956 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Wed, 9 Nov 2016 19:25:45 -0800 -Subject: [PATCH 03/19] define exp10 if missing - -Inspired by: http://peter.korsgaard.com/patches/alsa-utils/alsamixer-fix-build-on-uClibc-exp10.patch - -exp10 extension is not part of uClibc, so compute it. - -Upstream-Status: Pending - -Signed-off-by: Samuel Martin <s.martin49@gmail.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/basic/missing.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/basic/missing.h b/src/basic/missing.h -index 4c013be..4a3fd9c 100644 ---- a/src/basic/missing.h -+++ b/src/basic/missing.h -@@ -1078,4 +1078,9 @@ typedef int32_t key_serial_t; - - #endif - -+#ifdef __UCLIBC__ -+/* 10^x = 10^(log e^x) = (e^x)^log10 = e^(x * log 10) */ -+#define exp10(x) (exp((x) * log(10))) -+#endif /* __UCLIBC__ */ -+ - #include "missing_syscall.h" --- -2.10.2 - diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0003-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0003-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch new file mode 100644 index 0000000000..9a2d2c8e0a --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0003-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch @@ -0,0 +1,157 @@ +From 5bbbc2a08a3b4283ec04af0e77e25fb205aa8b82 Mon Sep 17 00:00:00 2001 +From: Emil Renner Berthing <systemd@esmil.dk> +Date: Mon, 23 Oct 2017 10:50:14 -0700 +Subject: [PATCH 03/12] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not + defined + +If the standard library doesn't provide brace +expansion users just won't get it. + +Dont use GNU GLOB extentions on non-glibc systems + +Conditionalize use of GLOB_ALTDIRFUNC + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + src/basic/glob-util.c | 20 +++++++++++++++++--- + src/test/test-glob-util.c | 17 +++++++++++++++-- + src/tmpfiles/tmpfiles.c | 8 ++++++++ + 3 files changed, 40 insertions(+), 5 deletions(-) + +diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c +index f611c42e4..ad6e2be8d 100644 +--- a/src/basic/glob-util.c ++++ b/src/basic/glob-util.c +@@ -27,13 +27,18 @@ + #include "macro.h" + #include "path-util.h" + #include "strv.h" ++/* Don't fail if the standard library ++ * doesn't provide brace expansion */ ++#ifndef GLOB_BRACE ++#define GLOB_BRACE 0 ++#endif + + int safe_glob(const char *path, int flags, glob_t *pglob) { + int k; + ++#ifdef GLOB_ALTDIRFUNC + /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */ + assert(!(flags & GLOB_ALTDIRFUNC)); +- + if (!pglob->gl_closedir) + pglob->gl_closedir = (void (*)(void *)) closedir; + if (!pglob->gl_readdir) +@@ -44,10 +49,13 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { + pglob->gl_lstat = lstat; + if (!pglob->gl_stat) + pglob->gl_stat = stat; +- ++#endif + errno = 0; ++#ifdef GLOB_ALTDIRFUNC + k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob); +- ++#else ++ k = glob(path, flags, NULL, pglob); ++#endif + if (k == GLOB_NOMATCH) + return -ENOENT; + if (k == GLOB_NOSPACE) +@@ -60,6 +68,12 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { + return 0; + } + ++/* Don't fail if the standard library ++ * doesn't provide brace expansion */ ++#ifndef GLOB_BRACE ++#define GLOB_BRACE 0 ++#endif ++ + int glob_exists(const char *path) { + _cleanup_globfree_ glob_t g = {}; + int k; +diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c +index af866e004..3afa09ada 100644 +--- a/src/test/test-glob-util.c ++++ b/src/test/test-glob-util.c +@@ -29,6 +29,11 @@ + #include "glob-util.h" + #include "macro.h" + #include "rm-rf.h" ++/* Don't fail if the standard library ++ * doesn't provide brace expansion */ ++#ifndef GLOB_BRACE ++#define GLOB_BRACE 0 ++#endif + + static void test_glob_exists(void) { + char name[] = "/tmp/test-glob_exists.XXXXXX"; +@@ -51,25 +56,33 @@ static void test_glob_exists(void) { + static void test_glob_no_dot(void) { + char template[] = "/tmp/test-glob-util.XXXXXXX"; + const char *fn; +- + _cleanup_globfree_ glob_t g = { ++#ifdef GLOB_ALTDIRFUNC + .gl_closedir = (void (*)(void *)) closedir, + .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot, + .gl_opendir = (void *(*)(const char *)) opendir, + .gl_lstat = lstat, + .gl_stat = stat, ++#endif + }; +- + int r; + + assert_se(mkdtemp(template)); + + fn = strjoina(template, "/*"); ++#ifdef GLOB_ALTDIRFUNC + r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g); ++#else ++ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g); ++#endif + assert_se(r == GLOB_NOMATCH); + + fn = strjoina(template, "/.*"); ++#ifdef GLOB_ALTDIRFUNC + r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g); ++#else ++ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g); ++#endif + assert_se(r == GLOB_NOMATCH); + + (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 9419c99e2..07027a765 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -71,6 +71,12 @@ + #include "umask-util.h" + #include "user-util.h" + #include "util.h" ++/* Don't fail if the standard library ++ * doesn't provide brace expansion */ ++#ifndef GLOB_BRACE ++#define GLOB_BRACE 0 ++#endif ++ + + /* 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 +@@ -1092,7 +1098,9 @@ static int item_do_children(Item *i, const char *path, action_t action) { + + static int glob_item(Item *i, action_t action, bool recursive) { + _cleanup_globfree_ glob_t g = { ++#ifdef GLOB_ALTDIRFUNC + .gl_opendir = (void *(*)(const char *)) opendir_nomod, ++#endif + }; + int r = 0, k; + char **fn; +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0004-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0004-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch new file mode 100644 index 0000000000..cb5ae99a46 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0004-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch @@ -0,0 +1,47 @@ +From c850b654e71677e0d6292f1345207b9b5acffc33 Mon Sep 17 00:00:00 2001 +From: Emil Renner Berthing <systemd@esmil.dk> +Date: Mon, 23 Oct 2017 11:31:03 -0700 +Subject: [PATCH 04/12] src/basic/missing.h: check for missing __compar_fn_t + typedef + +include missing.h for missing __compar_fn_t + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + src/basic/missing.h | 5 +++++ + src/basic/strbuf.c | 1 + + 2 files changed, 6 insertions(+) + +diff --git a/src/basic/missing.h b/src/basic/missing.h +index 8009888ad..671f341c6 100644 +--- a/src/basic/missing.h ++++ b/src/basic/missing.h +@@ -1063,6 +1063,11 @@ struct input_mask { + #define RENAME_NOREPLACE (1 << 0) + #endif + ++#ifndef __COMPAR_FN_T ++#define __COMPAR_FN_T ++typedef int (*__compar_fn_t)(const void *, const void *); ++#endif ++ + #ifndef KCMP_FILE + #define KCMP_FILE 0 + #endif +diff --git a/src/basic/strbuf.c b/src/basic/strbuf.c +index 00aaf9e62..9dc4a584a 100644 +--- a/src/basic/strbuf.c ++++ b/src/basic/strbuf.c +@@ -23,6 +23,7 @@ + + #include "alloc-util.h" + #include "strbuf.h" ++#include "missing.h" + + /* + * Strbuf stores given strings in a single continuous allocated memory +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch new file mode 100644 index 0000000000..55887ee823 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch @@ -0,0 +1,86 @@ +From 21080b6a40d0a4ddd2db8f0fa37686f6fa885d1c Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 23 Oct 2017 11:38:33 -0700 +Subject: [PATCH 06/12] Include netinet/if_ether.h + +Fixes +/mnt/a/oe/build/tmp/work/mips32r2-bec-linux-musl/systemd/1_234-r0/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr' + struct ethhdr { + ^~~~~~ + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + src/libsystemd/sd-netlink/netlink-types.c | 1 + + src/network/netdev/tuntap.c | 1 + + src/network/networkd-brvlan.c | 1 + + src/udev/net/ethtool-util.c | 2 +- + src/udev/udev-builtin-net_setup_link.c | 2 +- + 5 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c +index 923f7dd10..b95b1e4b2 100644 +--- a/src/libsystemd/sd-netlink/netlink-types.c ++++ b/src/libsystemd/sd-netlink/netlink-types.c +@@ -19,6 +19,7 @@ + + #include <stdint.h> + #include <sys/socket.h> ++#include <netinet/if_ether.h> + #include <linux/netlink.h> + #include <linux/rtnetlink.h> + #include <linux/can/netlink.h> +diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c +index 3d6280884..40e58c38f 100644 +--- a/src/network/netdev/tuntap.c ++++ b/src/network/netdev/tuntap.c +@@ -18,6 +18,7 @@ + ***/ + + #include <fcntl.h> ++#include <netinet/if_ether.h> + #include <linux/if_tun.h> + #include <net/if.h> + #include <netinet/if_ether.h> +diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c +index fa5d3ee7f..e0828962a 100644 +--- a/src/network/networkd-brvlan.c ++++ b/src/network/networkd-brvlan.c +@@ -18,6 +18,7 @@ + ***/ + + #include <netinet/in.h> ++#include <netinet/if_ether.h> + #include <linux/if_bridge.h> + #include <stdbool.h> + +diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c +index 201fc2343..5f7cc2a0a 100644 +--- a/src/udev/net/ethtool-util.c ++++ b/src/udev/net/ethtool-util.c +@@ -16,7 +16,7 @@ + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. + ***/ +- ++#include <netinet/if_ether.h> + #include <net/if.h> + #include <sys/ioctl.h> + #include <linux/ethtool.h> +diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c +index 8e4777513..d01fff2a4 100644 +--- a/src/udev/udev-builtin-net_setup_link.c ++++ b/src/udev/udev-builtin-net_setup_link.c +@@ -16,7 +16,7 @@ + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. + ***/ +- ++#include <netinet/if_ether.h> + #include "alloc-util.h" + #include "link-config.h" + #include "log.h" +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch deleted file mode 100644 index 43a0d3f616..0000000000 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 82d837b76618a773485b96e38b7b91083a7437e8 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 20 Feb 2015 05:05:45 +0000 -Subject: [PATCH 06/19] configure: Check for additional features that uclibc - doesnt support - -This helps in supporting uclibc which does not have all features that -glibc might have - -Upstream-Status: Denied [no desire for uclibc support] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - configure.ac | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 7f6b3b9..7c4b5a2 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -110,6 +110,24 @@ AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin] - - AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])]) - -+# check for few functions not implemented in uClibc -+ -+AC_CHECK_FUNCS_ONCE(mkostemp execvpe posix_fallocate) -+ -+# check for %ms format support - assume always no if cross compiling -+ -+AC_MSG_CHECKING([whether %ms format is supported by *scanf]) -+ -+AC_LINK_IFELSE( -+ [AC_LANG_PROGRAM([ -+ #include <stdio.h> -+ ],[ -+ char *buf1, *buf2, *buf3, str="1 2.3 abcde" ; -+ int rc = sscanf(str, "%ms %ms %ms", &buf1, &buf2, &buf3) ; -+ return (rc==3)?0:1;])], -+ [AC_DEFINE([HAVE_MSFORMAT], [1], [Define if %ms format is supported by *scanf.])], -+ [AC_MSG_RESULT([no])]) -+ - M4_DEFINES= - - AC_CHECK_TOOL(OBJCOPY, objcopy) --- -2.10.2 - diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0007-check-for-missing-canonicalize_file_name.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0007-check-for-missing-canonicalize_file_name.patch new file mode 100644 index 0000000000..5234c59a78 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0007-check-for-missing-canonicalize_file_name.patch @@ -0,0 +1,63 @@ +From 05dffe67919ffc72be5c017bc6cf82f164b2e8f9 Mon Sep 17 00:00:00 2001 +From: Emil Renner Berthing <systemd@esmil.dk> +Date: Mon, 23 Oct 2017 11:42:03 -0700 +Subject: [PATCH 07/12] check for missing canonicalize_file_name + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + configure.ac | 2 ++ + src/basic/missing.h | 1 + + src/basic/missing_syscall.h | 6 ++++++ + 3 files changed, 9 insertions(+) + +diff --git a/configure.ac b/configure.ac +index cd035a971..3674190fb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -333,6 +333,7 @@ AC_CHECK_DECLS([ + renameat2, + kcmp, + keyctl, ++ canonicalize_file_name, + LO_FLAGS_PARTSCAN, + copy_file_range, + explicit_bzero], +@@ -343,6 +344,7 @@ AC_CHECK_DECLS([ + #include <fcntl.h> + #include <sched.h> + #include <string.h> ++#include <stdlib.h> + #include <linux/loop.h> + ]]) + +diff --git a/src/basic/missing.h b/src/basic/missing.h +index 671f341c6..8ae4964e1 100644 +--- a/src/basic/missing.h ++++ b/src/basic/missing.h +@@ -1246,3 +1246,4 @@ struct ethtool_link_settings { + #endif + + #include "missing_syscall.h" ++ +diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h +index 898116c7b..4d44ee4fa 100644 +--- a/src/basic/missing_syscall.h ++++ b/src/basic/missing_syscall.h +@@ -28,6 +28,12 @@ static inline int pivot_root(const char *new_root, const char *put_old) { + } + #endif + ++#if !HAVE_DECL_CANONICALIZE_FILE_NAME ++static inline char *canonicalize_file_name(const char *path) { ++ return realpath(path, NULL); ++} ++#endif ++ + /* ======================================================================= */ + + #if !HAVE_DECL_MEMFD_CREATE +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0007-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0007-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch index fad69a51af..bc92db7468 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0007-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0007-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch @@ -12,10 +12,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> configure.ac | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) -diff --git a/Makefile.am b/Makefile.am -index 29ed1dd..02f4017 100644 ---- a/Makefile.am -+++ b/Makefile.am +Index: git/Makefile.am +=================================================================== +--- git.orig/Makefile.am ++++ git/Makefile.am @@ -320,7 +320,7 @@ define install-relative-aliases while [ -n "$$1" ]; do \ $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \ @@ -25,19 +25,16 @@ index 29ed1dd..02f4017 100644 shift 2 || exit $$?; \ done endef -diff --git a/configure.ac b/configure.ac -index 7c4b5a2..b10c952 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -108,8 +108,6 @@ AC_PATH_PROG([SULOGIN], [sulogin], [/usr/sbin/sulogin], [$PATH:/usr/sbin:/sbin]) +Index: git/configure.ac +=================================================================== +--- git.orig/configure.ac ++++ git/configure.ac +@@ -110,8 +110,6 @@ AC_PATH_PROG([SULOGIN], [sulogin], [/usr AC_PATH_PROG([MOUNT_PATH], [mount], [/usr/bin/mount], [$PATH:/usr/sbin:/sbin]) AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin]) -AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])]) - - # check for few functions not implemented in uClibc + M4_DEFINES= - AC_CHECK_FUNCS_ONCE(mkostemp execvpe posix_fallocate) --- -2.10.2 - + AC_CHECK_TOOL(OBJCOPY, objcopy) diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests.patch new file mode 100644 index 0000000000..67a4f8e03e --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests.patch @@ -0,0 +1,35 @@ +From 48e7c0f5b2f5d777a16ac5584dc4f50f1dfa832c Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 23 Oct 2017 12:27:53 -0700 +Subject: [PATCH 08/12] Do not enable nss tests + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 3cc8f3451..df20a9a11 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -5290,6 +5290,7 @@ EXTRA_DIST += \ + src/timesync/timesyncd.conf.in + + # ------------------------------------------------------------------------------ ++if ENABLE_NSS_SYSTEMD + test_nss_SOURCES = \ + src/test/test-nss.c + +@@ -5302,7 +5303,6 @@ manual_tests += \ + test-nss + + # ------------------------------------------------------------------------------ +-if ENABLE_NSS_SYSTEMD + libnss_systemd_la_SOURCES = \ + src/nss-systemd/nss-systemd.sym \ + src/nss-systemd/nss-systemd.c +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch deleted file mode 100644 index 586b5aab7d..0000000000 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 96026a3763264eb41a2c3e374f232f6e543284a8 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Wed, 9 Nov 2016 19:33:49 -0800 -Subject: [PATCH 08/19] nspawn: Use execvpe only when libc supports it - -Upstream-Status: Denied [no desire for uclibc support] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/nspawn/nspawn.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index 9b9ae90..19b47cd 100644 ---- a/src/nspawn/nspawn.c -+++ b/src/nspawn/nspawn.c -@@ -123,6 +123,8 @@ typedef enum LinkJournal { - LINK_GUEST - } LinkJournal; - -+#include "config.h" -+ - static char *arg_directory = NULL; - static char *arg_template = NULL; - static char *arg_chdir = NULL; -@@ -2871,7 +2873,12 @@ static int inner_child( - a[0] = (char*) "/sbin/init"; - execve(a[0], a, env_use); - } else if (!strv_isempty(arg_parameters)) -+#ifdef HAVE_EXECVPE - execvpe(arg_parameters[0], arg_parameters, env_use); -+#else -+ environ = env_use; -+ execvp(arg_parameters[0], arg_parameters); -+#endif /* HAVE_EXECVPE */ - else { - if (!arg_chdir) - /* If we cannot change the directory, we'll end up in /, that is expected. */ --- -2.10.2 - diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0009-test-hexdecoct.c-Include-missing.h-form-strndupa.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0009-test-hexdecoct.c-Include-missing.h-form-strndupa.patch new file mode 100644 index 0000000000..d3694dcbd5 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0009-test-hexdecoct.c-Include-missing.h-form-strndupa.patch @@ -0,0 +1,27 @@ +From 75f4e7f167de533a160ee1af2a03fba4c5a5ffc6 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 23 Oct 2017 12:33:22 -0700 +Subject: [PATCH 09/12] test-hexdecoct.c: Include missing.h form strndupa + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + src/test/test-hexdecoct.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c +index fcae427e7..5eb5e2ed7 100644 +--- a/src/test/test-hexdecoct.c ++++ b/src/test/test-hexdecoct.c +@@ -21,6 +21,7 @@ + #include "hexdecoct.h" + #include "macro.h" + #include "string-util.h" ++#include "missing.h" + + static void test_hexchar(void) { + assert_se(hexchar(0xa) == 'a'); +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch deleted file mode 100644 index f150bb087a..0000000000 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 085c8b6f253726ad547e7be84ff3f2b99701488b Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Wed, 9 Nov 2016 19:38:07 -0800 -Subject: [PATCH 09/19] util: bypass unimplemented _SC_PHYS_PAGES system - configuration API on uclibc - -Upstream-Status: Inappropriate [uclibc-specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/basic/util.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/src/basic/util.c b/src/basic/util.c -index c1b5ca1..4c62d43 100644 ---- a/src/basic/util.c -+++ b/src/basic/util.c -@@ -742,6 +742,20 @@ uint64_t physical_memory(void) { - * In order to support containers nicely that have a configured memory limit we'll take the minimum of the - * physically reported amount of memory and the limit configured for the root cgroup, if there is any. */ - -+#ifdef __UCLIBC__ -+ char line[128]; -+ FILE *f = fopen("/proc/meminfo", "r"); -+ if (f == NULL) -+ return 0; -+ while (!feof(f) && fgets(line, sizeof(line)-1, f)) { -+ if (sscanf(line, "MemTotal: %li kB", &mem) == 1) { -+ mem *= 1024; -+ break; -+ } -+ } -+ fclose(f); -+ return (uint64_t) mem; -+#else - sc = sysconf(_SC_PHYS_PAGES); - assert(sc > 0); - -@@ -762,6 +776,7 @@ uint64_t physical_memory(void) { - lim *= ps; - - return MIN(mem, lim); -+#endif - } - - uint64_t physical_memory_scale(uint64_t v, uint64_t max) { --- -2.10.2 - diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0010-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0010-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch new file mode 100644 index 0000000000..808c83aba3 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0010-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch @@ -0,0 +1,49 @@ +From 6e9d2bcaa6f886b2384c1c35a04e4ebc148aea68 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 23 Oct 2017 12:40:25 -0700 +Subject: [PATCH 10/12] test-sizeof.c: Disable tests for missing typedefs in + musl + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + src/test/test-sizeof.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c +index 269adfd18..ba7855dff 100644 +--- a/src/test/test-sizeof.c ++++ b/src/test/test-sizeof.c +@@ -18,7 +18,6 @@ + ***/ + + #include <stdio.h> +- + #include "time-util.h" + + /* Print information about various types. Useful when diagnosing +@@ -48,8 +47,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); +@@ -59,7 +60,9 @@ int main(void) { + info(ssize_t); + info(time_t); + info(usec_t); ++#ifdef __GLIBC__ + info(__time_t); ++#endif + + info(enum Enum); + info(enum BigEnum); +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0011-don-t-use-glibc-specific-qsort_r.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0011-don-t-use-glibc-specific-qsort_r.patch new file mode 100644 index 0000000000..7cfe829e85 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0011-don-t-use-glibc-specific-qsort_r.patch @@ -0,0 +1,105 @@ +From 2eb45f5a0a8bfb8bdca084587ad28e5001f3cc4b Mon Sep 17 00:00:00 2001 +From: Emil Renner Berthing <systemd@esmil.dk> +Date: Thu, 18 Sep 2014 15:24:56 +0200 +Subject: [PATCH 11/12] don't use glibc-specific qsort_r + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + src/hwdb/hwdb.c | 18 +++++++++++------- + src/udev/udevadm-hwdb.c | 16 ++++++++++------ + 2 files changed, 21 insertions(+), 13 deletions(-) + +diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c +index 793398ca6..669b00818 100644 +--- a/src/hwdb/hwdb.c ++++ b/src/hwdb/hwdb.c +@@ -151,13 +151,12 @@ static void trie_free(struct trie *trie) { + + DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); + +-static int trie_values_cmp(const void *v1, const void *v2, void *arg) { ++static struct trie *trie_node_add_value_trie; ++static int trie_values_cmp(const void *v1, const void *v2) { + const struct trie_value_entry *val1 = v1; + const struct trie_value_entry *val2 = v2; +- struct trie *trie = arg; +- +- return strcmp(trie->strings->buf + val1->key_off, +- trie->strings->buf + val2->key_off); ++ return strcmp(trie_node_add_value_trie->strings->buf + val1->key_off, ++ trie_node_add_value_trie->strings->buf + val2->key_off); + } + + static int trie_node_add_value(struct trie *trie, struct trie_node *node, +@@ -182,7 +181,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, + .value_off = v, + }; + +- val = xbsearch_r(&search, node->values, node->values_count, sizeof(struct trie_value_entry), 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. +@@ -207,7 +209,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, + node->values[node->values_count].file_priority = file_priority; + node->values[node->values_count].line_number = line_number; + node->values_count++; +- qsort_r(node->values, node->values_count, sizeof(struct trie_value_entry), 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/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c +index 69b0b9025..fbd213300 100644 +--- a/src/udev/udevadm-hwdb.c ++++ b/src/udev/udevadm-hwdb.c +@@ -128,13 +128,13 @@ static void trie_node_cleanup(struct trie_node *node) { + free(node); + } + +-static int trie_values_cmp(const void *v1, const void *v2, void *arg) { ++static struct trie *trie_node_add_value_trie; ++static int trie_values_cmp(const void *v1, const void *v2) { + const struct trie_value_entry *val1 = v1; + const struct trie_value_entry *val2 = v2; +- struct trie *trie = arg; + +- return strcmp(trie->strings->buf + val1->key_off, +- trie->strings->buf + val2->key_off); ++ return strcmp(trie_node_add_value_trie->strings->buf + val1->key_off, ++ trie_node_add_value_trie->strings->buf + val2->key_off); + } + + static int trie_node_add_value(struct trie *trie, struct trie_node *node, +@@ -155,7 +155,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, + .value_off = v, + }; + +- val = xbsearch_r(&search, node->values, node->values_count, sizeof(struct trie_value_entry), 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) { + /* replace existing earlier key with new value */ + val->value_off = v; +@@ -172,7 +174,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, + node->values[node->values_count].key_off = k; + node->values[node->values_count].value_off = v; + node->values_count++; +- qsort_r(node->values, node->values_count, sizeof(struct trie_value_entry), 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; + } + +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch new file mode 100644 index 0000000000..1a6db654f8 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch @@ -0,0 +1,99 @@ +From 9621618c701a2d5eb3e26f40c68354d4dfb8f872 Mon Sep 17 00:00:00 2001 +From: Andre McCurdy <armccurdy@gmail.com> +Date: Tue, 10 Oct 2017 14:33:30 -0700 +Subject: [PATCH 12/12] 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: + + http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html + http://www.openwall.com/lists/musl/2015/02/05/2 + +Note that laccess() is never passing AT_EACCESS so a lot of the +discussion in the links above doesn't apply. Note also that +(currently) all systemd callers of laccess() pass mode as F_OK, so +only check for existence of a file, not access permissions. +Therefore, in this case, the only distiction between faccessat() +with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour +for broken symlinks; laccess() on a broken symlink will succeed with +(flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0). + +The laccess() macros was added to systemd some time ago and it's not +clear if or why it needs to return success for broken symlinks. Maybe +just historical and not actually necessary or desired behaviour? + +Signed-off-by: Andre McCurdy <armccurdy@gmail.com> +--- +Upstream-Status: Pending + + src/basic/fs-util.h | 22 +++++++++++++++++++++- + src/shared/base-filesystem.c | 6 +++--- + 2 files changed, 24 insertions(+), 4 deletions(-) + +diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h +index 094acf179..cdbc0ae72 100644 +--- a/src/basic/fs-util.h ++++ b/src/basic/fs-util.h +@@ -48,7 +48,27 @@ int fchmod_umask(int fd, mode_t mode); + + int fd_warn_permissions(const char *path, int fd); + +-#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: ++ ++ http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html ++ http://www.openwall.com/lists/musl/2015/02/05/2 ++ ++ Note that laccess() is never passing AT_EACCESS so a lot of the discussion in ++ the links above doesn't apply. Note also that (currently) all systemd callers ++ of laccess() pass mode as F_OK, so only check for existence of a file, not ++ access permissions. Therefore, in this case, the only distiction between ++ faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the ++ behaviour for broken symlinks; laccess() on a broken symlink will succeed ++ with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0). ++ ++ The laccess() macros was added to systemd some time ago and it's not clear if ++ 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) + + 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 903a18786..2f6052ee7 100644 +--- a/src/shared/base-filesystem.c ++++ b/src/shared/base-filesystem.c +@@ -70,7 +70,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"); + + for (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) { +@@ -78,7 +78,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { + + /* check if one of the targets exists */ + NULSTR_FOREACH(s, table[i].target) { +- if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0) ++ if (faccessat(fd, s, F_OK, 0) < 0) + continue; + + /* check if a specific file exists at the target path */ +@@ -89,7 +89,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { + if (!p) + return log_oom(); + +- if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0) ++ if (faccessat(fd, p, F_OK, 0) < 0) + continue; + } + +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch index 8666bdc652..eb380ce78d 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch @@ -1,7 +1,7 @@ -From 8cc1ae11f54dcc38ee2168b0f99703b835dd3942 Mon Sep 17 00:00:00 2001 +From ab5a27040133f7cdf062ac8cfeb94e081d3567b3 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 9 Nov 2016 19:41:13 -0800 -Subject: [PATCH 12/19] rules: whitelist hd* devices +Subject: [PATCH 07/14] 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 @@ -11,23 +11,24 @@ 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> + --- 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 c13d05c..b14fbed 100644 +index d2745f65f..63f472be8 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*|scm*|pmem*", GOTO="persistent_storage_end" -+KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|hd*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|scm*|pmem*", GOTO="persistent_storage_end" +-KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|scm*|pmem*|nbd*", GOTO="persistent_storage_end" ++KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|scm*|pmem*|nbd*|hd*", GOTO="persistent_storage_end" # ignore partitions that span the entire disk TEST=="whole_disk", GOTO="persistent_storage_end" -- -2.10.2 +2.13.2 diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch index 2b333375bb..aeebbfb8fe 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch @@ -1,7 +1,7 @@ -From 79e64a07840e0d97d66e46111f1c086bf83981b7 Mon Sep 17 00:00:00 2001 +From 479e1f4aa2b9f1c911a4d0dd18e222d241a978ea Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 9 Nov 2016 20:35:30 -0800 -Subject: [PATCH 13/19] Make root's home directory configurable +Subject: [PATCH 42/48] Make root's home directory configurable OpenEmbedded has a configurable home directory for root. Allow systemd to be built using its idea of what root's home directory @@ -14,6 +14,7 @@ https://github.com/systemd/systemd/issues/541 Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> Signed-off-by: Khem Raj <raj.khem@gmail.com> + --- Makefile.am | 2 ++ configure.ac | 7 +++++++ @@ -24,18 +25,18 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am -index 420e0e0..3010b01 100644 +index 1bcd932c2..c2b4a99d2 100644 --- a/Makefile.am +++ b/Makefile.am -@@ -213,6 +213,7 @@ AM_CPPFLAGS = \ +@@ -226,6 +226,7 @@ AM_CPPFLAGS = \ -DLIBDIR=\"$(libdir)\" \ -DROOTLIBDIR=\"$(rootlibdir)\" \ -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \ + -DROOTHOMEDIR=\"$(roothomedir)\" \ - -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ -I $(top_srcdir)/src \ -I $(top_builddir)/src/basic \ -@@ -6057,6 +6058,7 @@ substitutions = \ + -I $(top_srcdir)/src/basic \ +@@ -6356,6 +6357,7 @@ substitutions = \ '|rootlibdir=$(rootlibdir)|' \ '|rootlibexecdir=$(rootlibexecdir)|' \ '|rootbindir=$(rootbindir)|' \ @@ -44,10 +45,10 @@ index 420e0e0..3010b01 100644 '|SYSTEMCTL=$(rootbindir)/systemctl|' \ '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ diff --git a/configure.ac b/configure.ac -index b10c952..dfc0bd3 100644 +index 0354ffe6a..b53ca1f1a 100644 --- a/configure.ac +++ b/configure.ac -@@ -1513,6 +1513,11 @@ AC_ARG_WITH([rootlibdir], +@@ -1641,6 +1641,11 @@ AC_ARG_WITH([rootlibdir], [with_rootlibdir=${libdir}]) AX_NORMALIZE_PATH([with_rootlibdir]) @@ -57,29 +58,29 @@ index b10c952..dfc0bd3 100644 + [with_roothomedir=/root]) + AC_ARG_WITH([pamlibdir], - AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), + AS_HELP_STRING([--with-pamlibdir=DIR], [directory for PAM modules]), [], -@@ -1598,6 +1603,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir]) - AC_SUBST([pamconfdir], [$with_pamconfdir]) +@@ -1733,6 +1738,7 @@ AC_SUBST([pamconfdir], [$with_pamconfdir]) + AC_SUBST([rpmmacrosdir], [$with_rpmmacrosdir]) AC_SUBST([rootprefix], [$with_rootprefix]) AC_SUBST([rootlibdir], [$with_rootlibdir]) +AC_SUBST([roothomedir], [$with_roothomedir]) AC_CONFIG_FILES([ Makefile -@@ -1688,6 +1694,7 @@ AC_MSG_RESULT([ +@@ -1829,6 +1835,7 @@ AC_MSG_RESULT([ includedir: ${includedir} lib dir: ${libdir} rootlib dir: ${with_rootlibdir} + root home dir: ${with_roothomedir} SysV init scripts: ${SYSTEM_SYSVINIT_PATH} SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} - Build Python: ${PYTHON} + build Python: ${PYTHON} diff --git a/src/basic/user-util.c b/src/basic/user-util.c -index 938533d..3f9fdc4 100644 +index c619dad52..662682adf 100644 --- a/src/basic/user-util.c +++ b/src/basic/user-util.c -@@ -127,7 +127,7 @@ int get_user_creds( +@@ -129,7 +129,7 @@ int get_user_creds( *gid = 0; if (home) @@ -88,7 +89,7 @@ index 938533d..3f9fdc4 100644 if (shell) *shell = "/bin/sh"; -@@ -387,7 +387,7 @@ int get_home_dir(char **_h) { +@@ -389,7 +389,7 @@ int get_home_dir(char **_h) { /* Hardcode home directory for root to avoid NSS */ u = getuid(); if (u == 0) { @@ -98,10 +99,10 @@ index 938533d..3f9fdc4 100644 return -ENOMEM; diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index 19b47cd..e42bf19 100644 +index 8a5fedd4b..7b01ec078 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c -@@ -2798,7 +2798,7 @@ static int inner_child( +@@ -2291,7 +2291,7 @@ static int inner_child( if (envp[n_env]) n_env++; @@ -110,8 +111,8 @@ index 19b47cd..e42bf19 100644 (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) || (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) return log_oom(); -@@ -2882,7 +2882,7 @@ static int inner_child( - else { +@@ -2373,7 +2373,7 @@ static int inner_child( + } else { if (!arg_chdir) /* If we cannot change the directory, we'll end up in /, that is expected. */ - (void) chdir(home ?: "/root"); @@ -120,7 +121,7 @@ index 19b47cd..e42bf19 100644 execle("/bin/bash", "-bash", NULL, env_use); execle("/bin/sh", "-sh", NULL, env_use); diff --git a/units/emergency.service.in b/units/emergency.service.in -index da68eb8..e25f879 100644 +index e9eb238b9..32588e48a 100644 --- a/units/emergency.service.in +++ b/units/emergency.service.in @@ -15,8 +15,8 @@ Conflicts=syslog.socket @@ -131,11 +132,11 @@ index da68eb8..e25f879 100644 -WorkingDirectory=-/root +Environment=HOME=@roothomedir@ +WorkingDirectory=-@roothomedir@ - ExecStartPre=-/bin/plymouth --wait quit - ExecStartPre=-/bin/echo -e 'You are in emergency mode. After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.' - ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default" + ExecStart=-@rootlibexecdir@/systemd-sulogin-shell emergency + Type=idle + StandardInput=tty-force diff --git a/units/rescue.service.in b/units/rescue.service.in -index 5feff69..a83439e 100644 +index 4ab66f485..bd9898f2c 100644 --- a/units/rescue.service.in +++ b/units/rescue.service.in @@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service @@ -146,9 +147,9 @@ index 5feff69..a83439e 100644 -WorkingDirectory=-/root +Environment=HOME=@roothomedir@ +WorkingDirectory=-@roothomedir@ - ExecStartPre=-/bin/plymouth --wait quit - ExecStartPre=-/bin/echo -e 'You are in rescue mode. After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.' - ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default" + ExecStart=-@rootlibexecdir@/systemd-sulogin-shell rescue + Type=idle + StandardInput=tty-force -- -2.10.2 +2.13.2 diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch new file mode 100644 index 0000000000..e219981ab0 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch @@ -0,0 +1,31 @@ +From 4b6733544beb662a0f77310302fae1fb7b76d167 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 12 Sep 2015 18:53:31 +0000 +Subject: [PATCH 13/13] comparison_fn_t is glibc specific, use raw signature in + function pointer + +make it work with musl where comparison_fn_t is not provided + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + src/basic/util.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/util.h b/src/basic/util.h +index c7da6c39b..87f62b891 100644 +--- a/src/basic/util.h ++++ b/src/basic/util.h +@@ -98,7 +98,7 @@ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, + * Normal qsort requires base to be nonnull. Here were require + * that only if nmemb > 0. + */ +-static inline void qsort_safe(void *base, size_t nmemb, size_t size, comparison_fn_t compar) { ++static inline void qsort_safe(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { + if (nmemb <= 1) + return; + +-- +2.14.2 + diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch index f31d211e76..95871bb053 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch @@ -1,7 +1,7 @@ -From 4d28d9a7d8d69fb429955d770e53e7a81640da24 Mon Sep 17 00:00:00 2001 +From 7883985a3a78677e9a1d5d61fe7fa8badf39f565 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 9 Nov 2016 20:45:23 -0800 -Subject: [PATCH 15/19] Revert "udev: remove userspace firmware loading +Subject: [PATCH 10/14] Revert "udev: remove userspace firmware loading support" This reverts commit be2ea723b1d023b3d385d3b791ee4607cbfb20ca. @@ -11,23 +11,24 @@ Upstream-Status: Inappropriate [OE specific] Signed-off-by: Jonathan Liu <net147@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> + --- Makefile.am | 12 +++ - README | 6 +- + README | 4 +- TODO | 1 + configure.ac | 18 +++++ src/udev/udev-builtin-firmware.c | 154 +++++++++++++++++++++++++++++++++++++++ src/udev/udev-builtin.c | 3 + src/udev/udev.h | 6 ++ src/udev/udevd.c | 13 ++++ - 8 files changed, 210 insertions(+), 3 deletions(-) + 8 files changed, 209 insertions(+), 2 deletions(-) create mode 100644 src/udev/udev-builtin-firmware.c diff --git a/Makefile.am b/Makefile.am -index 3010b01..229492a 100644 +index c2b4a99d2..692d7bb95 100644 --- a/Makefile.am +++ b/Makefile.am -@@ -3791,6 +3791,18 @@ libudev_core_la_LIBADD = \ +@@ -3985,6 +3985,18 @@ libudev_core_la_LIBADD = \ $(BLKID_LIBS) \ $(KMOD_LIBS) @@ -47,17 +48,10 @@ index 3010b01..229492a 100644 libudev_core_la_SOURCES += \ src/udev/udev-builtin-kmod.c diff --git a/README b/README -index 9f5bc93..f60ae11 100644 +index 60388eebe..e21976393 100644 --- a/README +++ b/README -@@ -50,14 +50,14 @@ REQUIREMENTS: - CONFIG_PROC_FS - CONFIG_FHANDLE (libudev, mount and bind mount handling) - -- udev will fail to work with the legacy sysfs layout: -+ Udev will fail to work with the legacy sysfs layout: - CONFIG_SYSFS_DEPRECATED=n - +@@ -61,8 +61,8 @@ REQUIREMENTS: Legacy hotplug slows down the system and confuses udev: CONFIG_UEVENT_HELPER_PATH="" @@ -69,10 +63,10 @@ index 9f5bc93..f60ae11 100644 Some udev rules and virtualization detection relies on it: diff --git a/TODO b/TODO -index baaac94..1ab1691 100644 +index 61efa5e9f..67ccac224 100644 --- a/TODO +++ b/TODO -@@ -658,6 +658,7 @@ Features: +@@ -740,6 +740,7 @@ Features: * initialize the hostname from the fs label of /, if /etc/hostname does not exist? * udev: @@ -81,11 +75,11 @@ index baaac94..1ab1691 100644 - kill scsi_id - add trigger --subsystem-match=usb/usb_device device diff --git a/configure.ac b/configure.ac -index dfc0bd3..1de0066 100644 +index b53ca1f1a..1150ca50e 100644 --- a/configure.ac +++ b/configure.ac -@@ -1394,6 +1394,23 @@ AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"]) - AC_ARG_ENABLE(hwdb, [AC_HELP_STRING([--disable-hwdb], [disable hardware database support])], +@@ -1522,6 +1522,23 @@ AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"]) + AC_ARG_ENABLE(hwdb, [AS_HELP_STRING([--disable-hwdb], [disable hardware database support])], enable_hwdb=$enableval, enable_hwdb=yes) AM_CONDITIONAL(ENABLE_HWDB, [test x$enable_hwdb = xyes]) +AC_ARG_WITH(firmware-path, @@ -108,17 +102,17 @@ index dfc0bd3..1de0066 100644 # ------------------------------------------------------------------------------ have_manpages=no -@@ -1698,6 +1715,7 @@ AC_MSG_RESULT([ +@@ -1839,6 +1856,7 @@ AC_MSG_RESULT([ SysV init scripts: ${SYSTEM_SYSVINIT_PATH} SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} - Build Python: ${PYTHON} + build Python: ${PYTHON} + firmware path: ${FIRMWARE_PATH} PAM modules dir: ${with_pamlibdir} PAM configuration dir: ${with_pamconfdir} - D-Bus policy dir: ${with_dbuspolicydir} + RPM macros dir: ${with_rpmmacrosdir} diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c new file mode 100644 -index 0000000..bd8c2fb +index 000000000..bd8c2fb96 --- /dev/null +++ b/src/udev/udev-builtin-firmware.c @@ -0,0 +1,154 @@ @@ -277,7 +271,7 @@ index 0000000..bd8c2fb + .run_once = true, +}; diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c -index e6b36f1..cd9947e 100644 +index e6b36f124..cd9947e2a 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -31,6 +31,9 @@ static const struct udev_builtin *builtins[] = { @@ -291,10 +285,10 @@ index e6b36f1..cd9947e 100644 [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, [UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard, diff --git a/src/udev/udev.h b/src/udev/udev.h -index 8433e8d..d32366d 100644 +index c0cb7eae8..9f0f1cf13 100644 --- a/src/udev/udev.h +++ b/src/udev/udev.h -@@ -148,6 +148,9 @@ enum udev_builtin_cmd { +@@ -150,6 +150,9 @@ enum udev_builtin_cmd { UDEV_BUILTIN_BLKID, #endif UDEV_BUILTIN_BTRFS, @@ -304,7 +298,7 @@ index 8433e8d..d32366d 100644 UDEV_BUILTIN_HWDB, UDEV_BUILTIN_INPUT_ID, UDEV_BUILTIN_KEYBOARD, -@@ -176,6 +179,9 @@ struct udev_builtin { +@@ -178,6 +181,9 @@ struct udev_builtin { extern const struct udev_builtin udev_builtin_blkid; #endif extern const struct udev_builtin udev_builtin_btrfs; @@ -315,7 +309,7 @@ index 8433e8d..d32366d 100644 extern const struct udev_builtin udev_builtin_input_id; extern const struct udev_builtin udev_builtin_keyboard; diff --git a/src/udev/udevd.c b/src/udev/udevd.c -index d336ee0..81e5dc5 100644 +index acbddd418..20347b402 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -125,6 +125,9 @@ struct event { @@ -353,5 +347,5 @@ index d336ee0..81e5dc5 100644 if (event->devpath[common] == '/') { event->delaying_seqnum = loop_event->seqnum; -- -2.10.2 +2.13.2 diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0016-make-test-dir-configurable.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0016-make-test-dir-configurable.patch deleted file mode 100644 index 10d1df5d52..0000000000 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0016-make-test-dir-configurable.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 218bbc555a37f9373fbb7f03c744eb65109d3470 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Wed, 9 Nov 2016 20:47:37 -0800 -Subject: [PATCH 16/19] make test dir configurable - -Upstream-Status: Pending - -test maybe be run on target in cross-compile environment, and test dir -is not the compilation dir, so make it configurable - -Signed-off-by: Roy Li <rongqing.li@windriver.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - Makefile.am | 2 +- - configure.ac | 7 +++++++ - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index 229492a..e997d82 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -214,7 +214,7 @@ AM_CPPFLAGS = \ - -DROOTLIBDIR=\"$(rootlibdir)\" \ - -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \ - -DROOTHOMEDIR=\"$(roothomedir)\" \ -- -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ -+ -DTEST_DIR=\"$(testdir)/test\" \ - -I $(top_srcdir)/src \ - -I $(top_builddir)/src/basic \ - -I $(top_srcdir)/src/basic \ -diff --git a/configure.ac b/configure.ac -index 1de0066..b12e320 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1535,6 +1535,11 @@ AC_ARG_WITH([roothomedir], - [], - [with_roothomedir=/root]) - -+AC_ARG_WITH([testdir], -+ AS_HELP_STRING([--with-testdir=DIR], [test file directory]), -+ [], -+ [with_testdir=${abs_top_srcdir}]) -+ - AC_ARG_WITH([pamlibdir], - AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), - [], -@@ -1621,6 +1626,7 @@ AC_SUBST([pamconfdir], [$with_pamconfdir]) - AC_SUBST([rootprefix], [$with_rootprefix]) - AC_SUBST([rootlibdir], [$with_rootlibdir]) - AC_SUBST([roothomedir], [$with_roothomedir]) -+AC_SUBST([testdir], [$with_testdir]) - - AC_CONFIG_FILES([ - Makefile -@@ -1712,6 +1718,7 @@ AC_MSG_RESULT([ - lib dir: ${libdir} - rootlib dir: ${with_rootlibdir} - root home dir: ${with_roothomedir} -+ test dir: ${with_testdir} - SysV init scripts: ${SYSTEM_SYSVINIT_PATH} - SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} - Build Python: ${PYTHON} --- -2.10.2 - diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0017-remove-duplicate-include-uchar.h.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0017-remove-duplicate-include-uchar.h.patch index 77dbd6eec8..d2006351df 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0017-remove-duplicate-include-uchar.h.patch +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0017-remove-duplicate-include-uchar.h.patch @@ -6,6 +6,7 @@ Subject: [PATCH 17/19] remove duplicate include uchar.h missing.h already includes it Signed-off-by: Khem Raj <raj.khem@gmail.com> +Upstream-Status: Pending --- src/basic/escape.h | 1 - src/basic/utf8.h | 1 - diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0018-check-for-uchar.h-in-configure.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0018-check-for-uchar.h-in-configure.patch index 5824033b40..067b73ff35 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0018-check-for-uchar.h-in-configure.patch +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0018-check-for-uchar.h-in-configure.patch @@ -1,21 +1,23 @@ -From 7cc0b19d244023c7b3e557765b03b7971e047f29 Mon Sep 17 00:00:00 2001 +From 1355457092b02a15c646fc1c72e68b694a86dd99 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Mon, 22 Feb 2016 06:02:38 +0000 -Subject: [PATCH 18/19] check for uchar.h in configure +Subject: [PATCH 12/14] check for uchar.h in configure Use ifdef to include uchar.h Signed-off-by: Khem Raj <raj.khem@gmail.com> +Upstream-Status: Pending + --- configure.ac | 1 + src/basic/missing.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac -index b12e320..4e6dfdf 100644 +index 1150ca50e..60e7df5ee 100644 --- a/configure.ac +++ b/configure.ac -@@ -298,6 +298,7 @@ AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"]) +@@ -304,6 +304,7 @@ AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"]) # ------------------------------------------------------------------------------ @@ -24,12 +26,12 @@ index b12e320..4e6dfdf 100644 AC_CHECK_HEADERS([linux/btrfs.h], [], []) AC_CHECK_HEADERS([linux/memfd.h], [], []) diff --git a/src/basic/missing.h b/src/basic/missing.h -index 4936873..ce79404 100644 +index 25a11f351..d631b7e3e 100644 --- a/src/basic/missing.h +++ b/src/basic/missing.h -@@ -35,7 +35,9 @@ - #include <stdlib.h> +@@ -37,7 +37,9 @@ #include <sys/resource.h> + #include <sys/socket.h> #include <sys/syscall.h> +#ifdef HAVE_UCHAR_H #include <uchar.h> @@ -38,5 +40,5 @@ index 4936873..ce79404 100644 #ifdef HAVE_AUDIT -- -2.10.2 +2.13.2 diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch index 66aa4cab84..b609276201 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch @@ -1,18 +1,19 @@ -From 289554d87e4fd96cae08c0fb449bf41d5641cd24 Mon Sep 17 00:00:00 2001 +From b7c6bfe2ec5ae426e586e1d6ecadb52a97128a3f Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Wed, 9 Nov 2016 20:49:53 -0800 -Subject: [PATCH 19/19] socket-util: don't fail if libc doesn't support IDN +Subject: [PATCH 13/14] socket-util: don't fail if libc doesn't support IDN Upstream-Status: Pending Signed-off-by: Emil Renner Berthing <systemd@esmil.dk> Signed-off-by: Khem Raj <raj.khem@gmail.com> + --- src/basic/socket-util.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c -index 4ebf106..53b9a12 100644 +index 016e64aa0..d4658826e 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -47,6 +47,15 @@ @@ -29,8 +30,8 @@ index 4ebf106..53b9a12 100644 +#define NI_IDN_USE_STD3_ASCII_RULES 0 +#endif - int socket_address_parse(SocketAddress *a, const char *s) { - char *e, *n; + #ifdef ENABLE_IDN + # define IDN_FLAGS (NI_IDN|NI_IDN_USE_STD3_ASCII_RULES) -- -2.10.2 +2.13.2 diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0020-back-port-233-don-t-use-the-unified-hierarchy-for-the-systemd.patch b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0020-back-port-233-don-t-use-the-unified-hierarchy-for-the-systemd.patch deleted file mode 100644 index ef2d868048..0000000000 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd/0020-back-port-233-don-t-use-the-unified-hierarchy-for-the-systemd.patch +++ /dev/null @@ -1,51 +0,0 @@ -This is a direct backport from systemd-233's stream to fix lxc/docker. - -% lxc-start -n container -F -lxc-start: cgfsng.c: parse_hierarchies: 825 Failed to find current cgroup for controller 'name=systemd' -lxc-start: cgfsng.c: all_controllers_found: 431 no systemd controller mountpoint found -lxc-start: start.c: lxc_spawn: 1082 failed initializing cgroup support -lxc-start: start.c: __lxc_start: 1332 failed to spawn 'container' -lxc-start: lxc_start.c: main: 344 The container failed to start. -lxc-start: lxc_start.c: main: 348 Additional information can be obtained by setting the --logfile and --logpriority options. - -## begin backport ## - -From 843d5baf6aad6c53fc00ea8d95d83209a4f92de1 Mon Sep 17 00:00:00 2001 -From: Martin Pitt <martin.pitt@ubuntu.com> -Date: Thu, 10 Nov 2016 05:33:13 +0100 -Subject: [PATCH] core: don't use the unified hierarchy for the systemd cgroup - yet (#4628) - -Too many things don't get along with the unified hierarchy yet: - - * https://github.com/opencontainers/runc/issues/1175 - * https://github.com/docker/docker/issues/28109 - * https://github.com/lxc/lxc/issues/1280 - -So revert the default to the legacy hierarchy for now. Developers of the above -software can opt into the unified hierarchy with -"systemd.legacy_systemd_cgroup_controller=0". ---- - src/basic/cgroup-util.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c -index 5e73753..dc13025 100644 ---- a/src/basic/cgroup-util.c -+++ b/src/basic/cgroup-util.c -@@ -2423,10 +2423,10 @@ bool cg_is_unified_systemd_controller_wanted(void) { - - r = get_proc_cmdline_key("systemd.legacy_systemd_cgroup_controller=", &value); - if (r < 0) -- return true; -+ return false; - - if (r == 0) -- wanted = true; -+ wanted = false; - else - wanted = parse_boolean(value) <= 0; - } --- -2.10.1 - diff --git a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd_232.bb b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd_234.bb index 25fe496417..9ce27bf67a 100644 --- a/import-layers/yocto-poky/meta/recipes-core/systemd/systemd_232.bb +++ b/import-layers/yocto-poky/meta/recipes-core/systemd/systemd_234.bb @@ -10,164 +10,189 @@ SECTION = "base/shell" inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext bash-completion manpages -SRC_URI += " \ +SRC_URI = "git://github.com/systemd/systemd.git;protocol=git \ file://touchscreen.rules \ file://00-create-volatile.conf \ file://init \ file://run-ptest \ - file://0003-define-exp10-if-missing.patch \ file://0004-Use-getenv-when-secure-versions-are-not-available.patch \ file://0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ - file://0006-configure-Check-for-additional-features-that-uclibc-.patch \ file://0007-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch \ - file://0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch \ - file://0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch \ file://0010-implment-systemd-sysv-install-for-OE.patch \ file://0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch \ file://0012-rules-whitelist-hd-devices.patch \ file://0013-Make-root-s-home-directory-configurable.patch \ file://0014-Revert-rules-remove-firmware-loading-rules.patch \ file://0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch \ - file://0016-make-test-dir-configurable.patch \ file://0017-remove-duplicate-include-uchar.h.patch \ file://0018-check-for-uchar.h-in-configure.patch \ file://0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch \ - file://0020-back-port-233-don-t-use-the-unified-hierarchy-for-the-systemd.patch \ - file://0001-core-load-fragment-refuse-units-with-errors-in-certa.patch \ + file://0001-add-fallback-parse_printf_format-implementation.patch \ + file://0002-src-basic-missing.h-check-for-missing-strndupa.patch \ + file://0003-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ + file://0004-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch \ + file://0006-Include-netinet-if_ether.h.patch \ + file://0007-check-for-missing-canonicalize_file_name.patch \ + file://0008-Do-not-enable-nss-tests.patch \ + file://0009-test-hexdecoct.c-Include-missing.h-form-strndupa.patch \ + file://0010-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ + file://0011-don-t-use-glibc-specific-qsort_r.patch \ + file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ + file://0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ + file://0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch \ + file://0001-Use-uintmax_t-for-handling-rlim_t.patch \ + file://0001-core-evaluate-presets-after-generators-have-run-6526.patch \ + file://0001-main-skip-many-initialization-steps-when-running-in-.patch \ + " +SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch" + +PAM_PLUGINS = " \ + pam-plugin-unix \ + pam-plugin-loginuid \ + pam-plugin-keyinit \ " -SRC_URI_append_libc-uclibc = "\ - file://0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch \ + +PACKAGECONFIG ??= " \ + ${@bb.utils.filter('DISTRO_FEATURES', 'efi ldconfig pam selinux usrmerge', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ + backlight \ + binfmt \ + firstboot \ + hibernate \ + hostnamed \ + ima \ + localed \ + logind \ + machined \ + myhostname \ + networkd \ + nss \ + polkit \ + quotacheck \ + randomseed \ + resolved \ + smack \ + sysusers \ + timedated \ + timesyncd \ + utmp \ + vconsole \ + xz \ " -SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch" -PACKAGECONFIG ??= "xz \ - ${@bb.utils.filter('DISTRO_FEATURES', 'efi pam selinux ldconfig', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ - binfmt \ - randomseed \ - machined \ - backlight \ - vconsole \ - quotacheck \ - hostnamed \ - ${@bb.utils.contains('TCLIBC', 'glibc', 'myhostname sysusers', '', d)} \ - hibernate \ - timedated \ - timesyncd \ - localed \ - ima \ - smack \ - logind \ - firstboot \ - utmp \ - polkit \ +PACKAGECONFIG_remove_libc-musl = " \ + localed \ + myhostname \ + nss \ + resolved \ + selinux \ + smack \ + sysusers \ + utmp \ " -PACKAGECONFIG_remove_libc-musl = "selinux" -PACKAGECONFIG_remove_libc-musl = "smack" # 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[journal-upload] = "--enable-libcurl,--disable-libcurl,curl" +PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit" +PACKAGECONFIG[backlight] = "--enable-backlight,--disable-backlight" +PACKAGECONFIG[binfmt] = "--enable-binfmt,--disable-binfmt" +PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" +PACKAGECONFIG[coredump] = "--enable-coredump,--disable-coredump" +PACKAGECONFIG[cryptsetup] = "--enable-libcryptsetup,--disable-libcryptsetup,cryptsetup" +PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus" +PACKAGECONFIG[efi] = "--enable-efi,--disable-efi" +PACKAGECONFIG[elfutils] = "--enable-elfutils,--disable-elfutils,elfutils" +PACKAGECONFIG[firstboot] = "--enable-firstboot,--disable-firstboot" # Sign the journal for anti-tampering PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt" -PACKAGECONFIG[cryptsetup] = "--enable-libcryptsetup,--disable-libcryptsetup,cryptsetup" +PACKAGECONFIG[hibernate] = "--enable-hibernate,--disable-hibernate" +PACKAGECONFIG[hostnamed] = "--enable-hostnamed,--disable-hostnamed" +PACKAGECONFIG[ima] = "--enable-ima,--disable-ima" +# importd requires curl/xz/zlib/bzip2/gcrypt +PACKAGECONFIG[importd] = "--enable-importd,--disable-importd" +# Update NAT firewall rules +PACKAGECONFIG[iptc] = "--enable-libiptc,--disable-libiptc,iptables" +PACKAGECONFIG[journal-upload] = "--enable-libcurl,--disable-libcurl,curl" +PACKAGECONFIG[ldconfig] = "--enable-ldconfig,--disable-ldconfig" +PACKAGECONFIG[libidn] = "--enable-libidn,--disable-libidn,libidn" +PACKAGECONFIG[localed] = "--enable-localed,--disable-localed" +PACKAGECONFIG[logind] = "--enable-logind,--disable-logind" +PACKAGECONFIG[lz4] = "--enable-lz4,--disable-lz4,lz4" +PACKAGECONFIG[machined] = "--enable-machined,--disable-machined" +PACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicrohttpd" -PACKAGECONFIG[elfutils] = "--enable-elfutils,--disable-elfutils,elfutils" -PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved" +PACKAGECONFIG[myhostname] = "--enable-myhostname,--disable-myhostname" PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd" -PACKAGECONFIG[machined] = "--enable-machined,--disable-machined" -PACKAGECONFIG[backlight] = "--enable-backlight,--disable-backlight" -PACKAGECONFIG[vconsole] = "--enable-vconsole,--disable-vconsole,,${PN}-vconsole-setup" +PACKAGECONFIG[nss] = "--enable-nss-systemd,--disable-nss-systemd" +PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam,${PAM_PLUGINS}" +PACKAGECONFIG[polkit] = "--enable-polkit,--disable-polkit" +PACKAGECONFIG[qrencode] = "--enable-qrencode,--disable-qrencode,qrencode" PACKAGECONFIG[quotacheck] = "--enable-quotacheck,--disable-quotacheck" -PACKAGECONFIG[hostnamed] = "--enable-hostnamed,--disable-hostnamed" -PACKAGECONFIG[myhostname] = "--enable-myhostname,--disable-myhostname" +PACKAGECONFIG[randomseed] = "--enable-randomseed,--disable-randomseed" +PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved" PACKAGECONFIG[rfkill] = "--enable-rfkill,--disable-rfkill" -PACKAGECONFIG[hibernate] = "--enable-hibernate,--disable-hibernate" -PACKAGECONFIG[timedated] = "--enable-timedated,--disable-timedated" -PACKAGECONFIG[timesyncd] = "--enable-timesyncd,--disable-timesyncd" -PACKAGECONFIG[localed] = "--enable-localed,--disable-localed" -PACKAGECONFIG[efi] = "--enable-efi,--disable-efi" -PACKAGECONFIG[ima] = "--enable-ima,--disable-ima" -PACKAGECONFIG[smack] = "--enable-smack,--disable-smack" # libseccomp is found in meta-security PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" -PACKAGECONFIG[logind] = "--enable-logind,--disable-logind" +PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,initscripts-sushell" +PACKAGECONFIG[smack] = "--enable-smack,--disable-smack" PACKAGECONFIG[sysusers] = "--enable-sysusers,--disable-sysusers" -PACKAGECONFIG[firstboot] = "--enable-firstboot,--disable-firstboot" -PACKAGECONFIG[randomseed] = "--enable-randomseed,--disable-randomseed" -PACKAGECONFIG[binfmt] = "--enable-binfmt,--disable-binfmt" +PACKAGECONFIG[timedated] = "--enable-timedated,--disable-timedated" +PACKAGECONFIG[timesyncd] = "--enable-timesyncd,--disable-timesyncd" +PACKAGECONFIG[usrmerge] = "--disable-split-usr,--enable-split-usr" PACKAGECONFIG[utmp] = "--enable-utmp,--disable-utmp" -PACKAGECONFIG[polkit] = "--enable-polkit,--disable-polkit" -# importd requires curl/xz/zlib/bzip2/gcrypt -PACKAGECONFIG[importd] = "--enable-importd,--disable-importd" -PACKAGECONFIG[libidn] = "--enable-libidn,--disable-libidn,libidn" -PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit" -PACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" -PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam" +PACKAGECONFIG[valgrind] = "ac_cv_header_valgrind_memcheck_h=yes ac_cv_header_valgrind_valgrind_h=yes,ac_cv_header_valgrind_memcheck_h=no ac_cv_header_valgrind_valgrind_h=no,valgrind" +PACKAGECONFIG[vconsole] = "--enable-vconsole,--disable-vconsole,,${PN}-vconsole-setup" # Verify keymaps on locale change PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon" -# Update NAT firewall rules -PACKAGECONFIG[iptc] = "--enable-libiptc,--disable-libiptc,iptables" -PACKAGECONFIG[ldconfig] = "--enable-ldconfig,--disable-ldconfig,," -PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux" -PACKAGECONFIG[valgrind] = "ac_cv_header_valgrind_memcheck_h=yes ac_cv_header_valgrind_valgrind_h=yes ,ac_cv_header_valgrind_memcheck_h=no ac_cv_header_valgrind_valgrind_h=no ,valgrind" -PACKAGECONFIG[qrencode] = "--enable-qrencode,--disable-qrencode,qrencode" -PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus" -PACKAGECONFIG[coredump] = "--enable-coredump,--disable-coredump" -PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" -PACKAGECONFIG[lz4] = "--enable-lz4,--disable-lz4,lz4" PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz" PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" -CACHED_CONFIGUREVARS += "ac_cv_path_KILL=${base_bindir}/kill" -CACHED_CONFIGUREVARS += "ac_cv_path_KMOD=${base_bindir}/kmod" -CACHED_CONFIGUREVARS += "ac_cv_path_QUOTACHECK=${sbindir}/quotacheck" -CACHED_CONFIGUREVARS += "ac_cv_path_QUOTAON=${sbindir}/quotaon" -CACHED_CONFIGUREVARS += "ac_cv_path_SULOGIN=${base_sbindir}/sulogin" +# Hardcode target binary paths to avoid AC_PROG_PATH in the systemd +# configure script detecting and setting paths from sysroot or host. +CACHED_CONFIGUREVARS_class-target = " \ + ac_cv_path_KEXEC=${sbindir}/kexec \ + ac_cv_path_KILL=${base_bindir}/kill \ + ac_cv_path_KMOD=${base_bindir}/kmod \ + ac_cv_path_MOUNT_PATH=${base_bindir}/mount \ + ac_cv_path_QUOTACHECK=${sbindir}/quotacheck \ + ac_cv_path_QUOTAON=${sbindir}/quotaon \ + ac_cv_path_SULOGIN=${base_sbindir}/sulogin \ + ac_cv_path_UMOUNT_PATH=${base_bindir}/umount \ +" # Helper variables to clarify locations. This mirrors the logic in systemd's # build system. -rootprefix ?= "${base_prefix}" +rootprefix ?= "${root_prefix}" rootlibdir ?= "${base_libdir}" rootlibexecdir = "${rootprefix}/lib" -CACHED_CONFIGUREVARS_class-target = "\ - ac_cv_path_MOUNT_PATH=${base_bindir}/mount \ - ac_cv_path_UMOUNT_PATH=${base_bindir}/umount \ - ac_cv_path_KMOD=${base_bindir}/kmod \ - ac_cv_path_KILL=${base_bindir}/kill \ - ac_cv_path_SULOGIN=${base_sbindir}/sulogin \ - ac_cv_path_KEXEC=${sbindir}/kexec \ - ac_cv_path_QUOTACHECK=${sbindir}/quotacheck \ - ac_cv_path_QUOTAON=${sbindir}/quotaon \ - " - -EXTRA_OECONF = " --with-rootprefix=${rootprefix} \ - --with-rootlibdir=${rootlibdir} \ - --with-roothomedir=${ROOT_HOME} \ - --enable-split-usr \ - --without-python \ - --with-sysvrcnd-path=${sysconfdir} \ - --with-firmware-path=/lib/firmware \ - --with-testdir=${PTEST_PATH} \ - " +EXTRA_OECONF = " \ + --without-python \ + --with-roothomedir=${ROOT_HOME} \ + --with-rootlibdir=${rootlibdir} \ + --with-rootprefix=${rootprefix} \ + --with-sysvrcnd-path=${sysconfdir} \ + --with-firmware-path=${nonarch_base_libdir}/firmware \ +" + # per the systemd README, define VALGRIND=1 to run under valgrind CFLAGS .= "${@bb.utils.contains('PACKAGECONFIG', 'valgrind', ' -DVALGRIND=1', '', d)}" # disable problematic GCC 5.2 optimizations [YOCTO #8291] FULL_OPTIMIZATION_append_arm = " -fno-schedule-insns -fno-schedule-insns2" -# Avoid login failure on qemumips64 when pam is enabled -FULL_OPTIMIZATION_append_mips64 = " -fno-tree-switch-conversion -fno-tree-tail-merge" +COMPILER_NM ?= "${HOST_PREFIX}gcc-nm" +COMPILER_AR ?= "${HOST_PREFIX}gcc-ar" +COMPILER_RANLIB ?= "${HOST_PREFIX}gcc-ranlib" do_configure_prepend() { - export NM="${HOST_PREFIX}gcc-nm" - export AR="${HOST_PREFIX}gcc-ar" - export RANLIB="${HOST_PREFIX}gcc-ranlib" + export NM="${COMPILER_NM}" + export AR="${COMPILER_AR}" + export RANLIB="${COMPILER_RANLIB}" export KMOD="${base_bindir}/kmod" if [ -d ${S}/units.pre_sed ] ; then cp -r ${S}/units.pre_sed ${S}/units @@ -194,7 +219,6 @@ do_install() { # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable touch ${D}${sysconfdir}/machine-id - install -d ${D}${sysconfdir}/udev/rules.d/ install -d ${D}${sysconfdir}/tmpfiles.d install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/ @@ -243,37 +267,46 @@ do_install() { 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 + 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 } do_install_ptest () { - # install data files needed for tests - install -d ${D}${PTEST_PATH}/tests/test - cp -rfL ${S}/test/* ${D}${PTEST_PATH}/tests/test - # python is disabled for systemd, thus removing these python testing scripts - rm ${D}${PTEST_PATH}/tests/test/*.py - sed -i 's/"tree"/"ls"/' ${D}${PTEST_PATH}/tests/test/udev-test.pl + # install data files needed for tests + install -d ${D}${PTEST_PATH}/tests/test + cp -rfL ${S}/test/* ${D}${PTEST_PATH}/tests/test + # python is disabled for systemd, thus removing these python testing scripts + rm ${D}${PTEST_PATH}/tests/test/*.py + sed -i 's/"tree"/"ls"/' ${D}${PTEST_PATH}/tests/test/udev-test.pl - install -d ${D}${PTEST_PATH}/tests/catalog - install ${S}/catalog/* ${D}${PTEST_PATH}/tests/catalog/ + install -d ${D}${PTEST_PATH}/tests/catalog + install ${S}/catalog/* ${D}${PTEST_PATH}/tests/catalog/ - install -D ${S}/build-aux/test-driver ${D}${PTEST_PATH}/tests/build-aux/test-driver + install -D ${S}/build-aux/test-driver ${D}${PTEST_PATH}/tests/build-aux/test-driver - install -d ${D}${PTEST_PATH}/tests/rules - install ${B}/rules/* ${D}${PTEST_PATH}/tests/rules/ + install -d ${D}${PTEST_PATH}/tests/rules + install ${B}/rules/* ${D}${PTEST_PATH}/tests/rules/ - # This directory needs to be there for udev-test.pl to work. - install -d ${D}${libdir}/udev/rules.d + # This directory needs to be there for udev-test.pl to work. + install -d ${D}${libdir}/udev/rules.d - # install actual test binaries - install -m 0755 ${B}/test-* ${D}${PTEST_PATH}/tests/ - install -m 0755 ${B}/.libs/test-* ${D}${PTEST_PATH}/tests/ + # install actual test binaries + install -m 0755 ${B}/test-* ${D}${PTEST_PATH}/tests/ + install -m 0755 ${B}/.libs/test-* ${D}${PTEST_PATH}/tests/ - install ${B}/Makefile ${D}${PTEST_PATH}/tests/ + install ${B}/Makefile ${D}${PTEST_PATH}/tests/ } python populate_packages_prepend (){ @@ -290,7 +323,6 @@ PACKAGES =+ "\ ${PN}-kernel-install \ ${PN}-rpm-macros \ ${PN}-binfmt \ - ${PN}-pam \ ${PN}-zsh-completion \ ${PN}-xorg-xinitrc \ ${PN}-container \ @@ -311,6 +343,7 @@ USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--sy USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;', '', d)}" USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /bin/nologin systemd-coredump;', '', 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', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal" USERADD_PARAM_${PN}-extra-utils += "--system -d / -M --shell /bin/nologin systemd-bus-proxy;" @@ -382,6 +415,7 @@ FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.c ${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.machine1.conf \ ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \ ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \ " @@ -450,7 +484,7 @@ FILES_${PN} = " ${base_bindir}/* \ ${sysconfdir}/tmpfiles.d/ \ ${sysconfdir}/xdg/ \ ${sysconfdir}/init.d/README \ - ${sysconfdir}/resolv.conf \ + ${sysconfdir}/resolv-conf.systemd \ ${rootlibexecdir}/systemd/* \ ${systemd_unitdir}/* \ ${base_libdir}/security/*.so \ @@ -468,22 +502,30 @@ FILES_${PN} = " ${base_bindir}/* \ ${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 \ + ${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 \ " FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" -RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})" +RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV}) util-linux-agetty" +RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" RDEPENDS_${PN} += "volatile-binds update-rc.d" -RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)} \ - systemd-extra-utils \ +RRECOMMENDS_${PN} += "systemd-extra-utils \ systemd-compat-units udev-hwdb \ - util-linux-agetty util-linux-fsck e2fsprogs-e2fsck \ + util-linux-fsck e2fsprogs-e2fsck \ kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \ os-release \ " @@ -534,7 +576,7 @@ python __anonymous() { # TODO: # u-a for runlevel and telinit -ALTERNATIVE_${PN} = "init halt reboot shutdown poweroff runlevel" +ALTERNATIVE_${PN} = "init halt reboot shutdown poweroff runlevel resolv-conf" ALTERNATIVE_TARGET[init] = "${rootlibexecdir}/systemd/systemd" ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init" @@ -560,6 +602,10 @@ ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl" ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel" ALTERNATIVE_PRIORITY[runlevel] ?= "300" +ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd" +ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf" +ALTERNATIVE_PRIORITY[resolv-conf] ?= "50" + pkg_postinst_${PN} () { sed -e '/^hosts:/s/\s*\<myhostname\>//' \ -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \ @@ -592,8 +638,4 @@ pkg_prerm_udev-hwdb () { python () { if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") - - import re - if re.match('.*musl*', d.getVar('TARGET_OS')) != None: - raise bb.parse.SkipPackage("Not _yet_ supported on musl based targets") } |