meta-bletchley: read fru from eeprom and store to inventory area

1. create configuration layer for fru yaml config
2. add fru eeprom path and id config
3. add FRU_YAML_GEN in phosphor-ipmi-host bbappend

Test:
root@bletchley:~# busctl introspect xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/bmc
NAME                                             TYPE      SIGNATURE RESULT/VALUE            FLAGS
org.freedesktop.DBus.Introspectable              interface -         -                       -
.Introspect                                      method    -         s                       -
org.freedesktop.DBus.Peer                        interface -         -                       -
.GetMachineId                                    method    -         s                       -
.Ping                                            method    -         -                       -
org.freedesktop.DBus.Properties                  interface -         -                       -
.Get                                             method    ss        v                       -
.GetAll                                          method    s         a{sv}                   -
.Set                                             method    ssv       -                       -
.PropertiesChanged                               signal    sa{sv}as  -                       -
xyz.openbmc_project.Inventory.Decorator.Asset    interface -         -                       -
.BuildDate                                       property  s         "2021-12-21 - 07:56:00" emits-change writable
.Manufacturer                                    property  s         "Quanta"                emits-change writable
.Model                                           property  s         ""                      emits-change writable
.PartNumber                                      property  s         "3RL19MA0000"           emits-change writable
.SerialNumber                                    property  s         "1234567890123"         emits-change writable
.SparePartNumber                                 property  s         ""                      emits-change writable
.SubModel                                        property  s         ""                      emits-change writable
xyz.openbmc_project.Inventory.Decorator.Revision interface -         -                       -
.Version                                         property  s         "FRU Ver 0.01"          emits-change writable
xyz.openbmc_project.Inventory.Item               interface -         -                       -
.Present                                         property  b         false                   emits-change writable
.PrettyName                                      property  s         "Bletchley -Class 1"    emits-change writable
xyz.openbmc_project.Inventory.Item.Bmc           interface -         -                       -
xyz.openbmc_project.Inventory.Item.Board         interface -         -                       -

