blob: 16874f84457e15032417fcc63c2c3a70f7d8ee6f [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 Geissler3c3d61a2024-03-22 16:30:25 -05009SRCREV = "bd4af900acc889ef840b78b6707d54b084e51dbf"
Andrew Geissler38f200f2023-10-03 01:30:20 -050010PACKAGECONFIG ??= "udev ssh"
Andrew Jeffery08413f22023-04-21 11:45:51 +093011PACKAGECONFIG[udev] = "-Dudev=enabled,-Dudev=disabled,udev"
12PACKAGECONFIG[concurrent-servers] = "-Dconcurrent-servers=true,-Dconcurrent-servers=false,"
Andrew Geissler38f200f2023-10-03 01:30:20 -050013PACKAGECONFIG[ssh] = "-Dssh=enabled,-Dssh=disabled"
Ed Tanous9936f862022-09-19 09:13:20 -070014PV = "1.0+git${SRCPV}"
15PR = "r1"
Matthew Barth3e20a722016-09-26 16:26:27 -050016
Patrick Williamsbccaff32023-04-14 11:24:47 -050017SRC_URI = "git://github.com/openbmc/obmc-console;branch=master;protocol=https"
Brad Bishop58b6bd12019-06-19 16:42:18 -040018SRC_URI += "file://${BPN}.conf"
Ninad Palsule34d21442023-03-09 10:20:38 -060019SRC_URI += "file://dropbear.env"
Jeremy Kerr2a9a9d72016-04-12 13:10:12 +080020
Ed Tanous9936f862022-09-19 09:13:20 -070021S = "${WORKDIR}/git"
Andrew Geissler38f200f2023-10-03 01:30:20 -050022SYSTEMD_SERVICE:${PN} += " obmc-console@.service"
23
24# Include ssh service if `ssh` is in PACKAGECONFIG.
25# Only install the ssh socket if we are not enabling
26# `concurrent-servers` in PACKAGECONFIG.
27SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc-console-ssh@.service', '', d)}"
28SSH_SYSTEMD_SOCKET = "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc-console-ssh.socket', '', d)}"
29SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'concurrent-servers', '', '${SSH_SYSTEMD_SOCKET}', d)}"
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103030
Andrew Jeffery08413f22023-04-21 11:45:51 +093031inherit meson pkgconfig
Ed Tanous9936f862022-09-19 09:13:20 -070032inherit obmc-phosphor-discovery-service
33inherit systemd
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080034
Patrick Williams12fc9392021-08-06 09:16:53 -050035do_install:append() {
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103036 # Install the server configuration
37 install -m 0755 -d ${D}${sysconfdir}/${BPN}
Ninad Palsule34d21442023-03-09 10:20:38 -060038
Patrick Williams206fa212024-02-05 13:37:47 -060039 if ${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'true', 'false', d)} ; then
40 install -m 0644 ${WORKDIR}/dropbear.env ${D}${sysconfdir}/${BPN}/
41 fi
Ninad Palsule34d21442023-03-09 10:20:38 -060042
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080043 # If the OBMC_CONSOLE_TTYS variable is used without the default OBMC_CONSOLE_HOST_TTY
44 # the port specific config file should be provided. If it is just OBMC_CONSOLE_HOST_TTY,
45 # use the old style which supports both port specific or obmc-console.conf method.
Vivekanand Veeracholane7914122022-02-02 10:53:33 -080046 if [ "${OBMC_CONSOLE_TTYS}" != "${OBMC_CONSOLE_HOST_TTY}" ]; then
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103047 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080048 for CONSOLE in ${OBMC_CONSOLE_TTYS}
49 do
50 if test -f "${WORKDIR}/server.${CONSOLE}.conf" ; then
51 install -m 0644 ${WORKDIR}/server.${CONSOLE}.conf ${D}${sysconfdir}/${BPN}/
52 else
53 bberror "Must provide port specific config files when using OBMC_CONSOLE_TTYS" \
54 "Missing server.${CONSOLE}.conf"
55 fi
56 done
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103057 else
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080058 # Port specific config file is prioritized over generic conf file.
59 # If port specific config file is not present and generic "obmc-console.conf"
60 # exists, it will be used.
61 if test -f "${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf" ; then
62 # Remove the upstream-provided server configuration
63 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
64 # Install the package-provided new-style configuration
65 install -m 0644 ${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf ${D}${sysconfdir}/${BPN}/
66 elif test -f "${WORKDIR}/${BPN}.conf"; then
67 # Remove the upstream-provided server configuration
68 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
69 # Install the old-style server configuration
70 install -m 0644 ${WORKDIR}/${BPN}.conf ${D}${sysconfdir}/
71 # Link the custom configuration to the required location
72 ln -sr ${D}${sysconfdir}/${BPN}.conf ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
73 else
Andrew Jeffery7a612d42023-06-05 16:16:57 +093074 # Otherwise, remove console-id from the shipped configuration to
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080075 # align with the lack of a client configuration file
Andrew Jeffery7a612d42023-06-05 16:16:57 +093076 sed -ri '/^console-id =/d' ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080077 fi
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103078 fi
Jeremy Kerr882199e2016-03-17 17:35:27 +080079}
Ed Tanous9936f862022-09-19 09:13:20 -070080
Andrew Geissler99f5c872023-04-14 13:40:56 -050081FILES:${PN} += "${systemd_system_unitdir}"
Ed Tanous9936f862022-09-19 09:13:20 -070082
83TARGET_CFLAGS += "-fpic -O2"
84
Patrick Williams206fa212024-02-05 13:37:47 -060085REGISTERED_SERVICES:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc_console:tcp:2200:', '', d)}"
Ed Tanous9936f862022-09-19 09:13:20 -070086OBMC_CONSOLE_HOST_TTY ?= "ttyVUART0"
87# Support multiple TTY ports using space separated list.
88# Ex. OBMC_CONSOLE_TTYS = "ttyS1 ttyS2"
89OBMC_CONSOLE_TTYS ?= "${OBMC_CONSOLE_HOST_TTY}"