Install phosphor-fan-control app and service
Also move the fan presence and fan control services
into obmc-power-chassis-on.target so they start as
soon as power comes on so it covers cases when the
boot stops at obmc-chassis-poweron.target.
Resolves openbmc/openbmc#1445
Change-Id: Idc271a2d770d85bc1a4d51d8d1473ca8d0c73889
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan.bb b/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan.bb
index 406dc6d..736149c 100644
--- a/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan.bb
+++ b/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan.bb
@@ -42,20 +42,37 @@
"
RDEPENDS_${PN}-presence-tach += "sdbusplus"
-# Needed to install into the obmc-host-start target
-TMPL = "phosphor-fan-presence-tach@.service"
-INSTFMT = "phosphor-fan-presence-tach@{0}.service"
-TGTFMT = "obmc-host-start@{0}.target"
-FMT = "../${TMPL}:${TGTFMT}.requires/${INSTFMT}"
+# Needed to install into the obmc-chassis-poweron target
+TMPL_TACH = "phosphor-fan-presence-tach@.service"
+INSTFMT_TACH = "phosphor-fan-presence-tach@{0}.service"
+TGTFMT = "obmc-chassis-poweron@{0}.target"
+FMT_TACH = "../${TMPL_TACH}:${TGTFMT}.requires/${INSTFMT_TACH}"
FILES_${PN}-presence-tach = "${sbindir}/phosphor-fan-presence-tach"
-SYSTEMD_SERVICE_${PN}-presence-tach += "${TMPL}"
-SYSTEMD_LINK_${PN}-presence-tach += "${@compose_list(d, 'FMT', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_SERVICE_${PN}-presence-tach += "${TMPL_TACH}"
+SYSTEMD_LINK_${PN}-presence-tach += "${@compose_list(d, 'FMT_TACH', 'OBMC_CHASSIS_INSTANCES')}"
# --------------------------------------
# ${PN}-control specific configuration
-PACKAGECONFIG[control] = "--enable-control,--disable-control,,"
+PACKAGECONFIG[control] = "--enable-control \
+ FAN_DEF_YAML_FILE=${STAGING_DIR_NATIVE}${control_datadir}/fans.yaml \
+ FAN_ZONE_YAML_FILE=${STAGING_DIR_NATIVE}${control_datadir}/zones.yaml \
+ FAN_ZONE_OUTPUT_DIR=${S}/control, \
+ --disable-control, \
+ virtual/phosphor-fan-control-fan-config \
+ phosphor-fan-control-zone-config-native \
+ , \
+"
+
+RDEPENDS_${PN}-control += "sdbusplus"
+
+TMPL_CONTROL = "phosphor-fan-control@.service"
+INSTFMT_CONTROL = "phosphor-fan-control@{0}.service"
+FMT_CONTROL = "../${TMPL_CONTROL}:${TGTFMT}.requires/${INSTFMT_CONTROL}"
+
FILES_${PN}-control = "${sbindir}/phosphor-fan-control"
+SYSTEMD_SERVICE_${PN}-control += "${TMPL_CONTROL}"
+SYSTEMD_LINK_${PN}-control += "${@compose_list(d, 'FMT_CONTROL', 'OBMC_CHASSIS_INSTANCES')}"
# --------------------------------------
# phosphor-chassis-cooling-type specific configuration
diff --git a/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control@.service b/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control@.service
new file mode 100644
index 0000000..568ff1e
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Phosphor Fan Control Daemon
+Wants=obmc-power-on@%i.target
+After=obmc-power-on@%i.target
+Conflicts=obmc-chassis-poweroff@%i.target
+
+[Service]
+Restart=on-failure
+ExecStart={sbindir}/phosphor-fan-control
+
+[Install]
+RequiredBy=obmc-chassis-poweron@%i.target
diff --git a/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-presence-tach@.service b/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-presence-tach@.service
index 8324fdb..c91ed4e 100644
--- a/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-presence-tach@.service
+++ b/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-presence-tach@.service
@@ -2,11 +2,11 @@
Description=Phosphor Fan Presence Tach Daemon
Wants=obmc-power-on@%i.target
After=obmc-power-on@%i.target
-Conflicts=obmc-host-stop@%i.target
+Conflicts=obmc-chassis-poweroff@%i.target
[Service]
Restart=on-failure
ExecStart={sbindir}/phosphor-fan-presence-tach
[Install]
-RequiredBy=obmc-host-start@%i.target
+RequiredBy=obmc-chassis-poweron@%i.target
diff --git a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
index 4c116ff..1bdb0f4 100644
--- a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
+++ b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
@@ -52,6 +52,7 @@
# be added those respective package groups instead.
SUMMARY_${PN}-fan-control = "Fan control"
RDEPENDS_${PN}-fan-control = " \
+ ${VIRTUAL-RUNTIME_obmc-fan-control} \
"
SUMMARY_${PN}-host-state-mgmt = "Host state management"