diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
commit | c527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch) | |
tree | bb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /meta/recipes-core/systemd/systemd-serialgetty.bb | |
download | poky-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/systemd-serialgetty.bb')
-rw-r--r-- | meta/recipes-core/systemd/systemd-serialgetty.bb | 49 |
1 files changed, 49 insertions, 0 deletions
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 @@ | |||
1 | SUMMARY = "Serial terminal support for systemd" | ||
2 | LICENSE = "GPLv2+" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" | ||
4 | |||
5 | PR = "r5" | ||
6 | |||
7 | SERIAL_CONSOLE ?= "115200 ttyS0" | ||
8 | |||
9 | SRC_URI = "file://serial-getty@.service" | ||
10 | |||
11 | do_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 | |||
39 | RDEPENDS_${PN} = "systemd" | ||
40 | |||
41 | # This is a machine specific file | ||
42 | FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}" | ||
43 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
44 | |||
45 | # As this package is tied to systemd, only build it when we're also building systemd. | ||
46 | python () { | ||
47 | if not oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): | ||
48 | raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") | ||
49 | } | ||