blob: 9540c8b43a570bfcf58e2b1a9a9ba40ddcf14e5c [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 \
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053033 ${PN}-sensor-monitor \
Brad Bishopbd9931f2017-04-22 16:26:22 -040034"
Brandon Wymanc50a8c42017-04-28 18:26:45 -050035
Patrick Williams12fc9392021-08-06 09:16:53 -050036ALLOW_EMPTY:${PN} = "1"
Brad Bishop93df99a2018-04-11 11:41:50 -040037PACKAGE_BEFORE_PN += "${FAN_PACKAGES}"
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053038PACKAGECONFIG ?= "presence control monitor sensor-monitor"
Brad Bishopbd9931f2017-04-22 16:26:22 -040039SYSTEMD_PACKAGES = "${FAN_PACKAGES}"
Matthew Barth2073f7d2021-08-19 10:12:05 -050040PKG_DEFAULT_MACHINE ??= "${MACHINE}"
41PACKAGE_ARCH = "${MACHINE_ARCH}"
Brad Bishopbd9931f2017-04-22 16:26:22 -040042
Matt Spinlerab79e2a2021-01-25 15:25:11 -060043# The control, monitor, and presence apps can either be JSON or YAML driven.
44PACKAGECONFIG[json] = "--enable-json, --disable-json"
45
Brad Bishopbd9931f2017-04-22 16:26:22 -040046# --------------------------------------
47# ${PN}-presence-tach specific configuration
Matthew Barth2073f7d2021-08-19 10:12:05 -050048PACKAGECONFIG[presence] = "--enable-presence \
49 MACHINE=${PKG_DEFAULT_MACHINE} \
50 PRESENCE_CONFIG=${STAGING_DIR_HOST}${presence_datadir}/config.yaml, \
51 --disable-presence, \
52 virtual/phosphor-fan-presence-config \
53 , \
Brad Bishopbd9931f2017-04-22 16:26:22 -040054"
Brad Bishopbd9931f2017-04-22 16:26:22 -040055
Matt Spinlerab79e2a2021-01-25 15:25:11 -060056MULTI_USR_TGT = "multi-user.target"
Matt Spinlerc133ec12017-04-19 08:23:50 -050057TMPL_TACH = "phosphor-fan-presence-tach@.service"
58INSTFMT_TACH = "phosphor-fan-presence-tach@{0}.service"
Matt Spinlerbde651b2017-05-16 10:49:57 -050059POWERON_TGT = "obmc-chassis-poweron@{0}.target"
60FMT_TACH = "../${TMPL_TACH}:${POWERON_TGT}.requires/${INSTFMT_TACH}"
Matt Spinlerab79e2a2021-01-25 15:25:11 -060061FMT_TACH_MUSR = "../${TMPL_TACH}:${MULTI_USR_TGT}.wants/${INSTFMT_TACH}"
Brad Bishopbd9931f2017-04-22 16:26:22 -040062
Patrick Williams12fc9392021-08-06 09:16:53 -050063FILES:${PN}-presence-tach = "${bindir}/phosphor-fan-presence-tach"
64SYSTEMD_SERVICE:${PN}-presence-tach += "${TMPL_TACH}"
Patrick Williamse83c2202021-09-01 16:17:33 -050065SYSTEMD_LINK:${PN}-presence-tach += "${@compose_list(d, 'FMT_TACH', 'OBMC_CHASSIS_INSTANCES')}"
Brad Bishopbd9931f2017-04-22 16:26:22 -040066
Matt Spinlerab79e2a2021-01-25 15:25:11 -060067# JSON mode also gets linked into multi-user
Patrick Williamse83c2202021-09-01 16:17:33 -050068SYSTEMD_LINK:${PN}-presence-tach += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matt Spinlerab79e2a2021-01-25 15:25:11 -060069 compose_list(d, 'FMT_TACH_MUSR', 'OBMC_CHASSIS_INSTANCES'), '', d)}"
70
Matthew Barth2073f7d2021-08-19 10:12:05 -050071# Package the JSON config files installed from the repo
72FILES:${PN}-presence-tach += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
73 '${datadir}/phosphor-fan-presence/presence/*', '', d)}"
74
Brad Bishopbd9931f2017-04-22 16:26:22 -040075# --------------------------------------
76# ${PN}-control specific configuration
Matt Spinlerc133ec12017-04-19 08:23:50 -050077PACKAGECONFIG[control] = "--enable-control \
Matthew Barthf3ee14a2021-08-19 10:48:58 -050078 MACHINE=${PKG_DEFAULT_MACHINE} \
79 FAN_DEF_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/fans.yaml \
80 FAN_ZONE_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/zones.yaml \
81 ZONE_EVENTS_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/events.yaml \
82 ZONE_CONDITIONS_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/zone_conditions.yaml, \
Matt Spinlerc133ec12017-04-19 08:23:50 -050083 --disable-control, \
84 virtual/phosphor-fan-control-fan-config \
Brad Bishopc8b67b32019-05-13 23:12:55 -040085 phosphor-fan-control-zone-config \
86 phosphor-fan-control-events-config \
87 phosphor-fan-control-zone-conditions-config \
Matt Spinlerc133ec12017-04-19 08:23:50 -050088 , \
89"
90
Matt Spinlerbde651b2017-05-16 10:49:57 -050091FAN_CONTROL_TGT = "obmc-fan-control-ready@{0}.target"
92
Matt Spinlerc133ec12017-04-19 08:23:50 -050093TMPL_CONTROL = "phosphor-fan-control@.service"
94INSTFMT_CONTROL = "phosphor-fan-control@{0}.service"
Matt Spinlerbde651b2017-05-16 10:49:57 -050095FMT_CONTROL = "../${TMPL_CONTROL}:${FAN_CONTROL_TGT}.requires/${INSTFMT_CONTROL}"
Matthew Barthcd9db6b2021-06-17 16:04:30 -050096FMT_CONTROL_MUSR = "../${TMPL_CONTROL}:${MULTI_USR_TGT}.wants/${INSTFMT_CONTROL}"
Matt Spinlerbddf4632022-01-13 22:31:51 +000097FMT_CONTROL_PWRON = "../${TMPL_CONTROL}:${POWERON_TGT}.wants/${INSTFMT_CONTROL}"
Matt Spinlerbde651b2017-05-16 10:49:57 -050098
99TMPL_CONTROL_INIT = "phosphor-fan-control-init@.service"
100INSTFMT_CONTROL_INIT = "phosphor-fan-control-init@{0}.service"
Matthew Barthb5e69d62017-10-24 14:04:46 -0500101FMT_CONTROL_INIT = "../${TMPL_CONTROL_INIT}:${POWERON_TGT}.wants/${INSTFMT_CONTROL_INIT}"
Matt Spinlerc133ec12017-04-19 08:23:50 -0500102
Patrick Williams12fc9392021-08-06 09:16:53 -0500103FILES:${PN}-control = "${bindir}/phosphor-fan-control"
Mike Cappsad3ad6f2021-08-26 10:19:09 -0400104FILES:${PN}-control += "${bindir}/fanctl"
Patrick Williams12fc9392021-08-06 09:16:53 -0500105SYSTEMD_SERVICE:${PN}-control += "${TMPL_CONTROL}"
106SYSTEMD_SERVICE:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', '', '${TMPL_CONTROL_INIT}', d)}"
Matthew Barthcd9db6b2021-06-17 16:04:30 -0500107
108# JSON: Linked to multi-user and poweron
109# YAML: Linked to fans-ready and fan control-init poweron
Patrick Williamse83c2202021-09-01 16:17:33 -0500110SYSTEMD_LINK:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matthew Barthcd9db6b2021-06-17 16:04:30 -0500111 compose_list(d, 'FMT_CONTROL_MUSR', 'OBMC_CHASSIS_INSTANCES'), \
112 compose_list(d, 'FMT_CONTROL', 'OBMC_CHASSIS_INSTANCES'), d)}"
Patrick Williamse83c2202021-09-01 16:17:33 -0500113SYSTEMD_LINK:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matthew Barthcd9db6b2021-06-17 16:04:30 -0500114 compose_list(d, 'FMT_CONTROL_PWRON', 'OBMC_CHASSIS_INSTANCES'), \
115 compose_list(d, 'FMT_CONTROL_INIT', 'OBMC_CHASSIS_INSTANCES'), d)}"
Brad Bishopbd9931f2017-04-22 16:26:22 -0400116
Matthew Barthf3ee14a2021-08-19 10:48:58 -0500117# Package the JSON config files installed from the repo
118FILES:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
119 '${datadir}/phosphor-fan-presence/control/*', '', d)}"
120
Brad Bishopbd9931f2017-04-22 16:26:22 -0400121# --------------------------------------
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500122# ${PN}-monitor specific configuration
123PACKAGECONFIG[monitor] = "--enable-monitor \
Matthew Barthbe61d222021-08-19 10:40:30 -0500124 MACHINE=${PKG_DEFAULT_MACHINE} \
125 FAN_MONITOR_YAML_FILE=${STAGING_DIR_HOST}${monitor_datadir}/monitor.yaml, \
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500126 --disable-monitor, \
Brad Bishopc8b67b32019-05-13 23:12:55 -0400127 phosphor-fan-monitor-config \
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500128 , \
129"
130
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500131TMPL_MONITOR = "phosphor-fan-monitor@.service"
132INSTFMT_MONITOR = "phosphor-fan-monitor@{0}.service"
Matt Spinlerd793c992021-02-12 13:02:05 -0600133FMT_MONITOR_FANSREADY = "../${TMPL_MONITOR}:${FAN_CONTROL_TGT}.requires/${INSTFMT_MONITOR}"
Matt Spinlerbddf4632022-01-13 22:31:51 +0000134FMT_MONITOR_PWRON = "../${TMPL_MONITOR}:${POWERON_TGT}.wants/${INSTFMT_MONITOR}"
Matt Spinlerd793c992021-02-12 13:02:05 -0600135FMT_MONITOR_MUSR = "../${TMPL_MONITOR}:${MULTI_USR_TGT}.wants/${INSTFMT_MONITOR}"
Matt Spinlerdd7a0802017-05-01 14:29:20 -0500136
Matthew Barthcac2ecf2017-08-23 13:18:01 -0500137TMPL_MONITOR_INIT = "phosphor-fan-monitor-init@.service"
138INSTFMT_MONITOR_INIT = "phosphor-fan-monitor-init@{0}.service"
Matthew Barthb5e69d62017-10-24 14:04:46 -0500139FMT_MONITOR_INIT = "../${TMPL_MONITOR_INIT}:${POWERON_TGT}.wants/${INSTFMT_MONITOR_INIT}"
Matthew Barthcac2ecf2017-08-23 13:18:01 -0500140
Patrick Williams12fc9392021-08-06 09:16:53 -0500141FILES:${PN}-monitor = "${bindir}/phosphor-fan-monitor"
142SYSTEMD_SERVICE:${PN}-monitor += "${TMPL_MONITOR}"
143SYSTEMD_SERVICE:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', '', '${TMPL_MONITOR_INIT}', d)}"
Matt Spinlerd793c992021-02-12 13:02:05 -0600144
145# JSON: power on and multi-user links. YAML: fans-ready and fan monitor init links
Patrick Williamse83c2202021-09-01 16:17:33 -0500146SYSTEMD_LINK:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matt Spinlerd793c992021-02-12 13:02:05 -0600147 compose_list(d, 'FMT_MONITOR_PWRON', 'OBMC_CHASSIS_INSTANCES'), \
148 compose_list(d, 'FMT_MONITOR_FANSREADY', 'OBMC_CHASSIS_INSTANCES'), d)}"
149
Patrick Williamse83c2202021-09-01 16:17:33 -0500150SYSTEMD_LINK:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
Matt Spinlerd793c992021-02-12 13:02:05 -0600151 compose_list(d, 'FMT_MONITOR_MUSR', 'OBMC_CHASSIS_INSTANCES'), \
152 compose_list(d, 'FMT_MONITOR_INIT', 'OBMC_CHASSIS_INSTANCES'), d)}"
Brandon Wymanc50a8c42017-04-28 18:26:45 -0500153
Matthew Barthbe61d222021-08-19 10:40:30 -0500154# Package the JSON config files installed from the repo
155FILES:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
156 '${datadir}/phosphor-fan-presence/monitor/*', '', d)}"
157
Brandon Wymanc50a8c42017-04-28 18:26:45 -0500158# --------------------------------------
159# phosphor-cooling-type specific configuration
Brad Bishop4785fdf2017-07-30 21:25:23 -0400160PACKAGECONFIG[cooling-type] = "--enable-cooling-type,--disable-cooling-type,,"
Matt Spinler7fc35dd2021-02-12 09:56:17 -0600161
162# --------------------------------------
163# ${PN}-sensor-monitor specific configuration
164PACKAGECONFIG[sensor-monitor] = "--enable-sensor-monitor, --disable-sensor-monitor"
165
Kumar Thangavelbf2522d2021-11-26 12:03:10 +0530166FAN_PACKAGES:append = "${@bb.utils.contains('PACKAGECONFIG', 'sensor-monitor', ' sensor-monitor', '', d)}"
167
Patrick Williams12fc9392021-08-06 09:16:53 -0500168FILES:sensor-monitor += " ${bindir}/sensor-monitor"
169SYSTEMD_SERVICE:sensor-monitor += "sensor-monitor.service"
Patrick Williamse83c2202021-09-01 16:17:33 -0500170SYSTEMD_LINK:sensor-monitor += "../sensor-monitor.service:${MULTI_USR_TGT}.wants/sensor-monitor.service"