Add native recipe to generate inventory map from MRW
Resolves openbmc/openbmc#1559
Change-Id: I3c663693df78cdf8daac83d49ca35982be27165a
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/classes/phosphor-ipmi-host.bbclass b/classes/phosphor-ipmi-host.bbclass
index 2857029..9725782 100644
--- a/classes/phosphor-ipmi-host.bbclass
+++ b/classes/phosphor-ipmi-host.bbclass
@@ -1 +1,3 @@
sensor_datadir="${datadir}/phosphor-ipmi-host/sensor"
+hostfw_datadir="${datadir}/phosphor-ipmi-fru/hostfw"
+config_datadir="${datadir}/phosphor-ipmi-host/config"
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-inventory-example-native.bb b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-inventory-example-native.bb
new file mode 100644
index 0000000..25fa0f1
--- /dev/null
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-inventory-example-native.bb
@@ -0,0 +1,17 @@
+SUMMARY = "Sample inventory map for phosphor-ipmi-host"
+PR = "r1"
+
+inherit native
+inherit phosphor-ipmi-host
+
+require phosphor-ipmi-host.inc
+
+PROVIDES += "virtual/phosphor-ipmi-fru-read-inventory"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ DEST=${D}${config_datadir}
+ install -d ${DEST}
+ install scripts/example.yaml ${DEST}/config.yaml
+}
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-inventory-mrw-native.bb b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-inventory-mrw-native.bb
new file mode 100644
index 0000000..6393f95
--- /dev/null
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-fru-read-inventory-mrw-native.bb
@@ -0,0 +1,24 @@
+SUMMARY = "Generate inventory map for phosphor-ipmi-host from a MRW."
+PR = "r1"
+
+inherit native
+inherit phosphor-ipmi-host
+
+require phosphor-ipmi-host.inc
+
+DEPENDS += "mrw-native mrw-perl-tools-native"
+
+DEPENDS += "virtual/phosphor-ipmi-fru-hostfw-config"
+PROVIDES += "virtual/phosphor-ipmi-fru-read-inventory"
+
+do_install() {
+
+ DEST=${D}${config_datadir}
+ install -d ${DEST}
+
+ ${bindir}/perl-native/perl \
+ ${bindir}/gen_ipmi_fru.pl \
+ -i ${datadir}/obmc-mrw/${MACHINE}.xml \
+ -m ${hostfw_datadir}/config.yaml \
+ -o ${DEST}/config.yaml
+}
diff --git a/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb b/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
index 91658f6..f2fa39e 100644
--- a/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
+++ b/common/recipes-phosphor/ipmi/phosphor-ipmi-host.bb
@@ -21,6 +21,7 @@
DEPENDS += "phosphor-dbus-interfaces"
DEPENDS += "obmc-targets"
DEPENDS += "virtual/phosphor-ipmi-inventory-sel"
+DEPENDS += "virtual/phosphor-ipmi-fru-read-inventory"
RDEPENDS_${PN}-dev += "phosphor-logging"
RDEPENDS_${PN}-dev += "phosphor-mapper-dev"
@@ -46,6 +47,7 @@
WHITELIST_CONF="${WHITELIST_CONF}" \
SENSOR_YAML_GEN=${STAGING_DIR_NATIVE}${sensor_datadir}/sensor.yaml \
INVSENSOR_YAML_GEN=${STAGING_DIR_NATIVE}${sensor_datadir}/invsensor.yaml \
+ FRU_YAML_GEN=${STAGING_DIR_NATIVE}${config_datadir}/config.yaml \
"
S = "${WORKDIR}/git"
diff --git a/conf/distro/include/phosphor-defaults.inc b/conf/distro/include/phosphor-defaults.inc
index b53eb13..e8462ca 100644
--- a/conf/distro/include/phosphor-defaults.inc
+++ b/conf/distro/include/phosphor-defaults.inc
@@ -138,6 +138,7 @@
# the phosphor-ipmi-fru build process.
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-hostfw-config ?= "phosphor-ipmi-fru-hostfw-config-example-native"
+
# The phosphor-ipmi-fru application is data-driven and requires an input
# mapping of IPMI inventory metadata to DBus objects interfaces and properties.
# This virtual is a native recipe that provides that mapping by installing
@@ -145,9 +146,14 @@
# the phosphor-ipmi-fru build process in the native sysroot.
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-inventory ?= \
"${@cf_enabled(d, 'obmc-mrw', 'phosphor-ipmi-fru-inventory-mrw-native', 'phosphor-ipmi-fru-inventory-example-native')}"
+
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-properties ?= \
"${@cf_enabled(d, 'obmc-mrw', 'phosphor-ipmi-fru-properties-mrw-native', 'phosphor-ipmi-fru-properties-native')}"
+
+PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-read-inventory ?= \
+ "${@cf_enabled(d, 'obmc-mrw', 'phosphor-ipmi-fru-read-inventory-mrw-native', 'phosphor-ipmi-fru-read-inventory-example-native')}"
+
# The phosphor-led-manager application is data-driven and requires an input
# yaml of LED group and members.
# This virtual is a native recipe that provides that mapping by installing