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"
26
27# Package configuration
28FAN_PACKAGES = " \
29        ${PN}-presence-tach \
30        ${PN}-control \
31        ${PN}-monitor \
32"
33
34ALLOW_EMPTY_${PN} = "1"
35PACKAGE_BEFORE_PN += "${FAN_PACKAGES}"
36PACKAGECONFIG ?= "presence control monitor"
37SYSTEMD_PACKAGES = "${FAN_PACKAGES}"
38
39# --------------------------------------
40# ${PN}-presence-tach specific configuration
41PACKAGECONFIG[presence] = " \
42        --enable-presence \
43        PRESENCE_CONFIG=${STAGING_DIR_HOST}${presence_datadir}/config.yaml, \
44        --disable-presence, \
45        virtual/phosphor-fan-presence-config \
46        , \
47"
48
49# Needed to install into the obmc-chassis-poweron target
50TMPL_TACH = "phosphor-fan-presence-tach@.service"
51INSTFMT_TACH = "phosphor-fan-presence-tach@{0}.service"
52POWERON_TGT = "obmc-chassis-poweron@{0}.target"
53FMT_TACH = "../${TMPL_TACH}:${POWERON_TGT}.requires/${INSTFMT_TACH}"
54
55FILES_${PN}-presence-tach = "${bindir}/phosphor-fan-presence-tach"
56SYSTEMD_SERVICE_${PN}-presence-tach += "${TMPL_TACH}"
57SYSTEMD_LINK_${PN}-presence-tach += "${@compose_list(d, 'FMT_TACH', 'OBMC_CHASSIS_INSTANCES')}"
58
59# --------------------------------------
60# ${PN}-control specific configuration
61PACKAGECONFIG[control] = "--enable-control \
62     FAN_DEF_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/fans.yaml \
63     FAN_ZONE_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/zones.yaml \
64     ZONE_EVENTS_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/events.yaml \
65     ZONE_CONDITIONS_YAML_FILE=${STAGING_DIR_HOST}${control_datadir}/zone_conditions.yaml, \
66    --disable-control, \
67    virtual/phosphor-fan-control-fan-config \
68    phosphor-fan-control-zone-config \
69    phosphor-fan-control-events-config \
70    phosphor-fan-control-zone-conditions-config \
71    , \
72"
73
74FAN_CONTROL_TGT = "obmc-fan-control-ready@{0}.target"
75
76TMPL_CONTROL = "phosphor-fan-control@.service"
77INSTFMT_CONTROL = "phosphor-fan-control@{0}.service"
78FMT_CONTROL = "../${TMPL_CONTROL}:${FAN_CONTROL_TGT}.requires/${INSTFMT_CONTROL}"
79
80TMPL_CONTROL_INIT = "phosphor-fan-control-init@.service"
81INSTFMT_CONTROL_INIT = "phosphor-fan-control-init@{0}.service"
82FMT_CONTROL_INIT = "../${TMPL_CONTROL_INIT}:${POWERON_TGT}.wants/${INSTFMT_CONTROL_INIT}"
83
84FILES_${PN}-control = "${bindir}/phosphor-fan-control"
85SYSTEMD_SERVICE_${PN}-control += "${TMPL_CONTROL} ${TMPL_CONTROL_INIT}"
86SYSTEMD_LINK_${PN}-control += "${@compose_list(d, 'FMT_CONTROL', 'OBMC_CHASSIS_INSTANCES')}"
87SYSTEMD_LINK_${PN}-control += "${@compose_list(d, 'FMT_CONTROL_INIT', 'OBMC_CHASSIS_INSTANCES')}"
88
89# --------------------------------------
90# ${PN}-monitor specific configuration
91PACKAGECONFIG[monitor] = "--enable-monitor \
92     FAN_MONITOR_YAML_FILE=${STAGING_DIR_HOST}${monitor_datadir}/monitor.yaml, \
93    --disable-monitor, \
94    phosphor-fan-monitor-config \
95    , \
96"
97
98TMPL_MONITOR = "phosphor-fan-monitor@.service"
99INSTFMT_MONITOR = "phosphor-fan-monitor@{0}.service"
100FMT_MONITOR = "../${TMPL_MONITOR}:${FAN_CONTROL_TGT}.requires/${INSTFMT_MONITOR}"
101
102TMPL_MONITOR_INIT = "phosphor-fan-monitor-init@.service"
103INSTFMT_MONITOR_INIT = "phosphor-fan-monitor-init@{0}.service"
104FMT_MONITOR_INIT = "../${TMPL_MONITOR_INIT}:${POWERON_TGT}.wants/${INSTFMT_MONITOR_INIT}"
105
106FILES_${PN}-monitor = "${bindir}/phosphor-fan-monitor"
107SYSTEMD_SERVICE_${PN}-monitor += "${TMPL_MONITOR} ${TMPL_MONITOR_INIT}"
108SYSTEMD_LINK_${PN}-monitor += "${@compose_list(d, 'FMT_MONITOR', 'OBMC_CHASSIS_INSTANCES')}"
109SYSTEMD_LINK_${PN}-monitor += "${@compose_list(d, 'FMT_MONITOR_INIT', 'OBMC_CHASSIS_INSTANCES')}"
110
111# --------------------------------------
112# phosphor-cooling-type specific configuration
113PACKAGECONFIG[cooling-type] = "--enable-cooling-type,--disable-cooling-type,,"
114