blob: 968cb48adb24cbf40a2e3473545fd2799a4eb5a0 [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 \
Andrew Geisslerd66b36e2024-07-24 03:00:40 -05009 libgpiod \
Ed Tanous9936f862022-09-19 09:13:20 -070010 "
Andrew Geissler085c9012024-09-16 20:40:53 -050011SRCREV = "6498f9fa9792ef0c14dab4aca3d38a674f6402cd"
Andrew Geissler38f200f2023-10-03 01:30:20 -050012PACKAGECONFIG ??= "udev ssh"
Andrew Jeffery08413f22023-04-21 11:45:51 +093013PACKAGECONFIG[udev] = "-Dudev=enabled,-Dudev=disabled,udev"
14PACKAGECONFIG[concurrent-servers] = "-Dconcurrent-servers=true,-Dconcurrent-servers=false,"
Andrew Geissler38f200f2023-10-03 01:30:20 -050015PACKAGECONFIG[ssh] = "-Dssh=enabled,-Dssh=disabled"
Andrew Geissler94c6e962024-07-09 23:40:15 -050016EXTRA_OEMESON = "-Dtests=false"
Ed Tanous9936f862022-09-19 09:13:20 -070017PV = "1.0+git${SRCPV}"
18PR = "r1"
Matthew Barth3e20a722016-09-26 16:26:27 -050019
Patrick Williamsbccaff32023-04-14 11:24:47 -050020SRC_URI = "git://github.com/openbmc/obmc-console;branch=master;protocol=https"
Brad Bishop58b6bd12019-06-19 16:42:18 -040021SRC_URI += "file://${BPN}.conf"
Ninad Palsule34d21442023-03-09 10:20:38 -060022SRC_URI += "file://dropbear.env"
Jeremy Kerr2a9a9d72016-04-12 13:10:12 +080023
Ed Tanous9936f862022-09-19 09:13:20 -070024S = "${WORKDIR}/git"
Andrew Geissler38f200f2023-10-03 01:30:20 -050025SYSTEMD_SERVICE:${PN} += " obmc-console@.service"
26
27# Include ssh service if `ssh` is in PACKAGECONFIG.
28# Only install the ssh socket if we are not enabling
29# `concurrent-servers` in PACKAGECONFIG.
30SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc-console-ssh@.service', '', d)}"
31SSH_SYSTEMD_SOCKET = "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc-console-ssh.socket', '', d)}"
32SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'concurrent-servers', '', '${SSH_SYSTEMD_SOCKET}', d)}"
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103033
Andrew Jeffery08413f22023-04-21 11:45:51 +093034inherit meson pkgconfig
Ed Tanous9936f862022-09-19 09:13:20 -070035inherit obmc-phosphor-discovery-service
36inherit systemd
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080037
Patrick Williams12fc9392021-08-06 09:16:53 -050038do_install:append() {
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103039 # Install the server configuration
40 install -m 0755 -d ${D}${sysconfdir}/${BPN}
Ninad Palsule34d21442023-03-09 10:20:38 -060041
Patrick Williams206fa212024-02-05 13:37:47 -060042 if ${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'true', 'false', d)} ; then
43 install -m 0644 ${WORKDIR}/dropbear.env ${D}${sysconfdir}/${BPN}/
44 fi
Ninad Palsule34d21442023-03-09 10:20:38 -060045
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080046 # If the OBMC_CONSOLE_TTYS variable is used without the default OBMC_CONSOLE_HOST_TTY
47 # the port specific config file should be provided. If it is just OBMC_CONSOLE_HOST_TTY,
48 # use the old style which supports both port specific or obmc-console.conf method.
Vivekanand Veeracholane7914122022-02-02 10:53:33 -080049 if [ "${OBMC_CONSOLE_TTYS}" != "${OBMC_CONSOLE_HOST_TTY}" ]; then
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103050 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080051 for CONSOLE in ${OBMC_CONSOLE_TTYS}
52 do
53 if test -f "${WORKDIR}/server.${CONSOLE}.conf" ; then
54 install -m 0644 ${WORKDIR}/server.${CONSOLE}.conf ${D}${sysconfdir}/${BPN}/
55 else
56 bberror "Must provide port specific config files when using OBMC_CONSOLE_TTYS" \
57 "Missing server.${CONSOLE}.conf"
58 fi
59 done
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103060 else
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080061 # Port specific config file is prioritized over generic conf file.
62 # If port specific config file is not present and generic "obmc-console.conf"
63 # exists, it will be used.
64 if test -f "${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf" ; then
65 # Remove the upstream-provided server configuration
66 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
67 # Install the package-provided new-style configuration
68 install -m 0644 ${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf ${D}${sysconfdir}/${BPN}/
69 elif test -f "${WORKDIR}/${BPN}.conf"; then
70 # Remove the upstream-provided server configuration
71 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
72 # Install the old-style server configuration
73 install -m 0644 ${WORKDIR}/${BPN}.conf ${D}${sysconfdir}/
74 # Link the custom configuration to the required location
75 ln -sr ${D}${sysconfdir}/${BPN}.conf ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
76 else
Andrew Jeffery7a612d42023-06-05 16:16:57 +093077 # Otherwise, remove console-id from the shipped configuration to
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080078 # align with the lack of a client configuration file
Andrew Jeffery7a612d42023-06-05 16:16:57 +093079 sed -ri '/^console-id =/d' ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080080 fi
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103081 fi
Jeremy Kerr882199e2016-03-17 17:35:27 +080082}
Ed Tanous9936f862022-09-19 09:13:20 -070083
Andrew Geissler99f5c872023-04-14 13:40:56 -050084FILES:${PN} += "${systemd_system_unitdir}"
Ed Tanous9936f862022-09-19 09:13:20 -070085
86TARGET_CFLAGS += "-fpic -O2"
87
Patrick Williams206fa212024-02-05 13:37:47 -060088REGISTERED_SERVICES:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc_console:tcp:2200:', '', d)}"
Ed Tanous9936f862022-09-19 09:13:20 -070089OBMC_CONSOLE_HOST_TTY ?= "ttyVUART0"
90# Support multiple TTY ports using space separated list.
91# Ex. OBMC_CONSOLE_TTYS = "ttyS1 ttyS2"
92OBMC_CONSOLE_TTYS ?= "${OBMC_CONSOLE_HOST_TTY}"