Add virtual/openpower-fru-inventory
This virtual provides an environment file that serves as inventory
configuration for openpower-vpd-parser.
Add a native recipe that builds the configuration from MRW. Set this
recipe as the default for OpenPOWER systems.
Change-Id: I88c1d4123d73a5cdf37cba8efda40107f7b9ef25
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/meta-openbmc-machines/meta-openpower/classes/openpower-fru-vpd.bbclass b/meta-openbmc-machines/meta-openpower/classes/openpower-fru-vpd.bbclass
index 8de966f..19f34e0 100644
--- a/meta-openbmc-machines/meta-openpower/classes/openpower-fru-vpd.bbclass
+++ b/meta-openbmc-machines/meta-openpower/classes/openpower-fru-vpd.bbclass
@@ -1 +1,3 @@
vpdlayout_datadir="${datadir}/openpower-fru-vpd/vpdlayout"
+inventory_datadir_name="/openpower-fru-inventory/inventory"
+inventory_datadir_native="${datadir}${inventory_datadir_name}"
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/vpd/openpower-fru-inventory-example-native.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/vpd/openpower-fru-inventory-example-native.bb
new file mode 100644
index 0000000..8f9bd05
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/vpd/openpower-fru-inventory-example-native.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Inventory config for openpower-vpd-parser"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit openpower-fru-vpd
+
+SRC_URI += "file://inventory"
+
+PROVIDES += "virtual/openpower-fru-inventory"
+
+S = "${WORKDIR}"
+
+do_install() {
+ # This recipe is supposed to create a systemd environment file
+ # with values for FRU types and paths. This example recipe
+ # uses a pre-defined file ($PN/inventory).
+
+ DEST=${D}${inventory_datadir_native}
+ install -d ${DEST}
+ install inventory ${DEST}
+}
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/vpd/openpower-fru-inventory-example/inventory b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/vpd/openpower-fru-inventory-example/inventory
new file mode 100644
index 0000000..1f6a5e3
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/vpd/openpower-fru-inventory-example/inventory
@@ -0,0 +1,2 @@
+FRUS=BMC
+PATHS=/system/chassis/bmc
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/vpd/openpower-fru-inventory-mrw-native.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/vpd/openpower-fru-inventory-mrw-native.bb
new file mode 100644
index 0000000..01ed362
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/vpd/openpower-fru-inventory-mrw-native.bb
@@ -0,0 +1,27 @@
+SUMMARY = "Inventory config for openpower-vpd-parser"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit openpower-fru-vpd
+
+DEPENDS += " \
+ mrw-native \
+ mrw-perl-tools-native \
+ virtual/openpower-fru-vpd-layout \
+ "
+
+PROVIDES += "virtual/openpower-fru-inventory"
+
+S = "${WORKDIR}"
+
+do_install() {
+ DEST=${D}${inventory_datadir_native}
+ install -d ${DEST}
+
+ ${bindir}/perl-native/perl \
+ ${bindir}/gen_openpower_fru.pl \
+ -m ${datadir}/obmc-mrw/${MACHINE}.xml \
+ -c ${vpdlayout_datadir}/layout.yaml \
+ -o ${DEST}/inventory
+}
diff --git a/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc b/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc
index 72a0139..ed87ec8 100644
--- a/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc
+++ b/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc
@@ -21,3 +21,5 @@
PREFERRED_PROVIDER_virtual/obmc-inventory-data ?= "${VIRTUAL-RUNTIME_skeleton_workbook}"
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-hostfw-config ?= "hostboot-inventory-config-native"
PREFERRED_PROVIDER_virtual/openpower-fru-vpd-layout ?= "openpower-fru-vpd-layout-native"
+PREFERRED_PROVIDER_virtual/openpower-fru-inventory ?= \
+ "${@cf_enabled(d, 'obmc-mrw', 'openpower-fru-inventory-mrw-native', 'openpower-fru-inventory-example-native')}"