blob: da2d6954f694ef320ece20ae2db75824ff4d80b2 [file] [log] [blame]
Brad Bishopbd9931f2017-04-22 16:26:22 -04001SUMMARY = "Phosphor Fan"
2DESCRIPTION = "Phosphor fan provides a set of fan monitoring and \
3control applications."
4PR = "r1"
Patrick Venture5def7e72018-10-21 08:25:11 -07005PV = "1.0+git${SRCPV}"
Brad Bishopbd9931f2017-04-22 16:26:22 -04006
Patrick Williamsfb700fd2020-04-03 15:48:30 -05007require ${BPN}.inc
Matt Spinlercb262872022-08-12 21:44:17 +00008inherit meson pkgconfig python3native
Brad Bishopbd9931f2017-04-22 16:26:22 -04009inherit obmc-phosphor-systemd
10inherit phosphor-fan
11
12S = "${WORKDIR}/git"
13
14# Common build dependencies
Matthew Barth700bba02020-02-20 14:48:19 -060015DEPENDS += "${PYTHON_PN}-pyyaml-native"
16DEPENDS += "${PYTHON_PN}-mako-native"
Brad Bishopbd9931f2017-04-22 16:26:22 -040017DEPENDS += "sdbusplus"
Patrick Williams4b32c9a2020-03-31 16:43:15 -050018DEPENDS += "${PYTHON_PN}-sdbus++-native"
William A. Kennington IIIaa5d9452018-10-19 18:24:31 -070019DEPENDS += "sdeventplus"
William A. Kennington III3bb26b92018-10-29 16:32:26 -070020DEPENDS += "gpioplus"
Brad Bishopbd9931f2017-04-22 16:26:22 -040021DEPENDS += "phosphor-logging"
Brad Bishop4785fdf2017-07-30 21:25:23 -040022DEPENDS += "libevdev"
Matthew Barth61a59ad2020-01-14 15:38:05 -060023DEPENDS += "nlohmann-json"
Mike Capps459d47e2021-09-23 14:05:04 -040024DEPENDS += "cli11"
Brad Bishopbd9931f2017-04-22 16:26:22 -040025
26# Package configuration
27FAN_PACKAGES = " \
28 ${PN}-presence-tach \
29 ${PN}-control \
Matt Spinlerdd7a0802017-05-01 14:29:20 -050030 ${PN}-monitor \
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053031 ${PN}-sensor-monitor \
Brad Bishopbd9931f2017-04-22 16:26:22 -040032"
Brandon Wymanc50a8c42017-04-28 18:26:45 -050033
Patrick Williams12fc9392021-08-06 09:16:53 -050034ALLOW_EMPTY:${PN} = "1"
Brad Bishop93df99a2018-04-11 11:41:50 -040035PACKAGE_BEFORE_PN += "${FAN_PACKAGES}"
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053036PACKAGECONFIG ?= "presence control monitor sensor-monitor"
Brad Bishopbd9931f2017-04-22 16:26:22 -040037SYSTEMD_PACKAGES = "${FAN_PACKAGES}"
Matt Spinlercb262872022-08-12 21:44:17 +000038EXTRA_OEMESON:append = " -Dtests=disabled"
Matthew Barth2073f7d2021-08-19 10:12:05 -050039PKG_DEFAULT_MACHINE ??= "${MACHINE}"
40PACKAGE_ARCH = "${MACHINE_ARCH}"
Brad Bishopbd9931f2017-04-22 16:26:22 -040041
Matt Spinlerab79e2a2021-01-25 15:25:11 -060042# The control, monitor, and presence apps can either be JSON or YAML driven.
Matt Spinlercb262872022-08-12 21:44:17 +000043PACKAGECONFIG[json] = "-Djson-config=enabled, -Djson-config=disabled"
Matt Spinlerab79e2a2021-01-25 15:25:11 -060044
Brad Bishopbd9931f2017-04-22 16:26:22 -040045# --------------------------------------
46# ${PN}-presence-tach specific configuration
Matt Spinlercb262872022-08-12 21:44:17 +000047PACKAGECONFIG[presence] = "-Dpresence-service=enabled \
48 -Dmachine-name=${PKG_DEFAULT_MACHINE} \
49 -Dpresence-config=${STAGING_DIR_HOST}${presence_datadir}/config.yaml, \
50 -Dpresence-service=disabled, \
Matthew Barth2073f7d2021-08-19 10:12:05 -050051 virtual/phosphor-fan-presence-config \
52 , \
Brad Bishopbd9931f2017-04-22 16:26:22 -040053"
Brad Bishopbd9931f2017-04-22 16:26:22 -040054
Matt Spinlerab79e2a2021-01-25 15:25:11 -060055MULTI_USR_TGT = "multi-user.target"
Matt Spinlerc133ec12017-04-19 08:23:50 -050056TMPL_TACH = "phosphor-fan-presence-tach@.service"
57INSTFMT_TACH = "phosphor-fan-presence-tach@{0}.service"
Matt Spinlerbde651b2017-05-16 10:49:57 -050058POWERON_TGT = "obmc-chassis-poweron@{0}.target"
Matt Spinler043052e2022-08-01 19:37:43 +000059FMT_TACH = "../${TMPL_TACH}:${POWERON_TGT}.wants/${INSTFMT_TACH}"
Matt Spinlerab79e2a2021-01-25 15:25:11 -060060FMT_TACH_MUSR = "../${TMPL_TACH}:${MULTI_USR_TGT}.wants/${INSTFMT_TACH}"
Brad Bishopbd9931f2017-04-22 16:26:22 -040061
Patrick Williams12fc9392021-08-06 09:16:53 -050062FILES:${PN}-presence-tach = "${bindir}/phosphor-fan-presence-tach"
63SYSTEMD_SERVICE:${PN}-presence-tach += "${TMPL_TACH}"
Patrick Williamse83c2202021-09-01 16:17:33 -050064SYSTEMD_LINK:${PN}-presence-tach += "${@compose_list(d, 'FMT_TACH', 'OBMC_CHASSIS_INSTANCES')}"
Brad Bishopbd9931f2017-04-22 16:26:22 -040065
Matt Spinlerab79e2a2021-01-25 15:25:11 -060066# JSON mode also gets linked into multi-user
Patrick Williamse83c2202021-09-01 16:17:33 -050067SYSTEMD_LINK:${PN}-presence-tach += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matt Spinlerab79e2a2021-01-25 15:25:11 -060068 compose_list(d, 'FMT_TACH_MUSR', 'OBMC_CHASSIS_INSTANCES'), '', d)}"
69
Matthew Barth2073f7d2021-08-19 10:12:05 -050070# Package the JSON config files installed from the repo
71FILES:${PN}-presence-tach += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
72 '${datadir}/phosphor-fan-presence/presence/*', '', d)}"
73
Brad Bishopbd9931f2017-04-22 16:26:22 -040074# --------------------------------------
75# ${PN}-control specific configuration
Matt Spinlercb262872022-08-12 21:44:17 +000076PACKAGECONFIG[control] = "-Dcontrol-service=enabled \
77 -Dmachine-name=${PKG_DEFAULT_MACHINE} \
78 -Dfan-def-yaml-file=${STAGING_DIR_HOST}${control_datadir}/fans.yaml \
79 -Dfan-zone-yaml-file=${STAGING_DIR_HOST}${control_datadir}/zones.yaml \
80 -Dzone-events-yaml-file=${STAGING_DIR_HOST}${control_datadir}/events.yaml \
81 -Dzone-conditions-yaml-file=${STAGING_DIR_HOST}${control_datadir}/zone_conditions.yaml, \
82 -Dcontrol-service=disabled, \
Matt Spinlerc133ec12017-04-19 08:23:50 -050083 virtual/phosphor-fan-control-fan-config \
Brad Bishopc8b67b32019-05-13 23:12:55 -040084 phosphor-fan-control-zone-config \
85 phosphor-fan-control-events-config \
86 phosphor-fan-control-zone-conditions-config \
Matt Spinlerc133ec12017-04-19 08:23:50 -050087 , \
88"
89
Matt Spinlerbde651b2017-05-16 10:49:57 -050090FAN_CONTROL_TGT = "obmc-fan-control-ready@{0}.target"
91
Matt Spinlerc133ec12017-04-19 08:23:50 -050092TMPL_CONTROL = "phosphor-fan-control@.service"
93INSTFMT_CONTROL = "phosphor-fan-control@{0}.service"
Matt Spinlerbde651b2017-05-16 10:49:57 -050094FMT_CONTROL = "../${TMPL_CONTROL}:${FAN_CONTROL_TGT}.requires/${INSTFMT_CONTROL}"
Matthew Barthcd9db6b2021-06-17 16:04:30 -050095FMT_CONTROL_MUSR = "../${TMPL_CONTROL}:${MULTI_USR_TGT}.wants/${INSTFMT_CONTROL}"
Matt Spinlerbddf4632022-01-13 22:31:51 +000096FMT_CONTROL_PWRON = "../${TMPL_CONTROL}:${POWERON_TGT}.wants/${INSTFMT_CONTROL}"
Matt Spinlerbde651b2017-05-16 10:49:57 -050097
98TMPL_CONTROL_INIT = "phosphor-fan-control-init@.service"
99INSTFMT_CONTROL_INIT = "phosphor-fan-control-init@{0}.service"
Matthew Barthb5e69d62017-10-24 14:04:46 -0500100FMT_CONTROL_INIT = "../${TMPL_CONTROL_INIT}:${POWERON_TGT}.wants/${INSTFMT_CONTROL_INIT}"
Matt Spinlerc133ec12017-04-19 08:23:50 -0500101
Patrick Williams12fc9392021-08-06 09:16:53 -0500102FILES:${PN}-control = "${bindir}/phosphor-fan-control"
Mike Cappsad3ad6f2021-08-26 10:19:09 -0400103FILES:${PN}-control += "${bindir}/fanctl"
Patrick Williams12fc9392021-08-06 09:16:53 -0500104SYSTEMD_SERVICE:${PN}-control += "${TMPL_CONTROL}"
105SYSTEMD_SERVICE:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', '', '${TMPL_CONTROL_INIT}', d)}"
Matthew Barthcd9db6b2021-06-17 16:04:30 -0500106
107# JSON: Linked to multi-user and poweron
108# YAML: Linked to fans-ready and fan control-init poweron
Patrick Williamse83c2202021-09-01 16:17:33 -0500109SYSTEMD_LINK:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matthew Barthcd9db6b2021-06-17 16:04:30 -0500110 compose_list(d, 'FMT_CONTROL_MUSR', 'OBMC_CHASSIS_INSTANCES'), \
111 compose_list(d, 'FMT_CONTROL', 'OBMC_CHASSIS_INSTANCES'), d)}"
Patrick Williamse83c2202021-09-01 16:17:33 -0500112SYSTEMD_LINK:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matthew Barthcd9db6b2021-06-17 16:04:30 -0500113 compose_list(d, 'FMT_CONTROL_PWRON', 'OBMC_CHASSIS_INSTANCES'), \
114 compose_list(d, 'FMT_CONTROL_INIT', 'OBMC_CHASSIS_INSTANCES'), d)}"
Brad Bishopbd9931f2017-04-22 16:26:22 -0400115
Matthew Barthf3ee14a2021-08-19 10:48:58 -0500116# Package the JSON config files installed from the repo
117FILES:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
118 '${datadir}/phosphor-fan-presence/control/*', '', d)}"
119
Brad Bishopbd9931f2017-04-22 16:26:22 -0400120# --------------------------------------
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500121# ${PN}-monitor specific configuration
Matt Spinlercb262872022-08-12 21:44:17 +0000122PACKAGECONFIG[monitor] = "-Dmonitor-service=enabled \
123 -Dmachine-name=${PKG_DEFAULT_MACHINE} \
124 -Dfan-monitor-yaml-file=${STAGING_DIR_HOST}${monitor_datadir}/monitor.yaml, \
125 -Dmonitor-service=disabled, \
Brad Bishopc8b67b32019-05-13 23:12:55 -0400126 phosphor-fan-monitor-config \
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500127 , \
128"
129
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500130TMPL_MONITOR = "phosphor-fan-monitor@.service"
131INSTFMT_MONITOR = "phosphor-fan-monitor@{0}.service"
Matt Spinlerd793c992021-02-12 13:02:05 -0600132FMT_MONITOR_FANSREADY = "../${TMPL_MONITOR}:${FAN_CONTROL_TGT}.requires/${INSTFMT_MONITOR}"
Matt Spinlerbddf4632022-01-13 22:31:51 +0000133FMT_MONITOR_PWRON = "../${TMPL_MONITOR}:${POWERON_TGT}.wants/${INSTFMT_MONITOR}"
Matt Spinlerd793c992021-02-12 13:02:05 -0600134FMT_MONITOR_MUSR = "../${TMPL_MONITOR}:${MULTI_USR_TGT}.wants/${INSTFMT_MONITOR}"
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500135
Matthew Barthcac2ecf2017-08-23 13:18:01 -0500136TMPL_MONITOR_INIT = "phosphor-fan-monitor-init@.service"
137INSTFMT_MONITOR_INIT = "phosphor-fan-monitor-init@{0}.service"
Matthew Barthb5e69d62017-10-24 14:04:46 -0500138FMT_MONITOR_INIT = "../${TMPL_MONITOR_INIT}:${POWERON_TGT}.wants/${INSTFMT_MONITOR_INIT}"
Matthew Barthcac2ecf2017-08-23 13:18:01 -0500139
Patrick Williams12fc9392021-08-06 09:16:53 -0500140FILES:${PN}-monitor = "${bindir}/phosphor-fan-monitor"
141SYSTEMD_SERVICE:${PN}-monitor += "${TMPL_MONITOR}"
142SYSTEMD_SERVICE:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', '', '${TMPL_MONITOR_INIT}', d)}"
Matt Spinlerd793c992021-02-12 13:02:05 -0600143
144# JSON: power on and multi-user links. YAML: fans-ready and fan monitor init links
Patrick Williamse83c2202021-09-01 16:17:33 -0500145SYSTEMD_LINK:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matt Spinlerd793c992021-02-12 13:02:05 -0600146 compose_list(d, 'FMT_MONITOR_PWRON', 'OBMC_CHASSIS_INSTANCES'), \
147 compose_list(d, 'FMT_MONITOR_FANSREADY', 'OBMC_CHASSIS_INSTANCES'), d)}"
148
Patrick Williamse83c2202021-09-01 16:17:33 -0500149SYSTEMD_LINK:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matt Spinlerd793c992021-02-12 13:02:05 -0600150 compose_list(d, 'FMT_MONITOR_MUSR', 'OBMC_CHASSIS_INSTANCES'), \
151 compose_list(d, 'FMT_MONITOR_INIT', 'OBMC_CHASSIS_INSTANCES'), d)}"
Brandon Wymanc50a8c42017-04-28 18:26:45 -0500152
Matthew Barthbe61d222021-08-19 10:40:30 -0500153# Package the JSON config files installed from the repo
154FILES:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
155 '${datadir}/phosphor-fan-presence/monitor/*', '', d)}"
156
Brandon Wymanc50a8c42017-04-28 18:26:45 -0500157# --------------------------------------
158# phosphor-cooling-type specific configuration
Matt Spinlercb262872022-08-12 21:44:17 +0000159PACKAGECONFIG[cooling-type] = "-Dcooling-type-service=enabled,-Dcooling-type-service=disabled,,"
Matt Spinler7fc35dd2021-02-12 09:56:17 -0600160# --------------------------------------
161# ${PN}-sensor-monitor specific configuration
Matt Spinlercb262872022-08-12 21:44:17 +0000162PACKAGECONFIG[sensor-monitor] = "-Dsensor-monitor-service=enabled,-Dsensor-monitor-service=disabled"
Matt Spinler7fc35dd2021-02-12 09:56:17 -0600163
Kumar Thangavelbf2522d2021-11-26 12:03:10 +0530164FAN_PACKAGES:append = "${@bb.utils.contains('PACKAGECONFIG', 'sensor-monitor', ' sensor-monitor', '', d)}"
165
Patrick Williams12fc9392021-08-06 09:16:53 -0500166FILES:sensor-monitor += " ${bindir}/sensor-monitor"
167SYSTEMD_SERVICE:sensor-monitor += "sensor-monitor.service"
Patrick Williamse83c2202021-09-01 16:17:33 -0500168SYSTEMD_LINK:sensor-monitor += "../sensor-monitor.service:${MULTI_USR_TGT}.wants/sensor-monitor.service"