summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-04-30 15:33:51 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-02 17:41:54 +0100
commit680954942789e44bf9a1c14f3643acb25af301a5 (patch)
tree3f6d538fc7e0e968a1bc0d13736015dafdf42ee3 /meta/recipes-core/systemd
parent4ea0449039517490688bc7ede7766e730af897d8 (diff)
downloadpoky-680954942789e44bf9a1c14f3643acb25af301a5.tar.gz
systemd-serialgetty: change to handle SERIAL_CONSOLES
SERIAL_CONSOLES is now set from SERIAL_CONSOLE if not already set. This is a little bit gnarly because we have to create a separate service file for each different baud rate; assume that the first baud rate is the default, thus preserving the previous behaviour in the event there is only one baud rate in use. This change also installs the service file before modifying it in place, allowing do_install to re-execute properly; additionally the service file now has the correct permissions (i.e. no execute bit set). (From OE-Core rev: cd89a71d0c3dce14d59134667bc47fa8210cfa7a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/systemd')
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty.bb45
1 files changed, 23 insertions, 22 deletions
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
index 96cbf31470..37c49b12d7 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty.bb
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -8,37 +8,38 @@ SERIAL_CONSOLE ?= "115200 ttyS0"
8 8
9SRC_URI = "file://serial-getty@.service" 9SRC_URI = "file://serial-getty@.service"
10 10
11def get_serial_console_value(d, index):
12 c = d.getVar('SERIAL_CONSOLE', True)
13
14 if len(c):
15 return c.split()[index]
16
17 return ""
18
19def get_baudrate(d):
20 return get_serial_console_value(d, 0)
21
22def get_console(d):
23 return get_serial_console_value(d, 1)
24
25do_install() { 11do_install() {
26 if [ ! ${@get_baudrate(d)} = "" ]; then 12 if [ ! -z "${SERIAL_CONSOLES}" ] ; then
27 sed -i -e s/\@BAUDRATE\@/${@get_baudrate(d)}/g ${WORKDIR}/serial-getty@.service 13 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
28 install -d ${D}${systemd_unitdir}/system/ 14 install -d ${D}${systemd_unitdir}/system/
29 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ 15 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
30 install ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/ 16 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
31 17 sed -i -e s/\@BAUDRATE\@/$default_baudrate/g ${D}${systemd_unitdir}/system/serial-getty@.service
32 # enable the service 18
33 ln -sf ${systemd_unitdir}/system/serial-getty@.service \ 19 tmp="${SERIAL_CONSOLES}"
34 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@${@get_console(d)}.service 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
35 fi 36 fi
36} 37}
37 38
38RDEPENDS_${PN} = "systemd" 39RDEPENDS_${PN} = "systemd"
39 40
40# This is a machine specific file 41# This is a machine specific file
41FILES_${PN} = "${systemd_unitdir}/system/serial-getty@.service ${sysconfdir}" 42FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}"
42PACKAGE_ARCH = "${MACHINE_ARCH}" 43PACKAGE_ARCH = "${MACHINE_ARCH}"
43 44
44# As this package is tied to systemd, only build it when we're also building systemd. 45# As this package is tied to systemd, only build it when we're also building systemd.