From 041570e584b98b580cc75f9ee23372da74a84377 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 25 Feb 2015 02:55:57 +0000 Subject: systemd: Upgrade 218 -> 219 219 has been in the docks for sometime, the older patch got merged this patch is now upgrading 218 to 219 Make all patches using git Change-Id: Ib0350144592aba26cad56c13c9a5522515915c58 Signed-off-by: Khem Raj Signed-off-by: Richard Purdie --- ...1-Make-root-s-home-directory-configurable.patch | 177 -------------------- ...ort-for-executing-scripts-under-etc-rcS.d.patch | 138 ---------------- ...0001-systemd-user-avoid-using-system-auth.patch | 27 --- ...r-getty-to-agetty-in-console-setup-system.patch | 44 +++++ ...ed-missing.h-fall-back-to-insecure-getenv.patch | 25 +++ ...t-install-dependency-links-at-install-tim.patch | 74 +++++++++ ...heck-for-additional-features-that-uclibc-.patch | 48 ++++++ ...wn-Use-execvpe-only-when-libc-supports-it.patch | 41 +++++ ...nal-Use-posix-fallocate-only-if-available.patch | 96 +++++++++++ ...til-Use-mkostemp-only-if-libc-supports-it.patch | 42 +++++ ...-unimplemented-_SC_PHYS_PAGES-system-conf.patch | 46 ++++++ ...tor-add-support-for-executing-scripts-und.patch | 143 ++++++++++++++++ ...0-Make-root-s-home-directory-configurable.patch | 181 +++++++++++++++++++++ ...0011-systemd-user-avoid-using-system-auth.patch | 31 ++++ .../systemd/systemd/binfmt-install.patch | 57 ------- .../systemd/systemd/optional_secure_getenv.patch | 19 --- .../systemd-pam-configure-check-uclibc.patch | 32 ---- .../systemd/systemd/systemd-pam-fix-execvpe.patch | 29 ---- .../systemd/systemd-pam-fix-fallocate.patch | 88 ---------- .../systemd/systemd-pam-fix-getty-unit.patch | 35 ---- .../systemd/systemd/systemd-pam-fix-mkostemp.patch | 30 ---- .../systemd/systemd/uclibc-get-physmem.patch | 37 ----- 22 files changed, 771 insertions(+), 669 deletions(-) delete mode 100644 meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch delete mode 100644 meta/recipes-core/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch delete mode 100644 meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch create 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-shared-missing.h-fall-back-to-insecure-getenv.patch create mode 100644 meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch create mode 100644 meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch create 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-journal-Use-posix-fallocate-only-if-available.patch create 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/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch create mode 100644 meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch create mode 100644 meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch create mode 100644 meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch delete mode 100644 meta/recipes-core/systemd/systemd/binfmt-install.patch delete mode 100644 meta/recipes-core/systemd/systemd/optional_secure_getenv.patch delete mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch delete mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch delete mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch delete mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch delete mode 100644 meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch delete mode 100644 meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch (limited to 'meta/recipes-core/systemd/systemd') diff --git a/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch deleted file mode 100644 index a86c8410df..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 4dc8dee0435bb63cbe474004b0a8df0363fe94dd Mon Sep 17 00:00:00 2001 -From: Dan McGregor -Date: Fri, 5 Sep 2014 06:28:58 -0600 -Subject: [PATCH] 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: Pending - -Signed-off-by: Dan McGregor ---- - Makefile.am | 2 ++ - configure.ac | 7 +++++++ - src/core/unit-printf.c | 2 +- - src/nspawn/nspawn.c | 4 ++-- - src/shared/util.c | 4 ++-- - units/console-shell.service.m4.in | 4 ++-- - units/emergency.service.in | 4 ++-- - units/rescue.service.m4.in | 4 ++-- - 8 files changed, 20 insertions(+), 11 deletions(-) - -Index: git/Makefile.am -=================================================================== ---- git.orig/Makefile.am -+++ git/Makefile.am -@@ -195,6 +195,7 @@ AM_CPPFLAGS = \ - -DKEXEC=\"$(KEXEC)\" \ - -DLIBDIR=\"$(libdir)\" \ - -DROOTLIBDIR=\"$(rootlibdir)\" \ -+ -DROOTHOMEDIR=\"$(roothomedir)\" \ - -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ - -I $(top_srcdir)/src \ - -I $(top_builddir)/src/shared \ -@@ -5830,6 +5831,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 -@@ -1310,6 +1310,11 @@ AC_ARG_WITH([rootlibdir], - [], - [with_rootlibdir=${libdir}]) - -+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]), - [], -@@ -1362,6 +1367,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 po/Makefile.in -@@ -1446,6 +1452,7 @@ AC_MSG_RESULT([ - include_prefix: ${INCLUDE_PREFIX} - 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 -@@ -259,7 +259,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 -ENOTSUP; - -Index: git/src/nspawn/nspawn.c -=================================================================== ---- git.orig/src/nspawn/nspawn.c -+++ git/src/nspawn/nspawn.c -@@ -3183,7 +3183,7 @@ int main(int argc, char *argv[]) { - if (r < 0) - _exit(EXIT_FAILURE); - -- 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)) { - log_oom(); -@@ -3278,7 +3278,7 @@ int main(int argc, char *argv[]) { - 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/shared/util.c -=================================================================== ---- git.orig/src/shared/util.c -+++ git/src/shared/util.c -@@ -4523,7 +4523,7 @@ int get_user_creds( - *gid = 0; - - if (home) -- *home = "/root"; -+ *home = ROOTHOMEDIR; - - if (shell) - *shell = "/bin/sh"; -@@ -5491,7 +5491,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=-/sbin/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 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 "/sbin/sulogin; @SYSTEMCTL@ --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 "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default" diff --git a/meta/recipes-core/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch b/meta/recipes-core/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch deleted file mode 100644 index 9aa07c1b10..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch +++ /dev/null @@ -1,138 +0,0 @@ -Upstream-Status: Inappropriate [OE specific] - -Subject: 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. - -Signed-off-by: Chen Qi ---- - 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 9a869ba..10c55c0 100644 ---- a/src/sysv-generator/sysv-generator.c -+++ b/src/sysv-generator/sysv-generator.c -@@ -43,7 +43,8 @@ - - typedef enum RunlevelType { - RUNLEVEL_UP, -- RUNLEVEL_DOWN -+ RUNLEVEL_DOWN, -+ RUNLEVEL_SYSINIT - } RunlevelType; - - static const struct { -@@ -58,6 +59,9 @@ static const struct { - { "rc4.d", SPECIAL_RUNLEVEL4_TARGET, RUNLEVEL_UP }, - { "rc5.d", SPECIAL_RUNLEVEL5_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 } -@@ -66,7 +70,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 { -@@ -82,6 +86,8 @@ typedef struct SysvStub { - char **conflicts; - bool has_lsb; - bool reload; -+ bool default_dependencies; -+ bool from_rcsd; - } SysvStub; - - const char *arg_dest = "/tmp"; -@@ -156,6 +162,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)) -@@ -661,18 +670,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? */ - } -@@ -725,6 +746,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; - -@@ -810,9 +833,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], -@@ -825,7 +850,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, - trivial_hash_func, trivial_compare_func); --- -1.9.1 - diff --git a/meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch b/meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch deleted file mode 100644 index 97701f707c..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch +++ /dev/null @@ -1,27 +0,0 @@ -Upstream-Status: Inappropriate [oe specific] - -Subject: 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. - -Signed-off-by: Chen Qi ---- - 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 --- -1.9.1 - 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 new file mode 100644 index 0000000000..b6ab5effc2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch @@ -0,0 +1,44 @@ +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-shared-missing.h-fall-back-to-insecure-getenv.patch b/meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch new file mode 100644 index 0000000000..1cf7840976 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch @@ -0,0 +1,25 @@ +From 03baade6db2cf83b44a157818ba827d725449bb0 Mon Sep 17 00:00:00 2001 +From: Emil Renner Berthing +Date: Thu, 18 Sep 2014 15:24:47 +0200 +Subject: [PATCH 02/11] shared/missing.h: fall back to insecure getenv + +--- + src/shared/missing.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/shared/missing.h b/src/shared/missing.h +index b33a70c..11cca04 100644 +--- a/src/shared/missing.h ++++ b/src/shared/missing.h +@@ -366,7 +366,7 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle + # ifdef HAVE___SECURE_GETENV + # define secure_getenv __secure_getenv + # else +-# error "neither secure_getenv nor __secure_getenv are available" ++# define secure_getenv getenv + # endif + #endif + +-- +2.1.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 new file mode 100644 index 0000000000..c14cc6fdd6 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch @@ -0,0 +1,74 @@ +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(-) + +diff --git a/Makefile.am b/Makefile.am +index ba63f68..0fb3f9f 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -4838,10 +4838,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 34a5d52..617462b 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/ +@@ -24,3 +26,6 @@ ConditionDirectoryNotEmpty=|/run/binfmt.d + Type=oneshot + RemainAfterExit=yes + ExecStart=@rootlibexecdir@/systemd-binfmt ++ ++[Install] ++WantedBy=sysinit.target +-- +2.1.4 + 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 new file mode 100644 index 0000000000..dddb7da690 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch @@ -0,0 +1,48 @@ +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(+) + +diff --git a/configure.ac b/configure.ac +index 9a2235b..a5b2e6e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -103,6 +103,24 @@ AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't s + + M4_DEFINES= + ++# 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])]) ++ + # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line + m4_ifdef([GTK_DOC_CHECK], [ + GTK_DOC_CHECK([1.18],[--flavour no-tmpl])], +-- +2.1.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 new file mode 100644 index 0000000000..85279d68c2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch @@ -0,0 +1,41 @@ +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(+) + +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index 0d8d199..b597edb 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -129,6 +129,8 @@ typedef enum Volatile { + VOLATILE_STATE, + } Volatile; + ++#include "config.h" ++ + static char *arg_directory = NULL; + static char *arg_template = NULL; + static char *arg_user = NULL; +@@ -4257,7 +4259,12 @@ int main(int argc, char *argv[]) { + 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); +-- +2.1.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 new file mode 100644 index 0000000000..631dd77465 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch @@ -0,0 +1,96 @@ +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-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 new file mode 100644 index 0000000000..29c20c010f --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch @@ -0,0 +1,42 @@ +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/shared/util.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/shared/util.c b/src/shared/util.c +index dc65280..72f4665 100644 +--- a/src/shared/util.c ++++ b/src/shared/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 new file mode 100644 index 0000000000..5297625c93 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch @@ -0,0 +1,46 @@ +From b45ea3bfd6635744c8a6b74d0ac701b44bb1d294 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 + configuration API on uclibc + +Upstream-Status: Inappropriate [uclibc-specific] + +Signed-off-by: Khem Raj +--- + src/shared/util.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/src/shared/util.c b/src/shared/util.c +index 72f4665..cbbe3b1 100644 +--- a/src/shared/util.c ++++ b/src/shared/util.c +@@ -6793,10 +6793,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 */ + ++#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: %l kB", &mem) == 1) { ++ mem *= 1024; ++ break; ++ } ++ } ++ fclose(f); ++ return (uint64_t) mem; ++#else + mem = sysconf(_SC_PHYS_PAGES); + assert(mem > 0); + + return (uint64_t) mem * (uint64_t) page_size(); ++#endif + } + + void hexdump(FILE *f, const void *p, size_t s) { +-- +2.1.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 new file mode 100644 index 0000000000..9ea3e83e52 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch @@ -0,0 +1,143 @@ +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 new file mode 100644 index 0000000000..41b903951e --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch @@ -0,0 +1,181 @@ +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: Pending + +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/shared/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(-) + +diff --git a/Makefile.am b/Makefile.am +index 0fb3f9f..4623963 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -199,6 +199,7 @@ AM_CPPFLAGS = \ + -DKEXEC=\"$(KEXEC)\" \ + -DLIBDIR=\"$(libdir)\" \ + -DROOTLIBDIR=\"$(rootlibdir)\" \ ++ -DROOTHOMEDIR=\"$(roothomedir)\" \ + -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ + -I $(top_srcdir)/src \ + -I $(top_builddir)/src/shared \ +@@ -6342,6 +6343,7 @@ EXTRA_DIST += \ + substitutions = \ + '|rootlibexecdir=$(rootlibexecdir)|' \ + '|rootbindir=$(rootbindir)|' \ ++ '|roothomedir=$(roothomedir)|' \ + '|bindir=$(bindir)|' \ + '|SYSTEMCTL=$(rootbindir)/systemctl|' \ + '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ +diff --git a/configure.ac b/configure.ac +index a5b2e6e..55bb7d8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1428,6 +1428,11 @@ AC_ARG_WITH([rootlibdir], + [], + [with_rootlibdir=${libdir}]) + ++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]), + [], +@@ -1518,6 +1523,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 po/Makefile.in +@@ -1617,6 +1623,7 @@ AC_MSG_RESULT([ + include_prefix: ${INCLUDE_PREFIX} + 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} +diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c +index 97135db..14d12f1 100644 +--- a/src/core/unit-printf.c ++++ b/src/core/unit-printf.c +@@ -259,7 +259,7 @@ static int specifier_user_home(char specifier, void *data, void *userdata, char + * 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 -ENOTSUP; + +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index b597edb..0b32673 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -4192,7 +4192,7 @@ int main(int argc, char *argv[]) { + if (r < 0) + _exit(EXIT_FAILURE); + +- 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)) { + log_oom(); +@@ -4266,7 +4266,7 @@ int main(int argc, char *argv[]) { + 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); + } +diff --git a/src/shared/util.c b/src/shared/util.c +index cbbe3b1..a0e3cc5 100644 +--- a/src/shared/util.c ++++ b/src/shared/util.c +@@ -4609,7 +4609,7 @@ int get_user_creds( + *gid = 0; + + if (home) +- *home = "/root"; ++ *home = ROOTHOMEDIR; + + if (shell) + *shell = "/bin/sh"; +@@ -5611,7 +5611,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; + +diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in +index 5c80722..efde5f0 100644 +--- a/units/console-shell.service.m4.in ++++ b/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 +diff --git a/units/emergency.service.in b/units/emergency.service.in +index 2695d7b..7f47b73 100644 +--- a/units/emergency.service.in ++++ b/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 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@ --fail --no-block default" +diff --git a/units/rescue.service.in b/units/rescue.service.in +index de73fee..47f3593 100644 +--- a/units/rescue.service.in ++++ b/units/rescue.service.in +@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service + 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@ --fail --no-block default" +-- +2.1.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 new file mode 100644 index 0000000000..e562bca100 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch @@ -0,0 +1,31 @@ +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/binfmt-install.patch b/meta/recipes-core/systemd/systemd/binfmt-install.patch deleted file mode 100644 index 93b8e3cf3a..0000000000 --- a/meta/recipes-core/systemd/systemd/binfmt-install.patch +++ /dev/null @@ -1,57 +0,0 @@ -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 - -Index: git/Makefile.am -=================================================================== ---- git.orig/Makefile.am -+++ git/Makefile.am -@@ -4495,10 +4495,6 @@ - $(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 @@ - - [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=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/ -@@ -24,3 +26,6 @@ - Type=oneshot - RemainAfterExit=yes - ExecStart=@rootlibexecdir@/systemd-binfmt -+ -+[Install] -+WantedBy=sysinit.target diff --git a/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch b/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch deleted file mode 100644 index 2063268246..0000000000 --- a/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch +++ /dev/null @@ -1,19 +0,0 @@ -on uclibc secure_getenv is not available -therefore default to using getenv instead - -Upstream-Status: Denied [no desire for uclibc support] -Signed-off-by: Khem Raj - -Index: git/src/shared/missing.h -=================================================================== ---- git.orig/src/shared/missing.h 2012-09-22 18:46:44.141282145 -0700 -+++ git/src/shared/missing.h 2012-09-22 18:48:44.081276570 -0700 -@@ -233,6 +233,8 @@ - #ifndef HAVE_SECURE_GETENV - # ifdef HAVE___SECURE_GETENV - # define secure_getenv __secure_getenv -+# elif defined __UCLIBC__ -+# define secure_getenv getenv - # else - # error neither secure_getenv nor __secure_getenv are available - # endif diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch b/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch deleted file mode 100644 index 4639532236..0000000000 --- a/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch +++ /dev/null @@ -1,32 +0,0 @@ -Upstream-Status: Denied [no desire for uclibc support] -Signed-off-by: Khem Raj - -Index: git/configure.ac -=================================================================== ---- git.orig/configure.ac 2014-03-15 17:53:51.756340454 -0700 -+++ git/configure.ac 2014-03-15 18:07:34.888355897 -0700 -@@ -78,6 +78,24 @@ - - M4_DEFINES= - -+# 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])]) -+ - # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line - m4_ifdef([GTK_DOC_CHECK], [ - GTK_DOC_CHECK([1.18],[--flavour no-tmpl])], diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch deleted file mode 100644 index 7170a38af3..0000000000 --- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch +++ /dev/null @@ -1,29 +0,0 @@ -Upstream-Status: Denied [no desire for uclibc support] -Signed-off-by: Khem Raj - -Index: systemd-209/src/nspawn/nspawn.c -=================================================================== ---- systemd-209.orig/src/nspawn/nspawn.c 2014-02-19 15:03:09.000000000 -0800 -+++ systemd-209/src/nspawn/nspawn.c 2014-02-19 23:20:38.720628627 -0800 -@@ -91,6 +91,8 @@ - LINK_GUEST - } LinkJournal; - -+#include "config.h" -+ - static char *arg_directory = NULL; - static char *arg_user = NULL; - static sd_id128_t arg_uuid = {}; -@@ -2045,7 +2047,12 @@ - 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/systemd-pam-fix-fallocate.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch deleted file mode 100644 index 28a9a3491f..0000000000 --- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch +++ /dev/null @@ -1,88 +0,0 @@ -Upstream-Status: Denied [no desire for uclibc support] - -This patch is uclibc specific, thus not suitable for upstream. - -Signed-off-by: Khem Raj -Signed-off-by: Chen Qi ---- - src/journal/journal-file.c | 16 +++++++++++++++- - src/journal/journald-kmsg.c | 16 ++++++++++++++-- - 2 files changed, 29 insertions(+), 3 deletions(-) - -Index: git/src/journal/journal-file.c -=================================================================== ---- git.orig/src/journal/journal-file.c -+++ git/src/journal/journal-file.c -@@ -35,6 +35,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)) - -@@ -314,7 +316,7 @@ static int journal_file_verify_header(Jo - - 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); - -@@ -362,9 +364,21 @@ static int journal_file_allocate(Journal - /* 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 */ - - if (fstat(f->fd, &f->last_stat) < 0) - return -errno; -Index: git/src/journal/journald-kmsg.c -=================================================================== ---- git.orig/src/journal/journald-kmsg.c -+++ git/src/journal/journald-kmsg.c -@@ -437,6 +437,7 @@ fail: - int server_open_kernel_seqnum(Server *s) { - _cleanup_close_ int fd; - uint64_t *p; -+ int r = 0; - - assert(s); - -@@ -450,7 +451,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; - } diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch deleted file mode 100644 index 9b4c940984..0000000000 --- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch +++ /dev/null @@ -1,35 +0,0 @@ -Prefer getty to agetty in console setup systemd units - -Upstream-Status: Inappropriate [configuration specific] -Signed-off-by: Maxime Ripard ---- - units/getty@.service.m4 | 2 +- - units/serial-getty@.service.m4 | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -Index: git/units/getty@.service.m4 -=================================================================== ---- git.orig/units/getty@.service.m4 2014-03-15 08:16:17.000000000 -0700 -+++ git/units/getty@.service.m4 2014-03-15 08:21:11.007695825 -0700 -@@ -27,7 +27,7 @@ - - [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 -Index: git/units/serial-getty@.service.m4 -=================================================================== ---- git.orig/units/serial-getty@.service.m4 2014-03-15 08:16:17.000000000 -0700 -+++ git/units/serial-getty@.service.m4 2014-03-15 08:22:31.291697331 -0700 -@@ -22,7 +22,7 @@ - IgnoreOnIsolate=yes - - [Service] --ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM -+ExecStart=-/sbin/getty -L 115200 %I $TERM - Type=idle - Restart=always - RestartSec=0 diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch deleted file mode 100644 index 8c7aa072da..0000000000 --- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch +++ /dev/null @@ -1,30 +0,0 @@ -Upstream-Status: Denied [no desire for uclibc support] -Signed-off-by: Khem Raj - -Index: git/src/shared/util.c -=================================================================== ---- git.orig/src/shared/util.c 2014-03-15 15:14:21.368160908 -0700 -+++ git/src/shared/util.c 2014-03-15 15:44:21.988194688 -0700 -@@ -85,6 +85,8 @@ - #include "def.h" - #include "missing.h" - -+#include "config.h" -+ - int saved_argc = 0; - char **saved_argv = NULL; - -@@ -6222,7 +6224,13 @@ - - 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; - diff --git a/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch b/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch deleted file mode 100644 index 39dfc9e2ea..0000000000 --- a/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch +++ /dev/null @@ -1,37 +0,0 @@ -bypass unimplemented _SC_PHYS_PAGES system configuration API in uclibc - -Upstream-Status: Inappropriate [uclibc-specific] - -Signed-off-by: Khem Raj - -Index: git/src/shared/util.c -=================================================================== ---- git.orig/src/shared/util.c 2014-03-15 18:09:34.796358146 -0700 -+++ git/src/shared/util.c 2014-03-15 20:16:33.836501084 -0700 -@@ -6332,11 +6332,24 @@ - - /* We return this as uint64_t in case we are running as 32bit - * process on a 64bit kernel with huge amounts of memory */ -- -+#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: %l kB", &mem) == 1) { -+ mem *= 1024; -+ break; -+ } -+ } -+ fclose(f); -+ return (uint64_t) mem; -+#else - mem = sysconf(_SC_PHYS_PAGES); - assert(mem > 0); -- - return (uint64_t) mem * (uint64_t) page_size(); -+#endif - } - - char* mount_test_option(const char *haystack, const char *needle) { -- cgit 1.2.3-korg