From fcaa030fa3c6eb0980cc635b92d6819682cf7742 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 14 Dec 2015 05:55:35 +0000 Subject: systemd: Upgrade to 228 Forward port all patches and format them to be git am'able Drop patches specific to uclibc's missing features which now are there in uclibc-ng Signed-off-by: Khem Raj Signed-off-by: Ross Burton --- .../systemd/0001-define-exp10-if-missing.patch | 33 ++ .../systemd/0001-fix-build-on-uClibc-exp10.patch | 22 -- ...r-getty-to-agetty-in-console-setup-system.patch | 44 --- ...r-getty-to-agetty-in-console-setup-system.patch | 44 +++ ...nv-when-secure-versions-are-not-available.patch | 38 ++ ...t-install-dependency-links-at-install-tim.patch | 71 ---- ...heck-for-additional-features-that-uclibc-.patch | 45 --- ....c-Change-the-default-device-timeout-to-2.patch | 33 ++ ...t-install-dependency-links-at-install-tim.patch | 74 ++++ ...wn-Use-execvpe-only-when-libc-supports-it.patch | 38 -- ...heck-for-additional-features-that-uclibc-.patch | 48 +++ ...nal-Use-posix-fallocate-only-if-available.patch | 96 ----- ...wn-Use-execvpe-only-when-libc-supports-it.patch | 41 ++ ...til-Use-mkostemp-only-if-libc-supports-it.patch | 42 -- ...-unimplemented-_SC_PHYS_PAGES-system-conf.patch | 16 +- ...0009-implment-systemd-sysv-install-for-OE.patch | 43 +++ ...tor-add-support-for-executing-scripts-und.patch | 143 ------- ...0-Make-root-s-home-directory-configurable.patch | 181 --------- ...nes-Build-conditionally-when-HAVE_MYHOSTN.patch | 38 ++ .../systemd/0011-rules-whitelist-hd-devices.patch | 32 ++ ...0011-systemd-user-avoid-using-system-auth.patch | 31 -- ...0012-implment-systemd-sysv-install-for-OE.patch | 40 -- ...tor-add-support-for-executing-scripts-und.patch | 143 +++++++ ...3-Make-root-s-home-directory-configurable.patch | 184 +++++++++ ...evert-rules-remove-firmware-loading-rules.patch | 28 -- ...0014-systemd-user-avoid-using-system-auth.patch | 36 ++ ...evert-rules-remove-firmware-loading-rules.patch | 28 ++ ...-remove-userspace-firmware-loading-suppor.patch | 364 ------------------ ...-remove-userspace-firmware-loading-suppor.patch | 364 ++++++++++++++++++ ...nv-when-secure-versions-are-not-available.patch | 39 -- ....c-Change-the-default-device-timeout-to-2.patch | 31 -- .../systemd/rules-whitelist-hd-devices.patch | 32 -- meta/recipes-core/systemd/systemd_225.bb | 424 --------------------- meta/recipes-core/systemd/systemd_228.bb | 422 ++++++++++++++++++++ 34 files changed, 1609 insertions(+), 1679 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd/0001-define-exp10-if-missing.patch delete mode 100644 meta/recipes-core/systemd/systemd/0001-fix-build-on-uClibc-exp10.patch delete mode 100644 meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch create mode 100644 meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch create mode 100644 meta/recipes-core/systemd/systemd/0003-Use-getenv-when-secure-versions-are-not-available.patch delete mode 100644 meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch delete mode 100644 meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch create mode 100644 meta/recipes-core/systemd/systemd/0004-core-device.c-Change-the-default-device-timeout-to-2.patch create mode 100644 meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch delete mode 100644 meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch create mode 100644 meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch delete mode 100644 meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch create mode 100644 meta/recipes-core/systemd/systemd/0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch delete mode 100644 meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch create mode 100644 meta/recipes-core/systemd/systemd/0009-implment-systemd-sysv-install-for-OE.patch delete mode 100644 meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch delete mode 100644 meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch create mode 100644 meta/recipes-core/systemd/systemd/0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch create mode 100644 meta/recipes-core/systemd/systemd/0011-rules-whitelist-hd-devices.patch delete mode 100644 meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch delete mode 100644 meta/recipes-core/systemd/systemd/0012-implment-systemd-sysv-install-for-OE.patch create mode 100644 meta/recipes-core/systemd/systemd/0012-sysv-generator-add-support-for-executing-scripts-und.patch create mode 100644 meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch delete mode 100644 meta/recipes-core/systemd/systemd/0014-Revert-rules-remove-firmware-loading-rules.patch create mode 100644 meta/recipes-core/systemd/systemd/0014-systemd-user-avoid-using-system-auth.patch create mode 100644 meta/recipes-core/systemd/systemd/0015-Revert-rules-remove-firmware-loading-rules.patch delete mode 100644 meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch create mode 100644 meta/recipes-core/systemd/systemd/0016-Revert-udev-remove-userspace-firmware-loading-suppor.patch delete mode 100644 meta/recipes-core/systemd/systemd/0022-Use-getenv-when-secure-versions-are-not-available.patch delete mode 100644 meta/recipes-core/systemd/systemd/qemuall_io_latency-core-device.c-Change-the-default-device-timeout-to-2.patch delete mode 100644 meta/recipes-core/systemd/systemd/rules-whitelist-hd-devices.patch delete mode 100644 meta/recipes-core/systemd/systemd_225.bb create mode 100644 meta/recipes-core/systemd/systemd_228.bb diff --git a/meta/recipes-core/systemd/systemd/0001-define-exp10-if-missing.patch b/meta/recipes-core/systemd/systemd/0001-define-exp10-if-missing.patch new file mode 100644 index 0000000000..8bb775ffa5 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-define-exp10-if-missing.patch @@ -0,0 +1,33 @@ +From ddad25c809846e08ea39bef49cc668f95d53304a Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 14 Dec 2015 00:42:49 +0000 +Subject: [PATCH 01/16] 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 +Signed-off-by: Khem Raj +--- + src/basic/missing.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/basic/missing.h b/src/basic/missing.h +index d539ed0..09a233b 100644 +--- a/src/basic/missing.h ++++ b/src/basic/missing.h +@@ -1125,3 +1125,8 @@ static inline key_serial_t request_key(const char *type, const char *description + #ifndef KEY_SPEC_USER_KEYRING + #define KEY_SPEC_USER_KEYRING -4 + #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__ */ +-- +2.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0001-fix-build-on-uClibc-exp10.patch b/meta/recipes-core/systemd/systemd/0001-fix-build-on-uClibc-exp10.patch deleted file mode 100644 index 76ce4b7813..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-fix-build-on-uClibc-exp10.patch +++ /dev/null @@ -1,22 +0,0 @@ -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. - - -Signed-off-by: Samuel Martin - -Upstream-Status: Pending - -Index: git/src/basic/missing.h -=================================================================== ---- git.orig/src/basic/missing.h -+++ git/src/basic/missing.h -@@ -1036,3 +1036,8 @@ static inline int kcmp(pid_t pid1, pid_t - #ifndef INPUT_PROP_ACCELEROMETER - #define INPUT_PROP_ACCELEROMETER 0x06 - #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__ */ diff --git a/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch b/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch deleted file mode 100644 index b6ab5effc2..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 100e50604efc4032001a2de6a6b47853c0003817 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 05:29:15 +0000 -Subject: [PATCH 01/11] units: Prefer getty to agetty in console setup systemd - units - -Upstream-Status: Inappropriate [configuration specific] - -Signed-off-by: Maxime Ripard -Signed-off-by: Khem Raj ---- - 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 46164ab..bdf6ec8 100644 ---- a/units/getty@.service.m4 -+++ b/units/getty@.service.m4 -@@ -27,7 +27,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.1.4 - diff --git a/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch b/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch new file mode 100644 index 0000000000..55ff0ce15f --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch @@ -0,0 +1,44 @@ +From bfb6562cdbec73d03765ce707e9e0cac138fd223 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 20 Feb 2015 05:29:15 +0000 +Subject: [PATCH 02/16] units: Prefer getty to agetty in console setup systemd + units + +Upstream-Status: Inappropriate [configuration specific] + +Signed-off-by: Maxime Ripard +Signed-off-by: Khem Raj +--- + 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 46164ab..bdf6ec8 100644 +--- a/units/getty@.service.m4 ++++ b/units/getty@.service.m4 +@@ -27,7 +27,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.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0003-Use-getenv-when-secure-versions-are-not-available.patch b/meta/recipes-core/systemd/systemd/0003-Use-getenv-when-secure-versions-are-not-available.patch new file mode 100644 index 0000000000..cbf69d109a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0003-Use-getenv-when-secure-versions-are-not-available.patch @@ -0,0 +1,38 @@ +From 9e79bb4bea758f25803e9f7ff2c5835ac4204230 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 12 Sep 2015 19:10:04 +0000 +Subject: [PATCH 03/16] Use getenv when secure versions are not available + +musl doesnt implement secure version, so we default +to it if configure does not detect a secure imeplementation + +Signed-off-by: Khem Raj +Upstream-Status: Denied +--- + src/basic/missing.h | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/basic/missing.h b/src/basic/missing.h +index 09a233b..3c37466 100644 +--- a/src/basic/missing.h ++++ b/src/basic/missing.h +@@ -582,13 +582,14 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle + return syscall(__NR_name_to_handle_at, fd, name, handle, mnt_id, flags); + } + #endif +- +-#ifndef HAVE_SECURE_GETENV ++#ifdef HAVE_SECURE_GETENV + # ifdef HAVE___SECURE_GETENV + # define secure_getenv __secure_getenv + # else + # error "neither secure_getenv nor __secure_getenv are available" + # endif ++#else ++# define secure_getenv getenv + #endif + + #ifndef CIFS_MAGIC_NUMBER +-- +2.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch deleted file mode 100644 index 0e20fd0548..0000000000 --- a/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 184a89caacfa00f07e7275bca592bd7dda1b541e Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 05:03:44 +0000 -Subject: [PATCH 03/11] binfmt: Don't install dependency links at install time - for the binfmt services - -use [Install] blocks so that they get created when the service is enabled -like a traditional service. - -The [Install] blocks were rejected upstream as they don't have a way to -"enable" -it on install without static symlinks which can't be disabled, only -masked. We -however can do that in a postinst. - -Upstream-Status: Denied - -Signed-off-by: Ross Burton -Signed-off-by: Khem Raj ---- - Makefile.am | 4 ---- - units/proc-sys-fs-binfmt_misc.automount | 3 +++ - units/systemd-binfmt.service.in | 5 +++++ - 3 files changed, 8 insertions(+), 4 deletions(-) - -Index: git/Makefile.am -=================================================================== ---- git.orig/Makefile.am -+++ git/Makefile.am -@@ -4271,10 +4271,6 @@ INSTALL_DIRS += \ - $(prefix)/lib/binfmt.d \ - $(sysconfdir)/binfmt.d - --SYSINIT_TARGET_WANTS += \ -- systemd-binfmt.service \ -- proc-sys-fs-binfmt_misc.automount -- - endif - - EXTRA_DIST += \ -Index: git/units/proc-sys-fs-binfmt_misc.automount -=================================================================== ---- git.orig/units/proc-sys-fs-binfmt_misc.automount -+++ git/units/proc-sys-fs-binfmt_misc.automount -@@ -16,3 +16,6 @@ ConditionPathIsReadWrite=/proc/sys/ - - [Automount] - Where=/proc/sys/fs/binfmt_misc -+ -+[Install] -+WantedBy=sysinit.target -Index: git/units/systemd-binfmt.service.in -=================================================================== ---- git.orig/units/systemd-binfmt.service.in -+++ git/units/systemd-binfmt.service.in -@@ -11,6 +11,8 @@ Documentation=man:systemd-binfmt.service - Documentation=https://www.kernel.org/doc/Documentation/binfmt_misc.txt - DefaultDependencies=no - Conflicts=shutdown.target -+Wants=proc-sys-fs-binfmt_misc.automount -+ - After=proc-sys-fs-binfmt_misc.automount - Before=sysinit.target shutdown.target - ConditionPathIsReadWrite=/proc/sys/ -@@ -25,3 +27,6 @@ Type=oneshot - RemainAfterExit=yes - ExecStart=@rootlibexecdir@/systemd-binfmt - TimeoutSec=90s -+ -+[Install] -+WantedBy=sysinit.target diff --git a/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch b/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch deleted file mode 100644 index 8078da9bb4..0000000000 --- a/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 4e2e8dbf3f23ab7dca32286cc0f37bff6ac49e22 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 05:05:45 +0000 -Subject: [PATCH 04/11] 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 ---- - configure.ac | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -Index: git/configure.ac -=================================================================== ---- git.orig/configure.ac -+++ git/configure.ac -@@ -110,6 +110,24 @@ AC_PATH_PROG([UMOUNT_PATH], [umount], [/ - - 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 -+ ],[ -+ 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) diff --git a/meta/recipes-core/systemd/systemd/0004-core-device.c-Change-the-default-device-timeout-to-2.patch b/meta/recipes-core/systemd/systemd/0004-core-device.c-Change-the-default-device-timeout-to-2.patch new file mode 100644 index 0000000000..74629fc82a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0004-core-device.c-Change-the-default-device-timeout-to-2.patch @@ -0,0 +1,33 @@ +From ef867afd27e8fed558e82430759d8d2c7efb6608 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 14 Dec 2015 04:09:19 +0000 +Subject: [PATCH 04/16] core/device.c: Change the default device timeout to 240 + sec. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [Specific case QEMU/AB] + +Signed-off-by: Aníbal Limón +Signed-off-by: Khem Raj +--- + 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 bcd4d11..f41bb54 100644 +--- a/src/core/device.c ++++ b/src/core/device.c +@@ -114,7 +114,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->ignore_on_isolate = true; + } +-- +2.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch new file mode 100644 index 0000000000..0b75facbaa --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch @@ -0,0 +1,74 @@ +From 319873d22a6b1225ae41aa38bc976e723326ba20 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 20 Feb 2015 05:03:44 +0000 +Subject: [PATCH 05/16] binfmt: Don't install dependency links at install time + for the binfmt services + +use [Install] blocks so that they get created when the service is enabled +like a traditional service. + +The [Install] blocks were rejected upstream as they don't have a way to +"enable" +it on install without static symlinks which can't be disabled, only +masked. We +however can do that in a postinst. + +Upstream-Status: Denied + +Signed-off-by: Ross Burton +Signed-off-by: Khem Raj +--- + Makefile.am | 4 ---- + units/proc-sys-fs-binfmt_misc.automount | 3 +++ + units/systemd-binfmt.service.in | 5 +++++ + 3 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 00a92e3..4c1143a 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -4455,10 +4455,6 @@ INSTALL_DIRS += \ + $(prefix)/lib/binfmt.d \ + $(sysconfdir)/binfmt.d + +-SYSINIT_TARGET_WANTS += \ +- systemd-binfmt.service \ +- proc-sys-fs-binfmt_misc.automount +- + endif + + EXTRA_DIST += \ +diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount +index 6be3893..709adef 100644 +--- a/units/proc-sys-fs-binfmt_misc.automount ++++ b/units/proc-sys-fs-binfmt_misc.automount +@@ -16,3 +16,6 @@ ConditionPathIsReadWrite=/proc/sys/ + + [Automount] + Where=/proc/sys/fs/binfmt_misc ++ ++[Install] ++WantedBy=sysinit.target +diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in +index d53073e..8c57ee0 100644 +--- a/units/systemd-binfmt.service.in ++++ b/units/systemd-binfmt.service.in +@@ -11,6 +11,8 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5) + Documentation=https://www.kernel.org/doc/Documentation/binfmt_misc.txt + DefaultDependencies=no + Conflicts=shutdown.target ++Wants=proc-sys-fs-binfmt_misc.automount ++ + After=proc-sys-fs-binfmt_misc.automount + Before=sysinit.target shutdown.target + ConditionPathIsReadWrite=/proc/sys/ +@@ -25,3 +27,6 @@ Type=oneshot + RemainAfterExit=yes + ExecStart=@rootlibexecdir@/systemd-binfmt + TimeoutSec=90s ++ ++[Install] ++WantedBy=sysinit.target +-- +2.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch b/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch deleted file mode 100644 index 55a0088c65..0000000000 --- a/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a7417c2e6950d55c22c1b0d15783898b8ff229ef Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 05:10:37 +0000 -Subject: [PATCH 05/11] nspawn: Use execvpe only when libc supports it - -Upstream-Status: Denied [no desire for uclibc support] - -Signed-off-by: Khem Raj ---- - src/nspawn/nspawn.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -Index: git/src/nspawn/nspawn.c -=================================================================== ---- git.orig/src/nspawn/nspawn.c -+++ git/src/nspawn/nspawn.c -@@ -143,6 +143,8 @@ typedef struct CustomMount { - char **lower; - } CustomMount; - -+#include "config.h" -+ - static char *arg_directory = NULL; - static char *arg_template = NULL; - static char *arg_user = NULL; -@@ -4238,7 +4240,12 @@ static int inner_child( - a[0] = (char*) "/sbin/init"; - execve(a[0], a, env_use); - } else if (argc > optind) -+#ifdef HAVE_EXECVPE - execvpe(argv[optind], argv + optind, env_use); -+#else -+ environ = env_use; -+ execvp(argv[optind], argv + optind); -+#endif /* HAVE_EXECVPE */ - else { - chdir(home ? home : "/root"); - execle("/bin/bash", "-bash", NULL, env_use); diff --git a/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch b/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch new file mode 100644 index 0000000000..a2c40b55f6 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch @@ -0,0 +1,48 @@ +From d1fe5d2dd38cdef984296f453c65ccaebb71d1a9 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 20 Feb 2015 05:05:45 +0000 +Subject: [PATCH 06/16] 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 +--- + configure.ac | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 3128ca8..49f73a4 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -112,6 +112,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 ++ ],[ ++ 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.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch b/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch deleted file mode 100644 index 631dd77465..0000000000 --- a/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 34a61b6c9eed3fad360066fb63132ebc7e0aaaa6 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 05:12:48 +0000 -Subject: [PATCH 06/11] journal: Use posix fallocate only if available - -Some architecture ports in uclibc did not support it in past - -Upstream-Status: Denied [no desire for uclibc support] - -Signed-off-by: Khem Raj -Signed-off-by: Chen Qi ---- - src/journal/journal-file.c | 16 +++++++++++++++- - src/journal/journald-kmsg.c | 15 ++++++++++++++- - 2 files changed, 29 insertions(+), 2 deletions(-) - -diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c -index 2845e05..9431171 100644 ---- a/src/journal/journal-file.c -+++ b/src/journal/journal-file.c -@@ -36,6 +36,8 @@ - #include "compress.h" - #include "fsprg.h" - -+#include "config.h" -+ - #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem)) - #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem)) - -@@ -354,7 +356,7 @@ static int journal_file_fstat(JournalFile *f) { - - static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) { - uint64_t old_size, new_size; -- int r; -+ int r = 0; - - assert(f); - -@@ -418,9 +420,21 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) - /* Note that the glibc fallocate() fallback is very - inefficient, hence we try to minimize the allocation area - as we can. */ -+#ifdef HAVE_POSIX_FALLOCATE - r = posix_fallocate(f->fd, old_size, new_size - old_size); - if (r != 0) - return -r; -+#else -+ /* Write something every 512 bytes to make sure the block is allocated */ -+ uint64_t len = new_size - old_size; -+ uint64_t offset = old_size; -+ for (offset += (len-1) % 512; len > 0; offset += 512) { -+ len -= 512; -+ if (pwrite(f->fd, "", 1, offset) != 1) -+ return -errno; -+ } -+ -+#endif /* HAVE_POSIX_FALLOCATE */ - - f->header->arena_size = htole64(new_size - le64toh(f->header->header_size)); - -diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c -index c4216c4..a998ed5 100644 ---- a/src/journal/journald-kmsg.c -+++ b/src/journal/journald-kmsg.c -@@ -436,6 +436,7 @@ fail: - int server_open_kernel_seqnum(Server *s) { - _cleanup_close_ int fd; - uint64_t *p; -+ int r = 0; - - assert(s); - -@@ -449,7 +450,19 @@ int server_open_kernel_seqnum(Server *s) { - return 0; - } - -- if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) { -+#ifdef HAVE_POSIX_FALLOCATE -+ r = posix_fallocate(fd, 0, sizeof(uint64_t)); -+#else -+ /* Use good old method to write zeros into the journal file -+ perhaps very inefficient yet working. */ -+ char *buf = alloca(sizeof(uint64_t)); -+ off_t oldpos = lseek(fd, 0, SEEK_CUR); -+ bzero(buf, sizeof(uint64_t)); -+ lseek(fd, 0, SEEK_SET); -+ r = write(fd, buf, sizeof(uint64_t)); -+ lseek(fd, oldpos, SEEK_SET); -+#endif /* HAVE_POSIX_FALLOCATE */ -+ if (r < 0) { - log_error_errno(errno, "Failed to allocate sequential number file, ignoring: %m"); - return 0; - } --- -2.1.4 - diff --git a/meta/recipes-core/systemd/systemd/0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch b/meta/recipes-core/systemd/systemd/0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch new file mode 100644 index 0000000000..85d39078ff --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0007-nspawn-Use-execvpe-only-when-libc-supports-it.patch @@ -0,0 +1,41 @@ +From 529e7e2f7f6a5dc0e4527ff5c2237b19ece2f112 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 20 Feb 2015 05:10:37 +0000 +Subject: [PATCH 07/16] nspawn: Use execvpe only when libc supports it + +Upstream-Status: Denied [no desire for uclibc support] + +Signed-off-by: Khem Raj +--- + src/nspawn/nspawn.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index a4e13bd..4def6ba 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -112,6 +112,8 @@ typedef enum LinkJournal { + LINK_GUEST + } LinkJournal; + ++#include "config.h" ++ + static char *arg_directory = NULL; + static char *arg_template = NULL; + static char *arg_user = NULL; +@@ -2595,7 +2597,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 { + chdir(home ?: "/root"); + execle("/bin/bash", "-bash", NULL, env_use); +-- +2.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch b/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch deleted file mode 100644 index b8ab7c4e70..0000000000 --- a/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch +++ /dev/null @@ -1,42 +0,0 @@ -From f771407d3e0288ca0c06a894194d3ddad69b9a8e Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 05:17:05 +0000 -Subject: [PATCH 07/11] util: Use mkostemp only if libc supports it - -Upstream-Status: Denied [no desire for uclibc support] - -Signed-off-by: Khem Raj ---- - src/basic/util.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/src/basic/util.c b/src/basic/util.c -index dc65280..72f4665 100644 ---- a/src/basic/util.c -+++ b/src/basic/util.c -@@ -97,6 +97,8 @@ - #include "def.h" - #include "sparse-endian.h" - -+#include "config.h" -+ - int saved_argc = 0; - char **saved_argv = NULL; - -@@ -6682,7 +6684,13 @@ int mkostemp_safe(char *pattern, int flags) { - - u = umask(077); - -+#ifdef HAVE_MKOSTEMP - fd = mkostemp(pattern, flags); -+#else -+ fd = mkstemp(pattern); -+ if (fd >= 0) fcntl(fd, F_SETFD, flags); -+#endif /* HAVE_MKOSTEMP */ -+ - if (fd < 0) - return -errno; - --- -2.1.4 - diff --git a/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch b/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch index 3f4d4de080..8d71ecbc0f 100644 --- a/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch +++ b/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch @@ -1,7 +1,7 @@ -From b45ea3bfd6635744c8a6b74d0ac701b44bb1d294 Mon Sep 17 00:00:00 2001 +From 83944758dc0703afea81f3c7aa0ad926bc5df757 Mon Sep 17 00:00:00 2001 From: Khem Raj -Date: Fri, 20 Feb 2015 05:19:37 +0000 -Subject: [PATCH 08/11] util: bypass unimplemented _SC_PHYS_PAGES system +Date: Mon, 14 Dec 2015 00:47:53 +0000 +Subject: [PATCH 08/16] util: bypass unimplemented _SC_PHYS_PAGES system configuration API on uclibc Upstream-Status: Inappropriate [uclibc-specific] @@ -12,10 +12,10 @@ Signed-off-by: Khem Raj 1 file changed, 15 insertions(+) diff --git a/src/basic/util.c b/src/basic/util.c -index 72f4665..cbbe3b1 100644 +index 9e0b576..65f0edf 100644 --- a/src/basic/util.c +++ b/src/basic/util.c -@@ -6793,10 +6793,25 @@ uint64_t physical_memory(void) { +@@ -769,10 +769,25 @@ uint64_t physical_memory(void) { /* We return this as uint64_t in case we are running as 32bit * process on a 64bit kernel with huge amounts of memory */ @@ -25,7 +25,7 @@ index 72f4665..cbbe3b1 100644 + if (f == NULL) + return 0; + while (!feof(f) && fgets(line, sizeof(line)-1, f)) { -+ if (sscanf(line, "MemTotal: %l kB", &mem) == 1) { ++ if (sscanf(line, "MemTotal: %li kB", &mem) == 1) { + mem *= 1024; + break; + } @@ -40,7 +40,7 @@ index 72f4665..cbbe3b1 100644 +#endif } - void hexdump(FILE *f, const void *p, size_t s) { + int update_reboot_param_file(const char *param) { -- -2.1.4 +2.6.4 diff --git a/meta/recipes-core/systemd/systemd/0009-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0009-implment-systemd-sysv-install-for-OE.patch new file mode 100644 index 0000000000..a1396849c4 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0009-implment-systemd-sysv-install-for-OE.patch @@ -0,0 +1,43 @@ +From 81c3d92b5bc5786cbd93b1e5ed82884e8caf2254 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 5 Sep 2015 06:31:47 +0000 +Subject: [PATCH 09/16] implment systemd-sysv-install for OE + +Use update-rc.d for enabling/disabling and status command +to check the status of the sysv service + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Khem Raj +--- + src/systemctl/systemd-sysv-install.SKELETON | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON +index a53a3e6..5d877b0 100755 +--- a/src/systemctl/systemd-sysv-install.SKELETON ++++ b/src/systemctl/systemd-sysv-install.SKELETON +@@ -30,17 +30,17 @@ case "$1" in + enable) + # call the command to enable SysV init script $NAME here + # (consider optional $ROOT) +- echo "IMPLEMENT ME: enabling SysV init.d script $NAME" ++ update-rc.d -f $NAME defaults + ;; + disable) + # call the command to disable SysV init script $NAME here + # (consider optional $ROOT) +- echo "IMPLEMENT ME: disabling SysV init.d script $NAME" ++ update-rc.d -f $NAME remove + ;; + is-enabled) + # exit with 0 if $NAME is enabled, non-zero if it is disabled + # (consider optional $ROOT) +- echo "IMPLEMENT ME: checking SysV init.d script $NAME" ++ /etc/init.d/$NAME status + ;; + *) + usage ;; +-- +2.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch b/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch deleted file mode 100644 index 9ea3e83e52..0000000000 --- a/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 8791b5b3934c55694872b6915a67340683ead91b Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 05:22:52 +0000 -Subject: [PATCH 09/11] sysv-generator: add support for executing scripts under - /etc/rcS.d/ - -To be compatible, all services translated from scripts under /etc/rcS.d would -run before services translated from scripts under /etc/rcN.d. - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Chen Qi -Signed-off-by: Khem Raj ---- - src/sysv-generator/sysv-generator.c | 50 ++++++++++++++++++++++++++++--------- - 1 file changed, 38 insertions(+), 12 deletions(-) - -diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c -index bd67f32..6756cc6 100644 ---- a/src/sysv-generator/sysv-generator.c -+++ b/src/sysv-generator/sysv-generator.c -@@ -42,7 +42,8 @@ - - typedef enum RunlevelType { - RUNLEVEL_UP, -- RUNLEVEL_DOWN -+ RUNLEVEL_DOWN, -+ RUNLEVEL_SYSINIT - } RunlevelType; - - static const struct { -@@ -57,6 +58,9 @@ static const struct { - { "rc4.d", SPECIAL_MULTI_USER_TARGET, RUNLEVEL_UP }, - { "rc5.d", SPECIAL_GRAPHICAL_TARGET, RUNLEVEL_UP }, - -+ /* Debian style rcS.d, also adopted by OE */ -+ { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT}, -+ - /* Standard SysV runlevels for shutdown */ - { "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN }, - { "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN } -@@ -65,7 +69,7 @@ static const struct { - directories in this order, and we want to make sure that - sysv_start_priority is known when we first load the - unit. And that value we only know from S links. Hence -- UP must be read before DOWN */ -+ UP/SYSINIT must be read before DOWN */ - }; - - typedef struct SysvStub { -@@ -81,6 +85,8 @@ typedef struct SysvStub { - char **conflicts; - bool has_lsb; - bool reload; -+ bool default_dependencies; -+ bool from_rcsd; - } SysvStub; - - const char *arg_dest = "/tmp"; -@@ -183,6 +189,9 @@ static int generate_unit_file(SysvStub *s) { - "Description=%s\n", - s->path, s->description); - -+ if (!s->default_dependencies) -+ fprintf(f, "DefaultDependencies=no\n"); -+ - if (!isempty(before)) - fprintf(f, "Before=%s\n", before); - if (!isempty(after)) -@@ -704,18 +713,30 @@ static int fix_order(SysvStub *s, Hashmap *all_services) { - if (s->has_lsb && other->has_lsb) - continue; - -- if (other->sysv_start_priority < s->sysv_start_priority) { -- r = strv_extend(&s->after, other->name); -+ /* All scripts under /etc/rcS.d should execute before scripts under -+ * /etc/rcN.d */ -+ if (!other->from_rcsd && s->from_rcsd) { -+ r = strv_extend(&s->before, other->name); - if (r < 0) - return log_oom(); -- } -- else if (other->sysv_start_priority > s->sysv_start_priority) { -- r = strv_extend(&s->before, other->name); -+ } else if (other->from_rcsd && !s->from_rcsd) { -+ r = strv_extend(&s->after, other->name); - if (r < 0) - return log_oom(); -- } -- else -- continue; -+ } else { -+ if (other->sysv_start_priority < s->sysv_start_priority) { -+ r = strv_extend(&s->after, other->name); -+ if (r < 0) -+ return log_oom(); -+ } -+ else if (other->sysv_start_priority > s->sysv_start_priority) { -+ r = strv_extend(&s->before, other->name); -+ if (r < 0) -+ return log_oom(); -+ } -+ else -+ continue; -+ } - - /* FIXME: Maybe we should compare the name here lexicographically? */ - } -@@ -778,6 +799,8 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) { - return log_oom(); - - service->sysv_start_priority = -1; -+ service->default_dependencies = true; -+ service->from_rcsd = false; - service->name = name; - service->path = fpath; - -@@ -864,9 +887,11 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) { - - if (de->d_name[0] == 'S') { - -- if (rcnd_table[i].type == RUNLEVEL_UP) { -+ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) { - service->sysv_start_priority = - MAX(a*10 + b, service->sysv_start_priority); -+ service->default_dependencies = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?false:true; -+ service->from_rcsd = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?true:false; - } - - r = set_ensure_allocated(&runlevel_services[i], NULL); -@@ -878,7 +903,8 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) { - goto finish; - - } else if (de->d_name[0] == 'K' && -- (rcnd_table[i].type == RUNLEVEL_DOWN)) { -+ (rcnd_table[i].type == RUNLEVEL_DOWN || -+ rcnd_table[i].type == RUNLEVEL_SYSINIT)) { - - r = set_ensure_allocated(&shutdown_services, NULL); - if (r < 0) --- -2.1.4 - diff --git a/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch deleted file mode 100644 index ed7ff5b09c..0000000000 --- a/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 3dc731c1d270e2e143de621db9bd898299fd849d Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 05:24:49 +0000 -Subject: [PATCH 10/11] 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 -should be. - -Upstream-Status: Denied -Upstream wants to have a unified hierarchy where everyone is -using the same root folder. -https://github.com/systemd/systemd/issues/541 - -Signed-off-by: Dan McGregor -Signed-off-by: Khem Raj ---- - Makefile.am | 2 ++ - configure.ac | 7 +++++++ - src/core/unit-printf.c | 2 +- - src/nspawn/nspawn.c | 4 ++-- - src/basic/util.c | 4 ++-- - units/console-shell.service.m4.in | 4 ++-- - units/emergency.service.in | 4 ++-- - units/rescue.service.in | 4 ++-- - 8 files changed, 20 insertions(+), 11 deletions(-) - -Index: git/Makefile.am -=================================================================== ---- git.orig/Makefile.am -+++ git/Makefile.am -@@ -208,6 +208,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 \ -@@ -5615,6 +5616,7 @@ EXTRA_DIST += \ - substitutions = \ - '|rootlibexecdir=$(rootlibexecdir)|' \ - '|rootbindir=$(rootbindir)|' \ -+ '|roothomedir=$(roothomedir)|' \ - '|bindir=$(bindir)|' \ - '|SYSTEMCTL=$(rootbindir)/systemctl|' \ - '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ -Index: git/configure.ac -=================================================================== ---- git.orig/configure.ac -+++ git/configure.ac -@@ -1383,6 +1383,11 @@ AC_ARG_WITH([rootlibdir], - [with_rootlibdir=${libdir}]) - AX_NORMALIZE_PATH([with_rootlibdir]) - -+AC_ARG_WITH([roothomedir], -+ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]), -+ [], -+ [with_roothomedir=/root]) -+ - AC_ARG_WITH([pamlibdir], - AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), - [], -@@ -1474,6 +1479,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir]) - AC_SUBST([pamconfdir], [$with_pamconfdir]) - AC_SUBST([rootprefix], [$with_rootprefix]) - AC_SUBST([rootlibdir], [$with_rootlibdir]) -+AC_SUBST([roothomedir], [$with_roothomedir]) - - AC_CONFIG_FILES([ - Makefile -@@ -1563,6 +1569,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} -Index: git/src/core/unit-printf.c -=================================================================== ---- git.orig/src/core/unit-printf.c -+++ git/src/core/unit-printf.c -@@ -237,7 +237,7 @@ static int specifier_user_home(char spec - * best of it if we can, but fail if we can't */ - - if (!c->user || streq(c->user, "root") || streq(c->user, "0")) -- n = strdup("/root"); -+ n = strdup(ROOTHOMEDIR); - else - return -EOPNOTSUPP; - -Index: git/src/nspawn/nspawn.c -=================================================================== ---- git.orig/src/nspawn/nspawn.c -+++ git/src/nspawn/nspawn.c -@@ -4176,7 +4176,7 @@ static int inner_child( - if (envp[n_env]) - n_env ++; - -- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) || -+ if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) || - (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(); -@@ -4247,7 +4247,7 @@ static int inner_child( - execvp(argv[optind], argv + optind); - #endif /* HAVE_EXECVPE */ - else { -- chdir(home ? home : "/root"); -+ chdir(home ? home : ROOTHOMEDIR); - execle("/bin/bash", "-bash", NULL, env_use); - execle("/bin/sh", "-sh", NULL, env_use); - } -Index: git/src/basic/util.c -=================================================================== ---- git.orig/src/basic/util.c -+++ git/src/basic/util.c -@@ -3233,7 +3233,7 @@ int get_user_creds( - *gid = 0; - - if (home) -- *home = "/root"; -+ *home = ROOTHOMEDIR; - - if (shell) - *shell = "/bin/sh"; -@@ -4069,7 +4069,7 @@ int get_home_dir(char **_h) { - /* Hardcode home directory for root to avoid NSS */ - u = getuid(); - if (u == 0) { -- h = strdup("/root"); -+ h = strdup(ROOTHOMEDIR); - if (!h) - return -ENOMEM; - -Index: git/units/console-shell.service.m4.in -=================================================================== ---- git.orig/units/console-shell.service.m4.in -+++ git/units/console-shell.service.m4.in -@@ -15,8 +15,8 @@ After=rc-local.service - Before=getty.target - - [Service] --Environment=HOME=/root --WorkingDirectory=/root -+Environment=HOME=@roothomedir@ -+WorkingDirectory=@roothomedir@ - ExecStart=-@SULOGIN@ - ExecStopPost=-@SYSTEMCTL@ poweroff - Type=idle -Index: git/units/emergency.service.in -=================================================================== ---- git.orig/units/emergency.service.in -+++ git/units/emergency.service.in -@@ -14,8 +14,8 @@ Conflicts=rescue.service - Before=shutdown.target - - [Service] --Environment=HOME=/root --WorkingDirectory=/root -+Environment=HOME=@roothomedir@ -+WorkingDirectory=@roothomedir@ - ExecStartPre=-/bin/plymouth --wait quit - ExecStartPre=-/bin/echo -e 'Welcome to 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" -Index: git/units/rescue.service.in -=================================================================== ---- git.orig/units/rescue.service.in -+++ git/units/rescue.service.in -@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.serv - Before=shutdown.target - - [Service] --Environment=HOME=/root --WorkingDirectory=/root -+Environment=HOME=@roothomedir@ -+WorkingDirectory=@roothomedir@ - ExecStartPre=-/bin/plymouth quit - ExecStartPre=-/bin/echo -e 'Welcome to emergency 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" diff --git a/meta/recipes-core/systemd/systemd/0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch b/meta/recipes-core/systemd/systemd/0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch new file mode 100644 index 0000000000..8cec071244 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0010-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch @@ -0,0 +1,38 @@ +From d4b7f9b771a538c2356c4c77461f3b4790043556 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 14 Dec 2015 00:50:01 +0000 +Subject: [PATCH 10/16] nss-mymachines: Build conditionally when + HAVE_MYHOSTNAME is set + +Fixes build failures when building with --disable-myhostname + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + Makefile.am | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index 4c1143a..cf559be 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -4961,6 +4961,7 @@ SYSTEM_UNIT_ALIASES += \ + BUSNAMES_TARGET_WANTS += \ + org.freedesktop.machine1.busname + ++if HAVE_MYHOSTNAME + libnss_mymachines_la_SOURCES = \ + src/nss-mymachines/nss-mymachines.sym \ + src/nss-mymachines/nss-mymachines.c +@@ -4981,6 +4982,7 @@ lib_LTLIBRARIES += \ + libnss_mymachines.la + + endif ++endif + + polkitpolicy_in_files += \ + src/machine/org.freedesktop.machine1.policy.in +-- +2.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0011-rules-whitelist-hd-devices.patch b/meta/recipes-core/systemd/systemd/0011-rules-whitelist-hd-devices.patch new file mode 100644 index 0000000000..03fdbff316 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0011-rules-whitelist-hd-devices.patch @@ -0,0 +1,32 @@ +From ae6c9dcb00919e1dd2793fd1b82125d123f69a90 Mon Sep 17 00:00:00 2001 +From: Patrick Ohly +Date: Wed, 16 Sep 2015 13:55:58 +0200 +Subject: [PATCH 11/16] rules: whitelist hd* devices + +qemu by default emulates IDE and the linux-yocto kernel(s) use +CONFIG_IDE instead of the more modern libsata, so disks appear as +/dev/hd*. Patch rejected upstream because CONFIG_IDE is deprecated. + +Upstream-Status: Denied [https://github.com/systemd/systemd/pull/1276] + +Signed-off-by: Patrick Ohly +--- + 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 0b14bb4..1c4d97a 100644 +--- a/rules/60-persistent-storage.rules ++++ b/rules/60-persistent-storage.rules +@@ -6,7 +6,7 @@ + ACTION=="remove", 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*", 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*", GOTO="persistent_storage_end" + + # ignore partitions that span the entire disk + TEST=="whole_disk", GOTO="persistent_storage_end" +-- +2.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch b/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch deleted file mode 100644 index e562bca100..0000000000 --- a/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 7e202f71785bf5a67c8a4f6b58d3585608fbfdc4 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 20 Feb 2015 05:26:25 +0000 -Subject: [PATCH 11/11] systemd-user: avoid using system-auth - -In OE, we don't provide system-auth, instead, we use common-* files. -So modify systemd-user file to use common-* files. - -Upstream-Status: Inappropriate [oe specific] - -Signed-off-by: Chen Qi -Signed-off-by: Khem Raj ---- - src/login/systemd-user | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/login/systemd-user b/src/login/systemd-user -index 8112d74..99635af 100644 ---- a/src/login/systemd-user -+++ b/src/login/systemd-user -@@ -2,5 +2,5 @@ - # - # Used by systemd --user instances. - --account include system-auth --session include system-auth -+account include common-account -+session include common-session --- -2.1.4 - diff --git a/meta/recipes-core/systemd/systemd/0012-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0012-implment-systemd-sysv-install-for-OE.patch deleted file mode 100644 index 68b45a9a58..0000000000 --- a/meta/recipes-core/systemd/systemd/0012-implment-systemd-sysv-install-for-OE.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 5f8b9f2d276c0ddbcbf5423733a23f043d688009 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sat, 5 Sep 2015 06:31:47 +0000 -Subject: [PATCH] implment systemd-sysv-install for OE - -Use update-rc.d for enabling/disabling and status command -to check the status of the sysv service - -Upstream-Status: Inappropriate [OE-Specific] - -Signed-off-by: Khem Raj ---- - src/systemctl/systemd-sysv-install.SKELETON | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -Index: git/src/systemctl/systemd-sysv-install.SKELETON -=================================================================== ---- git.orig/src/systemctl/systemd-sysv-install.SKELETON -+++ git/src/systemctl/systemd-sysv-install.SKELETON -@@ -30,17 +30,17 @@ case "$1" in - enable) - # call the command to enable SysV init script $NAME here - # (consider optional $ROOT) -- echo "IMPLEMENT ME: enabling SysV init.d script $NAME" -+ update-rc.d -f $NAME defaults - ;; - disable) - # call the command to disable SysV init script $NAME here - # (consider optional $ROOT) -- echo "IMPLEMENT ME: disabling SysV init.d script $NAME" -+ update-rc.d -f $NAME remove - ;; - is-enabled) - # exit with 0 if $NAME is enabled, non-zero if it is disabled - # (consider optional $ROOT) -- echo "IMPLEMENT ME: checking SysV init.d script $NAME" -+ /etc/init.d/$NAME status - ;; - *) - usage ;; diff --git a/meta/recipes-core/systemd/systemd/0012-sysv-generator-add-support-for-executing-scripts-und.patch b/meta/recipes-core/systemd/systemd/0012-sysv-generator-add-support-for-executing-scripts-und.patch new file mode 100644 index 0000000000..82feff0eb9 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0012-sysv-generator-add-support-for-executing-scripts-und.patch @@ -0,0 +1,143 @@ +From 9e6c907ff1f17deb96c66a607653db4c7da34289 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 14 Dec 2015 05:09:53 +0000 +Subject: [PATCH 12/16] sysv-generator: add support for executing scripts under + /etc/rcS.d/ + +To be compatible, all services translated from scripts under /etc/rcS.d would +run before services translated from scripts under /etc/rcN.d. + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Chen Qi +Signed-off-by: Khem Raj +--- + src/sysv-generator/sysv-generator.c | 50 +++++++++++++++++++++++++++++-------- + 1 file changed, 39 insertions(+), 11 deletions(-) + +diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c +index 5075548..32d3687 100644 +--- a/src/sysv-generator/sysv-generator.c ++++ b/src/sysv-generator/sysv-generator.c +@@ -46,7 +46,8 @@ + + typedef enum RunlevelType { + RUNLEVEL_UP, +- RUNLEVEL_DOWN ++ RUNLEVEL_DOWN, ++ RUNLEVEL_SYSINIT + } RunlevelType; + + static const struct { +@@ -61,6 +62,9 @@ static const struct { + { "rc4.d", SPECIAL_MULTI_USER_TARGET, RUNLEVEL_UP }, + { "rc5.d", SPECIAL_GRAPHICAL_TARGET, RUNLEVEL_UP }, + ++ /* Debian style rcS.d, also adopted by OE */ ++ { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT}, ++ + /* Standard SysV runlevels for shutdown */ + { "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN }, + { "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN } +@@ -69,7 +73,7 @@ static const struct { + directories in this order, and we want to make sure that + sysv_start_priority is known when we first load the + unit. And that value we only know from S links. Hence +- UP must be read before DOWN */ ++ UP/SYSINIT must be read before DOWN */ + }; + + const char *arg_dest = "/tmp"; +@@ -88,6 +92,8 @@ typedef struct SysvStub { + bool has_lsb; + bool reload; + bool loaded; ++ bool default_dependencies; ++ bool from_rcsd; + } SysvStub; + + static void free_sysvstub(SysvStub *s) { +@@ -204,6 +210,9 @@ static int generate_unit_file(SysvStub *s) { + if (s->description) + fprintf(f, "Description=%s\n", s->description); + ++ if (!s->default_dependencies) ++ fprintf(f, "DefaultDependencies=no\n"); ++ + if (!isempty(before)) + fprintf(f, "Before=%s\n", before); + if (!isempty(after)) +@@ -722,17 +731,31 @@ static int fix_order(SysvStub *s, Hashmap *all_services) { + if (s->has_lsb && other->has_lsb) + continue; + +- if (other->sysv_start_priority < s->sysv_start_priority) { +- r = strv_extend(&s->after, other->name); ++ /* All scripts under /etc/rcS.d should execute before scripts under ++ * /etc/rcN.d */ ++ if (!other->from_rcsd && s->from_rcsd) { ++ r = strv_extend(&s->before, other->name); + if (r < 0) + return log_oom(); + +- } else if (other->sysv_start_priority > s->sysv_start_priority) { +- r = strv_extend(&s->before, other->name); ++ } else if (other->from_rcsd && !s->from_rcsd) { ++ r = strv_extend(&s->after, other->name); + if (r < 0) + return log_oom(); +- } else +- continue; ++ } else { ++ if (other->sysv_start_priority < s->sysv_start_priority) { ++ r = strv_extend(&s->after, other->name); ++ if (r < 0) ++ return log_oom(); ++ } ++ else if (other->sysv_start_priority > s->sysv_start_priority) { ++ r = strv_extend(&s->before, other->name); ++ if (r < 0) ++ return log_oom(); ++ } ++ else ++ continue; ++ } + + /* FIXME: Maybe we should compare the name here lexicographically? */ + } +@@ -799,6 +822,8 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) { + return log_oom(); + + service->sysv_start_priority = -1; ++ service->default_dependencies = true; ++ service->from_rcsd = false; + service->name = name; + service->path = fpath; + name = fpath = NULL; +@@ -882,9 +907,11 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic + + if (de->d_name[0] == 'S') { + +- if (rcnd_table[i].type == RUNLEVEL_UP) ++ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) { + service->sysv_start_priority = MAX(a*10 + b, service->sysv_start_priority); +- ++ service->default_dependencies = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?false:true; ++ service->from_rcsd = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?true:false; ++ } + r = set_ensure_allocated(&runlevel_services[i], NULL); + if (r < 0) { + log_oom(); +@@ -898,7 +925,8 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic + } + + } else if (de->d_name[0] == 'K' && +- (rcnd_table[i].type == RUNLEVEL_DOWN)) { ++ (rcnd_table[i].type == RUNLEVEL_DOWN || ++ rcnd_table[i].type == RUNLEVEL_SYSINIT)) { + + r = set_ensure_allocated(&shutdown_services, NULL); + if (r < 0) { +-- +2.6.4 + diff --git a/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch new file mode 100644 index 0000000000..ea0b3e250f --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0013-Make-root-s-home-directory-configurable.patch @@ -0,0 +1,184 @@ +From 1ba00ff6ed3f0626892f57cdd8d9788692c7bf14 Mon Sep 17 00:00:00 2001 +From: Khem Raj