blob: c61582650153dc77898e1c71b9ee7efd4276dbce [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 \
Andrew Geissler94c6e962024-07-09 23:40:15 -05007 iniparser \
Ed Tanous9936f862022-09-19 09:13:20 -07008 systemd \
9 "
Andrew Geissler4f3a0bd2024-07-11 22:10:10 -050010SRCREV = "e3f1aa1ec8cecd58aa8f67702bd587c2989f787e"
Andrew Geissler38f200f2023-10-03 01:30:20 -050011PACKAGECONFIG ??= "udev ssh"
Andrew Jeffery08413f22023-04-21 11:45:51 +093012PACKAGECONFIG[udev] = "-Dudev=enabled,-Dudev=disabled,udev"
13PACKAGECONFIG[concurrent-servers] = "-Dconcurrent-servers=true,-Dconcurrent-servers=false,"
Andrew Geissler38f200f2023-10-03 01:30:20 -050014PACKAGECONFIG[ssh] = "-Dssh=enabled,-Dssh=disabled"
Andrew Geissler94c6e962024-07-09 23:40:15 -050015EXTRA_OEMESON = "-Dtests=false"
Ed Tanous9936f862022-09-19 09:13:20 -070016PV = "1.0+git${SRCPV}"
17PR = "r1"
Matthew Barth3e20a722016-09-26 16:26:27 -050018
Patrick Williamsbccaff32023-04-14 11:24:47 -050019SRC_URI = "git://github.com/openbmc/obmc-console;branch=master;protocol=https"
Brad Bishop58b6bd12019-06-19 16:42:18 -040020SRC_URI += "file://${BPN}.conf"
Ninad Palsule34d21442023-03-09 10:20:38 -060021SRC_URI += "file://dropbear.env"
Jeremy Kerr2a9a9d72016-04-12 13:10:12 +080022
Ed Tanous9936f862022-09-19 09:13:20 -070023S = "${WORKDIR}/git"
Andrew Geissler38f200f2023-10-03 01:30:20 -050024SYSTEMD_SERVICE:${PN} += " obmc-console@.service"
25
26# Include ssh service if `ssh` is in PACKAGECONFIG.
27# Only install the ssh socket if we are not enabling
28# `concurrent-servers` in PACKAGECONFIG.
29SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc-console-ssh@.service', '', d)}"
30SSH_SYSTEMD_SOCKET = "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc-console-ssh.socket', '', d)}"
31SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'concurrent-servers', '', '${SSH_SYSTEMD_SOCKET}', d)}"
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103032
Andrew Jeffery08413f22023-04-21 11:45:51 +093033inherit meson pkgconfig
Ed Tanous9936f862022-09-19 09:13:20 -070034inherit obmc-phosphor-discovery-service
35inherit systemd
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080036
Patrick Williams12fc9392021-08-06 09:16:53 -050037do_install:append() {
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103038 # Install the server configuration
39 install -m 0755 -d ${D}${sysconfdir}/${BPN}
Ninad Palsule34d21442023-03-09 10:20:38 -060040
Patrick Williams206fa212024-02-05 13:37:47 -060041 if ${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'true', 'false', d)} ; then
42 install -m 0644 ${WORKDIR}/dropbear.env ${D}${sysconfdir}/${BPN}/
43 fi
Ninad Palsule34d21442023-03-09 10:20:38 -060044
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080045 # If the OBMC_CONSOLE_TTYS variable is used without the default OBMC_CONSOLE_HOST_TTY
46 # the port specific config file should be provided. If it is just OBMC_CONSOLE_HOST_TTY,
47 # use the old style which supports both port specific or obmc-console.conf method.
Vivekanand Veeracholane7914122022-02-02 10:53:33 -080048 if [ "${OBMC_CONSOLE_TTYS}" != "${OBMC_CONSOLE_HOST_TTY}" ]; then
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103049 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080050 for CONSOLE in ${OBMC_CONSOLE_TTYS}
51 do
52 if test -f "${WORKDIR}/server.${CONSOLE}.conf" ; then
53 install -m 0644 ${WORKDIR}/server.${CONSOLE}.conf ${D}${sysconfdir}/${BPN}/
54 else
55 bberror "Must provide port specific config files when using OBMC_CONSOLE_TTYS" \
56 "Missing server.${CONSOLE}.conf"
57 fi
58 done
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103059 else
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080060 # Port specific config file is prioritized over generic conf file.
61 # If port specific config file is not present and generic "obmc-console.conf"
62 # exists, it will be used.
63 if test -f "${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf" ; then
64 # Remove the upstream-provided server configuration
65 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
66 # Install the package-provided new-style configuration
67 install -m 0644 ${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf ${D}${sysconfdir}/${BPN}/
68 elif test -f "${WORKDIR}/${BPN}.conf"; then
69 # Remove the upstream-provided server configuration
70 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
71 # Install the old-style server configuration
72 install -m 0644 ${WORKDIR}/${BPN}.conf ${D}${sysconfdir}/
73 # Link the custom configuration to the required location
74 ln -sr ${D}${sysconfdir}/${BPN}.conf ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
75 else
Andrew Jeffery7a612d42023-06-05 16:16:57 +093076 # Otherwise, remove console-id from the shipped configuration to
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080077 # align with the lack of a client configuration file
Andrew Jeffery7a612d42023-06-05 16:16:57 +093078 sed -ri '/^console-id =/d' ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080079 fi
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103080 fi
Jeremy Kerr882199e2016-03-17 17:35:27 +080081}
Ed Tanous9936f862022-09-19 09:13:20 -070082
Andrew Geissler99f5c872023-04-14 13:40:56 -050083FILES:${PN} += "${systemd_system_unitdir}"
Ed Tanous9936f862022-09-19 09:13:20 -070084
85TARGET_CFLAGS += "-fpic -O2"
86
Patrick Williams206fa212024-02-05 13:37:47 -060087REGISTERED_SERVICES:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc_console:tcp:2200:', '', d)}"
Ed Tanous9936f862022-09-19 09:13:20 -070088OBMC_CONSOLE_HOST_TTY ?= "ttyVUART0"
89# Support multiple TTY ports using space separated list.
90# Ex. OBMC_CONSOLE_TTYS = "ttyS1 ttyS2"
91OBMC_CONSOLE_TTYS ?= "${OBMC_CONSOLE_HOST_TTY}"