meta-google: phosphor-ipmi-config: Add gbmc-bridge interface
Change-Id: Ic13e677f12f09279df19a32d5f381b2f94d8e4b8
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend b/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
new file mode 100644
index 0000000..03e99b2
--- /dev/null
+++ b/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
@@ -0,0 +1,22 @@
+FILESEXTRAPATHS_prepend_gbmc := "${THISDIR}/${PN}:"
+
+SRC_URI_append_gbmc = " file://gbmc_bridge.json"
+
+DEPENDS_append_gbmc = " jq-native"
+
+GBMCBR_IPMI_CHANNEL ?= "11"
+
+# Replace a channel in config.json to add gbmcbr reporting
+do_install_append_gbmc() {
+ chjson=${D}${datadir}/ipmi-providers/channel_config.json
+ overlapping="$(jq '."${GBMCBR_IPMI_CHANNEL}" | .is_valid and .name != "gbmcbr"' $chjson)"
+ if [ "$overlapping" != "false" ]; then
+ echo "gBMC channel config overlaps on ${GBMCBR_IPMI_CHANNEL}" >&2
+ cat $chjson
+ exit 1
+ fi
+ jq --slurpfile brcfg ${WORKDIR}/gbmc_bridge.json \
+ '. + {"${GBMCBR_IPMI_CHANNEL}": $brcfg[0]}' $chjson >${WORKDIR}/tmp
+ mv ${WORKDIR}/tmp $chjson
+}
+
diff --git a/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config/gbmc_bridge.json b/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config/gbmc_bridge.json
new file mode 100644
index 0000000..f877283
--- /dev/null
+++ b/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config/gbmc_bridge.json
@@ -0,0 +1,11 @@
+{
+ "name" : "gbmcbr",
+ "is_valid" : true,
+ "active_sessions" : 0,
+ "channel_info" : {
+ "medium_type" : "lan-802.3",
+ "protocol_type" : "ipmb-1.0",
+ "session_supported" : "multi-session",
+ "is_ipmi" : true
+ }
+}