blob: 4f5d560a5a214e54231b41683a4610b3218c9fe9 [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"
Brad Bishopbd9931f2017-04-22 16:26:22 -040026
27# Package configuration
28FAN_PACKAGES = " \
29 ${PN}-presence-tach \
30 ${PN}-control \
Matt Spinlerdd7a0802017-05-01 14:29:20 -050031 ${PN}-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}"
Brandon Wyman5b42b742017-06-09 17:50:42 -050036PACKAGECONFIG ?= "presence control monitor"
Brad Bishopbd9931f2017-04-22 16:26:22 -040037SYSTEMD_PACKAGES = "${FAN_PACKAGES}"
Matthew Barth2073f7d2021-08-19 10:12:05 -050038PKG_DEFAULT_MACHINE ??= "${MACHINE}"
39PACKAGE_ARCH = "${MACHINE_ARCH}"
Brad Bishopbd9931f2017-04-22 16:26:22 -040040
Matt Spinlerab79e2a2021-01-25 15:25:11 -060041# The control, monitor, and presence apps can either be JSON or YAML driven.
42PACKAGECONFIG[json] = "--enable-json, --disable-json"
43
Brad Bishopbd9931f2017-04-22 16:26:22 -040044# --------------------------------------
45# ${PN}-presence-tach specific configuration
Matthew Barth2073f7d2021-08-19 10:12:05 -050046PACKAGECONFIG[presence] = "--enable-presence \
47 MACHINE=${PKG_DEFAULT_MACHINE} \
48 PRESENCE_CONFIG=${STAGING_DIR_HOST}${presence_datadir}/config.yaml, \
49 --disable-presence, \
50 virtual/phosphor-fan-presence-config \
51 , \
Brad Bishopbd9931f2017-04-22 16:26:22 -040052"
Brad Bishopbd9931f2017-04-22 16:26:22 -040053
Matt Spinlerab79e2a2021-01-25 15:25:11 -060054MULTI_USR_TGT = "multi-user.target"
Matt Spinlerc133ec12017-04-19 08:23:50 -050055TMPL_TACH = "phosphor-fan-presence-tach@.service"
56INSTFMT_TACH = "phosphor-fan-presence-tach@{0}.service"
Matt Spinlerbde651b2017-05-16 10:49:57 -050057POWERON_TGT = "obmc-chassis-poweron@{0}.target"
58FMT_TACH = "../${TMPL_TACH}:${POWERON_TGT}.requires/${INSTFMT_TACH}"
Matt Spinlerab79e2a2021-01-25 15:25:11 -060059FMT_TACH_MUSR = "../${TMPL_TACH}:${MULTI_USR_TGT}.wants/${INSTFMT_TACH}"
Brad Bishopbd9931f2017-04-22 16:26:22 -040060
Patrick Williams12fc9392021-08-06 09:16:53 -050061FILES:${PN}-presence-tach = "${bindir}/phosphor-fan-presence-tach"
62SYSTEMD_SERVICE:${PN}-presence-tach += "${TMPL_TACH}"
Matt Spinlerc133ec12017-04-19 08:23:50 -050063SYSTEMD_LINK_${PN}-presence-tach += "${@compose_list(d, 'FMT_TACH', 'OBMC_CHASSIS_INSTANCES')}"
Brad Bishopbd9931f2017-04-22 16:26:22 -040064
Matt Spinlerab79e2a2021-01-25 15:25:11 -060065# JSON mode also gets linked into multi-user
66SYSTEMD_LINK_${PN}-presence-tach += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
67 compose_list(d, 'FMT_TACH_MUSR', 'OBMC_CHASSIS_INSTANCES'), '', d)}"
68
Matthew Barth2073f7d2021-08-19 10:12:05 -050069# Package the JSON config files installed from the repo
70FILES:${PN}-presence-tach += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
71 '${datadir}/phosphor-fan-presence/presence/*', '', d)}"
72
Brad Bishopbd9931f2017-04-22 16:26:22 -040073# --------------------------------------
74# ${PN}-control specific configuration
Matt Spinlerc133ec12017-04-19 08:23:50 -050075PACKAGECONFIG[control] = "--enable-control \
Brad Bishopc8b67b32019-05-13 23:12:55 -040076 FAN_DEF_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/fans.yaml \
77 FAN_ZONE_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/zones.yaml \
78 ZONE_EVENTS_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/events.yaml \
Matthew Barth02027942020-02-19 10:38:34 -060079 ZONE_CONDITIONS_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/zone_conditions.yaml, \
Matt Spinlerc133ec12017-04-19 08:23:50 -050080 --disable-control, \
81 virtual/phosphor-fan-control-fan-config \
Brad Bishopc8b67b32019-05-13 23:12:55 -040082 phosphor-fan-control-zone-config \
83 phosphor-fan-control-events-config \
84 phosphor-fan-control-zone-conditions-config \
Matt Spinlerc133ec12017-04-19 08:23:50 -050085 , \
86"
87
Matt Spinlerbde651b2017-05-16 10:49:57 -050088FAN_CONTROL_TGT = "obmc-fan-control-ready@{0}.target"
89
Matt Spinlerc133ec12017-04-19 08:23:50 -050090TMPL_CONTROL = "phosphor-fan-control@.service"
91INSTFMT_CONTROL = "phosphor-fan-control@{0}.service"
Matt Spinlerbde651b2017-05-16 10:49:57 -050092FMT_CONTROL = "../${TMPL_CONTROL}:${FAN_CONTROL_TGT}.requires/${INSTFMT_CONTROL}"
Matthew Barthcd9db6b2021-06-17 16:04:30 -050093FMT_CONTROL_MUSR = "../${TMPL_CONTROL}:${MULTI_USR_TGT}.wants/${INSTFMT_CONTROL}"
94FMT_CONTROL_PWRON = "../${TMPL_CONTROL}:${POWERON_TGT}.requires/${INSTFMT_CONTROL}"
Matt Spinlerbde651b2017-05-16 10:49:57 -050095
96TMPL_CONTROL_INIT = "phosphor-fan-control-init@.service"
97INSTFMT_CONTROL_INIT = "phosphor-fan-control-init@{0}.service"
Matthew Barthb5e69d62017-10-24 14:04:46 -050098FMT_CONTROL_INIT = "../${TMPL_CONTROL_INIT}:${POWERON_TGT}.wants/${INSTFMT_CONTROL_INIT}"
Matt Spinlerc133ec12017-04-19 08:23:50 -050099
Patrick Williams12fc9392021-08-06 09:16:53 -0500100FILES:${PN}-control = "${bindir}/phosphor-fan-control"
101SYSTEMD_SERVICE:${PN}-control += "${TMPL_CONTROL}"
102SYSTEMD_SERVICE:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', '', '${TMPL_CONTROL_INIT}', d)}"
Matthew Barthcd9db6b2021-06-17 16:04:30 -0500103
104# JSON: Linked to multi-user and poweron
105# YAML: Linked to fans-ready and fan control-init poweron
106SYSTEMD_LINK_${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
107 compose_list(d, 'FMT_CONTROL_MUSR', 'OBMC_CHASSIS_INSTANCES'), \
108 compose_list(d, 'FMT_CONTROL', 'OBMC_CHASSIS_INSTANCES'), d)}"
109SYSTEMD_LINK_${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
110 compose_list(d, 'FMT_CONTROL_PWRON', 'OBMC_CHASSIS_INSTANCES'), \
111 compose_list(d, 'FMT_CONTROL_INIT', 'OBMC_CHASSIS_INSTANCES'), d)}"
Brad Bishopbd9931f2017-04-22 16:26:22 -0400112
113# --------------------------------------
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500114# ${PN}-monitor specific configuration
115PACKAGECONFIG[monitor] = "--enable-monitor \
Matthew Barth02027942020-02-19 10:38:34 -0600116 FAN_MONITOR_YAML_FILE=${STAGING_DIR_HOST}${monitor_datadir}/monitor.yaml, \
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500117 --disable-monitor, \
Brad Bishopc8b67b32019-05-13 23:12:55 -0400118 phosphor-fan-monitor-config \
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500119 , \
120"
121
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500122TMPL_MONITOR = "phosphor-fan-monitor@.service"
123INSTFMT_MONITOR = "phosphor-fan-monitor@{0}.service"
Matt Spinlerd793c992021-02-12 13:02:05 -0600124FMT_MONITOR_FANSREADY = "../${TMPL_MONITOR}:${FAN_CONTROL_TGT}.requires/${INSTFMT_MONITOR}"
125FMT_MONITOR_PWRON = "../${TMPL_MONITOR}:${POWERON_TGT}.requires/${INSTFMT_MONITOR}"
126FMT_MONITOR_MUSR = "../${TMPL_MONITOR}:${MULTI_USR_TGT}.wants/${INSTFMT_MONITOR}"
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500127
Matthew Barthcac2ecf2017-08-23 13:18:01 -0500128TMPL_MONITOR_INIT = "phosphor-fan-monitor-init@.service"
129INSTFMT_MONITOR_INIT = "phosphor-fan-monitor-init@{0}.service"
Matthew Barthb5e69d62017-10-24 14:04:46 -0500130FMT_MONITOR_INIT = "../${TMPL_MONITOR_INIT}:${POWERON_TGT}.wants/${INSTFMT_MONITOR_INIT}"
Matthew Barthcac2ecf2017-08-23 13:18:01 -0500131
Patrick Williams12fc9392021-08-06 09:16:53 -0500132FILES:${PN}-monitor = "${bindir}/phosphor-fan-monitor"
133SYSTEMD_SERVICE:${PN}-monitor += "${TMPL_MONITOR}"
134SYSTEMD_SERVICE:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', '', '${TMPL_MONITOR_INIT}', d)}"
Matt Spinlerd793c992021-02-12 13:02:05 -0600135
136# JSON: power on and multi-user links. YAML: fans-ready and fan monitor init links
137SYSTEMD_LINK_${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
138 compose_list(d, 'FMT_MONITOR_PWRON', 'OBMC_CHASSIS_INSTANCES'), \
139 compose_list(d, 'FMT_MONITOR_FANSREADY', 'OBMC_CHASSIS_INSTANCES'), d)}"
140
141SYSTEMD_LINK_${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
142 compose_list(d, 'FMT_MONITOR_MUSR', 'OBMC_CHASSIS_INSTANCES'), \
143 compose_list(d, 'FMT_MONITOR_INIT', 'OBMC_CHASSIS_INSTANCES'), d)}"
Brandon Wymanc50a8c42017-04-28 18:26:45 -0500144
145# --------------------------------------
146# phosphor-cooling-type specific configuration
Brad Bishop4785fdf2017-07-30 21:25:23 -0400147PACKAGECONFIG[cooling-type] = "--enable-cooling-type,--disable-cooling-type,,"
Matt Spinler7fc35dd2021-02-12 09:56:17 -0600148
149# --------------------------------------
150# ${PN}-sensor-monitor specific configuration
151PACKAGECONFIG[sensor-monitor] = "--enable-sensor-monitor, --disable-sensor-monitor"
152
Patrick Williams12fc9392021-08-06 09:16:53 -0500153FILES:sensor-monitor += " ${bindir}/sensor-monitor"
154SYSTEMD_SERVICE:sensor-monitor += "sensor-monitor.service"
Matt Spinler7fc35dd2021-02-12 09:56:17 -0600155SYSTEMD_LINK_sensor-monitor += "../sensor-monitor.service:${MULTI_USR_TGT}.wants/sensor-monitor.service"