Add virtual/phosphor-ipmi-fru-properties

This virtual provides an output file in YAML format, which has
property:value pairs for FRUs of interest.

Add a native recipe that builds the configuration from MRW. Set this
recipe as the default for OpenPOWER systems.

Change-Id: Icc816b777189a48aff79a958f38ad22d7002bfdc
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-example-native.bb b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-example-native.bb
new file mode 100644
index 0000000..200dcd7
--- /dev/null
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-example-native.bb
@@ -0,0 +1,22 @@
+SUMMARY = "FRU properties config for ipmi-fru-parser"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-ipmi-fru
+
+SRC_URI += "file://out.yaml"
+
+PROVIDES += "virtual/phosphor-ipmi-fru-properties"
+
+S = "${WORKDIR}"
+
+do_install() {
+        # This recipe is supposed to create an output yaml file with
+        # FRU property values extracted from the MRW. This example recipe
+        # provides a sample output file.
+
+        DEST=${D}${properties_datadir}
+        install -d ${DEST}
+        install out.yaml ${DEST}
+}
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-example/out.yaml b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-example/out.yaml
new file mode 100644
index 0000000..626ef33
--- /dev/null
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-example/out.yaml
@@ -0,0 +1,11 @@
+/system/chassis/motherboard/cpu0:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
+
+/system/chassis/motherboard/dimm0:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'true' 
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'true'
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-mrw-native.bb b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-mrw-native.bb
new file mode 100644
index 0000000..2188f04
--- /dev/null
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-mrw-native.bb
@@ -0,0 +1,28 @@
+SUMMARY = "FRU properties config for ipmi-fru-parser"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-ipmi-fru
+
+SRC_URI += "file://config.yaml"
+
+DEPENDS += " \
+           mrw-native \
+           mrw-perl-tools-native \
+           "
+
+PROVIDES += "virtual/phosphor-ipmi-fru-properties"
+
+S = "${WORKDIR}"
+
+do_install() {
+        DEST=${D}${properties_datadir}
+        install -d ${DEST}
+
+        ${bindir}/perl-native/perl \
+            ${bindir}/gen_fru_properties.pl \
+            -m ${datadir}/obmc-mrw/${MACHINE}.xml \
+            -c config.yaml \
+            -o ${DEST}/out.yaml
+}
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-mrw/config.yaml b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-mrw/config.yaml
new file mode 100644
index 0000000..eb62648
--- /dev/null
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-properties-mrw/config.yaml
@@ -0,0 +1,23 @@
+PROC:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'false'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'false'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+DIMM:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'false'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'false'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
+
+SYS:
+    xyz.openbmc_project.Inventory.Decorator.Replaceable:
+        FieldReplaceable: 'false'
+    xyz.openbmc_project.Inventory.Decorator.Cacheable:
+        Cached: 'false'
+    xyz.openbmc_project.Inventory.Item:
+        Present: 'true'
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru.bb b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru.bb
index 16e26df..e99d16b 100644
--- a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru.bb
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru.bb
@@ -13,6 +13,7 @@
 DEPENDS += " \
         virtual/phosphor-ipmi-fru-hostfw-config\
         virtual/phosphor-ipmi-fru-inventory \
+        virtual/phosphor-ipmi-fru-properties \
         systemd \
         sdbusplus \
         python-mako-native \
@@ -43,4 +44,7 @@
 # EXTRA_OECONF += "HOSTFW_YAML=${hostfw_datadir}/config.yaml"
 #
 # For now the generator requires them to already be combined so we have:
-EXTRA_OECONF = "YAML_GEN=${STAGING_DIR_NATIVE}${config_datadir}/config.yaml"
+EXTRA_OECONF = " \
+             YAML_GEN=${STAGING_DIR_NATIVE}${config_datadir}/config.yaml \
+             PROP_YAML=${STAGING_DIR_NATIVE}${properties_datadir}/out.yaml \
+             "