blob: c4f4ee05e6da8a6b232d2bfd7aef960c3f34de3e [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 Geisslera8c3ca72023-04-19 21:50:21 -05009SRCREV = "21f4cb4a76858d7dec71a04883894b8bc54d774f"
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 Williamsbccaff32023-04-14 11:24:47 -050018SRC_URI = "git://github.com/openbmc/obmc-console;branch=master;protocol=https"
Brad Bishop58b6bd12019-06-19 16:42:18 -040019SRC_URI += "file://${BPN}.conf"
Ninad Palsule34d21442023-03-09 10:20:38 -060020SRC_URI += "file://dropbear.env"
Jeremy Kerr2a9a9d72016-04-12 13:10:12 +080021
Ed Tanous9936f862022-09-19 09:13:20 -070022S = "${WORKDIR}/git"
Patrick Williams12fc9392021-08-06 09:16:53 -050023SYSTEMD_SERVICE:${PN} += "obmc-console-ssh@.service \
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103024 obmc-console-ssh.socket \
25 obmc-console@.service \
26 "
27
Ed Tanous9936f862022-09-19 09:13:20 -070028inherit autotools pkgconfig
29inherit obmc-phosphor-discovery-service
30inherit systemd
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080031
Patrick Williams12fc9392021-08-06 09:16:53 -050032do_install:append() {
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103033 # Install the server configuration
34 install -m 0755 -d ${D}${sysconfdir}/${BPN}
Ninad Palsule34d21442023-03-09 10:20:38 -060035
36 install -m 0644 ${WORKDIR}/dropbear.env ${D}${sysconfdir}/${BPN}/
37
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080038 # If the OBMC_CONSOLE_TTYS variable is used without the default OBMC_CONSOLE_HOST_TTY
39 # the port specific config file should be provided. If it is just OBMC_CONSOLE_HOST_TTY,
40 # use the old style which supports both port specific or obmc-console.conf method.
Vivekanand Veeracholane7914122022-02-02 10:53:33 -080041 if [ "${OBMC_CONSOLE_TTYS}" != "${OBMC_CONSOLE_HOST_TTY}" ]; then
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103042 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080043 for CONSOLE in ${OBMC_CONSOLE_TTYS}
44 do
45 if test -f "${WORKDIR}/server.${CONSOLE}.conf" ; then
46 install -m 0644 ${WORKDIR}/server.${CONSOLE}.conf ${D}${sysconfdir}/${BPN}/
47 else
48 bberror "Must provide port specific config files when using OBMC_CONSOLE_TTYS" \
49 "Missing server.${CONSOLE}.conf"
50 fi
51 done
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103052 else
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080053 # Port specific config file is prioritized over generic conf file.
54 # If port specific config file is not present and generic "obmc-console.conf"
55 # exists, it will be used.
56 if test -f "${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf" ; then
57 # Remove the upstream-provided server configuration
58 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
59 # Install the package-provided new-style configuration
60 install -m 0644 ${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf ${D}${sysconfdir}/${BPN}/
61 elif test -f "${WORKDIR}/${BPN}.conf"; then
62 # Remove the upstream-provided server configuration
63 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
64 # Install the old-style server configuration
65 install -m 0644 ${WORKDIR}/${BPN}.conf ${D}${sysconfdir}/
66 # Link the custom configuration to the required location
67 ln -sr ${D}${sysconfdir}/${BPN}.conf ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
68 else
69 # Otherwise, remove socket-id from the shipped configuration to
70 # align with the lack of a client configuration file
71 sed -ri '/^socket-id =/d' ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
72 fi
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103073 fi
Jeremy Kerr882199e2016-03-17 17:35:27 +080074}
Ed Tanous9936f862022-09-19 09:13:20 -070075
Andrew Geissler99f5c872023-04-14 13:40:56 -050076FILES:${PN} += "${systemd_system_unitdir}"
Ed Tanous9936f862022-09-19 09:13:20 -070077
78TARGET_CFLAGS += "-fpic -O2"
79
80REGISTERED_SERVICES:${PN} += "obmc_console:tcp:2200:"
81OBMC_CONSOLE_HOST_TTY ?= "ttyVUART0"
82# Support multiple TTY ports using space separated list.
83# Ex. OBMC_CONSOLE_TTYS = "ttyS1 ttyS2"
84OBMC_CONSOLE_TTYS ?= "${OBMC_CONSOLE_HOST_TTY}"