meta-ibm/sbp1: Assign static MAC
Add phosphor-ipmi-fru and ipmi-fru-properties configurations
to parse the MAC address from board IPMI EEPROM.
Add config for phosphor-network to sync MAC to u-boot env.
Change-Id: Ib470d71df06e75f9936f31efa3b86708dc226d57
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
diff --git a/meta-ibm/meta-sbp1/recipes-phosphor/configuration/sbp1-yaml-config.bb b/meta-ibm/meta-sbp1/recipes-phosphor/configuration/sbp1-yaml-config.bb
new file mode 100644
index 0000000..16ff00c
--- /dev/null
+++ b/meta-ibm/meta-sbp1/recipes-phosphor/configuration/sbp1-yaml-config.bb
@@ -0,0 +1,27 @@
+SUMMARY = "YAML configuration for IBM SBP1"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit allarch
+
+SRC_URI:sbp1 = " \
+ file://sbp1-ipmi-fru.yaml \
+ file://sbp1-ipmi-fru-properties.yaml \
+ "
+
+S = "${WORKDIR}"
+
+do_install:sbp1() {
+ install -m 0644 -D sbp1-ipmi-fru.yaml \
+ ${D}${datadir}/${BPN}/ipmi-fru-read.yaml
+ install -m 0644 -D sbp1-ipmi-fru-properties.yaml \
+ ${D}${datadir}/${BPN}/ipmi-extra-properties.yaml
+}
+
+FILES:${PN}-dev = " \
+ ${datadir}/${BPN}/ipmi-fru-read.yaml \
+ ${datadir}/${BPN}/ipmi-extra-properties.yaml \
+ "
+
+ALLOW_EMPTY:${PN} = "1"
diff --git a/meta-ibm/meta-sbp1/recipes-phosphor/configuration/sbp1-yaml-config/sbp1-ipmi-fru-properties.yaml b/meta-ibm/meta-sbp1/recipes-phosphor/configuration/sbp1-yaml-config/sbp1-ipmi-fru-properties.yaml
new file mode 100644
index 0000000..38ced08
--- /dev/null
+++ b/meta-ibm/meta-sbp1/recipes-phosphor/configuration/sbp1-yaml-config/sbp1-ipmi-fru-properties.yaml
@@ -0,0 +1,15 @@
+/system/chassis/motherboard/bmc/ethernet0:
+ xyz.openbmc_project.Inventory.Decorator.Replaceable:
+ FieldReplaceable: 'false'
+ xyz.openbmc_project.Inventory.Decorator.Cacheable:
+ Cached: 'true'
+ xyz.openbmc_project.Inventory.Item:
+ Present: 'true'
+
+/system/chassis/motherboard/bmc/ethernet1:
+ xyz.openbmc_project.Inventory.Decorator.Replaceable:
+ FieldReplaceable: 'false'
+ xyz.openbmc_project.Inventory.Decorator.Cacheable:
+ Cached: 'true'
+ xyz.openbmc_project.Inventory.Item:
+ Present: 'true'
diff --git a/meta-ibm/meta-sbp1/recipes-phosphor/configuration/sbp1-yaml-config/sbp1-ipmi-fru.yaml b/meta-ibm/meta-sbp1/recipes-phosphor/configuration/sbp1-yaml-config/sbp1-ipmi-fru.yaml
new file mode 100644
index 0000000..a48757c
--- /dev/null
+++ b/meta-ibm/meta-sbp1/recipes-phosphor/configuration/sbp1-yaml-config/sbp1-ipmi-fru.yaml
@@ -0,0 +1,20 @@
+0:
+ /system/chassis/motherboard/bmc/ethernet0:
+ entityID: 6
+ entityInstance: 1
+ interfaces:
+ xyz.openbmc_project.Inventory.Item.NetworkInterface:
+ MACAddress:
+ IPMIFruProperty: Custom Field 2
+ IPMIFruSection: Board
+ xyz.openbmc_project.Inventory.Item.Ethernet:
+ /system/chassis/motherboard/bmc/ethernet1:
+ entityID: 6
+ entityInstance: 2
+ interfaces:
+ xyz.openbmc_project.Inventory.Item.NetworkInterface:
+ MACAddress:
+ IPMIFruProperty: Custom Field 3
+ IPMIFruSection: Board
+ xyz.openbmc_project.Inventory.Item.Ethernet:
+
diff --git a/meta-ibm/meta-sbp1/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/motherboard b/meta-ibm/meta-sbp1/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/motherboard
new file mode 100644
index 0000000..e40af99
--- /dev/null
+++ b/meta-ibm/meta-sbp1/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/motherboard
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/27-0051/eeprom
+FRUID=0
diff --git a/meta-ibm/meta-sbp1/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend b/meta-ibm/meta-sbp1/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
new file mode 100644
index 0000000..12e7f3e
--- /dev/null
+++ b/meta-ibm/meta-sbp1/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
@@ -0,0 +1,27 @@
+inherit obmc-phosphor-systemd
+
+FILESEXTRAPATHS:prepend:sbp1 := "${THISDIR}/${PN}:"
+
+DEPENDS:append:sbp1 = " sbp1-yaml-config"
+
+EXTRA_OECONF:sbp1 = " \
+ YAML_GEN=${STAGING_DIR_HOST}${datadir}/sbp1-yaml-config/ipmi-fru-read.yaml \
+ PROP_YAML=${STAGING_DIR_HOST}${datadir}/sbp1-yaml-config/ipmi-extra-properties.yaml \
+ "
+
+EEPROM_NAMES = "motherboard"
+
+EEPROMFMT = "system/chassis/{0}"
+EEPROM_ESCAPEDFMT = "system-chassis-{0}"
+EEPROMS = "${@compose_list(d, 'EEPROMFMT', 'EEPROM_NAMES')}"
+EEPROMS_ESCAPED = "${@compose_list(d, 'EEPROM_ESCAPEDFMT', 'EEPROM_NAMES')}"
+
+ENVFMT = "obmc/eeproms/{0}"
+SYSTEMD_ENVIRONMENT_FILE:${PN}:append:sbp1 := " ${@compose_list(d, 'ENVFMT', 'EEPROMS')}"
+
+TMPL = "obmc-read-eeprom@.service"
+TGT = "${SYSTEMD_DEFAULT_TARGET}"
+INSTFMT = "obmc-read-eeprom@{0}.service"
+FMT = "../${TMPL}:${TGT}.wants/${INSTFMT}"
+
+SYSTEMD_LINK:${PN}:append:sbp1 := " ${@compose_list(d, 'FMT', 'EEPROMS_ESCAPED')}"
diff --git a/meta-ibm/meta-sbp1/recipes-phosphor/network/phosphor-network/config.json b/meta-ibm/meta-sbp1/recipes-phosphor/network/phosphor-network/config.json
new file mode 100644
index 0000000..cd28c11
--- /dev/null
+++ b/meta-ibm/meta-sbp1/recipes-phosphor/network/phosphor-network/config.json
@@ -0,0 +1,4 @@
+{
+ "eth0":"ethernet0",
+ "eth1":"ethernet1"
+}
diff --git a/meta-ibm/meta-sbp1/recipes-phosphor/network/phosphor-network_%.bbappend b/meta-ibm/meta-sbp1/recipes-phosphor/network/phosphor-network_%.bbappend
new file mode 100644
index 0000000..b91e82f
--- /dev/null
+++ b/meta-ibm/meta-sbp1/recipes-phosphor/network/phosphor-network_%.bbappend
@@ -0,0 +1,12 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+PACKAGECONFIG:append = " sync-mac"
+SRC_URI += " \
+ file://config.json \
+ "
+FILES:${PN} += "${datadir}/network/*.json"
+
+do_install:append() {
+ install -d ${D}${datadir}/network/
+ install -m 0644 ${WORKDIR}/config.json ${D}${datadir}/network/
+}