1SUMMARY = "Phosphor Fan" 2DESCRIPTION = "Phosphor fan provides a set of fan monitoring and \ 3control applications." 4PR = "r1" 5PV = "1.0+git${SRCPV}" 6 7require ${BPN}.inc 8 9inherit autotools pkgconfig python3native 10inherit obmc-phosphor-systemd 11inherit phosphor-fan 12 13S = "${WORKDIR}/git" 14 15# Common build dependencies 16DEPENDS += "autoconf-archive-native" 17DEPENDS += "${PYTHON_PN}-pyyaml-native" 18DEPENDS += "${PYTHON_PN}-mako-native" 19DEPENDS += "sdbusplus" 20DEPENDS += "${PYTHON_PN}-sdbus++-native" 21DEPENDS += "sdeventplus" 22DEPENDS += "gpioplus" 23DEPENDS += "phosphor-logging" 24DEPENDS += "libevdev" 25DEPENDS += "nlohmann-json" 26DEPENDS += "cli11" 27 28# Package configuration 29FAN_PACKAGES = " \ 30 ${PN}-presence-tach \ 31 ${PN}-control \ 32 ${PN}-monitor \ 33 ${PN}-sensor-monitor \ 34" 35 36ALLOW_EMPTY:${PN} = "1" 37PACKAGE_BEFORE_PN += "${FAN_PACKAGES}" 38PACKAGECONFIG ?= "presence control monitor sensor-monitor" 39SYSTEMD_PACKAGES = "${FAN_PACKAGES}" 40PKG_DEFAULT_MACHINE ??= "${MACHINE}" 41PACKAGE_ARCH = "${MACHINE_ARCH}" 42 43# The control, monitor, and presence apps can either be JSON or YAML driven. 44PACKAGECONFIG[json] = "--enable-json, --disable-json" 45 46# -------------------------------------- 47# ${PN}-presence-tach specific configuration 48PACKAGECONFIG[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 , \ 54" 55 56MULTI_USR_TGT = "multi-user.target" 57TMPL_TACH = "phosphor-fan-presence-tach@.service" 58INSTFMT_TACH = "phosphor-fan-presence-tach@{0}.service" 59POWERON_TGT = "obmc-chassis-poweron@{0}.target" 60FMT_TACH = "../${TMPL_TACH}:${POWERON_TGT}.requires/${INSTFMT_TACH}" 61FMT_TACH_MUSR = "../${TMPL_TACH}:${MULTI_USR_TGT}.wants/${INSTFMT_TACH}" 62 63FILES:${PN}-presence-tach = "${bindir}/phosphor-fan-presence-tach" 64SYSTEMD_SERVICE:${PN}-presence-tach += "${TMPL_TACH}" 65SYSTEMD_LINK:${PN}-presence-tach += "${@compose_list(d, 'FMT_TACH', 'OBMC_CHASSIS_INSTANCES')}" 66 67# JSON mode also gets linked into multi-user 68SYSTEMD_LINK:${PN}-presence-tach += "${@bb.utils.contains('PACKAGECONFIG', 'json', \ 69 compose_list(d, 'FMT_TACH_MUSR', 'OBMC_CHASSIS_INSTANCES'), '', d)}" 70 71# 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 75# -------------------------------------- 76# ${PN}-control specific configuration 77PACKAGECONFIG[control] = "--enable-control \ 78 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, \ 83 --disable-control, \ 84 virtual/phosphor-fan-control-fan-config \ 85 phosphor-fan-control-zone-config \ 86 phosphor-fan-control-events-config \ 87 phosphor-fan-control-zone-conditions-config \ 88 , \ 89" 90 91FAN_CONTROL_TGT = "obmc-fan-control-ready@{0}.target" 92 93TMPL_CONTROL = "phosphor-fan-control@.service" 94INSTFMT_CONTROL = "phosphor-fan-control@{0}.service" 95FMT_CONTROL = "../${TMPL_CONTROL}:${FAN_CONTROL_TGT}.requires/${INSTFMT_CONTROL}" 96FMT_CONTROL_MUSR = "../${TMPL_CONTROL}:${MULTI_USR_TGT}.wants/${INSTFMT_CONTROL}" 97FMT_CONTROL_PWRON = "../${TMPL_CONTROL}:${POWERON_TGT}.wants/${INSTFMT_CONTROL}" 98 99TMPL_CONTROL_INIT = "phosphor-fan-control-init@.service" 100INSTFMT_CONTROL_INIT = "phosphor-fan-control-init@{0}.service" 101FMT_CONTROL_INIT = "../${TMPL_CONTROL_INIT}:${POWERON_TGT}.wants/${INSTFMT_CONTROL_INIT}" 102 103FILES:${PN}-control = "${bindir}/phosphor-fan-control" 104FILES:${PN}-control += "${bindir}/fanctl" 105SYSTEMD_SERVICE:${PN}-control += "${TMPL_CONTROL}" 106SYSTEMD_SERVICE:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', '', '${TMPL_CONTROL_INIT}', d)}" 107 108# JSON: Linked to multi-user and poweron 109# YAML: Linked to fans-ready and fan control-init poweron 110SYSTEMD_LINK:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \ 111 compose_list(d, 'FMT_CONTROL_MUSR', 'OBMC_CHASSIS_INSTANCES'), \ 112 compose_list(d, 'FMT_CONTROL', 'OBMC_CHASSIS_INSTANCES'), d)}" 113SYSTEMD_LINK:${PN}-control += "${@bb.utils.contains('PACKAGECONFIG', 'json', \ 114 compose_list(d, 'FMT_CONTROL_PWRON', 'OBMC_CHASSIS_INSTANCES'), \ 115 compose_list(d, 'FMT_CONTROL_INIT', 'OBMC_CHASSIS_INSTANCES'), d)}" 116 117# 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 121# -------------------------------------- 122# ${PN}-monitor specific configuration 123PACKAGECONFIG[monitor] = "--enable-monitor \ 124 MACHINE=${PKG_DEFAULT_MACHINE} \ 125 FAN_MONITOR_YAML_FILE=${STAGING_DIR_HOST}${monitor_datadir}/monitor.yaml, \ 126 --disable-monitor, \ 127 phosphor-fan-monitor-config \ 128 , \ 129" 130 131TMPL_MONITOR = "phosphor-fan-monitor@.service" 132INSTFMT_MONITOR = "phosphor-fan-monitor@{0}.service" 133FMT_MONITOR_FANSREADY = "../${TMPL_MONITOR}:${FAN_CONTROL_TGT}.requires/${INSTFMT_MONITOR}" 134FMT_MONITOR_PWRON = "../${TMPL_MONITOR}:${POWERON_TGT}.wants/${INSTFMT_MONITOR}" 135FMT_MONITOR_MUSR = "../${TMPL_MONITOR}:${MULTI_USR_TGT}.wants/${INSTFMT_MONITOR}" 136 137TMPL_MONITOR_INIT = "phosphor-fan-monitor-init@.service" 138INSTFMT_MONITOR_INIT = "phosphor-fan-monitor-init@{0}.service" 139FMT_MONITOR_INIT = "../${TMPL_MONITOR_INIT}:${POWERON_TGT}.wants/${INSTFMT_MONITOR_INIT}" 140 141FILES:${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)}" 144 145# JSON: power on and multi-user links. YAML: fans-ready and fan monitor init links 146SYSTEMD_LINK:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \ 147 compose_list(d, 'FMT_MONITOR_PWRON', 'OBMC_CHASSIS_INSTANCES'), \ 148 compose_list(d, 'FMT_MONITOR_FANSREADY', 'OBMC_CHASSIS_INSTANCES'), d)}" 149 150SYSTEMD_LINK:${PN}-monitor += "${@bb.utils.contains('PACKAGECONFIG', 'json', \ 151 compose_list(d, 'FMT_MONITOR_MUSR', 'OBMC_CHASSIS_INSTANCES'), \ 152 compose_list(d, 'FMT_MONITOR_INIT', 'OBMC_CHASSIS_INSTANCES'), d)}" 153 154# 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 158# -------------------------------------- 159# phosphor-cooling-type specific configuration 160PACKAGECONFIG[cooling-type] = "--enable-cooling-type,--disable-cooling-type,," 161 162# -------------------------------------- 163# ${PN}-sensor-monitor specific configuration 164PACKAGECONFIG[sensor-monitor] = "--enable-sensor-monitor, --disable-sensor-monitor" 165 166FAN_PACKAGES:append = "${@bb.utils.contains('PACKAGECONFIG', 'sensor-monitor', ' sensor-monitor', '', d)}" 167 168FILES:sensor-monitor += " ${bindir}/sensor-monitor" 169SYSTEMD_SERVICE:sensor-monitor += "sensor-monitor.service" 170SYSTEMD_LINK:sensor-monitor += "../sensor-monitor.service:${MULTI_USR_TGT}.wants/sensor-monitor.service" 171