blob: 714e1e50827d564315a91dd75c2950d21b29ea5e [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"
4PR = "r1"
Brad Bishop75f03872018-11-03 09:41:57 -07005LICENSE = "Apache-2.0"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
Jeremy Kerr882199e2016-03-17 17:35:27 +08007
Cheng C Yangfac98702019-01-30 14:31:56 +08008inherit autotools pkgconfig
Ratan Guptadf7dfd42016-10-01 14:57:15 -05009inherit obmc-phosphor-discovery-service
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103010inherit systemd
Jeremy Kerr882199e2016-03-17 17:35:27 +080011
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103012S = "${WORKDIR}/git"
13
14TARGET_CFLAGS += "-fpic -O2"
15
16PACKAGECONFIG ??= "udev ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
17PACKAGECONFIG[udev] = "--with-udevdir=`pkg-config --variable=udevdir udev`,\
18 --without-udevdir,udev"
19PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_system_unitdir}, \
20 --without-systemdsystemunitdir"
Jeremy Kerr882199e2016-03-17 17:35:27 +080021
Cheng C Yangfac98702019-01-30 14:31:56 +080022DEPENDS += "autoconf-archive-native \
23 systemd \
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103024 "
Matthew Barth3e20a722016-09-26 16:26:27 -050025
Patrick Williamsbb99d222022-01-24 15:55:09 -060026SRC_URI += "git://github.com/openbmc/obmc-console;branch=master;protocol=https"
Brad Bishop58b6bd12019-06-19 16:42:18 -040027SRC_URI += "file://${BPN}.conf"
Jeremy Kerr2a9a9d72016-04-12 13:10:12 +080028
Andrew Geisslere9cfdef2022-04-05 00:20:07 +000029SRCREV = "93fd8a39d8d20cdf965490f594a2d6f6d90f506c"
Brad Bishop586e22612018-04-12 11:11:49 -040030PV = "1.0+git${SRCPV}"
Jeremy Kerr882199e2016-03-17 17:35:27 +080031
Patrick Williams5b587ca2021-09-01 16:33:36 -050032REGISTERED_SERVICES:${PN} += "obmc_console:tcp:2200:"
Ratan Guptadf7dfd42016-10-01 14:57:15 -050033
Patrick Williams12fc9392021-08-06 09:16:53 -050034SYSTEMD_SERVICE:${PN} += "obmc-console-ssh@.service \
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103035 obmc-console-ssh.socket \
36 obmc-console@.service \
37 "
38
Patrick Williams12fc9392021-08-06 09:16:53 -050039FILES:${PN} += "${systemd_system_unitdir}/obmc-console-ssh@.service.d/use-socket.conf"
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103040
Oskar Senfteefb1dd2021-11-24 15:19:25 -050041OBMC_CONSOLE_HOST_TTY ?= "ttyVUART0"
42
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080043# Support multiple TTY ports using space separated list.
44# Ex. OBMC_CONSOLE_TTYS = "ttyS1 ttyS2"
45OBMC_CONSOLE_TTYS ?= "${OBMC_CONSOLE_HOST_TTY}"
46
Patrick Williams12fc9392021-08-06 09:16:53 -050047do_install:append() {
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103048 # Install the server configuration
49 install -m 0755 -d ${D}${sysconfdir}/${BPN}
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080050
51 # If the OBMC_CONSOLE_TTYS variable is used without the default OBMC_CONSOLE_HOST_TTY
52 # the port specific config file should be provided. If it is just OBMC_CONSOLE_HOST_TTY,
53 # use the old style which supports both port specific or obmc-console.conf method.
Vivekanand Veeracholane7914122022-02-02 10:53:33 -080054 if [ "${OBMC_CONSOLE_TTYS}" != "${OBMC_CONSOLE_HOST_TTY}" ]; then
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103055 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080056
57 for CONSOLE in ${OBMC_CONSOLE_TTYS}
58 do
59 if test -f "${WORKDIR}/server.${CONSOLE}.conf" ; then
60 install -m 0644 ${WORKDIR}/server.${CONSOLE}.conf ${D}${sysconfdir}/${BPN}/
61 else
62 bberror "Must provide port specific config files when using OBMC_CONSOLE_TTYS" \
63 "Missing server.${CONSOLE}.conf"
64 fi
65 done
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103066 else
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080067 # Port specific config file is prioritized over generic conf file.
68 # If port specific config file is not present and generic "obmc-console.conf"
69 # exists, it will be used.
70 if test -f "${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf" ; then
71 # Remove the upstream-provided server configuration
72 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
73 # Install the package-provided new-style configuration
74 install -m 0644 ${WORKDIR}/server.${OBMC_CONSOLE_TTYS}.conf ${D}${sysconfdir}/${BPN}/
75 elif test -f "${WORKDIR}/${BPN}.conf"; then
76 # Remove the upstream-provided server configuration
77 rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
78 # Install the old-style server configuration
79 install -m 0644 ${WORKDIR}/${BPN}.conf ${D}${sysconfdir}/
80 # Link the custom configuration to the required location
81 ln -sr ${D}${sysconfdir}/${BPN}.conf ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
82 else
83 # Otherwise, remove socket-id from the shipped configuration to
84 # align with the lack of a client configuration file
85 sed -ri '/^socket-id =/d' ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf
86 fi
Andrew Jefferyabf95ef2020-02-13 16:30:43 +103087 fi
Vivekanand Veeracholane2982432021-12-03 17:09:52 -080088
Jeremy Kerr882199e2016-03-17 17:35:27 +080089}