summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
committerTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
commitc527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch)
treebb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /meta/recipes-core/systemd
downloadpoky-daisy-140929.tar.gz
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-core/systemd')
-rw-r--r--meta/recipes-core/systemd/systemd-compat-units.bb41
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty.bb49
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service36
-rw-r--r--meta/recipes-core/systemd/systemd-systemctl-native.bb15
-rwxr-xr-xmeta/recipes-core/systemd/systemd-systemctl/systemctl153
-rw-r--r--meta/recipes-core/systemd/systemd/00-create-volatile.conf7
-rw-r--r--meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch34
-rw-r--r--meta/recipes-core/systemd/systemd/binfmt-install.patch56
-rw-r--r--meta/recipes-core/systemd/systemd/init104
-rw-r--r--meta/recipes-core/systemd/systemd/optional_secure_getenv.patch19
-rw-r--r--meta/recipes-core/systemd/systemd/run-ptest3
-rw-r--r--meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch513
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch32
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch29
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch84
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch35
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch30
-rw-r--r--meta/recipes-core/systemd/systemd/touchscreen.rules18
-rw-r--r--meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch37
-rw-r--r--meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch19
-rw-r--r--meta/recipes-core/systemd/systemd_211.bb353
21 files changed, 1667 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
new file mode 100644
index 0000000000..6419bc2c65
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -0,0 +1,41 @@
1SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts"
2
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
5
6PR = "r29"
7
8DEPENDS = "systemd-systemctl-native"
9
10inherit allarch
11
12ALLOW_EMPTY_${PN} = "1"
13
14SYSTEMD_DISABLED_SYSV_SERVICES = " \
15 busybox-udhcpc \
16 hwclock \
17 networking \
18 nfsserver \
19 nfscommon \
20 syslog.busybox \
21"
22
23pkg_postinst_${PN} () {
24 cd $D${sysconfdir}/init.d
25
26 echo "Disabling the following sysv scripts: "
27
28 OPTS=""
29
30 if [ -n "$D" ]; then
31 OPTS="--root=$D"
32 fi
33
34 for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do
35 if [ \( -e $i -o $i.sh \) -a ! \( -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service \) ] ; then
36 echo -n "$i: " ; systemctl ${OPTS} mask $i.service
37 fi
38 done ; echo
39}
40
41RDPEPENDS_${PN} = "systemd"
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
new file mode 100644
index 0000000000..13b2dbacec
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -0,0 +1,49 @@
1SUMMARY = "Serial terminal support for systemd"
2LICENSE = "GPLv2+"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
4
5PR = "r5"
6
7SERIAL_CONSOLE ?= "115200 ttyS0"
8
9SRC_URI = "file://serial-getty@.service"
10
11do_install() {
12 if [ ! -z "${SERIAL_CONSOLES}" ] ; then
13 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
14 install -d ${D}${systemd_unitdir}/system/
15 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
16 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
17 sed -i -e s/\@BAUDRATE\@/$default_baudrate/g ${D}${systemd_unitdir}/system/serial-getty@.service
18
19 tmp="${SERIAL_CONSOLES}"
20 for entry in $tmp ; do
21 baudrate=`echo $entry | sed 's/\;.*//'`
22 ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
23 if [ "$baudrate" = "$default_baudrate" ] ; then
24 # enable the service
25 ln -sf ${systemd_unitdir}/system/serial-getty@.service \
26 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
27 else
28 # install custom service file for the non-default baudrate
29 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service
30 sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service
31 # enable the service
32 ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \
33 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service
34 fi
35 done
36 fi
37}
38
39RDEPENDS_${PN} = "systemd"
40
41# This is a machine specific file
42FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}"
43PACKAGE_ARCH = "${MACHINE_ARCH}"
44
45# As this package is tied to systemd, only build it when we're also building systemd.
46python () {
47 if not oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
48 raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES")
49}
diff --git a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
new file mode 100644
index 0000000000..865de3402d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
@@ -0,0 +1,36 @@
1# This file is part of systemd.
2#
3# systemd is free software; you can redistribute it and/or modify it
4# under the terms of the GNU Lesser General Public License as published by
5# the Free Software Foundation; either version 2.1 of the License, or
6# (at your option) any later version.
7
8[Unit]
9Description=Serial Getty on %I
10Documentation=man:agetty(8) man:systemd-getty-generator(8)
11Documentation=http://0pointer.de/blog/projects/serial-console.html
12BindsTo=dev-%i.device
13After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
14After=rc-local.service
15
16# If additional gettys are spawned during boot then we should make
17# sure that this is synchronized before getty.target, even though
18# getty.target didn't actually pull it in.
19Before=getty.target
20IgnoreOnIsolate=yes
21
22[Service]
23ExecStart=-/sbin/agetty --keep-baud %I @BAUDRATE@ $TERM
24Type=idle
25Restart=always
26RestartSec=0
27UtmpIdentifier=%I
28TTYPath=/dev/%I
29TTYReset=yes
30TTYVHangup=yes
31KillMode=process
32IgnoreSIGPIPE=no
33SendSIGHUP=yes
34
35[Install]
36WantedBy=getty.target
diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb b/meta/recipes-core/systemd/systemd-systemctl-native.bb
new file mode 100644
index 0000000000..72bc77df4f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-systemctl-native.bb
@@ -0,0 +1,15 @@
1SUMMARY = "Wrapper for enabling systemd services"
2
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
5
6PR = "r6"
7
8inherit native
9
10SRC_URI = "file://systemctl"
11
12do_install() {
13 install -d ${D}${bindir}
14 install -m 0755 ${WORKDIR}/systemctl ${D}${bindir}
15}
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
new file mode 100755
index 0000000000..b37f27abfb
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -0,0 +1,153 @@
1#!/bin/sh
2echo "Started $0 $*"
3
4ROOT=
5
6# parse command line params
7action=
8while [ $# != 0 ]; do
9 opt="$1"
10
11 case "$opt" in
12 enable)
13 shift
14
15 action="$opt"
16 services="$1"
17 cmd_args="1"
18 shift
19 ;;
20 disable)
21 shift
22
23 action="$opt"
24 services="$1"
25 cmd_args="1"
26 shift
27 ;;
28 mask)
29 shift
30
31 action="$opt"
32 services="$1"
33 cmd_args="1"
34 shift
35 ;;
36 preset)
37 shift
38
39 action="$opt"
40 services="$1"
41 cmd_args="1"
42 shift
43 ;;
44 --root=*)
45 ROOT=${opt##--root=}
46 cmd_args="0"
47 shift
48 ;;
49 *)
50 if [ "$cmd_args" = "1" ]; then
51 services="$services $opt"
52 shift
53 else
54 echo "'$opt' is an unkown option; exiting with error"
55 exit 1
56 fi
57 ;;
58 esac
59done
60if [ "$action" = "preset" -a "$service_file" = "" ]; then
61 services=$(for f in `find $ROOT/etc/systemd/system $ROOT/lib/systemd/system $ROOT/usr/lib/systemd/system -type f 2>1`; do basename $f; done)
62 services="$services $opt"
63 presetall=1
64fi
65
66for service in $services; do
67 if [ "$presetall" = "1" ]; then
68 action="preset"
69 fi
70 if [ "$action" = "mask" ]; then
71 if [ ! -d $ROOT/etc/systemd/system/ ]; then
72 mkdir -p $ROOT/etc/systemd/system/
73 fi
74 cmd="ln -s /dev/null $ROOT/etc/systemd/system/$service"
75 echo "$cmd"
76 $cmd
77 exit 0
78 fi
79
80 echo "Try to find location of $service..."
81 # find service file
82 for p in $ROOT/etc/systemd/system \
83 $ROOT/lib/systemd/system \
84 $ROOT/usr/lib/systemd/system; do
85 if [ -e $p/$service ]; then
86 service_file=$p/$service
87 service_file=${service_file##$ROOT}
88 fi
89 done
90 if [ -z "$service_file" ]; then
91 echo "'$service' couldn't be found; exiting with error"
92 exit 1
93 fi
94 echo "Found $service in $service_file"
95
96 # If any new unit types are added to systemd they should be added
97 # to this regular expression.
98 unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|path\|timer\|snapshot\)$'
99 if [ "$action" = "preset" ]; then
100 action=`egrep -sh $service $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '`
101 if [ -z "$action" ]; then
102 globalpreset=`egrep -sh '\*' $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '`
103 if [ -n "$globalpreset" ]; then
104 action="$globalpreset"
105 else
106 action="enable"
107 fi
108 fi
109 fi
110 # create the required symbolic links
111 wanted_by=$(sed '/^WantedBy[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
112 | tr ',' '\n' \
113 | grep "$unit_types_re")
114
115 for r in $wanted_by; do
116 echo "WantedBy=$r found in $service"
117 if [ "$action" = "enable" ]; then
118 mkdir -p $ROOT/etc/systemd/system/$r.wants
119 ln -s $service_file $ROOT/etc/systemd/system/$r.wants
120 echo "Enabled $service for $wanted_by."
121 else
122 rm -f $ROOT/etc/systemd/system/$r.wants/$service
123 rmdir --ignore-fail-on-non-empty -p $ROOT/etc/systemd/system/$r.wants
124 echo "Disabled $service for $wanted_by."
125 fi
126 done
127
128 # create the required symbolic 'Alias' links
129 alias=$(sed '/^Alias[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
130 | tr ',' '\n' \
131 | grep "$unit_types_re")
132
133 for r in $alias; do
134 if [ "$action" = "enable" ]; then
135 mkdir -p $ROOT/etc/systemd/system
136 ln -s $service_file $ROOT/etc/systemd/system/$r
137 echo "Enabled $service for $alias."
138 else
139 rm -f $ROOT/etc/systemd/system/$r
140 echo "Disabled $service for $alias."
141 fi
142 done
143
144 # call us for the other required scripts
145 also=$(sed '/^Also[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
146 | tr ',' '\n')
147 for a in $also; do
148 echo "Also=$a found in $service"
149 if [ "$action" = "enable" ]; then
150 $0 --root=$ROOT enable $a
151 fi
152 done
153done
diff --git a/meta/recipes-core/systemd/systemd/00-create-volatile.conf b/meta/recipes-core/systemd/systemd/00-create-volatile.conf
new file mode 100644
index 0000000000..9ffa88e464
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/00-create-volatile.conf
@@ -0,0 +1,7 @@
1#This goes hand-in-hand with the base-files of OE-Core. The file must
2# be sorted before 'systemd.conf' becuase this attempts to create a file
3# inside /var/log.
4
5
6d /var/volatile/log - - - -
7d /var/volatile/tmp - - - -
diff --git a/meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch b/meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch
new file mode 100644
index 0000000000..9fdb3c9ab3
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-uClibc-doesn-t-implement-pwritev-preadv.patch
@@ -0,0 +1,34 @@
1Upstream-Status: Inappropriate [uclibc specific]
2
3From 7be9273548bcb1f57d011fc252965e45dd2a058c Mon Sep 17 00:00:00 2001
4From: Khem Raj <raj.khem@gmail.com>
5Date: Wed, 21 Aug 2013 19:09:27 -0700
6Subject: [PATCH] uClibc doesn't implement pwritev/preadv
7
8Lets stub out the testcase for building.
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 src/libsystemd-bus/test-bus-memfd.c | 2 ++
13 1 file changed, 2 insertions(+)
14
15Index: systemd-209/src/libsystemd/sd-bus/test-bus-memfd.c
16===================================================================
17--- systemd-209.orig/src/libsystemd/sd-bus/test-bus-memfd.c 2014-02-19 15:03:09.983254602 -0800
18+++ systemd-209/src/libsystemd/sd-bus/test-bus-memfd.c 2014-02-19 23:42:10.636652864 -0800
19@@ -151,6 +151,7 @@
20 /* check content */
21 assert_se(memcmp(buf, "ll", 2) == 0);
22
23+#ifndef __UCLIBC__
24 /* writev it out*/
25 iov[0].iov_base = (char *)"ABC";
26 iov[0].iov_len = 3;
27@@ -173,6 +174,7 @@
28 assert_se(memcmp(bufv[0], "ABC", 3) == 0);
29 assert_se(memcmp(bufv[1], "DEF", 3) == 0);
30 assert_se(memcmp(bufv[2], "GHI", 3) == 0);
31+#endif /* __UCLIBC__ */
32
33 sd_memfd_free(m);
34
diff --git a/meta/recipes-core/systemd/systemd/binfmt-install.patch b/meta/recipes-core/systemd/systemd/binfmt-install.patch
new file mode 100644
index 0000000000..c2d5099f24
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/binfmt-install.patch
@@ -0,0 +1,56 @@
1Don't install dependency links at install time for the binfmt services, use
2[Install] blocks so that they get created when the service is enabled like a
3traditional service.
4
5The [Install] blocks were rejected upstream as they don't have a way to "enable"
6it on install without static symlinks which can't be disabled, only masked. We
7however can do that in a postinst.
8
9Upstream-Status: Denied
10Signed-off-by: Ross Burton <ross.burton@intel.com>
11
12diff --git a/Makefile.am b/Makefile.am
13index 7933de6..78acb6f 100644
14--- a/Makefile.am
15+++ b/Makefile.am
16@@ -3133,10 +3133,6 @@ INSTALL_DIRS += \
17 $(prefix)/lib/binfmt.d \
18 $(sysconfdir)/binfmt.d
19
20-SYSINIT_TARGET_WANTS += \
21- systemd-binfmt.service \
22- proc-sys-fs-binfmt_misc.automount
23-
24 endif
25
26 EXTRA_DIST += \
27diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
28index 6be3893..709adef 100644
29--- a/units/proc-sys-fs-binfmt_misc.automount
30+++ b/units/proc-sys-fs-binfmt_misc.automount
31@@ -16,3 +16,6 @@ ConditionPathIsReadWrite=/proc/sys/
32
33 [Automount]
34 Where=/proc/sys/fs/binfmt_misc
35+
36+[Install]
37+WantedBy=sysinit.target
38diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
39index 02dfe77..86d3481 100644
40--- a/units/systemd-binfmt.service.in
41+++ b/units/systemd-binfmt.service.in
42@@ -11,6 +11,7 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5)
43 Documentation=https://www.kernel.org/doc/Documentation/binfmt_misc.txt
44 DefaultDependencies=no
45 Conflicts=shutdown.target
46+Wants=proc-sys-fs-binfmt_misc.automount
47 After=systemd-readahead-collect.service systemd-readahead-replay.service proc-sys-fs-binfmt_misc.automount
48 Before=sysinit.target shutdown.target
49 ConditionPathIsReadWrite=/proc/sys/
50@@ -24,3 +25,6 @@ ConditionDirectoryNotEmpty=|/run/binfmt.d
51 Type=oneshot
52 RemainAfterExit=yes
53 ExecStart=@rootlibexecdir@/systemd-binfmt
54+
55+[Install]
56+WantedBy=sysinit.target
diff --git a/meta/recipes-core/systemd/systemd/init b/meta/recipes-core/systemd/systemd/init
new file mode 100644
index 0000000000..ea52be4820
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/init
@@ -0,0 +1,104 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: udev
5# Required-Start: mountvirtfs
6# Required-Stop:
7# Default-Start: S
8# Default-Stop:
9# Short-Description: Start udevd, populate /dev and load drivers.
10### END INIT INFO
11
12. /etc/init.d/functions
13
14export TZ=/etc/localtime
15
16[ -d /sys/class ] || exit 1
17[ -r /proc/mounts ] || exit 1
18[ -x @UDEVD@ ] || exit 1
19[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
20[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
21
22readfile () {
23 filename=$1
24 READDATA=""
25 if [ -r $filename ]; then
26 while read line; do
27 READDATA="$READDATA$line"
28 done < $filename
29 fi
30}
31
32case "$1" in
33 start)
34 export ACTION=add
35 # propagate /dev from /sys
36 echo "Starting udev"
37
38 # mount the devtmpfs on /dev, if not already done
39 LANG=C awk '$2 == "/dev" && ($3 == "devtmpfs") { exit 1 }' /proc/mounts && {
40 mount -n -o mode=0755 -t devtmpfs none "/dev"
41 }
42 [ -e /dev/pts ] || mkdir -m 0755 /dev/pts
43 [ -e /dev/shm ] || mkdir -m 1777 /dev/shm
44 mount -a -t tmpfs 2>/dev/null
45
46 # cache handling
47 if [ "$DEVCACHE" != "" ]; then
48 readfile /proc/version
49 VERSION="$READDATA"
50 readfile /proc/cmdline
51 CMDLINE="$READDATA"
52 readfile /proc/devices
53 DEVICES="$READDATA"
54 readfile /proc/atags
55 ATAGS="$READDATA"
56
57 if [ -e $DEVCACHE ]; then
58 readfile /etc/udev/cache.data
59 if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then
60 (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
61 not_first_boot=1
62 [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
63 [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
64 else
65 echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
66 fi
67 else
68 echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
69 fi
70 fi
71
72 # make_extra_nodes
73 killproc systemd-udevd > "/dev/null" 2>&1
74
75 # trigger the sorted events
76 echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
77 @UDEVD@ -d
78
79 udevadm control --env=STARTUP=1
80 if [ "$not_first_boot" != "" ];then
81 udevadm trigger --action=add --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux --subsystem-nomatch=platform
82 (udevadm settle --timeout=3; udevadm control --env=STARTUP=)&
83 else
84 udevadm trigger --action=add
85 udevadm settle
86 fi
87 ;;
88 stop)
89 echo "Stopping udevd"
90 start-stop-daemon --stop --name systemd-udevd --quiet
91 ;;
92 restart)
93 $0 stop
94 sleep 1
95 $0 start
96 ;;
97 status)
98 status systemd-udevd
99 ;;
100 *)
101 echo "Usage: $0 {start|stop|status|restart}"
102 exit 1
103esac
104exit 0
diff --git a/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch b/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch
new file mode 100644
index 0000000000..2063268246
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch
@@ -0,0 +1,19 @@
1on uclibc secure_getenv is not available
2therefore default to using getenv instead
3
4Upstream-Status: Denied [no desire for uclibc support]
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7Index: git/src/shared/missing.h
8===================================================================
9--- git.orig/src/shared/missing.h 2012-09-22 18:46:44.141282145 -0700
10+++ git/src/shared/missing.h 2012-09-22 18:48:44.081276570 -0700
11@@ -233,6 +233,8 @@
12 #ifndef HAVE_SECURE_GETENV
13 # ifdef HAVE___SECURE_GETENV
14 # define secure_getenv __secure_getenv
15+# elif defined __UCLIBC__
16+# define secure_getenv getenv
17 # else
18 # error neither secure_getenv nor __secure_getenv are available
19 # endif
diff --git a/meta/recipes-core/systemd/systemd/run-ptest b/meta/recipes-core/systemd/systemd/run-ptest
new file mode 100644
index 0000000000..2f6bd93a5b
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/run-ptest
@@ -0,0 +1,3 @@
1tar -C test -xJf test/sys.tar.xz
2make test/rules-test.sh.log
3make test/udev-test.pl.log
diff --git a/meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch b/meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch
new file mode 100644
index 0000000000..c5bee97238
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch
@@ -0,0 +1,513 @@
1From a3d59cd1b0a2738d06893948492113f2c35be0af Mon Sep 17 00:00:00 2001
2From: Lennart Poettering <lennart@poettering.net>
3Date: Wed, 19 Mar 2014 21:41:21 +0100
4Subject: [PATCH] sd-bus: don't use assert_return() to check for disconnected
5 bus connections
6
7A terminated connection is a runtime error and not a developer mistake,
8hence don't use assert_return() to check for it.
9
10Upstream-Status: Backport
11
12Signed-off-by: Jonathan Liu <net147@gmail.com>
13---
14 src/libsystemd/sd-bus/bus-control.c | 20 +++++++++---
15 src/libsystemd/sd-bus/bus-convenience.c | 58 +++++++++++++++++++++++++--------
16 src/libsystemd/sd-bus/bus-objects.c | 23 +++++++++----
17 src/libsystemd/sd-bus/sd-bus.c | 49 ++++++++++++++++++++--------
18 4 files changed, 113 insertions(+), 37 deletions(-)
19
20diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
21index bb6683e..bd392a2 100644
22--- a/src/libsystemd/sd-bus/bus-control.c
23+++ b/src/libsystemd/sd-bus/bus-control.c
24@@ -128,12 +128,14 @@ _public_ int sd_bus_request_name(sd_bus *bus, const char *name, uint64_t flags)
25 assert_return(bus, -EINVAL);
26 assert_return(name, -EINVAL);
27 assert_return(bus->bus_client, -EINVAL);
28- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
29 assert_return(!bus_pid_changed(bus), -ECHILD);
30 assert_return(!(flags & ~(SD_BUS_NAME_ALLOW_REPLACEMENT|SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_QUEUE)), -EINVAL);
31 assert_return(service_name_is_valid(name), -EINVAL);
32 assert_return(name[0] != ':', -EINVAL);
33
34+ if (!BUS_IS_OPEN(bus->state))
35+ return -ENOTCONN;
36+
37 if (bus->is_kernel)
38 return bus_request_name_kernel(bus, name, flags);
39 else
40@@ -201,11 +203,13 @@ _public_ int sd_bus_release_name(sd_bus *bus, const char *name) {
41 assert_return(bus, -EINVAL);
42 assert_return(name, -EINVAL);
43 assert_return(bus->bus_client, -EINVAL);
44- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
45 assert_return(!bus_pid_changed(bus), -ECHILD);
46 assert_return(service_name_is_valid(name), -EINVAL);
47 assert_return(name[0] != ':', -EINVAL);
48
49+ if (!BUS_IS_OPEN(bus->state))
50+ return -ENOTCONN;
51+
52 if (bus->is_kernel)
53 return bus_release_name_kernel(bus, name);
54 else
55@@ -342,9 +346,11 @@ static int bus_list_names_dbus1(sd_bus *bus, char ***acquired, char ***activatab
56 _public_ int sd_bus_list_names(sd_bus *bus, char ***acquired, char ***activatable) {
57 assert_return(bus, -EINVAL);
58 assert_return(acquired || activatable, -EINVAL);
59- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
60 assert_return(!bus_pid_changed(bus), -ECHILD);
61
62+ if (!BUS_IS_OPEN(bus->state))
63+ return -ENOTCONN;
64+
65 if (bus->is_kernel)
66 return bus_list_names_kernel(bus, acquired, activatable);
67 else
68@@ -735,11 +741,13 @@ _public_ int sd_bus_get_owner(
69 assert_return(name, -EINVAL);
70 assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP);
71 assert_return(mask == 0 || creds, -EINVAL);
72- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
73 assert_return(!bus_pid_changed(bus), -ECHILD);
74 assert_return(service_name_is_valid(name), -EINVAL);
75 assert_return(bus->bus_client, -ENODATA);
76
77+ if (!BUS_IS_OPEN(bus->state))
78+ return -ENOTCONN;
79+
80 if (bus->is_kernel)
81 return bus_get_owner_kdbus(bus, name, mask, creds);
82 else
83@@ -1196,10 +1204,12 @@ _public_ int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128
84 assert_return(bus, -EINVAL);
85 assert_return(name, -EINVAL);
86 assert_return(machine, -EINVAL);
87- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
88 assert_return(!bus_pid_changed(bus), -ECHILD);
89 assert_return(service_name_is_valid(name), -EINVAL);
90
91+ if (!BUS_IS_OPEN(bus->state))
92+ return -ENOTCONN;
93+
94 if (streq_ptr(name, bus->unique_name))
95 return sd_id128_get_machine(machine);
96
97diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c
98index 6e02ad3..c5b9cd4 100644
99--- a/src/libsystemd/sd-bus/bus-convenience.c
100+++ b/src/libsystemd/sd-bus/bus-convenience.c
101@@ -36,9 +36,11 @@ _public_ int sd_bus_emit_signal(
102 int r;
103
104 assert_return(bus, -EINVAL);
105- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
106 assert_return(!bus_pid_changed(bus), -ECHILD);
107
108+ if (!BUS_IS_OPEN(bus->state))
109+ return -ENOTCONN;
110+
111 r = sd_bus_message_new_signal(bus, &m, path, interface, member);
112 if (r < 0)
113 return r;
114@@ -70,9 +72,11 @@ _public_ int sd_bus_call_method(
115 int r;
116
117 assert_return(bus, -EINVAL);
118- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
119 assert_return(!bus_pid_changed(bus), -ECHILD);
120
121+ if (!BUS_IS_OPEN(bus->state))
122+ return -ENOTCONN;
123+
124 r = sd_bus_message_new_method_call(bus, &m, destination, path, interface, member);
125 if (r < 0)
126 return r;
127@@ -100,9 +104,12 @@ _public_ int sd_bus_reply_method_return(
128 assert_return(call, -EINVAL);
129 assert_return(call->sealed, -EPERM);
130 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
131- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
132+ assert_return(call->bus, -EINVAL);
133 assert_return(!bus_pid_changed(call->bus), -ECHILD);
134
135+ if (!BUS_IS_OPEN(call->bus->state))
136+ return -ENOTCONN;
137+
138 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
139 return 0;
140
141@@ -134,9 +141,12 @@ _public_ int sd_bus_reply_method_error(
142 assert_return(call->sealed, -EPERM);
143 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
144 assert_return(sd_bus_error_is_set(e), -EINVAL);
145- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
146+ assert_return(call->bus, -EINVAL);
147 assert_return(!bus_pid_changed(call->bus), -ECHILD);
148
149+ if (!BUS_IS_OPEN(call->bus->state))
150+ return -ENOTCONN;
151+
152 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
153 return 0;
154
155@@ -159,9 +169,12 @@ _public_ int sd_bus_reply_method_errorf(
156 assert_return(call, -EINVAL);
157 assert_return(call->sealed, -EPERM);
158 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
159- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
160+ assert_return(call->bus, -EINVAL);
161 assert_return(!bus_pid_changed(call->bus), -ECHILD);
162
163+ if (!BUS_IS_OPEN(call->bus->state))
164+ return -ENOTCONN;
165+
166 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
167 return 0;
168
169@@ -182,9 +195,12 @@ _public_ int sd_bus_reply_method_errno(
170 assert_return(call, -EINVAL);
171 assert_return(call->sealed, -EPERM);
172 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
173- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
174+ assert_return(call->bus, -EINVAL);
175 assert_return(!bus_pid_changed(call->bus), -ECHILD);
176
177+ if (!BUS_IS_OPEN(call->bus->state))
178+ return -ENOTCONN;
179+
180 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
181 return 0;
182
183@@ -208,9 +224,12 @@ _public_ int sd_bus_reply_method_errnof(
184 assert_return(call, -EINVAL);
185 assert_return(call->sealed, -EPERM);
186 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
187- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
188+ assert_return(call->bus, -EINVAL);
189 assert_return(!bus_pid_changed(call->bus), -ECHILD);
190
191+ if (!BUS_IS_OPEN(call->bus->state))
192+ return -ENOTCONN;
193+
194 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
195 return 0;
196
197@@ -239,9 +258,11 @@ _public_ int sd_bus_get_property(
198 assert_return(member_name_is_valid(member), -EINVAL);
199 assert_return(reply, -EINVAL);
200 assert_return(signature_is_single(type, false), -EINVAL);
201- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
202 assert_return(!bus_pid_changed(bus), -ECHILD);
203
204+ if (!BUS_IS_OPEN(bus->state))
205+ return -ENOTCONN;
206+
207 r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &rep, "ss", strempty(interface), member);
208 if (r < 0)
209 return r;
210@@ -273,9 +294,11 @@ _public_ int sd_bus_get_property_trivial(
211 assert_return(member_name_is_valid(member), -EINVAL);
212 assert_return(bus_type_is_trivial(type), -EINVAL);
213 assert_return(ptr, -EINVAL);
214- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
215 assert_return(!bus_pid_changed(bus), -ECHILD);
216
217+ if (!BUS_IS_OPEN(bus->state))
218+ return -ENOTCONN;
219+
220 r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
221 if (r < 0)
222 return r;
223@@ -309,9 +332,11 @@ _public_ int sd_bus_get_property_string(
224 assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL);
225 assert_return(member_name_is_valid(member), -EINVAL);
226 assert_return(ret, -EINVAL);
227- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
228 assert_return(!bus_pid_changed(bus), -ECHILD);
229
230+ if (!BUS_IS_OPEN(bus->state))
231+ return -ENOTCONN;
232+
233 r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
234 if (r < 0)
235 return r;
236@@ -348,9 +373,11 @@ _public_ int sd_bus_get_property_strv(
237 assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL);
238 assert_return(member_name_is_valid(member), -EINVAL);
239 assert_return(ret, -EINVAL);
240- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
241 assert_return(!bus_pid_changed(bus), -ECHILD);
242
243+ if (!BUS_IS_OPEN(bus->state))
244+ return -ENOTCONN;
245+
246 r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
247 if (r < 0)
248 return r;
249@@ -383,9 +410,11 @@ _public_ int sd_bus_set_property(
250 assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL);
251 assert_return(member_name_is_valid(member), -EINVAL);
252 assert_return(signature_is_single(type, false), -EINVAL);
253- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
254 assert_return(!bus_pid_changed(bus), -ECHILD);
255
256+ if (!BUS_IS_OPEN(bus->state))
257+ return -ENOTCONN;
258+
259 r = sd_bus_message_new_method_call(bus, &m, destination, path, "org.freedesktop.DBus.Properties", "Set");
260 if (r < 0)
261 return r;
262@@ -416,9 +445,12 @@ _public_ int sd_bus_query_sender_creds(sd_bus_message *call, uint64_t mask, sd_b
263
264 assert_return(call, -EINVAL);
265 assert_return(call->sealed, -EPERM);
266- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
267+ assert_return(call->bus, -EINVAL);
268 assert_return(!bus_pid_changed(call->bus), -ECHILD);
269
270+ if (!BUS_IS_OPEN(call->bus->state))
271+ return -ENOTCONN;
272+
273 c = sd_bus_message_get_creds(call);
274
275 /* All data we need? */
276diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
277index 08792fe..539cf2a 100644
278--- a/src/libsystemd/sd-bus/bus-objects.c
279+++ b/src/libsystemd/sd-bus/bus-objects.c
280@@ -2196,9 +2196,10 @@ _public_ int sd_bus_emit_properties_changed_strv(
281 assert_return(bus, -EINVAL);
282 assert_return(object_path_is_valid(path), -EINVAL);
283 assert_return(interface_name_is_valid(interface), -EINVAL);
284- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
285 assert_return(!bus_pid_changed(bus), -ECHILD);
286
287+ if (!BUS_IS_OPEN(bus->state))
288+ return -ENOTCONN;
289
290 /* A non-NULL but empty names list means nothing needs to be
291 generated. A NULL list OTOH indicates that all properties
292@@ -2241,9 +2242,11 @@ _public_ int sd_bus_emit_properties_changed(
293 assert_return(bus, -EINVAL);
294 assert_return(object_path_is_valid(path), -EINVAL);
295 assert_return(interface_name_is_valid(interface), -EINVAL);
296- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
297 assert_return(!bus_pid_changed(bus), -ECHILD);
298
299+ if (!BUS_IS_OPEN(bus->state))
300+ return -ENOTCONN;
301+
302 if (!name)
303 return 0;
304
305@@ -2361,9 +2364,11 @@ _public_ int sd_bus_emit_interfaces_added_strv(sd_bus *bus, const char *path, ch
306
307 assert_return(bus, -EINVAL);
308 assert_return(object_path_is_valid(path), -EINVAL);
309- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
310 assert_return(!bus_pid_changed(bus), -ECHILD);
311
312+ if (!BUS_IS_OPEN(bus->state))
313+ return -ENOTCONN;
314+
315 if (strv_isempty(interfaces))
316 return 0;
317
318@@ -2421,9 +2426,11 @@ _public_ int sd_bus_emit_interfaces_added(sd_bus *bus, const char *path, const c
319
320 assert_return(bus, -EINVAL);
321 assert_return(object_path_is_valid(path), -EINVAL);
322- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
323 assert_return(!bus_pid_changed(bus), -ECHILD);
324
325+ if (!BUS_IS_OPEN(bus->state))
326+ return -ENOTCONN;
327+
328 interfaces = strv_from_stdarg_alloca(interface);
329
330 return sd_bus_emit_interfaces_added_strv(bus, path, interfaces);
331@@ -2435,9 +2442,11 @@ _public_ int sd_bus_emit_interfaces_removed_strv(sd_bus *bus, const char *path,
332
333 assert_return(bus, -EINVAL);
334 assert_return(object_path_is_valid(path), -EINVAL);
335- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
336 assert_return(!bus_pid_changed(bus), -ECHILD);
337
338+ if (!BUS_IS_OPEN(bus->state))
339+ return -ENOTCONN;
340+
341 if (strv_isempty(interfaces))
342 return 0;
343
344@@ -2461,9 +2470,11 @@ _public_ int sd_bus_emit_interfaces_removed(sd_bus *bus, const char *path, const
345
346 assert_return(bus, -EINVAL);
347 assert_return(object_path_is_valid(path), -EINVAL);
348- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
349 assert_return(!bus_pid_changed(bus), -ECHILD);
350
351+ if (!BUS_IS_OPEN(bus->state))
352+ return -ENOTCONN;
353+
354 interfaces = strv_from_stdarg_alloca(interface);
355
356 return sd_bus_emit_interfaces_removed_strv(bus, path, interfaces);
357diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
358index fa6d43a..15c7677 100644
359--- a/src/libsystemd/sd-bus/sd-bus.c
360+++ b/src/libsystemd/sd-bus/sd-bus.c
361@@ -1594,10 +1594,12 @@ static int bus_send_internal(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie,
362 int r;
363
364 assert_return(bus, -EINVAL);
365- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
366 assert_return(m, -EINVAL);
367 assert_return(!bus_pid_changed(bus), -ECHILD);
368
369+ if (!BUS_IS_OPEN(bus->state))
370+ return -ENOTCONN;
371+
372 if (m->n_fds > 0) {
373 r = sd_bus_can_send(bus, SD_BUS_TYPE_UNIX_FD);
374 if (r < 0)
375@@ -1673,10 +1675,12 @@ _public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destinat
376 int r;
377
378 assert_return(bus, -EINVAL);
379- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
380 assert_return(m, -EINVAL);
381 assert_return(!bus_pid_changed(bus), -ECHILD);
382
383+ if (!BUS_IS_OPEN(bus->state))
384+ return -ENOTCONN;
385+
386 if (!streq_ptr(m->destination, destination)) {
387
388 if (!destination)
389@@ -1728,13 +1732,15 @@ _public_ int sd_bus_call_async(
390 int r;
391
392 assert_return(bus, -EINVAL);
393- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
394 assert_return(m, -EINVAL);
395 assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
396 assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL);
397 assert_return(callback, -EINVAL);
398 assert_return(!bus_pid_changed(bus), -ECHILD);
399
400+ if (!BUS_IS_OPEN(bus->state))
401+ return -ENOTCONN;
402+
403 r = hashmap_ensure_allocated(&bus->reply_callbacks, uint64_hash_func, uint64_compare_func);
404 if (r < 0)
405 return r;
406@@ -1841,13 +1847,15 @@ _public_ int sd_bus_call(
407 int r;
408
409 assert_return(bus, -EINVAL);
410- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
411 assert_return(m, -EINVAL);
412 assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
413 assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL);
414 assert_return(!bus_error_is_dirty(error), -EINVAL);
415 assert_return(!bus_pid_changed(bus), -ECHILD);
416
417+ if (!BUS_IS_OPEN(bus->state))
418+ return -ENOTCONN;
419+
420 r = bus_ensure_running(bus);
421 if (r < 0)
422 return r;
423@@ -1973,9 +1981,11 @@ _public_ int sd_bus_get_events(sd_bus *bus) {
424 int flags = 0;
425
426 assert_return(bus, -EINVAL);
427- assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN);
428 assert_return(!bus_pid_changed(bus), -ECHILD);
429
430+ if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING)
431+ return -ENOTCONN;
432+
433 if (bus->state == BUS_OPENING)
434 flags |= POLLOUT;
435 else if (bus->state == BUS_AUTHENTICATING) {
436@@ -2000,9 +2010,11 @@ _public_ int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec) {
437
438 assert_return(bus, -EINVAL);
439 assert_return(timeout_usec, -EINVAL);
440- assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN);
441 assert_return(!bus_pid_changed(bus), -ECHILD);
442
443+ if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING)
444+ return -ENOTCONN;
445+
446 if (bus->track_queue) {
447 *timeout_usec = 0;
448 return 1;
449@@ -2531,7 +2543,8 @@ static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec) {
450 if (bus->state == BUS_CLOSING)
451 return 1;
452
453- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
454+ if (!BUS_IS_OPEN(bus->state))
455+ return -ENOTCONN;
456
457 e = sd_bus_get_events(bus);
458 if (e < 0)
459@@ -2586,7 +2599,8 @@ _public_ int sd_bus_wait(sd_bus *bus, uint64_t timeout_usec) {
460 if (bus->state == BUS_CLOSING)
461 return 0;
462
463- assert_return(BUS_IS_OPEN(bus->state) , -ENOTCONN);
464+ if (!BUS_IS_OPEN(bus->state))
465+ return -ENOTCONN;
466
467 if (bus->rqueue_size > 0)
468 return 0;
469@@ -2603,7 +2617,8 @@ _public_ int sd_bus_flush(sd_bus *bus) {
470 if (bus->state == BUS_CLOSING)
471 return 0;
472
473- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
474+ if (!BUS_IS_OPEN(bus->state))
475+ return -ENOTCONN;
476
477 r = bus_ensure_running(bus);
478 if (r < 0)
479@@ -3113,9 +3128,13 @@ _public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **re
480 assert_return(bus, -EINVAL);
481 assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP);
482 assert_return(ret, -EINVAL);
483- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
484 assert_return(!bus_pid_changed(bus), -ECHILD);
485- assert_return(!bus->is_kernel, -ENOTSUP);
486+
487+ if (!bus->is_kernel)
488+ return -ENOTSUP;
489+
490+ if (!BUS_IS_OPEN(bus->state))
491+ return -ENOTCONN;
492
493 if (!bus->ucred_valid && !isempty(bus->label))
494 return -ENODATA;
495@@ -3154,9 +3173,13 @@ _public_ int sd_bus_try_close(sd_bus *bus) {
496 int r;
497
498 assert_return(bus, -EINVAL);
499- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
500 assert_return(!bus_pid_changed(bus), -ECHILD);
501- assert_return(bus->is_kernel, -ENOTSUP);
502+
503+ if (!bus->is_kernel)
504+ return -ENOTSUP;
505+
506+ if (!BUS_IS_OPEN(bus->state))
507+ return -ENOTCONN;
508
509 if (bus->rqueue_size > 0)
510 return -EBUSY;
511--
5121.9.1
513
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch b/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch
new file mode 100644
index 0000000000..4639532236
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch
@@ -0,0 +1,32 @@
1Upstream-Status: Denied [no desire for uclibc support]
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4Index: git/configure.ac
5===================================================================
6--- git.orig/configure.ac 2014-03-15 17:53:51.756340454 -0700
7+++ git/configure.ac 2014-03-15 18:07:34.888355897 -0700
8@@ -78,6 +78,24 @@
9
10 M4_DEFINES=
11
12+# check for few functions not implemented in uClibc
13+
14+AC_CHECK_FUNCS_ONCE(mkostemp execvpe posix_fallocate)
15+
16+# check for %ms format support - assume always no if cross compiling
17+
18+AC_MSG_CHECKING([whether %ms format is supported by *scanf])
19+
20+AC_LINK_IFELSE(
21+ [AC_LANG_PROGRAM([
22+ #include <stdio.h>
23+ ],[
24+ char *buf1, *buf2, *buf3, str="1 2.3 abcde" ;
25+ int rc = sscanf(str, "%ms %ms %ms", &buf1, &buf2, &buf3) ;
26+ return (rc==3)?0:1;])],
27+ [AC_DEFINE([HAVE_MSFORMAT], [1], [Define if %ms format is supported by *scanf.])],
28+ [AC_MSG_RESULT([no])])
29+
30 # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line
31 m4_ifdef([GTK_DOC_CHECK], [
32 GTK_DOC_CHECK([1.18],[--flavour no-tmpl])],
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch
new file mode 100644
index 0000000000..7170a38af3
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch
@@ -0,0 +1,29 @@
1Upstream-Status: Denied [no desire for uclibc support]
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4Index: systemd-209/src/nspawn/nspawn.c
5===================================================================
6--- systemd-209.orig/src/nspawn/nspawn.c 2014-02-19 15:03:09.000000000 -0800
7+++ systemd-209/src/nspawn/nspawn.c 2014-02-19 23:20:38.720628627 -0800
8@@ -91,6 +91,8 @@
9 LINK_GUEST
10 } LinkJournal;
11
12+#include "config.h"
13+
14 static char *arg_directory = NULL;
15 static char *arg_user = NULL;
16 static sd_id128_t arg_uuid = {};
17@@ -2045,7 +2047,12 @@
18 a[0] = (char*) "/sbin/init";
19 execve(a[0], a, env_use);
20 } else if (argc > optind)
21+#ifdef HAVE_EXECVPE
22 execvpe(argv[optind], argv + optind, env_use);
23+#else
24+ environ = env_use;
25+ execvp(argv[optind], argv + optind);
26+#endif /* HAVE_EXECVPE */
27 else {
28 chdir(home ? home : "/root");
29 execle("/bin/bash", "-bash", NULL, env_use);
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch
new file mode 100644
index 0000000000..de73be96a7
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch
@@ -0,0 +1,84 @@
1Upstream-Status: Denied [no desire for uclibc support]
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4Index: systemd-209/src/journal/journal-file.c
5===================================================================
6--- systemd-209.orig/src/journal/journal-file.c 2014-02-12 18:42:33.000000000 -0800
7+++ systemd-209/src/journal/journal-file.c 2014-02-19 23:23:19.464631643 -0800
8@@ -38,6 +38,8 @@
9 #include "compress.h"
10 #include "fsprg.h"
11
12+#include "config.h"
13+
14 #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem))
15 #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem))
16
17@@ -316,7 +318,7 @@
18
19 static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) {
20 uint64_t old_size, new_size;
21- int r;
22+ int r = 0;
23
24 assert(f);
25
26@@ -364,9 +366,24 @@
27 /* Note that the glibc fallocate() fallback is very
28 inefficient, hence we try to minimize the allocation area
29 as we can. */
30+#ifdef HAVE_POSIX_ALLOCATE
31 r = posix_fallocate(f->fd, old_size, new_size - old_size);
32 if (r != 0)
33 return -r;
34+#else
35+ /* Use good old method to write zeros into the journal file
36+ perhaps very inefficient yet working. */
37+ if(new_size > old_size) {
38+ char *buf = alloca(new_size - old_size);
39+ off_t oldpos = lseek(f->fd, 0, SEEK_CUR);
40+ bzero(buf, new_size - old_size);
41+ lseek(f->fd, old_size, SEEK_SET);
42+ r = write(f->fd, buf, new_size - old_size);
43+ lseek(f->fd, oldpos, SEEK_SET);
44+ }
45+ if (r < 0)
46+ return -errno;
47+#endif /* HAVE_POSIX_FALLOCATE */
48
49 if (fstat(f->fd, &f->last_stat) < 0)
50 return -errno;
51Index: systemd-209/src/journal/journald-kmsg.c
52===================================================================
53--- systemd-209.orig/src/journal/journald-kmsg.c 2014-02-19 15:03:09.000000000 -0800
54+++ systemd-209/src/journal/journald-kmsg.c 2014-02-19 23:22:14.396630422 -0800
55@@ -441,6 +441,7 @@
56
57 int server_open_kernel_seqnum(Server *s) {
58 int fd;
59+ int r = 0;
60 uint64_t *p;
61
62 assert(s);
63@@ -454,8 +455,19 @@
64 log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m");
65 return 0;
66 }
67-
68- if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) {
69+#ifdef HAVE_POSIX_ALLOCATE
70+ r = posix_fallocate(fd, 0, sizeof(uint64_t));
71+#else
72+ /* Use good old method to write zeros into the journal file
73+ perhaps very inefficient yet working. */
74+ char *buf = alloca(sizeof(uint64_t));
75+ off_t oldpos = lseek(fd, 0, SEEK_CUR);
76+ bzero(buf, sizeof(uint64_t));
77+ lseek(fd, 0, SEEK_SET);
78+ r = write(fd, buf, sizeof(uint64_t));
79+ lseek(fd, oldpos, SEEK_SET);
80+#endif /* HAVE_POSIX_FALLOCATE */
81+ if (r < 0) {
82 log_error("Failed to allocate sequential number file, ignoring: %m");
83 close_nointr_nofail(fd);
84 return 0;
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch
new file mode 100644
index 0000000000..9b4c940984
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch
@@ -0,0 +1,35 @@
1Prefer getty to agetty in console setup systemd units
2
3Upstream-Status: Inappropriate [configuration specific]
4Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
5---
6 units/getty@.service.m4 | 2 +-
7 units/serial-getty@.service.m4 | 2 +-
8 2 files changed, 2 insertions(+), 2 deletions(-)
9
10Index: git/units/getty@.service.m4
11===================================================================
12--- git.orig/units/getty@.service.m4 2014-03-15 08:16:17.000000000 -0700
13+++ git/units/getty@.service.m4 2014-03-15 08:21:11.007695825 -0700
14@@ -27,7 +27,7 @@
15
16 [Service]
17 # the VT is cleared by TTYVTDisallocate
18-ExecStart=-/sbin/agetty --noclear %I $TERM
19+ExecStart=-/sbin/getty -L %I $TERM
20 Type=idle
21 Restart=always
22 RestartSec=0
23Index: git/units/serial-getty@.service.m4
24===================================================================
25--- git.orig/units/serial-getty@.service.m4 2014-03-15 08:16:17.000000000 -0700
26+++ git/units/serial-getty@.service.m4 2014-03-15 08:22:31.291697331 -0700
27@@ -22,7 +22,7 @@
28 IgnoreOnIsolate=yes
29
30 [Service]
31-ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
32+ExecStart=-/sbin/getty -L 115200 %I $TERM
33 Type=idle
34 Restart=always
35 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
new file mode 100644
index 0000000000..8c7aa072da
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch
@@ -0,0 +1,30 @@
1Upstream-Status: Denied [no desire for uclibc support]
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4Index: git/src/shared/util.c
5===================================================================
6--- git.orig/src/shared/util.c 2014-03-15 15:14:21.368160908 -0700
7+++ git/src/shared/util.c 2014-03-15 15:44:21.988194688 -0700
8@@ -85,6 +85,8 @@
9 #include "def.h"
10 #include "missing.h"
11
12+#include "config.h"
13+
14 int saved_argc = 0;
15 char **saved_argv = NULL;
16
17@@ -6222,7 +6224,13 @@
18
19 u = umask(077);
20
21+#ifdef HAVE_MKOSTEMP
22 fd = mkostemp(pattern, flags);
23+#else
24+ fd = mkstemp(pattern);
25+ if (fd >= 0) fcntl(fd, F_SETFD, flags);
26+#endif /* HAVE_MKOSTEMP */
27+
28 if (fd < 0)
29 return -errno;
30
diff --git a/meta/recipes-core/systemd/systemd/touchscreen.rules b/meta/recipes-core/systemd/systemd/touchscreen.rules
new file mode 100644
index 0000000000..d83fd1673d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/touchscreen.rules
@@ -0,0 +1,18 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# Create a symlink to any touchscreen input device
17SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0"
18SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="ads7846", SYMLINK+="input/touchscreen0"
diff --git a/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch b/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch
new file mode 100644
index 0000000000..39dfc9e2ea
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch
@@ -0,0 +1,37 @@
1bypass unimplemented _SC_PHYS_PAGES system configuration API in uclibc
2
3Upstream-Status: Inappropriate [uclibc-specific]
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7Index: git/src/shared/util.c
8===================================================================
9--- git.orig/src/shared/util.c 2014-03-15 18:09:34.796358146 -0700
10+++ git/src/shared/util.c 2014-03-15 20:16:33.836501084 -0700
11@@ -6332,11 +6332,24 @@
12
13 /* We return this as uint64_t in case we are running as 32bit
14 * process on a 64bit kernel with huge amounts of memory */
15-
16+#ifdef __UCLIBC__
17+ char line[128];
18+ FILE *f = fopen("/proc/meminfo", "r");
19+ if (f == NULL)
20+ return 0;
21+ while (!feof(f) && fgets(line, sizeof(line)-1, f)) {
22+ if (sscanf(line, "MemTotal: %l kB", &mem) == 1) {
23+ mem *= 1024;
24+ break;
25+ }
26+ }
27+ fclose(f);
28+ return (uint64_t) mem;
29+#else
30 mem = sysconf(_SC_PHYS_PAGES);
31 assert(mem > 0);
32-
33 return (uint64_t) mem * (uint64_t) page_size();
34+#endif
35 }
36
37 char* mount_test_option(const char *haystack, const char *needle) {
diff --git a/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch b/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch
new file mode 100644
index 0000000000..15645dee11
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch
@@ -0,0 +1,19 @@
1Dont include sys/sysinfo.h on uclibc it conflicts with linux/sysinfo.h
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Inappropriate [uclibc specific]
5
6Index: systemd-209/src/readahead/readahead-common.c
7===================================================================
8--- systemd-209.orig/src/readahead/readahead-common.c 2014-02-12 18:42:33.810685053 -0800
9+++ systemd-209/src/readahead/readahead-common.c 2014-02-19 23:49:31.856661142 -0800
10@@ -22,7 +22,9 @@
11 #include <errno.h>
12 #include <stdlib.h>
13 #include <string.h>
14+#ifndef __UCLIBC__
15 #include <sys/sysinfo.h>
16+#endif
17 #include <sys/inotify.h>
18 #include <fcntl.h>
19 #include <sys/mman.h>
diff --git a/meta/recipes-core/systemd/systemd_211.bb b/meta/recipes-core/systemd/systemd_211.bb
new file mode 100644
index 0000000000..44b196538a
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd_211.bb
@@ -0,0 +1,353 @@
1SUMMARY = "System and service manager for Linux, replacing SysVinit"
2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
3
4LICENSE = "GPLv2 & LGPLv2.1 & MIT"
5LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
6 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \
7 file://LICENSE.MIT;md5=544799d0b492f119fa04641d1b8868ed"
8
9PROVIDES = "udev"
10
11PE = "1"
12
13DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup glib-2.0 qemu-native util-linux"
14DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
15
16SECTION = "base/shell"
17
18inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest
19
20SRCREV = "3a450ec5c6adf3057bcedd6cc19c10617abc35a5"
21
22PV = "211+git${SRCPV}"
23
24SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol=git \
25 file://binfmt-install.patch \
26 file://systemd-pam-configure-check-uclibc.patch \
27 file://systemd-pam-fix-execvpe.patch \
28 file://systemd-pam-fix-fallocate.patch \
29 file://systemd-pam-fix-mkostemp.patch \
30 file://optional_secure_getenv.patch \
31 file://0001-uClibc-doesn-t-implement-pwritev-preadv.patch \
32 file://uclibc-sysinfo_h.patch \
33 file://uclibc-get-physmem.patch \
34 file://sd-bus-don-t-use-assert_return-to-check-for-disconne.patch \
35 \
36 file://touchscreen.rules \
37 file://00-create-volatile.conf \
38 file://init \
39 file://run-ptest \
40 "
41
42S = "${WORKDIR}/git"
43
44SRC_URI_append_libc-uclibc = "\
45 file://systemd-pam-fix-getty-unit.patch \
46 "
47LDFLAGS_append_libc-uclibc = " -lrt"
48
49GTKDOC_DOCDIR = "${S}/docs/"
50
51PACKAGECONFIG ??= "xz tcp-wrappers"
52# Sign the journal for anti-tampering
53PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt"
54# regardless of PACKAGECONFIG, libgcrypt is always required to expand
55# the AM_PATH_LIBGCRYPT autoconf macro
56DEPENDS += "libgcrypt"
57# Compress the journal
58PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz"
59PACKAGECONFIG[tcp-wrappers] = "--enable-tcpwrap,--disable-tcpwrap,tcp-wrappers"
60PACKAGECONFIG[cryptsetup] = "--enable-libcryptsetup,--disable-libcryptsetup,cryptsetup"
61PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicrohttpd"
62
63CACHED_CONFIGUREVARS = "ac_cv_path_KILL=${base_bindir}/kill"
64
65# Helper variables to clarify locations. This mirrors the logic in systemd's
66# build system.
67rootprefix ?= "${base_prefix}"
68rootlibdir ?= "${base_libdir}"
69rootlibexecdir = "${rootprefix}/lib"
70
71# The gtk+ tools should get built as a separate recipe e.g. systemd-tools
72EXTRA_OECONF = " --with-rootprefix=${rootprefix} \
73 --with-rootlibdir=${rootlibdir} \
74 ${@base_contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)} \
75 --enable-xz \
76 --disable-manpages \
77 --disable-coredump \
78 --disable-introspection \
79 --disable-kdbus \
80 --enable-split-usr \
81 --without-python \
82 --with-sysvrcnd-path=${sysconfdir} \
83 --with-firmware-path=/lib/firmware \
84 ac_cv_path_KILL=${base_bindir}/kill \
85 "
86# uclibc does not have NSS
87EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname "
88
89do_configure_prepend() {
90 export CPP="${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}"
91 export KMOD="${base_bindir}/kmod"
92 if [ -d ${S}/units.pre_sed ] ; then
93 cp -r ${S}/units.pre_sed ${S}/units
94 else
95 cp -r ${S}/units ${S}/units.pre_sed
96 fi
97 sed -i -e 's:=/root:=${ROOT_HOME}:g' ${S}/units/*.service*
98 sed -i -e 's:\$(LN_S) --relative -f:lnr:g' ${S}/Makefile.am
99 sed -i -e 's:\$(LN_S) --relative:lnr:g' ${S}/Makefile.am
100}
101
102do_install() {
103 autotools_do_install
104 install -d ${D}/${base_sbindir}
105 # Provided by a separate recipe
106 rm ${D}${systemd_unitdir}/system/serial-getty* -f
107
108 # Provide support for initramfs
109 [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
110 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
111
112 # Create machine-id
113 # 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
114 touch ${D}${sysconfdir}/machine-id
115
116 install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
117
118 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
119
120 if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
121 install -d ${D}${sysconfdir}/init.d
122 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
123 sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
124 fi
125
126 # Delete journal README, as log can be symlinked inside volatile.
127 rm -f ${D}/${localstatedir}/log/README
128}
129
130do_install_ptest () {
131 install -d ${D}${PTEST_PATH}/test
132 cp -rf ${S}/test/* ${D}${PTEST_PATH}/test
133 install -m 0755 ${B}/test-udev ${D}${PTEST_PATH}/
134 install -d ${D}${PTEST_PATH}/build-aux
135 cp ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
136 cp -rf ${B}/rules ${D}${PTEST_PATH}/
137 # This directory needs to be there for udev-test.pl to work.
138 install -d ${D}${libdir}/udev/rules.d
139 cp ${B}/Makefile ${D}${PTEST_PATH}/
140 cp ${S}/test/sys.tar.xz ${D}${PTEST_PATH}/test
141 sed -i 's/"tree"/"ls"/' ${D}${PTEST_PATH}/test/udev-test.pl
142 sed -i 's#${S}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile
143 sed -i 's#${B}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile
144}
145
146python populate_packages_prepend (){
147 systemdlibdir = d.getVar("rootlibdir", True)
148 do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
149}
150PACKAGES_DYNAMIC += "^lib(udev|gudev|systemd).*"
151
152PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install \
153 ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-zsh"
154
155SYSTEMD_PACKAGES = "${PN}-binfmt"
156SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
157
158USERADD_PACKAGES = "${PN}"
159USERADD_PARAM_${PN} += "--system systemd-journal-gateway"
160GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal"
161
162FILES_${PN}-analyze = "${bindir}/systemd-analyze"
163
164FILES_${PN}-initramfs = "/init"
165RDEPENDS_${PN}-initramfs = "${PN}"
166
167# The test cases need perl and bash to run correctly.
168RDEPENDS_${PN}-ptest += "perl bash"
169FILES_${PN}-ptest += "${libdir}/udev/rules.d"
170
171FILES_${PN}-dbg += "${libdir}/systemd/ptest/.debug"
172
173FILES_${PN}-gui = "${bindir}/systemadm"
174
175FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
176 ${systemd_unitdir}/system/systemd-vconsole-setup.service \
177 ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
178
179FILES_${PN}-kernel-install = "${bindir}/kernel-install \
180 ${sysconfdir}/kernel/ \
181 ${exec_prefix}/lib/kernel \
182 "
183FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
184 "
185
186FILES_${PN}-zsh = "${datadir}/zsh/site-functions"
187
188FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
189 ${exec_prefix}/lib/binfmt.d \
190 ${rootlibexecdir}/systemd/systemd-binfmt \
191 ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \
192 ${systemd_unitdir}/system/systemd-binfmt.service"
193RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
194
195RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts"
196
197CONFFILES_${PN} = "${sysconfdir}/systemd/journald.conf \
198 ${sysconfdir}/systemd/logind.conf \
199 ${sysconfdir}/systemd/system.conf \
200 ${sysconfdir}/systemd/user.conf"
201
202FILES_${PN} = " ${base_bindir}/* \
203 ${datadir}/bash-completion \
204 ${datadir}/dbus-1/services \
205 ${datadir}/dbus-1/system-services \
206 ${datadir}/polkit-1 \
207 ${datadir}/${BPN} \
208 ${sysconfdir}/bash_completion.d/ \
209 ${sysconfdir}/dbus-1/ \
210 ${sysconfdir}/machine-id \
211 ${sysconfdir}/modules-load.d/ \
212 ${sysconfdir}/sysctl.d/ \
213 ${sysconfdir}/systemd/ \
214 ${sysconfdir}/tmpfiles.d/ \
215 ${sysconfdir}/xdg/ \
216 ${sysconfdir}/init.d/README \
217 ${rootlibexecdir}/systemd/* \
218 ${systemd_unitdir}/* \
219 ${base_libdir}/security/*.so \
220 ${libdir}/libnss_myhostname.so.2 \
221 /cgroup \
222 ${bindir}/systemd* \
223 ${bindir}/busctl \
224 ${bindir}/localectl \
225 ${bindir}/hostnamectl \
226 ${bindir}/timedatectl \
227 ${bindir}/bootctl \
228 ${bindir}/kernel-install \
229 ${exec_prefix}/lib/tmpfiles.d/*.conf \
230 ${exec_prefix}/lib/systemd \
231 ${exec_prefix}/lib/modules-load.d \
232 ${exec_prefix}/lib/sysctl.d \
233 ${localstatedir} \
234 /lib/udev/rules.d/70-uaccess.rules \
235 /lib/udev/rules.d/71-seat.rules \
236 /lib/udev/rules.d/73-seat-late.rules \
237 /lib/udev/rules.d/99-systemd.rules \
238 ${@base_contains('DISTRO_FEATURES', 'pam', '${sysconfdir}/pam.d', '', d)} \
239 "
240
241FILES_${PN}-dbg += "${rootlibdir}/.debug ${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/"
242FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
243
244RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})"
245
246RRECOMMENDS_${PN} += "systemd-serialgetty systemd-compat-units \
247 util-linux-agetty \
248 util-linux-fsck e2fsprogs-e2fsck \
249 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \
250"
251
252PACKAGES =+ "udev-dbg udev udev-utils udev-hwdb"
253
254FILES_udev-dbg += "/lib/udev/.debug"
255
256RDEPENDS_udev += "udev-utils"
257RPROVIDES_udev = "hotplug"
258RRECOMMENDS_udev += "udev-hwdb"
259
260RDEPENDS_udev-hwdb += "udev-utils"
261
262FILES_udev += "${base_sbindir}/udevd \
263 ${rootlibexecdir}/systemd/systemd-udevd \
264 ${rootlibexecdir}/udev/accelerometer \
265 ${rootlibexecdir}/udev/ata_id \
266 ${rootlibexecdir}/udev/cdrom_id \
267 ${rootlibexecdir}/udev/collect \
268 ${rootlibexecdir}/udev/findkeyboards \
269 ${rootlibexecdir}/udev/keyboard-force-release.sh \
270 ${rootlibexecdir}/udev/keymap \
271 ${rootlibexecdir}/udev/mtd_probe \
272 ${rootlibexecdir}/udev/scsi_id \
273 ${rootlibexecdir}/udev/v4l_id \
274 ${rootlibexecdir}/udev/keymaps \
275 ${rootlibexecdir}/udev/rules.d/4*.rules \
276 ${rootlibexecdir}/udev/rules.d/5*.rules \
277 ${rootlibexecdir}/udev/rules.d/6*.rules \
278 ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \
279 ${rootlibexecdir}/udev/rules.d/75*.rules \
280 ${rootlibexecdir}/udev/rules.d/78*.rules \
281 ${rootlibexecdir}/udev/rules.d/8*.rules \
282 ${rootlibexecdir}/udev/rules.d/95*.rules \
283 ${sysconfdir}/udev \
284 ${sysconfdir}/init.d/systemd-udevd \
285 ${systemd_unitdir}/system/*udev* \
286 ${systemd_unitdir}/system/*.wants/*udev* \
287 "
288
289FILES_udev-utils = "${base_bindir}/udevadm ${datadir}/bash-completion/completions/udevadm"
290
291FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d"
292
293INITSCRIPT_PACKAGES = "udev"
294INITSCRIPT_NAME_udev = "systemd-udevd"
295INITSCRIPT_PARAMS_udev = "start 03 S ."
296
297python __anonymous() {
298 if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
299 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
300}
301
302# TODO:
303# u-a for runlevel and telinit
304
305ALTERNATIVE_${PN} = "init halt reboot shutdown poweroff runlevel"
306
307ALTERNATIVE_TARGET[init] = "${rootlibexecdir}/systemd/systemd"
308ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
309ALTERNATIVE_PRIORITY[init] ?= "300"
310
311ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
312ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
313ALTERNATIVE_PRIORITY[halt] ?= "300"
314
315ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
316ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
317ALTERNATIVE_PRIORITY[reboot] ?= "300"
318
319ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
320ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
321ALTERNATIVE_PRIORITY[shutdown] ?= "300"
322
323ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
324ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
325ALTERNATIVE_PRIORITY[poweroff] ?= "300"
326
327ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
328ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
329ALTERNATIVE_PRIORITY[runlevel] ?= "300"
330
331pkg_postinst_udev-hwdb () {
332 if test -n "$D"; then
333 ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
334 --root $D
335 else
336 udevadm hwdb --update
337 fi
338}
339
340pkg_prerm_udev-hwdb () {
341 if test -n "$D"; then
342 exit 1
343 fi
344
345 rm -f ${sysconfdir}/udev/hwdb.bin
346}
347
348# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
349# that we don't build both udev and systemd in world builds.
350python () {
351 if not oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
352 raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES")
353}