diff --git a/recipes-tweaks/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch b/recipes-tweaks/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch new file mode 100644 index 0000000..9aa07c1 --- /dev/null +++ b/recipes-tweaks/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch @@ -0,0 +1,138 @@ +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/recipes-tweaks/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch b/recipes-tweaks/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch new file mode 100644 index 0000000..448ef1a --- /dev/null +++ b/recipes-tweaks/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch @@ -0,0 +1,29 @@ +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 +--- + 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/recipes-tweaks/systemd/systemd/run-ptest b/recipes-tweaks/systemd/systemd/run-ptest index 2f6bd93..a2d61c2 100644 --- a/recipes-tweaks/systemd/systemd/run-ptest +++ b/recipes-tweaks/systemd/systemd/run-ptest @@ -1,3 +1,5 @@ +#!/bin/sh + tar -C test -xJf test/sys.tar.xz make test/rules-test.sh.log make test/udev-test.pl.log diff --git a/recipes-tweaks/systemd/systemd_216.bb b/recipes-tweaks/systemd/systemd_216.bb index ead32a0..a02cd3b 100644 --- a/recipes-tweaks/systemd/systemd_216.bb +++ b/recipes-tweaks/systemd/systemd_216.bb @@ -10,14 +10,14 @@ PROVIDES = "udev" PE = "1" -DEPENDS = "curl kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup glib-2.0 qemu-native util-linux" +DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup glib-2.0 qemu-native util-linux" DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" SECTION = "base/shell" inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext -SRCREV = "e1ad6e245dcf63faa8f183063eb97678f4f9ac94" +SRCREV = "5d0ae62c665262c4c55536457e84e278c252cc0b" PV = "216+git${SRCPV}" @@ -30,6 +30,8 @@ SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol= file://optional_secure_getenv.patch \ file://uclibc-sysinfo_h.patch \ file://uclibc-get-physmem.patch \ + file://0001-add-support-for-executing-scripts-under-etc-rcS.d.patch \ + file://0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch \ file://0001-configure-disable-LTO.patch \ file://touchscreen.rules \ file://00-create-volatile.conf \ @@ -47,6 +49,7 @@ LDFLAGS_append_libc-uclibc = " -lrt" GTKDOC_DOCDIR = "${S}/docs/" PACKAGECONFIG ??= "xz" +PACKAGECONFIG[journal-upload] = "--enable-libcurl,--disable-libcurl,curl" # Sign the journal for anti-tampering PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt" # regardless of PACKAGECONFIG, libgcrypt is always required to expand @@ -56,6 +59,9 @@ DEPENDS += "libgcrypt" PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz" PACKAGECONFIG[cryptsetup] = "--enable-libcryptsetup,--disable-libcryptsetup,cryptsetup" PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicrohttpd" +PACKAGECONFIG[elfutils] = "--enable-elfutils,--disable-elfutils,elfutils" +PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved" +PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd" CACHED_CONFIGUREVARS = "ac_cv_path_KILL=${base_bindir}/kill" @@ -123,8 +129,26 @@ do_install() { sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd fi + # Move libgudev back to ${rootlibdir} to keep backward compatibility + [ ${rootlibdir} != ${libdir} ] && mv -t ${D}${rootlibdir} ${D}${libdir}/libgudev* + # Delete journal README, as log can be symlinked inside volatile. rm -f ${D}/${localstatedir}/log/README + + # Create symlinks for systemd-update-utmp-runlevel.service + install -d ${D}${systemd_unitdir}/system/graphical.target.wants + install -d ${D}${systemd_unitdir}/system/multi-user.target.wants + install -d ${D}${systemd_unitdir}/system/poweroff.target.wants + install -d ${D}${systemd_unitdir}/system/reboot.target.wants + install -d ${D}${systemd_unitdir}/system/rescue.target.wants + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service + + # Enable journal to forward message to syslog daemon + sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf } do_install_ptest () { @@ -145,9 +169,7 @@ do_install_ptest () { python populate_packages_prepend (){ systemdlibdir = d.getVar("rootlibdir", True) - prefixlibdir = d.getVar("libdir", True) do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) - do_split_packages(d, prefixlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) } PACKAGES_DYNAMIC += "^lib(udev|gudev|systemd).*" @@ -194,7 +216,7 @@ FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ ${systemd_unitdir}/system/systemd-binfmt.service" RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc" -RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts" +RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps" CONFFILES_${PN} = "${sysconfdir}/systemd/journald.conf \ ${sysconfdir}/systemd/logind.conf \ @@ -209,8 +231,8 @@ FILES_${PN} = " ${base_bindir}/* \ ${datadir}/dbus-1/services \ ${datadir}/dbus-1/system-services \ ${datadir}/polkit-1 \ - ${datadir}/factory \ ${datadir}/${BPN} \ + ${datadir}/factory \ ${sysconfdir}/bash_completion.d/ \ ${sysconfdir}/dbus-1/ \ ${sysconfdir}/machine-id \ @@ -223,8 +245,7 @@ FILES_${PN} = " ${base_bindir}/* \ ${rootlibexecdir}/systemd/* \ ${systemd_unitdir}/* \ ${base_libdir}/security/*.so \ - ${libdir}/libnss_*.so.* \ - ${libdir}/sysusers.d \ + ${libdir}/libnss_* \ /cgroup \ ${bindir}/systemd* \ ${bindir}/busctl \ @@ -237,6 +258,7 @@ FILES_${PN} = " ${base_bindir}/* \ ${exec_prefix}/lib/systemd \ ${exec_prefix}/lib/modules-load.d \ ${exec_prefix}/lib/sysctl.d \ + ${exec_prefix}/lib/sysusers.d \ ${localstatedir} \ /lib/udev/rules.d/70-uaccess.rules \ /lib/udev/rules.d/71-seat.rules \ @@ -254,7 +276,7 @@ RDEPENDS_${PN} += "volatile-binds" RRECOMMENDS_${PN} += "systemd-serialgetty systemd-compat-units udev-hwdb\ util-linux-agetty \ util-linux-fsck e2fsprogs-e2fsck \ - kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \ + kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 os-release \ " PACKAGES =+ "udev-dbg udev udev-hwdb"