Add the IBM log manager recipe and service

Installs the ibm-log-manager application and the
com.ibm.Logging.service.  The lifetime of this service
matches that of the phosphor-logging service.

After building the code, the recipe also condenses the
policyTable.json file into a version to go onto the flash.

The policyTable.json in this layer is empty, and the system
specific ones should be installed from their own layers by
bbappending this recipe from there.

Change-Id: I5310da06e9beb69c7d53a16d0beb44232a937716
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/logging/ibm-logging.bb b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/logging/ibm-logging.bb
new file mode 100644
index 0000000..9c8a3db
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/logging/ibm-logging.bb
@@ -0,0 +1,52 @@
+SUMMARY = "IBM enhanced error logging"
+DESCRIPTION = "Adds additional error logging functionality for IBM systems"
+PR = "r1"
+HOMEPAGE = "https://github.com/openbmc/ibm-logging"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
+SRC_URI += "git://github.com/openbmc/ibm-logging"
+SRCREV = "259e7277e6af53d2c4862cd48c14131c0b22bb81"
+
+inherit autotools
+inherit pkgconfig
+inherit obmc-phosphor-dbus-service
+inherit obmc-phosphor-systemd
+
+DEPENDS += " \
+         ibm-dbus-interfaces \
+         phosphor-logging \
+         nlohmann-json \
+         autoconf-archive-native \
+         sdbusplus \
+         "
+
+RDEPENDS_${PN} += " \
+         phosphor-logging \
+         phosphor-dbus-interfaces \
+         sdbusplus \
+         "
+
+S = "${WORKDIR}/git"
+
+SRC_URI += "file://policyTable.json"
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[policy-interface] = "--enable-policy-interface, --disable-policy-interface,,"
+
+SERVICE = "com.ibm.Logging.service"
+DBUS_SERVICE_${PN} += "${SERVICE}"
+
+#The link is so that this service will restart if phosphor-logging restarts.
+#The BindsTo in the service will not do the restart, it will only do the
+#original start and a stop.
+LOG_FMT = "../${SERVICE}:xyz.openbmc_project.Logging.service.wants/${SERVICE}"
+SYSTEMD_LINK_${PN} += "${LOG_FMT}"
+
+do_install_append(){
+
+    install -d ${D}${datadir}/ibm-logging
+
+    ${S}/condense_policy.py \
+        -p ${WORKDIR}/policyTable.json \
+        -c ${D}/${datadir}/ibm-logging/policy.json
+}
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/logging/ibm-logging/com.ibm.Logging.service b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/logging/ibm-logging/com.ibm.Logging.service
new file mode 100644
index 0000000..57ebc99
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/logging/ibm-logging/com.ibm.Logging.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=IBM Log Manager
+After=xyz.openbmc_project.Logging.service
+BindsTo=xyz.openbmc_project.Logging.service
+
+[Service]
+ExecStart=/usr/bin/env ibm-log-manager
+SyslogIdentifier=ibm-log-manager
+Restart=always
+Type=dbus
+BusName={BUSNAME}
+
+[Install]
+WantedBy=xyz.openbmc_project.Logging.service
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/logging/ibm-logging/policyTable.json b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/logging/ibm-logging/policyTable.json
new file mode 100644
index 0000000..677c024
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/logging/ibm-logging/policyTable.json
@@ -0,0 +1,5 @@
+{
+    "_comment": "This file should be overridden with one from the machine layer.",
+    "events": {
+    }
+}
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
new file mode 100644
index 0000000..b8927b9
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
@@ -0,0 +1 @@
+RDEPENDS_${PN}-logging += "ibm-logging"