root@bletchley:~# busctl introspect xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/bmc/ethernet
NAME                                                TYPE      SIGNATURE RESULT/VALUE   FLAGS
org.freedesktop.DBus.Introspectable                 interface -         -              -
.Introspect                                         method    -         s              -
org.freedesktop.DBus.Peer                           interface -         -              -
.GetMachineId                                       method    -         s              -
.Ping                                               method    -         -              -
org.freedesktop.DBus.Properties                     interface -         -              -
.Get                                                method    ss        v              -
.GetAll                                             method    s         a{sv}          -
.Set                                                method    ssv       -              -
.PropertiesChanged                                  signal    sa{sv}as  -              -
xyz.openbmc_project.Inventory.Item.Ethernet         interface -         -              -
xyz.openbmc_project.Inventory.Item.NetworkInterface interface -         -              -
.MACAddress                                         property  s         "3AD664F68D3F" emits-change writable

Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I70d624885abaa13639a0617b356554aa6c88af57
diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/configuration/bletchley-yaml-config.bb b/meta-facebook/meta-bletchley/recipes-phosphor/configuration/bletchley-yaml-config.bb
new file mode 100644
index 0000000..7a8f847
--- /dev/null
+++ b/meta-facebook/meta-bletchley/recipes-phosphor/configuration/bletchley-yaml-config.bb
@@ -0,0 +1,23 @@
+SUMMARY = "YAML configuration for bletchley"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit allarch
+
+SRC_URI = " \
+    file://bletchley-ipmi-fru.yaml \
+    "
+
+S = "${WORKDIR}"
+
+do_install() {
+    install -m 0644 -D bletchley-ipmi-fru.yaml \
+        ${D}${datadir}/${BPN}/ipmi-fru-read.yaml
+}
+
+FILES:${PN}-dev = " \
+    ${datadir}/${BPN}/ipmi-fru-read.yaml \
+    "
+
+ALLOW_EMPTY:${PN} = "1"
diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/configuration/bletchley-yaml-config/bletchley-ipmi-fru.yaml b/meta-facebook/meta-bletchley/recipes-phosphor/configuration/bletchley-yaml-config/bletchley-ipmi-fru.yaml
new file mode 100644
index 0000000..8c53a2a
--- /dev/null
+++ b/meta-facebook/meta-bletchley/recipes-phosphor/configuration/bletchley-yaml-config/bletchley-ipmi-fru.yaml
@@ -0,0 +1,38 @@
+0:
+  /system/chassis/bmc:
+    entityID: 7
+    entityInstance: 1
+    interfaces:
+      xyz.openbmc_project.Inventory.Decorator.Asset:
+        BuildDate:
+          IPMIFruProperty: Mfg Date
+          IPMIFruSection: Board
+        SerialNumber:
+          IPMIFruProperty: Serial Number
+          IPMIFruSection: Board
+        PartNumber:
+          IPMIFruProperty: Part Number
+          IPMIFruSection: Board
+        Manufacturer:
+          IPMIFruProperty: Manufacturer
+          IPMIFruSection: Board
+      xyz.openbmc_project.Inventory.Item:
+        PrettyName:
+          IPMIFruProperty: Name
+          IPMIFruSection: Board
+      xyz.openbmc_project.Inventory.Decorator.Revision:
+        Version:
+          IPMIFruProperty: FRU File ID
+          IPMIFruSection: Board
+      xyz.openbmc_project.Inventory.Item.Board:
+      xyz.openbmc_project.Inventory.Item.Bmc:
+
+  /system/chassis/bmc/ethernet:
+    entityID: 7
+    entityInstance: 1
+    interfaces:
+      xyz.openbmc_project.Inventory.Item.NetworkInterface:
+        MACAddress:
+          IPMIFruProperty: Custom Field 3
+          IPMIFruSection: Board
+      xyz.openbmc_project.Inventory.Item.Ethernet:
\ No newline at end of file
diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/bmc b/meta-facebook/meta-bletchley/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/bmc
new file mode 100644
index 0000000..b1bd018
--- /dev/null
+++ b/meta-facebook/meta-bletchley/recipes-phosphor/ipmi/phosphor-ipmi-fru/obmc/eeproms/system/chassis/bmc
@@ -0,0 +1,2 @@
+SYSFS_PATH=/sys/bus/i2c/devices/7-0054/eeprom
+FRUID=0
\ No newline at end of file
diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend b/meta-facebook/meta-bletchley/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
new file mode 100644
index 0000000..0c78a8f
--- /dev/null
+++ b/meta-facebook/meta-bletchley/recipes-phosphor/ipmi/phosphor-ipmi-fru_%.bbappend
@@ -0,0 +1,26 @@
+inherit obmc-phosphor-systemd
+
+FILESEXTRAPATHS:prepend:bletchley := "${THISDIR}/${PN}:"
+
+DEPENDS:append:bletchley = " bletchley-yaml-config"
+
+EXTRA_OECONF:bletchley = " \
+    YAML_GEN=${STAGING_DIR_HOST}${datadir}/bletchley-yaml-config/ipmi-fru-read.yaml \
+    "
+
+EEPROM_NAMES = "bmc"
+
+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:bletchley := " ${@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:bletchley := " ${@compose_list(d, 'FMT', 'EEPROMS_ESCAPED')}"
diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-facebook/meta-bletchley/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
new file mode 100644
index 0000000..fd303a0
--- /dev/null
+++ b/meta-facebook/meta-bletchley/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
@@ -0,0 +1,5 @@
+DEPENDS:append:bletchley = " bletchley-yaml-config"
+
+EXTRA_OECONF:bletchley = " \
+    FRU_YAML_GEN=${STAGING_DIR_HOST}${datadir}/bletchley-yaml-config/ipmi-fru-read.yaml \
+    "