meta-phosphor: fru-device: add package

Add a fru-device package, packagegroup, and image feature.

Remove the ipmi-fru distro feature, since adding it in the first place
was a mistake - no projects have conditional ipmi-fru feature flags.

(From meta-phosphor rev: 4525a9d01a5f65438342a894f27c82f0dd61642c)

Change-Id: I6928ac67d4acb4568359a308b45cb0734d116054
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/meta-phosphor/classes/obmc-phosphor-image.bbclass b/meta-phosphor/classes/obmc-phosphor-image.bbclass
index f34b1a6..d68fa37 100644
--- a/meta-phosphor/classes/obmc-phosphor-image.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image.bbclass
@@ -12,6 +12,7 @@
 # - obmc-fan-control                  - OpenBMC fan management
 # - obmc-fan-mgmt                     - Deprecated - use obmc-fan-control instead
 # - obmc-flash-mgmt                   - OpenBMC flash management
+# - obmc-fru-ipmi                     - OpenBMC IPMI FRU EEPROM support
 # - obmc-health-monitor               - OpenBMC health monitoring
 # - obmc-host-ctl                     - OpenBMC host control
 # - obmc-host-ipmi                    - OpenBMC host IPMI
@@ -42,6 +43,7 @@
 FEATURE_PACKAGES_obmc-fan-control ?= "packagegroup-obmc-apps-fan-control"
 FEATURE_PACKAGES_obmc-fan-mgmt ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-phosphor-fan-mgmt', 'virtual-obmc-fan-mgmt', '', d)}"
 FEATURE_PACKAGES_obmc-flash-mgmt ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-phosphor-flash-mgmt', 'virtual-obmc-flash-mgmt', '', d)}"
+FEATURE_PACKAGES_obmc-fru-ipmi ?= "packagegroup-obmc-apps-fru-ipmi"
 FEATURE_PACKAGES_obmc-health-monitor ?= "packagegroup-obmc-apps-health-monitor"
 FEATURE_PACKAGES_obmc-host-ctl ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-host-ctl', 'virtual-obmc-host-ctl', '', d)}"
 FEATURE_PACKAGES_obmc-host-ipmi ?= "${@bb.utils.contains('COMBINED_FEATURES', 'obmc-host-ipmi', 'virtual-obmc-host-ipmi-hw', '', d)}"
diff --git a/meta-phosphor/conf/distro/include/phosphor-base.inc b/meta-phosphor/conf/distro/include/phosphor-base.inc
index 3a1f2a0..93b2455 100644
--- a/meta-phosphor/conf/distro/include/phosphor-base.inc
+++ b/meta-phosphor/conf/distro/include/phosphor-base.inc
@@ -95,7 +95,6 @@
         "
 
 DISTRO_FEATURES_OBMC = " \
-        ipmi-fru \
         obmc-host-ctl \
         obmc-host-ipmi \
         obmc-phosphor-chassis-mgmt \
diff --git a/meta-phosphor/recipes-phosphor/configuration/entity-manager_git.bb b/meta-phosphor/recipes-phosphor/configuration/entity-manager_git.bb
index 4162b2b..a329663 100644
--- a/meta-phosphor/recipes-phosphor/configuration/entity-manager_git.bb
+++ b/meta-phosphor/recipes-phosphor/configuration/entity-manager_git.bb
@@ -9,10 +9,6 @@
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENCE;md5=a6a4edad4aed50f39a66d098d74b265b"
 
-SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.EntityManager.service \
-                         ${@bb.utils.contains('DISTRO_FEATURES', 'ipmi-fru', 'xyz.openbmc_project.FruDevice.service', '', d)}"
-SYSTEMD_AUTO_ENABLE_${PN}_ibm-power-cpu = "disable"
-
 DEPENDS = "boost \
            nlohmann-json \
            sdbusplus \
@@ -23,9 +19,22 @@
 
 EXTRA_OEMESON = "-Dtests=disabled"
 
-PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipmi-fru', d)}"
+PACKAGECONFIG ??= "ipmi-fru"
 PACKAGECONFIG[ipmi-fru] = "-Dfru-device=true, -Dfru-device=false, i2c-tools,"
 
+EXTRA_ENTITY_MANAGER_PACKAGES = " \
+    ${@bb.utils.contains('PACKAGECONFIG', 'ipmi-fru', 'fru-device', '', d)} \
+    "
+
+PACKAGE_BEFORE_PN = "${EXTRA_ENTITY_MANAGER_PACKAGES}"
+
 do_install_append() {
     install -D ${WORKDIR}/blocklist.json ${D}${datadir}/${BPN}/blacklist.json
 }
+
+FILES_fru-device = "${bindir}/fru-device ${datadir}/${BPN}/blacklist.json"
+
+SYSTEMD_PACKAGES = "${PN} ${EXTRA_ENTITY_MANAGER_PACKAGES}"
+SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.EntityManager.service"
+SYSTEMD_SERVICE_fru-device = "xyz.openbmc_project.FruDevice.service"
+SYSTEMD_AUTO_ENABLE_fru-device_ibm-power-cpu = "disable"
diff --git a/meta-phosphor/recipes-phosphor/images/obmc-phosphor-image.bb b/meta-phosphor/recipes-phosphor/images/obmc-phosphor-image.bb
index ea87fb1..63908a1 100644
--- a/meta-phosphor/recipes-phosphor/images/obmc-phosphor-image.bb
+++ b/meta-phosphor/recipes-phosphor/images/obmc-phosphor-image.bb
@@ -15,6 +15,7 @@
         obmc-fan-control \
         obmc-fan-mgmt \
         obmc-flash-mgmt \
+        obmc-fru-ipmi \
         obmc-health-monitor \
         obmc-host-ctl \
         obmc-host-ipmi \
diff --git a/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb b/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
index 78949f7..e080ff6 100644
--- a/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
+++ b/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
@@ -13,6 +13,7 @@
         ${PN}-extras \
         ${PN}-devtools \
         ${PN}-fan-control \
+        ${PN}-fru-ipmi \
         ${PN}-health-monitor \
         ${PN}-host-state-mgmt \
         ${PN}-ikvm \
@@ -83,6 +84,11 @@
         phosphor-fan-monitor \
         "
 
+SUMMARY_${PN}-fru-ipmi = "Support for EEPROMS with IPMI FRU"
+RDEPENDS_${PN}-fru-ipmi = " \
+        fru-device \
+        "
+
 SUMMARY_${PN}-health-monitor = "Support for health monitoring"
 RDEPENDS_${PN}-health-monitor = " \
         phosphor-health-monitor \