blob: 28da7fe2d9dd49e81d9eabb778e7acee704ae7d9 [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
Brad Bishopbd9931f2017-04-22 16:26:22 -04008
Andrew Geisslerae60c9c2020-04-02 21:31:02 +00009inherit autotools pkgconfig python3native
Brad Bishopbd9931f2017-04-22 16:26:22 -040010inherit obmc-phosphor-systemd
11inherit phosphor-fan
12
13S = "${WORKDIR}/git"
14
15# Common build dependencies
16DEPENDS += "autoconf-archive-native"
Matthew Barth700bba02020-02-20 14:48:19 -060017DEPENDS += "${PYTHON_PN}-pyyaml-native"
18DEPENDS += "${PYTHON_PN}-mako-native"
Brad Bishopbd9931f2017-04-22 16:26:22 -040019DEPENDS += "sdbusplus"
Patrick Williams4b32c9a2020-03-31 16:43:15 -050020DEPENDS += "${PYTHON_PN}-sdbus++-native"
William A. Kennington IIIaa5d9452018-10-19 18:24:31 -070021DEPENDS += "sdeventplus"
William A. Kennington III3bb26b92018-10-29 16:32:26 -070022DEPENDS += "gpioplus"
Brad Bishopbd9931f2017-04-22 16:26:22 -040023DEPENDS += "phosphor-logging"
Brad Bishop4785fdf2017-07-30 21:25:23 -040024DEPENDS += "libevdev"
Matthew Barth61a59ad2020-01-14 15:38:05 -060025DEPENDS += "nlohmann-json"
Mike Capps459d47e2021-09-23 14:05:04 -040026DEPENDS += "cli11"
Brad Bishopbd9931f2017-04-22 16:26:22 -040027
28# Package configuration
29FAN_PACKAGES = " \
30 ${PN}-presence-tach \
31 ${PN}-control \
Matt Spinlerdd7a0802017-05-01 14:29:20 -050032 ${PN}-monitor \
Brad Bishopbd9931f2017-04-22 16:26:22 -040033"
Brandon Wymanc50a8c42017-04-28 18:26:45 -050034
Patrick Williams12fc9392021-08-06 09:16:53 -050035ALLOW_EMPTY:${PN} = "1"
Brad Bishop93df99a2018-04-11 11:41:50 -040036PACKAGE_BEFORE_PN += "${FAN_PACKAGES}"
Brandon Wyman5b42b742017-06-09 17:50:42 -050037PACKAGECONFIG ?= "presence control monitor"
Brad Bishopbd9931f2017-04-22 16:26:22 -040038SYSTEMD_PACKAGES = "${FAN_PACKAGES}"
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.
43PACKAGECONFIG[json] = "--enable-json, --disable-json"
44
Brad Bishopbd9931f2017-04-22 16:26:22 -040045# --------------------------------------
46# ${PN}-presence-tach specific configuration
Matthew Barth2073f7d2021-08-19 10:12:05 -050047PACKAGECONFIG[presence] = "--enable-presence \
48 MACHINE=${PKG_DEFAULT_MACHINE} \
49 PRESENCE_CONFIG=${STAGING_DIR_HOST}${presence_datadir}/config.yaml, \
50 --disable-presence, \
51 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"
59FMT_TACH = "../${TMPL_TACH}:${POWERON_TGT}.requires/${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 Spinlerc133ec12017-04-19 08:23:50 -050076PACKAGECONFIG[control] = "--enable-control \
Matthew Barthf3ee14a2021-08-19 10:48:58 -050077 MACHINE=${PKG_DEFAULT_MACHINE} \
78 FAN_DEF_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/fans.yaml \
79 FAN_ZONE_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/zones.yaml \
80 ZONE_EVENTS_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/events.yaml \
81 ZONE_CONDITIONS_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/zone_conditions.yaml, \
Matt Spinlerc133ec12017-04-19 08:23:50 -050082 --disable-control, \
83 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
122PACKAGECONFIG[monitor] = "--enable-monitor \
Matthew Barthbe61d222021-08-19 10:40:30 -0500123 MACHINE=${PKG_DEFAULT_MACHINE} \
124 FAN_MONITOR_YAML_FILE=${STAGING_DIR_HOST}${monitor_datadir}/monitor.yaml, \
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500125 --disable-monitor, \
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
Brad Bishop4785fdf2017-07-30 21:25:23 -0400159PACKAGECONFIG[cooling-type] = "--enable-cooling-type,--disable-cooling-type,,"
Matt Spinler7fc35dd2021-02-12 09:56:17 -0600160
161# --------------------------------------
162# ${PN}-sensor-monitor specific configuration
163PACKAGECONFIG[sensor-monitor] = "--enable-sensor-monitor, --disable-sensor-monitor"
164
Patrick Williams12fc9392021-08-06 09:16:53 -0500165FILES:sensor-monitor += " ${bindir}/sensor-monitor"
166SYSTEMD_SERVICE:sensor-monitor += "sensor-monitor.service"
Patrick Williamse83c2202021-09-01 16:17:33 -0500167SYSTEMD_LINK:sensor-monitor += "../sensor-monitor.service:${MULTI_USR_TGT}.wants/sensor-monitor.service"