Add virtual/phosphor-logging-callouts
This virtual generates mappings between sysfs device paths and inventory
items.
Add a native recipe that builds the configuration from MRW. Set this
recipe as the default for OpenPOWER systems.
Resolves openbmc/openbmc#1093
Resolves openbmc/openbmc#1249
Change-Id: If67b4ef0850910a076ca212197a4bd0e704d0266
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-phosphor/classes/phosphor-logging.bbclass b/meta-phosphor/classes/phosphor-logging.bbclass
new file mode 100644
index 0000000..18f53d4
--- /dev/null
+++ b/meta-phosphor/classes/phosphor-logging.bbclass
@@ -0,0 +1 @@
+callouts_datadir="${datadir}/phosphor-logging/callouts"
diff --git a/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging-callouts-example-native.bb b/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging-callouts-example-native.bb
new file mode 100644
index 0000000..f76d202
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging-callouts-example-native.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Generated callout information for phosphor-logging"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-logging
+
+SRC_URI += "file://callouts.yaml"
+
+PROVIDES += "virtual/phosphor-logging-callouts"
+
+S = "${WORKDIR}"
+
+do_install() {
+ DEST=${D}${callouts_datadir}
+ install -d ${DEST}
+ install callouts.yaml ${DEST}
+}
diff --git a/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging-callouts-example/callouts.yaml b/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging-callouts-example/callouts.yaml
new file mode 100644
index 0000000..5b92a04
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging-callouts-example/callouts.yaml
@@ -0,0 +1 @@
+/sys/devices/device: /system/chassis/motherboard/device
diff --git a/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging-callouts-mrw-native.bb b/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging-callouts-mrw-native.bb
new file mode 100644
index 0000000..4981626
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging-callouts-mrw-native.bb
@@ -0,0 +1,25 @@
+SUMMARY = "Generated callout information for phosphor-logging"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-logging
+
+DEPENDS += " \
+ mrw-native \
+ mrw-perl-tools-native \
+ "
+
+PROVIDES += "virtual/phosphor-logging-callouts"
+
+S = "${WORKDIR}"
+
+do_install() {
+ DEST=${D}${callouts_datadir}
+ install -d ${DEST}
+
+ ${bindir}/perl-native/perl \
+ ${bindir}/gen_callouts.pl \
+ -m ${datadir}/obmc-mrw/${MACHINE}.xml \
+ -o ${DEST}/callouts.yaml
+}
diff --git a/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging.bb b/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging.bb
index 14f2e6e..1d059c4 100644
--- a/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging.bb
+++ b/meta-phosphor/common/recipes-phosphor/logging/phosphor-logging.bb
@@ -8,6 +8,7 @@
inherit obmc-phosphor-license
inherit obmc-phosphor-dbus-service
inherit phosphor-dbus-interfaces
+inherit phosphor-logging
DBUS_SERVICE_${PN} += "xyz.openbmc_project.Logging.service"
@@ -17,6 +18,7 @@
DEPENDS += "python-pyyaml-native"
DEPENDS += "sdbusplus sdbusplus-native"
DEPENDS += "phosphor-dbus-interfaces"
+DEPENDS += "virtual/phosphor-logging-callouts"
RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces"
PROVIDES += "virtual/obmc-logging-mgmt"
RPROVIDES_${PN} += "virtual-obmc-logging-mgmt"
@@ -26,4 +28,9 @@
S = "${WORKDIR}/git"
-EXTRA_OECONF = "YAML_DIR=${STAGING_DIR_NATIVE}${yaml_dir}"
+EXTRA_OECONF = " \
+ YAML_DIR=${STAGING_DIR_NATIVE}${yaml_dir} \
+ CALLOUTS_YAML=${STAGING_DIR_NATIVE}${callouts_datadir}/callouts.yaml \
+ "
+
+TARGET_CXXFLAGS += "-DPROCESS_META"
diff --git a/meta-phosphor/conf/distro/include/phosphor-defaults.inc b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
index d9d532a..f78ea33 100644
--- a/meta-phosphor/conf/distro/include/phosphor-defaults.inc
+++ b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
@@ -116,6 +116,15 @@
PREFERRED_PROVIDER_virtual/phosphor-ipmi-sensor-inventory ?= \
"${@cf_enabled(d, 'obmc-mrw', 'phosphor-ipmi-sensor-inventory-mrw-native', 'phosphor-ipmi-sensor-inventory-example-native')}"
+# The phosphor-logging application has a data driven plugin that adds FRU
+# callout information to error logs, when applications generating error logs
+# add the requisite callout metadata to the systemd journal. The plugin requires
+# an input mapping of Linux sysfs devices to OpenBMC DBus objects.
+# This virtual is a native recipe that provides that mapping by installing
+# configuration files in the format and native sysroot location expected by
+# the phosphor-logging build process in the native sysroot.
+PREFERRED_PROVIDER_virtual/phosphor-logging-callouts ?= \
+ "${@cf_enabled(d, 'obmc-mrw', 'phosphor-logging-callouts-mrw-native', 'phosphor-logging-callouts-example-native')}"
OBMC_DBUS_PATH_ROOT ?= "/xyz/openbmc_project"
OBMC_DBUS_IFACE_ROOT ?= "xyz.openbmc_project"