Jeremy Kerr | 882199e | 2016-03-17 17:35:27 +0800 | [diff] [blame] | 1 | SUMMARY = "OpenBMC console daemon" |
| 2 | DESCRIPTION = "Daemon to handle UART console connections" |
| 3 | HOMEPAGE = "http://github.com/openbmc/obmc-console" |
Brad Bishop | 75f0387 | 2018-11-03 09:41:57 -0700 | [diff] [blame] | 4 | LICENSE = "Apache-2.0" |
| 5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc" |
Ed Tanous | 9936f86 | 2022-09-19 09:13:20 -0700 | [diff] [blame] | 6 | DEPENDS += "autoconf-archive-native \ |
| 7 | systemd \ |
| 8 | " |
Andrew Geissler | 0ffd704 | 2023-12-21 23:50:15 -0600 | [diff] [blame] | 9 | SRCREV = "66ddf711d10cf684c8a179c4c2e6690e073990da" |
Andrew Geissler | 38f200f | 2023-10-03 01:30:20 -0500 | [diff] [blame] | 10 | PACKAGECONFIG ??= "udev ssh" |
Andrew Jeffery | 08413f2 | 2023-04-21 11:45:51 +0930 | [diff] [blame] | 11 | PACKAGECONFIG[udev] = "-Dudev=enabled,-Dudev=disabled,udev" |
| 12 | PACKAGECONFIG[concurrent-servers] = "-Dconcurrent-servers=true,-Dconcurrent-servers=false," |
Andrew Geissler | 38f200f | 2023-10-03 01:30:20 -0500 | [diff] [blame] | 13 | PACKAGECONFIG[ssh] = "-Dssh=enabled,-Dssh=disabled" |
Ed Tanous | 9936f86 | 2022-09-19 09:13:20 -0700 | [diff] [blame] | 14 | PV = "1.0+git${SRCPV}" |
| 15 | PR = "r1" |
Matthew Barth | 3e20a72 | 2016-09-26 16:26:27 -0500 | [diff] [blame] | 16 | |
Patrick Williams | bccaff3 | 2023-04-14 11:24:47 -0500 | [diff] [blame] | 17 | SRC_URI = "git://github.com/openbmc/obmc-console;branch=master;protocol=https" |
Brad Bishop | 58b6bd1 | 2019-06-19 16:42:18 -0400 | [diff] [blame] | 18 | SRC_URI += "file://${BPN}.conf" |
Ninad Palsule | 34d2144 | 2023-03-09 10:20:38 -0600 | [diff] [blame] | 19 | SRC_URI += "file://dropbear.env" |
Jeremy Kerr | 2a9a9d7 | 2016-04-12 13:10:12 +0800 | [diff] [blame] | 20 | |
Ed Tanous | 9936f86 | 2022-09-19 09:13:20 -0700 | [diff] [blame] | 21 | S = "${WORKDIR}/git" |
Andrew Geissler | 38f200f | 2023-10-03 01:30:20 -0500 | [diff] [blame] | 22 | SYSTEMD_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. |
| 27 | SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc-console-ssh@.service', '', d)}" |
| 28 | SSH_SYSTEMD_SOCKET = "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc-console-ssh.socket', '', d)}" |
| 29 | SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'concurrent-servers', '', '${SSH_SYSTEMD_SOCKET}', d)}" |
Andrew Jeffery | abf95ef | 2020-02-13 16:30:43 +1030 | [diff] [blame] | 30 | |
Andrew Jeffery | 08413f2 | 2023-04-21 11:45:51 +0930 | [diff] [blame] | 31 | inherit meson pkgconfig |
Ed Tanous | 9936f86 | 2022-09-19 09:13:20 -0700 | [diff] [blame] | 32 | inherit obmc-phosphor-discovery-service |
| 33 | inherit systemd |
Vivekanand Veeracholan | e298243 | 2021-12-03 17:09:52 -0800 | [diff] [blame] | 34 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 35 | do_install:append() { |
Andrew Jeffery | abf95ef | 2020-02-13 16:30:43 +1030 | [diff] [blame] | 36 | # Install the server configuration |
| 37 | install -m 0755 -d ${D}${sysconfdir}/${BPN} |
Ninad Palsule | 34d2144 | 2023-03-09 10:20:38 -0600 | [diff] [blame] | 38 | |
Patrick Williams | 206fa21 | 2024-02-05 13:37:47 -0600 | [diff] [blame^] | 39 | if ${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'true', 'false', d)} ; then |
| 40 | install -m 0644 ${WORKDIR}/dropbear.env ${D}${sysconfdir}/${BPN}/ |
| 41 | fi |
Ninad Palsule | 34d2144 | 2023-03-09 10:20:38 -0600 | [diff] [blame] | 42 | |
Vivekanand Veeracholan | e298243 | 2021-12-03 17:09:52 -0800 | [diff] [blame] | 43 | # 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 Veeracholan | e791412 | 2022-02-02 10:53:33 -0800 | [diff] [blame] | 46 | if [ "${OBMC_CONSOLE_TTYS}" != "${OBMC_CONSOLE_HOST_TTY}" ]; then |
Andrew Jeffery | abf95ef | 2020-02-13 16:30:43 +1030 | [diff] [blame] | 47 | rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf |
Vivekanand Veeracholan | e298243 | 2021-12-03 17:09:52 -0800 | [diff] [blame] | 48 | 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 Jeffery | abf95ef | 2020-02-13 16:30:43 +1030 | [diff] [blame] | 57 | else |
Vivekanand Veeracholan | e298243 | 2021-12-03 17:09:52 -0800 | [diff] [blame] | 58 | # 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 Jeffery | 7a612d4 | 2023-06-05 16:16:57 +0930 | [diff] [blame] | 74 | # Otherwise, remove console-id from the shipped configuration to |
Vivekanand Veeracholan | e298243 | 2021-12-03 17:09:52 -0800 | [diff] [blame] | 75 | # align with the lack of a client configuration file |
Andrew Jeffery | 7a612d4 | 2023-06-05 16:16:57 +0930 | [diff] [blame] | 76 | sed -ri '/^console-id =/d' ${D}${sysconfdir}/${BPN}/server.${OBMC_CONSOLE_TTYS}.conf |
Vivekanand Veeracholan | e298243 | 2021-12-03 17:09:52 -0800 | [diff] [blame] | 77 | fi |
Andrew Jeffery | abf95ef | 2020-02-13 16:30:43 +1030 | [diff] [blame] | 78 | fi |
Jeremy Kerr | 882199e | 2016-03-17 17:35:27 +0800 | [diff] [blame] | 79 | } |
Ed Tanous | 9936f86 | 2022-09-19 09:13:20 -0700 | [diff] [blame] | 80 | |
Andrew Geissler | 99f5c87 | 2023-04-14 13:40:56 -0500 | [diff] [blame] | 81 | FILES:${PN} += "${systemd_system_unitdir}" |
Ed Tanous | 9936f86 | 2022-09-19 09:13:20 -0700 | [diff] [blame] | 82 | |
| 83 | TARGET_CFLAGS += "-fpic -O2" |
| 84 | |
Patrick Williams | 206fa21 | 2024-02-05 13:37:47 -0600 | [diff] [blame^] | 85 | REGISTERED_SERVICES:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'obmc_console:tcp:2200:', '', d)}" |
Ed Tanous | 9936f86 | 2022-09-19 09:13:20 -0700 | [diff] [blame] | 86 | OBMC_CONSOLE_HOST_TTY ?= "ttyVUART0" |
| 87 | # Support multiple TTY ports using space separated list. |
| 88 | # Ex. OBMC_CONSOLE_TTYS = "ttyS1 ttyS2" |
| 89 | OBMC_CONSOLE_TTYS ?= "${OBMC_CONSOLE_HOST_TTY}" |