blob: a19ccae75206d937fc946ccdc2c34b0a31ec4218 [file] [log] [blame]
Jeremy Kerr882199e2016-03-17 17:35:27 +08001SUMMARY = "OpenBMC console daemon"
2DESCRIPTION = "Daemon to handle UART console connections"
3HOMEPAGE = "http://github.com/openbmc/obmc-console"
Brad Bishop75f03872018-11-03 09:41:57 -07004LICENSE = "Apache-2.0"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
Ed Tanous9936f862022-09-19 09:13:20 -07006DEPENDS += "autoconf-archive-native \
7 systemd \
8 "
Andrew Geisslere7663ac2022-12-08 17:40:28 -06009SRCREV = "ed04991236db13e25bc50cd613c348cd94fe0a83"
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103010PACKAGECONFIG ??= "udev ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
11PACKAGECONFIG[udev] = "--with-udevdir=`pkg-config --variable=udevdir udev`,\
12 --without-udevdir,udev"
13PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_system_unitdir}, \
14 --without-systemdsystemunitdir"
Ed Tanous9936f862022-09-19 09:13:20 -070015PV = "1.0+git${SRCPV}"
16PR = "r1"
Matthew Barth3e20a722016-09-26 16:26:27 -050017
Patrick Williamsbb99d222022-01-24 15:55:09 -060018SRC_URI += "git://github.com/openbmc/obmc-console;branch=master;protocol=https"
Brad Bishop58b6bd12019-06-19 16:42:18 -040019SRC_URI += "file://${BPN}.conf"
Jeremy Kerr2a9a9d72016-04-12 13:10:12 +080020
Ed Tanous9936f862022-09-19 09:13:20 -070021S = "${WORKDIR}/git"
Patrick Williams12fc9392021-08-06 09:16:53 -050022SYSTEMD_SERVICE:${PN} += "obmc-console-ssh@.service \
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103023 obmc-console-ssh.socket \
24 obmc-console@.service \
25 "
26
Ed Tanous9936f862022-09-19 09:13:20 -070027inherit autotools pkgconfig
28inherit obmc-phosphor-discovery-service
29inherit systemd
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080030
Patrick Williams12fc9392021-08-06 09:16:53 -050031do_install:append() {
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103032 # Install the server configuration
33 install -m 0755 -d ${D}${sysconfdir}/${BPN}
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080034 # If the OBMC_CONSOLE_TTYS variable is used without the default OBMC_CONSOLE_HOST_TTY
35 # the port specific config file should be provided. If it is just OBMC_CONSOLE_HOST_TTY,
36 # use the old style which supports both port specific or obmc-console.conf method.
Vivekanand Veeracholane7914122022-02-02 10:53:33 -080037 if [ "${OBMC_CONSOLE_TTYS}" != "${OBMC_CONSOLE_HOST_TTY}" ]; then
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103038 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080039 for CONSOLE in ${OBMC_CONSOLE_TTYS}
40 do
41 if test -f "${WORKDIR}/server.${CONSOLE}.conf" ; then
42 install -m 0644 ${WORKDIR}/server.${CONSOLE}.conf ${D}${sysconfdir}/${BPN}/
43 else
44 bberror "Must provide port specific config files when using OBMC_CONSOLE_TTYS" \
45 "Missing server.${CONSOLE}.conf"
46 fi
47 done
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103048 else
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080049 # Port specific config file is prioritized over generic conf file.
50 # If port specific config file is not present and generic "obmc-console.conf"
51 # exists, it will be used.
52 if test -f "${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf" ; then
53 # Remove the upstream-provided server configuration
54 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
55 # Install the package-provided new-style configuration
56 install -m 0644 ${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf ${D}${sysconfdir}/${BPN}/
57 elif test -f "${WORKDIR}/${BPN}.conf"; then
58 # Remove the upstream-provided server configuration
59 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
60 # Install the old-style server configuration
61 install -m 0644 ${WORKDIR}/${BPN}.conf ${D}${sysconfdir}/
62 # Link the custom configuration to the required location
63 ln -sr ${D}${sysconfdir}/${BPN}.conf ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
64 else
65 # Otherwise, remove socket-id from the shipped configuration to
66 # align with the lack of a client configuration file
67 sed -ri '/^socket-id =/d' ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
68 fi
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103069 fi
Jeremy Kerr882199e2016-03-17 17:35:27 +080070}
Ed Tanous9936f862022-09-19 09:13:20 -070071
72FILES:${PN} += "${systemd_system_unitdir}/obmc-console-ssh@.service.d/use-socket.conf"
73
74TARGET_CFLAGS += "-fpic -O2"
75
76REGISTERED_SERVICES:${PN} += "obmc_console:tcp:2200:"
77OBMC_CONSOLE_HOST_TTY ?= "ttyVUART0"
78# Support multiple TTY ports using space separated list.
79# Ex. OBMC_CONSOLE_TTYS = "ttyS1 ttyS2"
80OBMC_CONSOLE_TTYS ?= "${OBMC_CONSOLE_HOST_TTY}"