From 38150f17b44aaa2f8b17eca6a77f0ca597e5327f Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 28 Mar 2013 00:48:29 -0700 Subject: systemd: Upgrade to 199 udevadm is now moved from /usr/bin to /bin so account for that bash completions for udevadm should be packages with udev-utils since thats where udevadm itself is, they were in systemd package which is not correct location for it Backport patches for readahead fixes on spinning disks and to tackle error reported on missing /etc/sysctl.conf (From OE-Core rev: 0e692e846e5d6685619a7ce9f6e7346ced013b9b) Signed-off-by: Khem Raj Signed-off-by: Richard Purdie --- .../0002-readahead-chunk-on-spinning-media.patch | 142 +++++++++++ .../systemd/systemd/0003-readahead-cleanups.patch | 86 +++++++ ...ctl-Handle-missing-etc-sysctl.conf-proper.patch | 33 +++ meta/recipes-core/systemd/systemd_198.bb | 275 -------------------- meta/recipes-core/systemd/systemd_199.bb | 278 +++++++++++++++++++++ 5 files changed, 539 insertions(+), 275 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd/0002-readahead-chunk-on-spinning-media.patch create mode 100644 meta/recipes-core/systemd/systemd/0003-readahead-cleanups.patch create mode 100644 meta/recipes-core/systemd/systemd/0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch delete mode 100644 meta/recipes-core/systemd/systemd_198.bb create mode 100644 meta/recipes-core/systemd/systemd_199.bb (limited to 'meta/recipes-core/systemd') diff --git a/meta/recipes-core/systemd/systemd/0002-readahead-chunk-on-spinning-media.patch b/meta/recipes-core/systemd/systemd/0002-readahead-chunk-on-spinning-media.patch new file mode 100644 index 0000000000..d57a01c916 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-readahead-chunk-on-spinning-media.patch @@ -0,0 +1,142 @@ +Upstream-Status: Backport + +-Khem 2013/03/28 + +From 94243ef299425d6c7089a7a05c48c9bb8f6cf3da Mon Sep 17 00:00:00 2001 +From: Auke Kok +Date: Fri, 22 Mar 2013 15:09:45 -0700 +Subject: [PATCH 02/17] readahead: chunk on spinning media + +Readahead has all sorts of bad side effects depending on your +storage media. On rotating disks, it may be degrading startup +performance if enough requests are queued spanning linearly +over all blocks early at boot, and mount, blkid and friends +want to insert reads to the start of these block devices after. + +The end result is that on spinning disks with ext3/4 that udev +and mounts take a very long time, and nothing really happens until +readahead is completely finished. + +This has the net effect that the CPU is almost entirely idle +for the entire period that readahead is working. We could have +finished starting up quite a lot of services in this time if +we were smarter at how we do readahead. + +This patch sorts all requests into 2 second "chunks" and sub-sorts +each chunk by block. This adds a single cross-drive seek per "chunk" +but has the benefit that we will have a lot of the blocks we need +early on in the boot sequence loaded into memory faster. + +For a comparison of how before/after bootcharts look (ext4 on a +mobile 5400rpm 250GB drive) please look at: + + http://foo-projects.org/~sofar/blocked-tests/ + +There are bootcharts in the "before" and "after" folders where you +should be able to see that many low-level services finish 5-7 +seconds earlier with the patch applied (after). +--- + Makefile.am | 2 +- + src/readahead/readahead-collect.c | 28 +++++++++++++++++++++++++--- + 2 files changed, 26 insertions(+), 4 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 37c1cc2..5861976 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -2956,7 +2956,7 @@ systemd_readahead_SOURCES = \ + systemd_readahead_LDADD = \ + libsystemd-shared.la \ + libsystemd-daemon.la \ +- libudev.la ++ libudev.la -lm + + dist_doc_DATA += \ + src/readahead/sd-readahead.c \ +diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c +index 5d07f47..5d22949 100644 +--- a/src/readahead/readahead-collect.c ++++ b/src/readahead/readahead-collect.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_FANOTIFY_INIT + #include +@@ -67,6 +68,7 @@ + */ + + static ReadaheadShared *shared = NULL; ++static struct timespec starttime; + + /* Avoid collisions with the NULL pointer */ + #define SECTOR_TO_PTR(s) ULONG_TO_PTR((s)+1) +@@ -205,6 +207,7 @@ static unsigned long fd_first_block(int fd) { + struct item { + const char *path; + unsigned long block; ++ unsigned long bin; + }; + + static int qsort_compare(const void *a, const void *b) { +@@ -213,6 +216,13 @@ static int qsort_compare(const void *a, const void *b) { + i = a; + j = b; + ++ /* sort by bin first */ ++ if (i->bin < j->bin) ++ return -1; ++ if (i->bin > j->bin) ++ return 1; ++ ++ /* then sort by sector */ + if (i->block < j->block) + return -1; + if (i->block > j->block) +@@ -250,6 +260,8 @@ static int collect(const char *root) { + goto finish; + } + ++ clock_gettime(CLOCK_MONOTONIC, &starttime); ++ + /* If there's no pack file yet we lower the kernel readahead + * so that mincore() is accurate. If there is a pack file + * already we assume it is accurate enough so that kernel +@@ -447,10 +459,21 @@ static int collect(const char *root) { + free(p); + else { + unsigned long ul; ++ struct timespec ts; ++ struct item *entry; ++ ++ entry = new0(struct item, 1); + + ul = fd_first_block(m->fd); + +- if ((k = hashmap_put(files, p, SECTOR_TO_PTR(ul))) < 0) { ++ clock_gettime(CLOCK_MONOTONIC, &ts); ++ ++ entry->block = ul; ++ entry->path = strdup(p); ++ entry->bin = round((ts.tv_sec - starttime.tv_sec + ++ ((ts.tv_nsec - starttime.tv_nsec) / 1000000000.0)) / 2.0); ++ ++ if ((k = hashmap_put(files, p, entry)) < 0) { + log_warning("set_put() failed: %s", strerror(-k)); + free(p); + } +@@ -518,8 +541,7 @@ done: + + j = ordered; + HASHMAP_FOREACH_KEY(q, p, files, i) { +- j->path = p; +- j->block = PTR_TO_SECTOR(q); ++ memcpy(j, q, sizeof(struct item)); + j++; + } + +-- +1.7.9.5 + diff --git a/meta/recipes-core/systemd/systemd/0003-readahead-cleanups.patch b/meta/recipes-core/systemd/systemd/0003-readahead-cleanups.patch new file mode 100644 index 0000000000..e0b68df607 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0003-readahead-cleanups.patch @@ -0,0 +1,86 @@ +Upstream-Status: Backport + +-Khem 2013/03/28 + +From b0640287f784a320661f7206c9ade07b99003fd5 Mon Sep 17 00:00:00 2001 +From: Auke Kok +Date: Tue, 26 Mar 2013 11:13:47 -0700 +Subject: [PATCH 03/17] readahead: cleanups + +- check for OOM +- no need to use floats and round() +--- + Makefile.am | 2 +- + src/readahead/readahead-collect.c | 20 ++++++++++++++------ + 2 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 5861976..37c1cc2 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -2956,7 +2956,7 @@ systemd_readahead_SOURCES = \ + systemd_readahead_LDADD = \ + libsystemd-shared.la \ + libsystemd-daemon.la \ +- libudev.la -lm ++ libudev.la + + dist_doc_DATA += \ + src/readahead/sd-readahead.c \ +diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c +index 5d22949..e2fd8df 100644 +--- a/src/readahead/readahead-collect.c ++++ b/src/readahead/readahead-collect.c +@@ -68,7 +68,7 @@ + */ + + static ReadaheadShared *shared = NULL; +-static struct timespec starttime; ++static usec_t starttime; + + /* Avoid collisions with the NULL pointer */ + #define SECTOR_TO_PTR(s) ULONG_TO_PTR((s)+1) +@@ -260,7 +260,7 @@ static int collect(const char *root) { + goto finish; + } + +- clock_gettime(CLOCK_MONOTONIC, &starttime); ++ starttime = now(CLOCK_MONOTONIC); + + /* If there's no pack file yet we lower the kernel readahead + * so that mincore() is accurate. If there is a pack file +@@ -459,19 +459,27 @@ static int collect(const char *root) { + free(p); + else { + unsigned long ul; +- struct timespec ts; ++ usec_t entrytime; + struct item *entry; + + entry = new0(struct item, 1); ++ if (!entry) { ++ r = log_oom(); ++ goto finish; ++ } + + ul = fd_first_block(m->fd); + +- clock_gettime(CLOCK_MONOTONIC, &ts); ++ entrytime = now(CLOCK_MONOTONIC); + + entry->block = ul; + entry->path = strdup(p); +- entry->bin = round((ts.tv_sec - starttime.tv_sec + +- ((ts.tv_nsec - starttime.tv_nsec) / 1000000000.0)) / 2.0); ++ if (!entry->path) { ++ free(entry); ++ r = log_oom(); ++ goto finish; ++ } ++ entry->bin = (entrytime - starttime) / 2000000; + + if ((k = hashmap_put(files, p, entry)) < 0) { + log_warning("set_put() failed: %s", strerror(-k)); +-- +1.7.9.5 + diff --git a/meta/recipes-core/systemd/systemd/0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch b/meta/recipes-core/systemd/systemd/0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch new file mode 100644 index 0000000000..f2c8e0290f --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch @@ -0,0 +1,33 @@ +Upstream-Status: Backport + +-Khem 2013/03/28 + +From 6f6fad96addf6b00b55c98cc0d0d8026b0c1e7ca Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra +Date: Wed, 27 Mar 2013 13:41:59 +0100 +Subject: [PATCH 13/17] systemd-sysctl: Handle missing /etc/sysctl.conf + properly + +Since fabe5c0e5fce730aa66e10a9c4f9fdd443d7aeda, systemd-sysctl returns +a non-zero exit code if /etc/sysctl.conf does not exist, due to a +broken ENOENT check. +--- + src/sysctl/sysctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c +index 2d43660..79f3f77 100644 +--- a/src/sysctl/sysctl.c ++++ b/src/sysctl/sysctl.c +@@ -125,7 +125,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno + + r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f); + if (r < 0) { +- if (ignore_enoent && errno == -ENOENT) ++ if (ignore_enoent && r == -ENOENT) + return 0; + + log_error("Failed to open file '%s', ignoring: %s", path, strerror(-r)); +-- +1.7.9.5 + diff --git a/meta/recipes-core/systemd/systemd_198.bb b/meta/recipes-core/systemd/systemd_198.bb deleted file mode 100644 index 6a8db512ca..0000000000 --- a/meta/recipes-core/systemd/systemd_198.bb +++ /dev/null @@ -1,275 +0,0 @@ -DESCRIPTION = "Systemd a init replacement" -HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd" - -LICENSE = "GPLv2 & LGPLv2.1 & MIT" -LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ - file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \ - file://LICENSE.MIT;md5=544799d0b492f119fa04641d1b8868ed" - -PROVIDES = "udev" - -PE = "1" - -DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup tcp-wrappers glib-2.0" -DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" - -SECTION = "base/shell" - -inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d - -SRC_URI = "http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz \ - file://touchscreen.rules \ - file://modprobe.rules \ - file://var-run.conf \ - ${UCLIBCPATCHES} \ - file://00-create-volatile.conf \ - file://init \ - " -SRC_URI[md5sum] = "26a75e2a310f8c1c1ea9ec26ddb171c5" -SRC_URI[sha256sum] = "444492355e5ff0ad99e0691ecaff1081ee8d45901580f47ba8b74e56107c71bf" - -UCLIBCPATCHES = "" -UCLIBCPATCHES_libc-uclibc = "file://systemd-pam-configure-check-uclibc.patch \ - file://systemd-pam-fix-execvpe.patch \ - file://systemd-pam-fix-fallocate.patch \ - file://systemd-pam-fix-getty-unit.patch \ - file://systemd-pam-fix-mkostemp.patch \ - file://systemd-pam-fix-msformat.patch \ - file://optional_secure_getenv.patch \ - " -LDFLAGS_libc-uclibc_append = " -lrt" - -GTKDOC_DOCDIR = "${S}/docs/" - -PACKAGECONFIG ??= "xz" -# Sign the journal for anti-tampering -PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt" -# Compress the journal -PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz" - -CACHED_CONFIGUREVARS = "ac_cv_path_KILL=${base_bindir}/kill" - -# The gtk+ tools should get built as a separate recipe e.g. systemd-tools -EXTRA_OECONF = " --with-rootprefix=${base_prefix} \ - --with-rootlibdir=${base_libdir} \ - --sbindir=${base_sbindir} \ - --libexecdir=${base_libdir} \ - ${@base_contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)} \ - --enable-xz \ - --disable-manpages \ - --disable-coredump \ - --disable-introspection \ - --disable-tcpwrap \ - --enable-split-usr \ - --disable-microhttpd \ - --without-python \ - --with-sysvrcnd-path=${sysconfdir} \ - ac_cv_path_KILL=${base_bindir}/kill \ - " -# uclibc does not have NSS -EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname " - -# There's no docbook-xsl-native, so for the xsltproc check to false -do_configure_prepend() { - export CPP="${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}" - - sed -i -e 's:=/root:=${ROOT_HOME}:g' units/*.service* -} - -do_install() { - autotools_do_install - install -d ${D}/${base_sbindir} - # provided by a seperate recipe - rm ${D}${systemd_unitdir}/system/serial-getty* -f - - # provide support for initramfs - ln -s ${systemd_unitdir}/systemd ${D}/init - ln -s ${systemd_unitdir}/systemd-udevd ${D}/${base_sbindir}/udevd - - # create dir for journal - install -d ${D}${localstatedir}/log/journal - - # create machine-id - # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable - touch ${D}${sysconfdir}/machine-id - - install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/ - - install -m 0644 ${WORKDIR}/var-run.conf ${D}${sysconfdir}/tmpfiles.d/ - - install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ - - if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd - fi -} - -python populate_packages_prepend (){ - systemdlibdir = d.getVar("base_libdir", True) - do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) -} -PACKAGES_DYNAMIC += "^lib(udev|gudev|systemd).*" - -PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze" - -USERADD_PACKAGES = "${PN}" -GROUPADD_PARAM_${PN} = "-r lock" - -FILES_${PN}-analyze = "${base_bindir}/systemd-analyze" - -FILES_${PN}-initramfs = "/init" -RDEPENDS_${PN}-initramfs = "${PN}" - -FILES_${PN}-gui = "${bindir}/systemadm" - -FILES_${PN}-vconsole-setup = "${systemd_unitdir}/systemd-vconsole-setup \ - ${systemd_unitdir}/system/systemd-vconsole-setup.service \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service" - -RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts" - -CONFFILES_${PN} = "${sysconfdir}/systemd/journald.conf \ - ${sysconfdir}/systemd/logind.conf \ - ${sysconfdir}/systemd/system.conf \ - ${sysconfdir}/systemd/user.conf" - -FILES_${PN} = " ${base_bindir}/* \ - ${datadir}/bash-completion \ - ${datadir}/dbus-1/services \ - ${datadir}/dbus-1/system-services \ - ${datadir}/polkit-1 \ - ${datadir}/${PN} \ - ${sysconfdir}/bash_completion.d/ \ - ${sysconfdir}/binfmt.d/ \ - ${sysconfdir}/dbus-1/ \ - ${sysconfdir}/machine-id \ - ${sysconfdir}/modules-load.d/ \ - ${sysconfdir}/sysctl.d/ \ - ${sysconfdir}/systemd/ \ - ${sysconfdir}/tmpfiles.d/ \ - ${sysconfdir}/xdg/ \ - ${sysconfdir}/init.d/README \ - ${systemd_unitdir}/* \ - ${systemd_unitdir}/system/* \ - /lib/udev/rules.d/99-systemd.rules \ - ${base_libdir}/security/*.so \ - ${libdir}/libnss_myhostname.so.2 \ - /cgroup \ - ${bindir}/systemd* \ - ${bindir}/localectl \ - ${bindir}/hostnamectl \ - ${bindir}/timedatectl \ - ${bindir}/bootctl \ - ${bindir}/kernel-install \ - ${exec_prefix}/lib/tmpfiles.d/*.conf \ - ${exec_prefix}/lib/systemd \ - ${exec_prefix}/lib/binfmt.d \ - ${exec_prefix}/lib/modules-load.d \ - ${exec_prefix}/lib/sysctl.d \ - ${localstatedir} \ - ${libexecdir} \ - /lib/udev/rules.d/70-uaccess.rules \ - /lib/udev/rules.d/71-seat.rules \ - /lib/udev/rules.d/73-seat-late.rules \ - /lib/udev/rules.d/99-systemd.rules \ - " - -FILES_${PN}-dbg += "${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/" -FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" - -RDEPENDS_${PN} += "dbus" - -RRECOMMENDS_${PN} += "systemd-serialgetty systemd-compat-units \ - util-linux-agetty \ - util-linux-fsck e2fsprogs-e2fsck \ - kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \ -" - -PACKAGES =+ "udev-dbg udev udev-consolekit udev-utils udev-hwdb" - -FILES_udev-dbg += "/lib/udev/.debug" - -RDEPENDS_udev += "udev-utils" -RPROVIDES_udev = "hotplug" -RRECOMMENDS_udev += "udev-extraconf udev-hwdb" - -FILES_udev += "${base_sbindir}/udevd \ - ${base_libdir}/systemd/systemd-udevd \ - /lib/udev/accelerometer \ - /lib/udev/ata_id \ - /lib/udev/cdrom_id \ - /lib/udev/collect \ - /lib/udev/findkeyboards \ - /lib/udev/keyboard-force-release.sh \ - /lib/udev/keymap \ - /lib/udev/mtd_probe \ - /lib/udev/scsi_id \ - /lib/udev/v4l_id \ - /lib/udev/keymaps \ - /lib/udev/rules.d/4*.rules \ - /lib/udev/rules.d/5*.rules \ - /lib/udev/rules.d/6*.rules \ - /lib/udev/rules.d/70-power-switch.rules \ - /lib/udev/rules.d/75*.rules \ - /lib/udev/rules.d/78*.rules \ - /lib/udev/rules.d/8*.rules \ - /lib/udev/rules.d/95*.rules \ - ${sysconfdir}/udev \ - ${sysconfdir}/init.d/systemd-udevd \ - ${systemd_unitdir}/system/*udev* \ - ${systemd_unitdir}/system/*.wants/*udev* \ - " - -FILES_udev-consolekit += "/lib/ConsoleKit" -RDEPENDS_udev-consolekit += "${@base_contains('DISTRO_FEATURES', 'x11', 'consolekit', '', d)}" - -FILES_udev-utils = "${bindir}/udevadm" - -FILES_udev-hwdb = "${base_libdir}/udev/hwdb.d" - -INITSCRIPT_PACKAGES = "udev" -INITSCRIPT_NAME_udev = "systemd-udevd" -INITSCRIPT_PARAMS_udev = "start 03 S ." - -# TODO: -# u-a for runlevel and telinit - -pkg_postinst_systemd () { -update-alternatives --install ${base_sbindir}/init init ${systemd_unitdir}/systemd 300 -update-alternatives --install ${base_sbindir}/halt halt ${base_bindir}/systemctl 300 -update-alternatives --install ${base_sbindir}/reboot reboot ${base_bindir}/systemctl 300 -update-alternatives --install ${base_sbindir}/shutdown shutdown ${base_bindir}/systemctl 300 -update-alternatives --install ${base_sbindir}/poweroff poweroff ${base_bindir}/systemctl 300 -} - -pkg_prerm_systemd () { -update-alternatives --remove init ${systemd_unitdir}/systemd -update-alternatives --remove halt ${base_bindir}/systemctl -update-alternatives --remove reboot ${base_bindir}/systemctl -update-alternatives --remove shutdown ${base_bindir}/systemctl -update-alternatives --remove poweroff ${base_bindir}/systemctl -} - -pkg_postinst_udev-hwdb () { - if test -n "$D"; then - exit 1 - fi - - udevadm hwdb --update -} - -pkg_prerm_udev-hwdb () { - if test -n "$D"; then - exit 1 - fi - - rm -f ${sysconfdir}/udev/hwdb.bin -} - -# As this recipe builds udev, respect the systemd DISTRO_FEATURE so we don't try -# building udev and systemd in world builds. -python () { - if not oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): - raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") -} diff --git a/meta/recipes-core/systemd/systemd_199.bb b/meta/recipes-core/systemd/systemd_199.bb new file mode 100644 index 0000000000..74b14afeaf --- /dev/null +++ b/meta/recipes-core/systemd/systemd_199.bb @@ -0,0 +1,278 @@ +DESCRIPTION = "Systemd a init replacement" +HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd" + +LICENSE = "GPLv2 & LGPLv2.1 & MIT" +LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ + file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \ + file://LICENSE.MIT;md5=544799d0b492f119fa04641d1b8868ed" + +PROVIDES = "udev" + +PE = "1" + +DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup tcp-wrappers glib-2.0" +DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" + +SECTION = "base/shell" + +inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d + +SRC_URI = "http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz \ + file://touchscreen.rules \ + file://modprobe.rules \ + file://var-run.conf \ + ${UCLIBCPATCHES} \ + file://00-create-volatile.conf \ + file://0002-readahead-chunk-on-spinning-media.patch \ + file://0003-readahead-cleanups.patch \ + file://0013-systemd-sysctl-Handle-missing-etc-sysctl.conf-proper.patch \ + file://init \ + " +SRC_URI[md5sum] = "4bb13f84ce211e93f0141774a90a2322" +SRC_URI[sha256sum] = "8c4462a04f3ecf7f083782e5e0687913b1d33c6444bf20fa2f31df9222965fed" + +UCLIBCPATCHES = "" +UCLIBCPATCHES_libc-uclibc = "file://systemd-pam-configure-check-uclibc.patch \ + file://systemd-pam-fix-execvpe.patch \ + file://systemd-pam-fix-fallocate.patch \ + file://systemd-pam-fix-getty-unit.patch \ + file://systemd-pam-fix-mkostemp.patch \ + file://systemd-pam-fix-msformat.patch \ + file://optional_secure_getenv.patch \ + " +LDFLAGS_libc-uclibc_append = " -lrt" + +GTKDOC_DOCDIR = "${S}/docs/" + +PACKAGECONFIG ??= "xz" +# Sign the journal for anti-tampering +PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt" +# Compress the journal +PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz" + +CACHED_CONFIGUREVARS = "ac_cv_path_KILL=${base_bindir}/kill" + +# The gtk+ tools should get built as a separate recipe e.g. systemd-tools +EXTRA_OECONF = " --with-rootprefix=${base_prefix} \ + --with-rootlibdir=${base_libdir} \ + --sbindir=${base_sbindir} \ + --libexecdir=${base_libdir} \ + ${@base_contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)} \ + --enable-xz \ + --disable-manpages \ + --disable-coredump \ + --disable-introspection \ + --disable-tcpwrap \ + --enable-split-usr \ + --disable-microhttpd \ + --without-python \ + --with-sysvrcnd-path=${sysconfdir} \ + ac_cv_path_KILL=${base_bindir}/kill \ + " +# uclibc does not have NSS +EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname " + +# There's no docbook-xsl-native, so for the xsltproc check to false +do_configure_prepend() { + export CPP="${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}" + + sed -i -e 's:=/root:=${ROOT_HOME}:g' units/*.service* +} + +do_install() { + autotools_do_install + install -d ${D}/${base_sbindir} + # provided by a seperate recipe + rm ${D}${systemd_unitdir}/system/serial-getty* -f + + # provide support for initramfs + ln -s ${systemd_unitdir}/systemd ${D}/init + ln -s ${systemd_unitdir}/systemd-udevd ${D}/${base_sbindir}/udevd + + # create dir for journal + install -d ${D}${localstatedir}/log/journal + + # create machine-id + # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable + touch ${D}${sysconfdir}/machine-id + + install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/ + + install -m 0644 ${WORKDIR}/var-run.conf ${D}${sysconfdir}/tmpfiles.d/ + + install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ + + if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd + fi +} + +python populate_packages_prepend (){ + systemdlibdir = d.getVar("base_libdir", True) + do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) +} +PACKAGES_DYNAMIC += "^lib(udev|gudev|systemd).*" + +PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze" + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal" + +FILES_${PN}-analyze = "${base_bindir}/systemd-analyze" + +FILES_${PN}-initramfs = "/init" +RDEPENDS_${PN}-initramfs = "${PN}" + +FILES_${PN}-gui = "${bindir}/systemadm" + +FILES_${PN}-vconsole-setup = "${systemd_unitdir}/systemd-vconsole-setup \ + ${systemd_unitdir}/system/systemd-vconsole-setup.service \ + ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service" + +RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts" + +CONFFILES_${PN} = "${sysconfdir}/systemd/journald.conf \ + ${sysconfdir}/systemd/logind.conf \ + ${sysconfdir}/systemd/system.conf \ + ${sysconfdir}/systemd/user.conf" + +FILES_${PN} = " ${base_bindir}/* \ + ${datadir}/bash-completion \ + ${datadir}/dbus-1/services \ + ${datadir}/dbus-1/system-services \ + ${datadir}/polkit-1 \ + ${datadir}/${PN} \ + ${sysconfdir}/bash_completion.d/ \ + ${sysconfdir}/binfmt.d/ \ + ${sysconfdir}/dbus-1/ \ + ${sysconfdir}/machine-id \ + ${sysconfdir}/modules-load.d/ \ + ${sysconfdir}/sysctl.d/ \ + ${sysconfdir}/systemd/ \ + ${sysconfdir}/tmpfiles.d/ \ + ${sysconfdir}/xdg/ \ + ${sysconfdir}/init.d/README \ + ${systemd_unitdir}/* \ + ${systemd_unitdir}/system/* \ + /lib/udev/rules.d/99-systemd.rules \ + ${base_libdir}/security/*.so \ + ${libdir}/libnss_myhostname.so.2 \ + /cgroup \ + ${bindir}/systemd* \ + ${bindir}/localectl \ + ${bindir}/hostnamectl \ + ${bindir}/timedatectl \ + ${bindir}/bootctl \ + ${bindir}/kernel-install \ + ${exec_prefix}/lib/tmpfiles.d/*.conf \ + ${exec_prefix}/lib/systemd \ + ${exec_prefix}/lib/binfmt.d \ + ${exec_prefix}/lib/modules-load.d \ + ${exec_prefix}/lib/sysctl.d \ + ${localstatedir} \ + ${libexecdir} \ + /lib/udev/rules.d/70-uaccess.rules \ + /lib/udev/rules.d/71-seat.rules \ + /lib/udev/rules.d/73-seat-late.rules \ + /lib/udev/rules.d/99-systemd.rules \ + " + +FILES_${PN}-dbg += "${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/" +FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" + +RDEPENDS_${PN} += "dbus" + +RRECOMMENDS_${PN} += "systemd-serialgetty systemd-compat-units \ + util-linux-agetty \ + util-linux-fsck e2fsprogs-e2fsck \ + kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \ +" + +PACKAGES =+ "udev-dbg udev udev-consolekit udev-utils udev-hwdb" + +FILES_udev-dbg += "/lib/udev/.debug" + +RDEPENDS_udev += "udev-utils" +RPROVIDES_udev = "hotplug" +RRECOMMENDS_udev += "udev-extraconf udev-hwdb" + +FILES_udev += "${base_sbindir}/udevd \ + ${base_libdir}/systemd/systemd-udevd \ + /lib/udev/accelerometer \ + /lib/udev/ata_id \ + /lib/udev/cdrom_id \ + /lib/udev/collect \ + /lib/udev/findkeyboards \ + /lib/udev/keyboard-force-release.sh \ + /lib/udev/keymap \ + /lib/udev/mtd_probe \ + /lib/udev/scsi_id \ + /lib/udev/v4l_id \ + /lib/udev/keymaps \ + /lib/udev/rules.d/4*.rules \ + /lib/udev/rules.d/5*.rules \ + /lib/udev/rules.d/6*.rules \ + /lib/udev/rules.d/70-power-switch.rules \ + /lib/udev/rules.d/75*.rules \ + /lib/udev/rules.d/78*.rules \ + /lib/udev/rules.d/8*.rules \ + /lib/udev/rules.d/95*.rules \ + ${sysconfdir}/udev \ + ${sysconfdir}/init.d/systemd-udevd \ + ${systemd_unitdir}/system/*udev* \ + ${systemd_unitdir}/system/*.wants/*udev* \ + " + +FILES_udev-consolekit += "/lib/ConsoleKit" +RDEPENDS_udev-consolekit += "${@base_contains('DISTRO_FEATURES', 'x11', 'consolekit', '', d)}" + +FILES_udev-utils = "${base_bindir}/udevadm ${datadir}/bash-completion/completions/udevadm" + +FILES_udev-hwdb = "${base_libdir}/udev/hwdb.d" + +INITSCRIPT_PACKAGES = "udev" +INITSCRIPT_NAME_udev = "systemd-udevd" +INITSCRIPT_PARAMS_udev = "start 03 S ." + +# TODO: +# u-a for runlevel and telinit + +pkg_postinst_systemd () { +update-alternatives --install ${base_sbindir}/init init ${systemd_unitdir}/systemd 300 +update-alternatives --install ${base_sbindir}/halt halt ${base_bindir}/systemctl 300 +update-alternatives --install ${base_sbindir}/reboot reboot ${base_bindir}/systemctl 300 +update-alternatives --install ${base_sbindir}/shutdown shutdown ${base_bindir}/systemctl 300 +update-alternatives --install ${base_sbindir}/poweroff poweroff ${base_bindir}/systemctl 300 +} + +pkg_prerm_systemd () { +update-alternatives --remove init ${systemd_unitdir}/systemd +update-alternatives --remove halt ${base_bindir}/systemctl +update-alternatives --remove reboot ${base_bindir}/systemctl +update-alternatives --remove shutdown ${base_bindir}/systemctl +update-alternatives --remove poweroff ${base_bindir}/systemctl +} + +pkg_postinst_udev-hwdb () { + if test -n "$D"; then + exit 1 + fi + + udevadm hwdb --update +} + +pkg_prerm_udev-hwdb () { + if test -n "$D"; then + exit 1 + fi + + rm -f ${sysconfdir}/udev/hwdb.bin +} + +# As this recipe builds udev, respect the systemd DISTRO_FEATURE so we don't try +# building udev and systemd in world builds. +python () { + if not oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): + raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") +} -- cgit v1.2.3-54-g00ecf