meta-romulus: Add phosphor-cooling-type service

Romulus is air-cooled machine, configure phosphor-cooling-type to always
set AirCooled to true and WaterCooled to false.

Change-Id: I3b3e477c1b45ff9fb9a4c37ca837cccbb1bf07fa
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/meta-romulus/recipes-phosphor/fans/phosphor-fan%.bbappend b/meta-romulus/recipes-phosphor/fans/phosphor-fan%.bbappend
new file mode 100644
index 0000000..86ed1d4
--- /dev/null
+++ b/meta-romulus/recipes-phosphor/fans/phosphor-fan%.bbappend
@@ -0,0 +1,22 @@
+FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"
+
+# Package configuration
+FAN_PACKAGES += " \
+        phosphor-cooling-type \
+"
+
+PACKAGECONFIG += "cooling-type"
+
+TMPL_COOLING = "phosphor-cooling-type@.service"
+INSTFMT_COOLING = "phosphor-cooling-type@{0}.service"
+COOLING_TGT = "${SYSTEMD_DEFAULT_TARGET}"
+FMT_COOLING = "../${TMPL_COOLING}:${COOLING_TGT}.requires/${INSTFMT_COOLING}"
+
+FILES_phosphor-cooling-type = "${sbindir}/phosphor-cooling-type"
+SYSTEMD_SERVICE_phosphor-cooling-type += "${TMPL_COOLING}"
+SYSTEMD_LINK_phosphor-cooling-type += "${@compose_list(d, 'FMT_COOLING', 'OBMC_CHASSIS_INSTANCES')}"
+
+COOLING_ENV_FMT = "obmc/phosphor-fan/phosphor-cooling-type-{0}.conf"
+
+SYSTEMD_ENVIRONMENT_FILE_phosphor-cooling-type += "${@compose_list(d, 'COOLING_ENV_FMT', 'OBMC_CHASSIS_INSTANCES')}"
+
diff --git a/meta-romulus/recipes-phosphor/fans/phosphor-fan%/obmc/phosphor-fan/phosphor-cooling-type-0.conf b/meta-romulus/recipes-phosphor/fans/phosphor-fan%/obmc/phosphor-fan/phosphor-cooling-type-0.conf
new file mode 100644
index 0000000..21fcfcb
--- /dev/null
+++ b/meta-romulus/recipes-phosphor/fans/phosphor-fan%/obmc/phosphor-fan/phosphor-cooling-type-0.conf
@@ -0,0 +1,3 @@
+OBJPATH="--path=/system/chassis"
+AIR="--air"
+
diff --git a/meta-romulus/recipes-phosphor/fans/phosphor-fan%/phosphor-cooling-type@.service b/meta-romulus/recipes-phosphor/fans/phosphor-fan%/phosphor-cooling-type@.service
new file mode 100644
index 0000000..7452b91
--- /dev/null
+++ b/meta-romulus/recipes-phosphor/fans/phosphor-fan%/phosphor-cooling-type@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Phosphor Cooling Type
+Wants=mapper-wait@-xyz-openbmc_project-inventory.service
+After=mapper-wait@-xyz-openbmc_project-inventory.service
+ConditionPathExists={envfiledir}/obmc/phosphor-fan/phosphor-cooling-type-%i.conf
+
+[Service]
+EnvironmentFile={envfiledir}/obmc/phosphor-fan/phosphor-cooling-type-%i.conf
+ExecStart=/usr/bin/env phosphor-cooling-type ${{OBJPATH}} ${{AIR}}
+SyslogIdentifier=phosphor-cooling-type
+
+[Install]
+RequiredBy={SYSTEMD_DEFAULT_TARGET}