diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd')
25 files changed, 1182 insertions, 301 deletions
diff --git a/meta/recipes-core/systemd/systemd/00-create-volatile.conf b/meta/recipes-core/systemd/systemd/00-create-volatile.conf index 9ffa88e464..87cbe1e7d3 100644 --- a/meta/recipes-core/systemd/systemd/00-create-volatile.conf +++ b/meta/recipes-core/systemd/systemd/00-create-volatile.conf @@ -4,4 +4,4 @@ d /var/volatile/log - - - - -d /var/volatile/tmp - - - - +d /var/volatile/tmp 1777 - - diff --git a/meta/recipes-core/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch b/meta/recipes-core/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch deleted file mode 100644 index 448ef1a917..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch +++ /dev/null @@ -1,29 +0,0 @@ -Upstream-Status: Backport - -Subject: missing.h: add fake __NR_memfd_create for MIPS - -We don't have the correct __NR_memfd_create syscall number yet, so set it to -0xffffffff for now to prevent compile time errors. - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/shared/missing.h | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/shared/missing.h b/src/shared/missing.h -index 3ff1a21..3051cb5 100644 ---- a/src/shared/missing.h -+++ b/src/shared/missing.h -@@ -167,6 +167,9 @@ static inline int pivot_root(const char *new_root, const char *put_old) { - # define __NR_fanotify_mark 5296 - # endif - # endif -+# ifndef __NR_memfd_create -+# define __NR_memfd_create 0xffffffff /* FIXME */ -+# endif - #else - # ifndef __NR_fanotify_init - # define __NR_fanotify_init 338 --- -1.9.1 - diff --git a/meta/recipes-core/systemd/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch b/meta/recipes-core/systemd/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch new file mode 100644 index 0000000000..6652e28e23 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch @@ -0,0 +1,134 @@ +Upstream-Status: Backport +Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> + +From 33d36e28b0a23fb7ac33435a1329d65bff1ba4ec Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> +Date: Mon, 23 Feb 2015 23:19:54 -0500 +Subject: [PATCH] tmpfiles: avoid creating duplicate acl entries + +https://bugs.freedesktop.org/show_bug.cgi?id=89202 +https://bugs.debian.org/778656 + +Status quo ante can be restored with: + getfacl -p /var/log/journal/`cat /etc/machine-id`|grep -v '^#'|sort -u|sudo setfacl --set-file=- /var/log/journal/`cat /etc/machine-id` + +(cherry picked from commit 1c73f3bc29111a00738569c9d40a989b161a0624) +--- + src/shared/acl-util.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++-- + src/shared/acl-util.h | 4 +++ + 2 files changed, 81 insertions(+), 2 deletions(-) + +diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c +index a4ff1ab..cbe09d7 100644 +--- a/src/shared/acl-util.c ++++ b/src/shared/acl-util.c +@@ -282,6 +282,77 @@ int parse_acl(char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask) + return 0; + } + ++static int acl_entry_equal(acl_entry_t a, acl_entry_t b) { ++ acl_tag_t tag_a, tag_b; ++ ++ if (acl_get_tag_type(a, &tag_a) < 0) ++ return -errno; ++ ++ if (acl_get_tag_type(b, &tag_b) < 0) ++ return -errno; ++ ++ if (tag_a != tag_b) ++ return false; ++ ++ switch (tag_a) { ++ case ACL_USER_OBJ: ++ case ACL_GROUP_OBJ: ++ case ACL_MASK: ++ case ACL_OTHER: ++ /* can have only one of those */ ++ return true; ++ case ACL_USER: { ++ _cleanup_(acl_free_uid_tpp) uid_t *uid_a, *uid_b; ++ ++ uid_a = acl_get_qualifier(a); ++ if (!uid_a) ++ return -errno; ++ ++ uid_b = acl_get_qualifier(b); ++ if (!uid_b) ++ return -errno; ++ ++ return *uid_a == *uid_b; ++ } ++ case ACL_GROUP: { ++ _cleanup_(acl_free_gid_tpp) gid_t *gid_a, *gid_b; ++ ++ gid_a = acl_get_qualifier(a); ++ if (!gid_a) ++ return -errno; ++ ++ gid_b = acl_get_qualifier(b); ++ if (!gid_b) ++ return -errno; ++ ++ return *gid_a == *gid_b; ++ } ++ default: ++ assert_not_reached("Unknown acl tag type"); ++ } ++} ++ ++static int find_acl_entry(acl_t acl, acl_entry_t entry, acl_entry_t *out) { ++ acl_entry_t i; ++ int r; ++ ++ for (r = acl_get_entry(acl, ACL_FIRST_ENTRY, &i); ++ r > 0; ++ r = acl_get_entry(acl, ACL_NEXT_ENTRY, &i)) { ++ ++ r = acl_entry_equal(i, entry); ++ if (r < 0) ++ return r; ++ if (r > 0) { ++ *out = i; ++ return 1; ++ } ++ } ++ if (r < 0) ++ return -errno; ++ return 0; ++} ++ + int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl) { + _cleanup_(acl_freep) acl_t old; + acl_entry_t i; +@@ -297,8 +368,12 @@ int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl) { + + acl_entry_t j; + +- if (acl_create_entry(&old, &j) < 0) +- return -errno; ++ r = find_acl_entry(old, i, &j); ++ if (r < 0) ++ return r; ++ if (r == 0) ++ if (acl_create_entry(&old, &j) < 0) ++ return -errno; + + if (acl_copy_entry(j, i) < 0) + return -errno; +diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h +index 90e88ff..fdb9006 100644 +--- a/src/shared/acl-util.h ++++ b/src/shared/acl-util.h +@@ -41,5 +41,9 @@ int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl); + DEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free); + #define acl_free_charp acl_free + DEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp); ++#define acl_free_uid_tp acl_free ++DEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp); ++#define acl_free_gid_tp acl_free ++DEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp); + + #endif +-- +2.3.1 + diff --git a/meta/recipes-core/systemd/systemd/0001-tmpfiles.d-etc.conf-disable-resolv.conf-symlink.patch b/meta/recipes-core/systemd/systemd/0001-tmpfiles.d-etc.conf-disable-resolv.conf-symlink.patch deleted file mode 100644 index 7218322d4c..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-tmpfiles.d-etc.conf-disable-resolv.conf-symlink.patch +++ /dev/null @@ -1,35 +0,0 @@ -From f0ab1600fb56d680e6aba3d0d51dfb9ffa3d9403 Mon Sep 17 00:00:00 2001 -From: "Peter A. Bigot" <pab@pabigot.com> -Date: Thu, 18 Sep 2014 08:36:54 -0500 -Subject: [PATCH] tmpfiles.d/etc.conf: disable resolv.conf symlink - -This link is valid only if ENABLE_RESOLVED is configured for systemd. -If left unconditional, the symlink is created preventing connman from -storing the configuration it received from DHCP or other sources. - -Upstream has a TODO to fix this, but has not done so as of this date. -Provide a temporary workaround for OE until this is done properly -upstream. - -Upstream-Status: Inappropriate [OE-specific] -Signed-off-by: Peter A. Bigot <pab@pabigot.com> ---- - tmpfiles.d/etc.conf | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/tmpfiles.d/etc.conf b/tmpfiles.d/etc.conf -index b23272c..5364dd8 100644 ---- a/tmpfiles.d/etc.conf -+++ b/tmpfiles.d/etc.conf -@@ -10,6 +10,7 @@ - L /etc/os-release - - - - ../usr/lib/os-release - L /etc/localtime - - - - ../usr/share/zoneinfo/UTC - L+ /etc/mtab - - - - ../proc/self/mounts --L /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf -+# TODO: conditional on ENABLE_RESOLVED -+#L /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf - C /etc/nsswitch.conf - - - - - C /etc/pam.d - - - - --- -1.8.5.5 - 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 <raj.khem@gmail.com> +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 <maxime.ripard@free-electrons.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + units/getty@.service.m4 | 2 +- + units/serial-getty@.service.m4 | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/units/getty@.service.m4 b/units/getty@.service.m4 +index 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 <systemd@esmil.dk> +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/0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch b/meta/recipes-core/systemd/systemd/0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch new file mode 100644 index 0000000000..c195437ba0 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch @@ -0,0 +1,86 @@ +Upstream-Status: Backport +Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> + +From 31d05181e3a34c5c0ff6314d8eca1c3b4bb29423 Mon Sep 17 00:00:00 2001 +From: Hans-Peter Deifel <hpd@hpdeifel.de> +Date: Tue, 3 Mar 2015 00:35:08 +0100 +Subject: [PATCH 2/2] tmpfiles: quietly ignore ACLs on unsupported filesystems + +A warning is printed if ACLs cannot be retrieved for any reason other +than -ENOSYS. For -ENOSYS, debug log is printed. + +(cherry picked from commit d873e8778c92014c02a9122852758b436fa95c0e) +--- + src/tmpfiles/tmpfiles.c | 36 ++++++++++++++++++++---------------- + 1 file changed, 20 insertions(+), 16 deletions(-) + +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 88ba7e4..187997e 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -704,6 +704,9 @@ static int path_set_acl(const char *path, acl_type_t type, acl_t acl, bool modif + int r; + _cleanup_(acl_free_charpp) char *t = NULL; + ++ /* Returns 0 for success, positive error if already warned, ++ * negative error otherwise. */ ++ + if (modify) { + r = acls_for_file(path, type, acl, &dup); + if (r < 0) +@@ -731,35 +734,36 @@ static int path_set_acl(const char *path, acl_type_t type, acl_t acl, bool modif + + r = acl_set_file(path, type, dup); + if (r < 0) +- return log_error_errno(-errno, +- "Setting %s ACL \"%s\" on %s failed: %m", +- type == ACL_TYPE_ACCESS ? "access" : "default", +- strna(t), path); ++ return -log_error_errno(errno, ++ "Setting %s ACL \"%s\" on %s failed: %m", ++ type == ACL_TYPE_ACCESS ? "access" : "default", ++ strna(t), path); ++ + return 0; + } + #endif + + static int path_set_acls(Item *item, const char *path) { ++ int r = 0; + #ifdef HAVE_ACL +- int r; +- + assert(item); + assert(path); + +- if (item->acl_access) { ++ if (item->acl_access) + r = path_set_acl(path, ACL_TYPE_ACCESS, item->acl_access, item->force); +- if (r < 0) +- return r; +- } + +- if (item->acl_default) { ++ if (r == 0 && item->acl_default) + r = path_set_acl(path, ACL_TYPE_DEFAULT, item->acl_default, item->force); +- if (r < 0) +- return r; +- } +-#endif + +- return 0; ++ if (r > 0) ++ return -r; /* already warned */ ++ else if (r == -ENOTSUP) { ++ log_debug_errno(r, "ACLs not supported by file system at %s", path); ++ return 0; ++ } else if (r < 0) ++ log_error_errno(r, "ACL operation on \"%s\" failed: %m", path); ++#endif ++ return r; + } + + static int write_one_file(Item *i, const char *path) { +-- +2.3.1 + diff --git a/meta/recipes-core/systemd/systemd/binfmt-install.patch b/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch index c2d5099f24..c14cc6fdd6 100644 --- a/meta/recipes-core/systemd/systemd/binfmt-install.patch +++ b/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch @@ -1,19 +1,33 @@ -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. +From 184a89caacfa00f07e7275bca592bd7dda1b541e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +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 -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 +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 <ross.burton@intel.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + 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 7933de6..78acb6f 100644 +index ba63f68..0fb3f9f 100644 --- a/Makefile.am +++ b/Makefile.am -@@ -3133,10 +3133,6 @@ INSTALL_DIRS += \ +@@ -4838,10 +4838,6 @@ INSTALL_DIRS += \ $(prefix)/lib/binfmt.d \ $(sysconfdir)/binfmt.d @@ -36,21 +50,25 @@ index 6be3893..709adef 100644 +[Install] +WantedBy=sysinit.target diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in -index 02dfe77..86d3481 100644 +index 34a5d52..617462b 100644 --- a/units/systemd-binfmt.service.in +++ b/units/systemd-binfmt.service.in -@@ -11,6 +11,7 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5) +@@ -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=systemd-readahead-collect.service systemd-readahead-replay.service proc-sys-fs-binfmt_misc.automount ++ + After=proc-sys-fs-binfmt_misc.automount Before=sysinit.target shutdown.target ConditionPathIsReadWrite=/proc/sys/ -@@ -24,3 +25,6 @@ ConditionDirectoryNotEmpty=|/run/binfmt.d +@@ -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/systemd-pam-configure-check-uclibc.patch b/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch index 4639532236..dddb7da690 100644 --- a/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch +++ b/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch @@ -1,11 +1,24 @@ +From 4e2e8dbf3f23ab7dca32286cc0f37bff6ac49e22 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 20 Feb 2015 05:05:45 +0000 +Subject: [PATCH 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 <raj.khem@gmail.com> +--- + configure.ac | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) -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 @@ +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= @@ -30,3 +43,6 @@ Index: git/configure.ac # 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/systemd-pam-fix-execvpe.patch b/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch index 7170a38af3..85279d68c2 100644 --- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch +++ b/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch @@ -1,20 +1,29 @@ +From a7417c2e6950d55c22c1b0d15783898b8ff229ef Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +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 <raj.khem@gmail.com> +--- + src/nspawn/nspawn.c | 7 +++++++ + 1 file changed, 7 insertions(+) -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; +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; - static sd_id128_t arg_uuid = {}; -@@ -2045,7 +2047,12 @@ +@@ -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) @@ -23,7 +32,10 @@ Index: systemd-209/src/nspawn/nspawn.c +#else + environ = env_use; + execvp(argv[optind], argv + optind); -+#endif /* HAVE_EXECVPE */ ++#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/systemd-pam-fix-fallocate.patch b/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch index f8e19ce172..631dd77465 100644 --- a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch +++ b/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch @@ -1,19 +1,24 @@ -Upstream-Status: Denied [no desire for uclibc support] +From 34a61b6c9eed3fad360066fb63132ebc7e0aaaa6 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +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 -This patch is uclibc specific, thus not suitable for upstream. +Upstream-Status: Denied [no desire for uclibc support] Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> --- - src/journal/journal-file.c | 16 +++++++++++++++- - src/journal/journald-kmsg.c | 16 ++++++++++++++-- - 2 files changed, 29 insertions(+), 3 deletions(-) + 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 f2f1f35..092f87b 100644 +index 2845e05..9431171 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c -@@ -38,6 +38,8 @@ +@@ -36,6 +36,8 @@ #include "compress.h" #include "fsprg.h" @@ -22,7 +27,7 @@ index f2f1f35..092f87b 100644 #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(JournalFile *f) { +@@ -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; @@ -31,7 +36,7 @@ index f2f1f35..092f87b 100644 assert(f); -@@ -362,9 +364,21 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) +@@ -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. */ @@ -51,13 +56,13 @@ index f2f1f35..092f87b 100644 + +#endif /* HAVE_POSIX_FALLOCATE */ - if (fstat(f->fd, &f->last_stat) < 0) - return -errno; + 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 12992e7..dc4fa93 100644 +index c4216c4..a998ed5 100644 --- a/src/journal/journald-kmsg.c +++ b/src/journal/journald-kmsg.c -@@ -437,6 +437,7 @@ fail: +@@ -436,6 +436,7 @@ fail: int server_open_kernel_seqnum(Server *s) { _cleanup_close_ int fd; uint64_t *p; @@ -65,28 +70,27 @@ index 12992e7..dc4fa93 100644 assert(s); -@@ -449,8 +450,19 @@ int server_open_kernel_seqnum(Server *s) { - log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m"); +@@ -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); ++ /* 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("Failed to allocate sequential number file, ignoring: %m"); ++ if (r < 0) { + log_error_errno(errno, "Failed to allocate sequential number file, ignoring: %m"); return 0; } -- -1.7.9.5 +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 <raj.khem@gmail.com> +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 <raj.khem@gmail.com> +--- + 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/uclibc-get-physmem.patch b/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch index 39dfc9e2ea..5297625c93 100644 --- a/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch +++ b/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch @@ -1,18 +1,24 @@ -bypass unimplemented _SC_PHYS_PAGES system configuration API in uclibc +From b45ea3bfd6635744c8a6b74d0ac701b44bb1d294 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +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 <raj.khem@gmail.com> +--- + src/shared/util.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) -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 @@ - +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"); @@ -29,9 +35,12 @@ Index: git/src/shared/util.c +#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) { + void hexdump(FILE *f, const void *p, size_t s) { +-- +2.1.4 + 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/0009-sysv-generator-add-support-for-executing-scripts-und.patch index 9aa07c1b10..9ea3e83e52 100644 --- a/meta/recipes-core/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch +++ b/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch @@ -1,20 +1,25 @@ -Upstream-Status: Inappropriate [OE specific] - -Subject: add support for executing scripts under /etc/rcS.d/ +From 8791b5b3934c55694872b6915a67340683ead91b Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +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 <Qi.Chen@windriver.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> --- 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 +index bd67f32..6756cc6 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c -@@ -43,7 +43,8 @@ +@@ -42,7 +42,8 @@ typedef enum RunlevelType { RUNLEVEL_UP, @@ -24,9 +29,9 @@ index 9a869ba..10c55c0 100644 } 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 }, +@@ -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}, @@ -34,7 +39,7 @@ index 9a869ba..10c55c0 100644 /* 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 { +@@ -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 @@ -43,7 +48,7 @@ index 9a869ba..10c55c0 100644 }; typedef struct SysvStub { -@@ -82,6 +86,8 @@ typedef struct SysvStub { +@@ -81,6 +85,8 @@ typedef struct SysvStub { char **conflicts; bool has_lsb; bool reload; @@ -52,7 +57,7 @@ index 9a869ba..10c55c0 100644 } SysvStub; const char *arg_dest = "/tmp"; -@@ -156,6 +162,9 @@ static int generate_unit_file(SysvStub *s) { +@@ -183,6 +189,9 @@ static int generate_unit_file(SysvStub *s) { "Description=%s\n", s->path, s->description); @@ -62,7 +67,7 @@ index 9a869ba..10c55c0 100644 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) { +@@ -704,18 +713,30 @@ static int fix_order(SysvStub *s, Hashmap *all_services) { if (s->has_lsb && other->has_lsb) continue; @@ -101,7 +106,7 @@ index 9a869ba..10c55c0 100644 /* FIXME: Maybe we should compare the name here lexicographically? */ } -@@ -725,6 +746,8 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) { +@@ -778,6 +799,8 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) { return log_oom(); service->sysv_start_priority = -1; @@ -110,7 +115,7 @@ index 9a869ba..10c55c0 100644 service->name = name; service->path = fpath; -@@ -810,9 +833,11 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) { +@@ -864,9 +887,11 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) { if (de->d_name[0] == 'S') { @@ -122,8 +127,8 @@ index 9a869ba..10c55c0 100644 + 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) { + 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' && @@ -131,8 +136,8 @@ index 9a869ba..10c55c0 100644 + (rcnd_table[i].type == RUNLEVEL_DOWN || + rcnd_table[i].type == RUNLEVEL_SYSINIT)) { - r = set_ensure_allocated(&shutdown_services, - trivial_hash_func, trivial_compare_func); + r = set_ensure_allocated(&shutdown_services, NULL); + if (r < 0) -- -1.9.1 +2.1.4 diff --git a/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch index c5ad29174c..41b903951e 100644 --- a/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch +++ b/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch @@ -1,7 +1,7 @@ -From 4dc8dee0435bb63cbe474004b0a8df0363fe94dd Mon Sep 17 00:00:00 2001 -From: Dan McGregor <dan.mcgregor@usask.ca> -Date: Fri, 5 Sep 2014 06:28:58 -0600 -Subject: [PATCH] Make root's home directory configurable. +From 3dc731c1d270e2e143de621db9bd898299fd849d Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +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 @@ -10,6 +10,7 @@ should be. Upstream-Status: Pending Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> +Signed-off-by: Khem Raj <raj.khem@gmail.com> --- Makefile.am | 2 ++ configure.ac | 7 +++++++ @@ -18,14 +19,14 @@ Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> src/shared/util.c | 4 ++-- units/console-shell.service.m4.in | 4 ++-- units/emergency.service.in | 4 ++-- - units/rescue.service.m4.in | 4 ++-- + units/rescue.service.in | 4 ++-- 8 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am -index 4028112..5d18f5c 100644 +index 0fb3f9f..4623963 100644 --- a/Makefile.am +++ b/Makefile.am -@@ -191,6 +191,7 @@ AM_CPPFLAGS = \ +@@ -199,6 +199,7 @@ AM_CPPFLAGS = \ -DKEXEC=\"$(KEXEC)\" \ -DLIBDIR=\"$(libdir)\" \ -DROOTLIBDIR=\"$(rootlibdir)\" \ @@ -33,7 +34,7 @@ index 4028112..5d18f5c 100644 -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ -I $(top_srcdir)/src \ -I $(top_builddir)/src/shared \ -@@ -5584,6 +5585,7 @@ EXTRA_DIST += \ +@@ -6342,6 +6343,7 @@ EXTRA_DIST += \ substitutions = \ '|rootlibexecdir=$(rootlibexecdir)|' \ '|rootbindir=$(rootbindir)|' \ @@ -42,13 +43,13 @@ index 4028112..5d18f5c 100644 '|SYSTEMCTL=$(rootbindir)/systemctl|' \ '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ diff --git a/configure.ac b/configure.ac -index 18b7198..365bc73 100644 +index a5b2e6e..55bb7d8 100644 --- a/configure.ac +++ b/configure.ac -@@ -1272,6 +1272,11 @@ AC_ARG_WITH([rootlibdir], +@@ -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]), + [], @@ -57,15 +58,15 @@ index 18b7198..365bc73 100644 AC_ARG_WITH([pamlibdir], AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), [], -@@ -1317,6 +1322,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir]) +@@ -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 -@@ -1400,6 +1406,7 @@ AC_MSG_RESULT([ +@@ -1617,6 +1623,7 @@ AC_MSG_RESULT([ include_prefix: ${INCLUDE_PREFIX} lib dir: ${libdir} rootlib dir: ${with_rootlibdir} @@ -74,34 +75,34 @@ index 18b7198..365bc73 100644 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 62599d0..852d34c 100644 +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 d01da45..3e876d5 100644 +index b597edb..0b32673 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c -@@ -3312,7 +3312,7 @@ int main(int argc, char *argv[]) { +@@ -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(); -@@ -3402,7 +3402,7 @@ int main(int argc, char *argv[]) { - } else if (argc > optind) - execvpe(argv[optind], argv + optind, env_use); +@@ -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); @@ -109,19 +110,19 @@ index d01da45..3e876d5 100644 execle("/bin/sh", "-sh", NULL, env_use); } diff --git a/src/shared/util.c b/src/shared/util.c -index 85a570a..aef6033 100644 +index cbbe3b1..a0e3cc5 100644 --- a/src/shared/util.c +++ b/src/shared/util.c -@@ -4377,7 +4377,7 @@ int get_user_creds( +@@ -4609,7 +4609,7 @@ int get_user_creds( *gid = 0; - + if (home) - *home = "/root"; + *home = ROOTHOMEDIR; - + if (shell) *shell = "/bin/sh"; -@@ -5363,7 +5363,7 @@ int get_home_dir(char **_h) { +@@ -5611,7 +5611,7 @@ int get_home_dir(char **_h) { /* Hardcode home directory for root to avoid NSS */ u = getuid(); if (u == 0) { @@ -129,52 +130,52 @@ index 85a570a..aef6033 100644 + h = strdup(ROOTHOMEDIR); if (!h) return -ENOMEM; - + diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in -index 3f4904a..e2af652 100644 +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=-/sbin/sulogin + ExecStart=-@SULOGIN@ ExecStopPost=-@SYSTEMCTL@ poweroff Type=idle diff --git a/units/emergency.service.in b/units/emergency.service.in -index 91fc1bb..659547e 100644 +index 2695d7b..7f47b73 100644 --- a/units/emergency.service.in +++ b/units/emergency.service.in -@@ -13,8 +13,8 @@ Conflicts=shutdown.target +@@ -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" to try again\\nto boot into default mode.' - ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default" -diff --git a/units/rescue.service.m4.in b/units/rescue.service.m4.in -index ef54369..7aad86f 100644 ---- a/units/rescue.service.m4.in -+++ b/units/rescue.service.m4.in + 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 rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.' - ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default" + 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" -- -1.9.3 +2.1.4 diff --git a/meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch b/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch index fbde13f077..e562bca100 100644 --- a/meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch +++ b/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch @@ -1,11 +1,15 @@ -Upstream-Status: Inappropriate [oe specific] - -Subject: systemd-user: avoid using system-auth +From 7e202f71785bf5a67c8a4f6b58d3585608fbfdc4 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +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 <Qi.Chen@windriver.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> --- src/login/systemd-user | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) @@ -17,10 +21,11 @@ index 8112d74..99635af 100644 @@ -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 +-- +2.1.4 + diff --git a/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch b/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch new file mode 100644 index 0000000000..ccd675798c --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch @@ -0,0 +1,185 @@ +From 2abf886295b979bce6d3f0a240f6f5ecfd70ba37 Mon Sep 17 00:00:00 2001 +From: Randy Witt <randy.e.witt@linux.intel.com> +Date: Wed, 4 Mar 2015 18:32:40 -0800 +Subject: [PATCH] tmpfiles.c: Honor ordering within files as the docs say. + +Previously, globs would always get processed first followed by any other +items in arbitrary order. This is contrary to the documentation which +states "Otherwise, the files/directories are processed in the order they +are listed." + +To fix this, remove the separate "globs" hashmap, and instead use only one +marking each entry as a glob or not. There should be little overhead +from doing this, considering the only time nested processing will occur +is for processing of globs which are not of type "X". + +Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> +--- + src/tmpfiles/tmpfiles.c | 53 ++++++++++++++++++++++--------------------------- + 1 file changed, 24 insertions(+), 29 deletions(-) + +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 917bb3c..0b6d226 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -116,6 +116,7 @@ typedef struct Item { + bool force:1; + + bool done:1; ++ bool glob:1; + } Item; + + typedef struct ItemArray { +@@ -137,7 +138,7 @@ static const char conf_file_dirs[] = CONF_DIRS_NULSTR("tmpfiles"); + + #define MAX_DEPTH 256 + +-static Hashmap *items = NULL, *globs = NULL; ++static OrderedHashmap *items = NULL; + static Set *unix_sockets = NULL; + + static bool needs_glob(ItemType t) { +@@ -176,17 +177,17 @@ static bool takes_ownership(ItemType t) { + RECURSIVE_REMOVE_PATH); + } + +-static struct Item* find_glob(Hashmap *h, const char *match) { ++static struct Item* find_glob(OrderedHashmap *h, const char *match) { + ItemArray *j; + Iterator i; + +- HASHMAP_FOREACH(j, h, i) { ++ ORDERED_HASHMAP_FOREACH(j, h, i) { + unsigned n; + + for (n = 0; n < j->count; n++) { + Item *item = j->items + n; + +- if (fnmatch(item->path, match, FNM_PATHNAME|FNM_PERIOD) == 0) ++ if (item->glob && fnmatch(item->path, match, FNM_PATHNAME|FNM_PERIOD) == 0) + return item; + } + } +@@ -391,12 +392,12 @@ static int dir_cleanup( + } + + /* Is there an item configured for this path? */ +- if (hashmap_get(items, sub_path)) { ++ if (ordered_hashmap_get(items, sub_path)) { + log_debug("Ignoring \"%s\": a separate entry exists.", sub_path); + continue; + } + +- if (find_glob(globs, sub_path)) { ++ if (find_glob(items, sub_path)) { + log_debug("Ignoring \"%s\": a separate glob exists.", sub_path); + continue; + } +@@ -1378,7 +1379,7 @@ static int process_item(Item *i) { + PATH_FOREACH_PREFIX(prefix, i->path) { + ItemArray *j; + +- j = hashmap_get(items, prefix); ++ j = ordered_hashmap_get(items, prefix); + if (j) { + int s; + +@@ -1505,7 +1506,6 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { + _cleanup_free_ char *action = NULL, *mode = NULL, *user = NULL, *group = NULL, *age = NULL, *path = NULL; + _cleanup_(item_free_contents) Item i = {}; + ItemArray *existing; +- Hashmap *h; + int r, c = -1, pos; + bool force = false, boot = false; + +@@ -1739,9 +1739,9 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { + i.age_set = true; + } + +- h = needs_glob(i.type) ? globs : items; ++ i.glob = needs_glob(i.type); + +- existing = hashmap_get(h, i.path); ++ existing = ordered_hashmap_get(items, i.path); + if (existing) { + unsigned n; + +@@ -1752,7 +1752,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { + } + } else { + existing = new0(ItemArray, 1); +- r = hashmap_put(h, i.path, existing); ++ r = ordered_hashmap_put(items, i.path, existing); + if (r < 0) + return log_oom(); + } +@@ -1911,14 +1911,20 @@ static int read_config_file(const char *fn, bool ignore_enoent) { + } + + /* we have to determine age parameter for each entry of type X */ +- HASHMAP_FOREACH(i, globs, iterator) { ++ ORDERED_HASHMAP_FOREACH(i, items, iterator) { + Iterator iter; + Item *j, *candidate_item = NULL; ++ int number = 0; + ++ if (!i->glob) ++ continue; + if (i->type != IGNORE_DIRECTORY_PATH) + continue; + +- HASHMAP_FOREACH(j, items, iter) { ++ ORDERED_HASHMAP_FOREACH(j, items, iter) { ++ number++; ++ if (j == i) ++ continue; + if (j->type != CREATE_DIRECTORY && j->type != TRUNCATE_DIRECTORY && j->type != CREATE_SUBVOLUME) + continue; + +@@ -1964,10 +1970,9 @@ int main(int argc, char *argv[]) { + + mac_selinux_init(NULL); + +- items = hashmap_new(&string_hash_ops); +- globs = hashmap_new(&string_hash_ops); ++ items = ordered_hashmap_new(&string_hash_ops); + +- if (!items || !globs) { ++ if (!items) { + r = log_oom(); + goto finish; + } +@@ -2000,27 +2005,17 @@ int main(int argc, char *argv[]) { + } + } + +- HASHMAP_FOREACH(a, globs, iterator) { +- k = process_item_array(a); +- if (k < 0 && r == 0) +- r = k; +- } +- +- HASHMAP_FOREACH(a, items, iterator) { ++ ORDERED_HASHMAP_FOREACH(a, items, iterator) { + k = process_item_array(a); + if (k < 0 && r == 0) + r = k; + } + + finish: +- while ((a = hashmap_steal_first(items))) +- item_array_free(a); +- +- while ((a = hashmap_steal_first(globs))) ++ while ((a = ordered_hashmap_steal_first(items))) + item_array_free(a); + +- hashmap_free(items); +- hashmap_free(globs); ++ ordered_hashmap_free(items); + + free(arg_include_prefixes); + free(arg_exclude_prefixes); +-- +1.9.3 + diff --git a/meta/recipes-core/systemd/systemd/0013-journal-fix-Inappropriate-ioctl-for-device-on-ext4.patch b/meta/recipes-core/systemd/systemd/0013-journal-fix-Inappropriate-ioctl-for-device-on-ext4.patch new file mode 100644 index 0000000000..a49d626824 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0013-journal-fix-Inappropriate-ioctl-for-device-on-ext4.patch @@ -0,0 +1,37 @@ +From 65eae3b76243d2dfd869f8c43b787575f7b4b994 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org> +Date: Sun, 1 Mar 2015 21:13:10 -0300 +Subject: [PATCH] journal: fix Inappropriate ioctl for device on ext4 + +Logs constantly show + +systemd-journald[395]: Failed to set file attributes: Inappropriate ioctl for device + +This is because ext4 does not support FS_NOCOW_FL. + +[zj: fold into one conditional as suggested on the ML and + fix (preexisting) r/errno confusion in error message.] + +Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> +--- + src/journal/journal-file.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c +index 9c9a548..0e33a0f 100644 +--- a/src/journal/journal-file.c ++++ b/src/journal/journal-file.c +@@ -2609,8 +2609,8 @@ int journal_file_open( + * shouldn't be too bad, given that we do our own + * checksumming). */ + r = chattr_fd(f->fd, true, FS_NOCOW_FL); +- if (r < 0) +- log_warning_errno(errno, "Failed to set file attributes: %m"); ++ if (r < 0 && r != -ENOTTY) ++ log_warning_errno(r, "Failed to set file attributes: %m"); + + /* Let's attach the creation time to the journal file, + * so that the vacuuming code knows the age of this +-- +1.9.3 + diff --git a/meta/recipes-core/systemd/systemd/0014-Revert-rules-remove-firmware-loading-rules.patch b/meta/recipes-core/systemd/systemd/0014-Revert-rules-remove-firmware-loading-rules.patch new file mode 100644 index 0000000000..fe2ba5328d --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0014-Revert-rules-remove-firmware-loading-rules.patch @@ -0,0 +1,28 @@ +From 4f0a722489154da99e7f6b3051afde984eed2f74 Mon Sep 17 00:00:00 2001 +From: Jonathan Liu <net147@gmail.com> +Date: Thu, 19 Mar 2015 15:01:29 +1100 +Subject: [PATCH] Revert "rules: remove firmware loading rules" + +This reverts commit 70e7d754ddb356fb1a2942b262f8cee9650e2a19. +Userspace firmware loading support is needed for Linux < 3.7. + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Jonathan Liu <net147@gmail.com> +--- + rules/50-firmware.rules | 3 +++ + 1 file changed, 3 insertions(+) + create mode 100644 rules/50-firmware.rules + +diff --git a/rules/50-firmware.rules b/rules/50-firmware.rules +new file mode 100644 +index 0000000..f0ae684 +--- /dev/null ++++ b/rules/50-firmware.rules +@@ -0,0 +1,3 @@ ++# do not edit this file, it will be overwritten on update ++ ++SUBSYSTEM=="firmware", ACTION=="add", RUN{builtin}="firmware" +-- +2.3.3 + diff --git a/meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch b/meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch new file mode 100644 index 0000000000..3e3aa278bd --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch @@ -0,0 +1,367 @@ +From 7f074def4e32045353ba4336d703e17b8de7ec4e Mon Sep 17 00:00:00 2001 +From: Jonathan Liu <net147@gmail.com> +Date: Thu, 19 Mar 2015 15:01:33 +1100 +Subject: [PATCH] Revert "udev: remove userspace firmware loading support" + +This reverts commit be2ea723b1d023b3d385d3b791ee4607cbfb20ca. +Userspace firmware loading support is needed for Linux < 3.7. + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Jonathan Liu <net147@gmail.com> +--- + Makefile.am | 12 +++ + README | 9 ++- + TODO | 1 + + configure.ac | 20 +++++ + src/udev/udev-builtin-firmware.c | 154 +++++++++++++++++++++++++++++++++++++++ + src/udev/udev-builtin.c | 3 + + src/udev/udev.h | 6 ++ + src/udev/udevd.c | 13 ++++ + 8 files changed, 214 insertions(+), 4 deletions(-) + create mode 100644 src/udev/udev-builtin-firmware.c + +diff --git a/Makefile.am b/Makefile.am +index bf04d31..9394700 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -3678,6 +3678,18 @@ libudev_core_la_LIBADD = \ + $(BLKID_LIBS) \ + $(KMOD_LIBS) + ++libudev_core_la_CPPFLAGS = \ ++ $(AM_CPPFLAGS) \ ++ -DFIRMWARE_PATH="$(FIRMWARE_PATH)" ++ ++if ENABLE_FIRMWARE ++libudev_core_la_SOURCES += \ ++ src/udev/udev-builtin-firmware.c ++ ++dist_udevrules_DATA += \ ++ rules/50-firmware.rules ++endif ++ + if HAVE_KMOD + libudev_core_la_SOURCES += \ + src/udev/udev-builtin-kmod.c +diff --git a/README b/README +index c722092..db382d2 100644 +--- a/README ++++ b/README +@@ -36,7 +36,8 @@ LICENSE: + - except src/udev/* which is (currently still) GPLv2, GPLv2+ + + REQUIREMENTS: +- Linux kernel >= 3.7 ++ Linux kernel >= 3.0 ++ Linux kernel >= 3.3 for loop device partition support features with nspawn + Linux kernel >= 3.8 for Smack support + + Kernel Config Options: +@@ -51,14 +52,14 @@ REQUIREMENTS: + CONFIG_PROC_FS + CONFIG_FHANDLE (libudev, mount and bind mount handling) + +- udev will fail to work with the legacy sysfs layout: ++ Udev will fail to work with the legacy layout: + CONFIG_SYSFS_DEPRECATED=n + + Legacy hotplug slows down the system and confuses udev: + CONFIG_UEVENT_HELPER_PATH="" + +- Userspace firmware loading is not supported and should +- be disabled in the kernel: ++ Userspace firmware loading is deprecated, will go away, and ++ sometimes causes problems: + CONFIG_FW_LOADER_USER_HELPER=n + + Some udev rules and virtualization detection relies on it: +diff --git a/TODO b/TODO +index 255a4f2..407bdd0 100644 +--- a/TODO ++++ b/TODO +@@ -727,6 +727,7 @@ Features: + * ExecOnFailure=/usr/bin/foo + + * udev: ++ - remove src/udev/udev-builtin-firmware.c (CONFIG_FW_LOADER_USER_HELPER=n) + - move to LGPL + - kill scsi_id + - add trigger --subsystem-match=usb/usb_device device +diff --git a/configure.ac b/configure.ac +index 97a29d6..13b80ce 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1245,6 +1245,25 @@ fi + AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"]) + + # ------------------------------------------------------------------------------ ++AC_ARG_WITH(firmware-path, ++ AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], ++ [Firmware search path (default="")]), ++ [], [with_firmware_path=""]) ++OLD_IFS=$IFS ++IFS=: ++for i in $with_firmware_path; do ++ if test "x${FIRMWARE_PATH}" = "x"; then ++ FIRMWARE_PATH="\\\"${i}/\\\"" ++ else ++ FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\"" ++ fi ++done ++IFS=$OLD_IFS ++AC_SUBST(FIRMWARE_PATH) ++AS_IF([test "x${FIRMWARE_PATH}" != "x"], [ AC_DEFINE(HAVE_FIRMWARE, 1, [Define if FIRMWARE is available]) ]) ++AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"]) ++ ++# ------------------------------------------------------------------------------ + AC_ARG_ENABLE([gudev], + AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]), + [], [enable_gudev=yes]) +@@ -1533,6 +1552,7 @@ AC_MSG_RESULT([ + Build Python: ${PYTHON} + Installation Python: ${PYTHON_BINARY} + sphinx binary: ${SPHINX_BUILD} ++ firmware path: ${FIRMWARE_PATH} + PAM modules dir: ${with_pamlibdir} + PAM configuration dir: ${with_pamconfdir} + D-Bus policy dir: ${with_dbuspolicydir} +diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c +new file mode 100644 +index 0000000..bd8c2fb +--- /dev/null ++++ b/src/udev/udev-builtin-firmware.c +@@ -0,0 +1,154 @@ ++/* ++ * firmware - Kernel firmware loader ++ * ++ * Copyright (C) 2009 Piter Punk <piterpunk@slackware.com> ++ * Copyright (C) 2009-2011 Kay Sievers <kay@vrfy.org> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details:* ++ */ ++ ++#include <unistd.h> ++#include <stdlib.h> ++#include <string.h> ++#include <stdio.h> ++#include <getopt.h> ++#include <errno.h> ++#include <stdbool.h> ++#include <sys/utsname.h> ++#include <sys/stat.h> ++ ++#include "udev.h" ++ ++static bool set_loading(struct udev *udev, char *loadpath, const char *state) { ++ FILE *ldfile; ++ ++ ldfile = fopen(loadpath, "we"); ++ if (ldfile == NULL) { ++ log_error("error: can not open '%s'", loadpath); ++ return false; ++ }; ++ fprintf(ldfile, "%s\n", state); ++ fclose(ldfile); ++ return true; ++} ++ ++static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) { ++ char *buf; ++ FILE *fsource = NULL, *ftarget = NULL; ++ bool ret = false; ++ ++ buf = malloc(size); ++ if (buf == NULL) { ++ log_error("No memory available to load firmware file"); ++ return false; ++ } ++ ++ log_debug("writing '%s' (%zi) to '%s'", source, size, target); ++ ++ fsource = fopen(source, "re"); ++ if (fsource == NULL) ++ goto exit; ++ ftarget = fopen(target, "we"); ++ if (ftarget == NULL) ++ goto exit; ++ if (fread(buf, size, 1, fsource) != 1) ++ goto exit; ++ if (fwrite(buf, size, 1, ftarget) == 1) ++ ret = true; ++exit: ++ if (ftarget != NULL) ++ fclose(ftarget); ++ if (fsource != NULL) ++ fclose(fsource); ++ free(buf); ++ return ret; ++} ++ ++static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) { ++ struct udev *udev = udev_device_get_udev(dev); ++ static const char *searchpath[] = { FIRMWARE_PATH }; ++ char loadpath[UTIL_PATH_SIZE]; ++ char datapath[UTIL_PATH_SIZE]; ++ char fwpath[UTIL_PATH_SIZE]; ++ const char *firmware; ++ FILE *fwfile = NULL; ++ struct utsname kernel; ++ struct stat statbuf; ++ unsigned int i; ++ int rc = EXIT_SUCCESS; ++ ++ firmware = udev_device_get_property_value(dev, "FIRMWARE"); ++ if (firmware == NULL) { ++ log_error("firmware parameter missing"); ++ rc = EXIT_FAILURE; ++ goto exit; ++ } ++ ++ /* lookup firmware file */ ++ uname(&kernel); ++ for (i = 0; i < ELEMENTSOF(searchpath); i++) { ++ strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); ++ fwfile = fopen(fwpath, "re"); ++ if (fwfile != NULL) ++ break; ++ ++ strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); ++ fwfile = fopen(fwpath, "re"); ++ if (fwfile != NULL) ++ break; ++ } ++ ++ strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); ++ ++ if (fwfile == NULL) { ++ log_debug("did not find firmware file '%s'", firmware); ++ rc = EXIT_FAILURE; ++ /* ++ * Do not cancel the request in the initrd, the real root might have ++ * the firmware file and the 'coldplug' run in the real root will find ++ * this pending request and fulfill or cancel it. ++ * */ ++ if (!in_initrd()) ++ set_loading(udev, loadpath, "-1"); ++ goto exit; ++ } ++ ++ if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { ++ if (!in_initrd()) ++ set_loading(udev, loadpath, "-1"); ++ rc = EXIT_FAILURE; ++ goto exit; ++ } ++ ++ if (!set_loading(udev, loadpath, "1")) ++ goto exit; ++ ++ strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); ++ if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { ++ log_error("error sending firmware '%s' to device", firmware); ++ set_loading(udev, loadpath, "-1"); ++ rc = EXIT_FAILURE; ++ goto exit; ++ }; ++ ++ set_loading(udev, loadpath, "0"); ++exit: ++ if (fwfile) ++ fclose(fwfile); ++ return rc; ++} ++ ++const struct udev_builtin udev_builtin_firmware = { ++ .name = "firmware", ++ .cmd = builtin_firmware, ++ .help = "kernel firmware loader", ++ .run_once = true, ++}; +diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c +index 1950ec2..f21c0b6 100644 +--- a/src/udev/udev-builtin.c ++++ b/src/udev/udev-builtin.c +@@ -34,6 +34,9 @@ static const struct udev_builtin *builtins[] = { + [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, + #endif + [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs, ++#ifdef HAVE_FIRMWARE ++ [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, ++#endif + [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb, + [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, + [UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard, +diff --git a/src/udev/udev.h b/src/udev/udev.h +index dece6ec..f7ee1e7 100644 +--- a/src/udev/udev.h ++++ b/src/udev/udev.h +@@ -151,6 +151,9 @@ enum udev_builtin_cmd { + UDEV_BUILTIN_BLKID, + #endif + UDEV_BUILTIN_BTRFS, ++#ifdef HAVE_FIRMWARE ++ UDEV_BUILTIN_FIRMWARE, ++#endif + UDEV_BUILTIN_HWDB, + UDEV_BUILTIN_INPUT_ID, + UDEV_BUILTIN_KEYBOARD, +@@ -179,6 +182,9 @@ struct udev_builtin { + extern const struct udev_builtin udev_builtin_blkid; + #endif + extern const struct udev_builtin udev_builtin_btrfs; ++#ifdef HAVE_FIRMWARE ++extern const struct udev_builtin udev_builtin_firmware; ++#endif + extern const struct udev_builtin udev_builtin_hwdb; + extern const struct udev_builtin udev_builtin_input_id; + extern const struct udev_builtin udev_builtin_keyboard; +diff --git a/src/udev/udevd.c b/src/udev/udevd.c +index 99d4c89..71af1e1 100644 +--- a/src/udev/udevd.c ++++ b/src/udev/udevd.c +@@ -99,6 +99,9 @@ struct event { + dev_t devnum; + int ifindex; + bool is_block; ++#ifdef HAVE_FIRMWARE ++ bool nodelay; ++#endif + }; + + static inline struct event *node_to_event(struct udev_list_node *node) { +@@ -472,6 +475,10 @@ static int event_queue_insert(struct udev_device *dev) { + event->devnum = udev_device_get_devnum(dev); + event->is_block = streq("block", udev_device_get_subsystem(dev)); + event->ifindex = udev_device_get_ifindex(dev); ++#ifdef HAVE_FIRMWARE ++ if (streq(udev_device_get_subsystem(dev), "firmware")) ++ event->nodelay = true; ++#endif + + log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev), + udev_device_get_action(dev), udev_device_get_subsystem(dev)); +@@ -548,6 +555,12 @@ static bool is_devpath_busy(struct event *event) { + return true; + } + ++#ifdef HAVE_FIRMWARE ++ /* allow to bypass the dependency tracking */ ++ if (event->nodelay) ++ continue; ++#endif ++ + /* parent device event found */ + if (event->devpath[common] == '/') { + event->delaying_seqnum = loop_event->seqnum; +-- +2.3.3 + 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 <raj.khem@gmail.com> - -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-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 <maxime.ripard@free-electrons.com> ---- - 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 <raj.khem@gmail.com> - -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/tmpfiles-pam.patch b/meta/recipes-core/systemd/systemd/tmpfiles-pam.patch new file mode 100644 index 0000000000..a40b1b9d3f --- /dev/null +++ b/meta/recipes-core/systemd/systemd/tmpfiles-pam.patch @@ -0,0 +1,30 @@ +Upstream-Status: Submitted +Signed-off-by: Ross Burton <ross.burton@intel.com> + +From 0802aaaa9784813d318d045c79533a044eedf542 Mon Sep 17 00:00:00 2001 +From: Ross Burton <ross.burton@intel.com> +Date: Tue, 3 Mar 2015 11:32:29 +0000 +Subject: [PATCH] tmpfiles.d: only copy /etc/pam.d if PAM is present + +If HAVE_PAM isn't set then don't attempt to copy /etc/pam.d from the factory, as +it doesn't get installed. + +Signed-off-by: Ross Burton <ross.burton@intel.com> +--- + tmpfiles.d/etc.conf.m4 | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tmpfiles.d/etc.conf.m4 b/tmpfiles.d/etc.conf.m4 +index 9b0e080..ab5cd16 100644 +--- a/tmpfiles.d/etc.conf.m4 ++++ b/tmpfiles.d/etc.conf.m4 +@@ -14,4 +14,6 @@ m4_ifdef(`ENABLE_RESOLVED', + L /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf + )m4_dnl + C /etc/nsswitch.conf - - - - ++m4_ifdef(`HAVE_PAM', + C /etc/pam.d - - - - ++)m4_dnl +-- +1.7.10.4 + diff --git a/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch b/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch deleted file mode 100644 index 15645dee11..0000000000 --- a/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch +++ /dev/null @@ -1,19 +0,0 @@ -Dont include sys/sysinfo.h on uclibc it conflicts with linux/sysinfo.h - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Upstream-Status: Inappropriate [uclibc specific] - -Index: systemd-209/src/readahead/readahead-common.c -=================================================================== ---- systemd-209.orig/src/readahead/readahead-common.c 2014-02-12 18:42:33.810685053 -0800 -+++ systemd-209/src/readahead/readahead-common.c 2014-02-19 23:49:31.856661142 -0800 -@@ -22,7 +22,9 @@ - #include <errno.h> - #include <stdlib.h> - #include <string.h> -+#ifndef __UCLIBC__ - #include <sys/sysinfo.h> -+#endif - #include <sys/inotify.h> - #include <fcntl.h> - #include <sys/mman.h> |