meta-fii: meta-mori: Move BMC BIOS CPLD update to phosphor-ipmi-flash

Combine the update packages into phosphor-ipmi-flash to clean up the
meta layer. Since meta-google has installed their virtual/bmc-update,
so we specify phosphor-ipmi-flash as the preferred provider to use our
configuration.

Tested:
1. Ran burn-my-bmc from host side to flash BMC/BIOS/BMC CPLD/MB CPLD.
2. Checked the corresponding service has been executed.
3. Checked the versions have been updated.

Change-Id: I0a6408778ce928aa032b085e65dbd797f5c5e1e6
Signed-off-by: Vincent Chou <vincent.chou@fii-na.com>
diff --git a/meta-fii/meta-mori/conf/machine/mori.conf b/meta-fii/meta-mori/conf/machine/mori.conf
index d59d24d..a6284a7 100644
--- a/meta-fii/meta-mori/conf/machine/mori.conf
+++ b/meta-fii/meta-mori/conf/machine/mori.conf
@@ -23,9 +23,7 @@
 SERIAL_CONSOLES = "115200;ttyS0"
 
 PREFERRED_PROVIDER_virtual/obmc-host-ipmi-hw = "phosphor-ipmi-ssif"
-PREFERRED_PROVIDER_virtual/bmc-update = "mori-bmc-update"
-PREFERRED_PROVIDER_virtual/bios-update = "mori-bios-update"
-PREFERRED_PROVIDER_virtual/cpld-update = "mori-cpld-update"
+PREFERRED_PROVIDER_virtual/bmc-update = "phosphor-ipmi-flash"
 PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native = "mori-led-manager-config-native"
 
 MACHINE_FEATURES += "dynamic-sensors"
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bios-update.bb b/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bios-update.bb
deleted file mode 100644
index cf3cba9..0000000
--- a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bios-update.bb
+++ /dev/null
@@ -1,31 +0,0 @@
-SUMMARY = "Phosphor OpenBMC Mori BIOS Firmware Upgrade Command"
-DESCRIPTION = "Phosphor OpenBMC Mori BIOS Firmware Upgrade Comman Daemon"
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
-DEPENDS:append = " systemd phosphor-ipmi-flash"
-PROVIDES:append = " virtual/bios-update"
-PR = "r1"
-
-SRC_URI = " \
-    file://phosphor-ipmi-flash-bios-update.service \
-    file://config-bios.json \
-"
-
-SYSTEMD_SERVICE:${PN} = "phosphor-ipmi-flash-bios-update.service"
-
-inherit systemd obmc-phosphor-systemd
-
-do_install () {
-    install -d ${D}${datadir}/phosphor-ipmi-flash
-    install -m 0644 ${WORKDIR}/config-bios.json \
-        ${D}${datadir}/phosphor-ipmi-flash
-    install -d ${D}${systemd_system_unitdir}
-    install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-bios-update.service \
-        ${D}${systemd_system_unitdir}
-}
-
-RDEPENDS:${PN}:append = " libsystemd mori-fw"
-
-RPROVIDES:${PN}:append = " virtual/bios-update"
-
-FILES:${PN}:append = " ${datadir}/phosphor-ipmi-flash/config-bios.json"
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bios-update/config-bios.json b/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bios-update/config-bios.json
deleted file mode 100644
index de23823..0000000
--- a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bios-update/config-bios.json
+++ /dev/null
@@ -1,19 +0,0 @@
-[{
-    "blob": "/flash/bios",
-    "handler": {
-        "type": "file",
-        "path": "/run/initramfs/bios-image"
-    },
-    "actions": {
-        "preparation": {
-            "type": "skip"
-        },
-        "verification": {
-            "type": "skip"
-        },
-        "update": {
-            "type": "systemd",
-            "unit": "phosphor-ipmi-flash-bios-update.service"
-        }
-    }
-}]
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bmc-update.bb b/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bmc-update.bb
deleted file mode 100644
index 2b802d0..0000000
--- a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bmc-update.bb
+++ /dev/null
@@ -1,21 +0,0 @@
-SUMMARY = "Phosphor OpenBMC Mori BMC Firmware Upgrade Command"
-DESCRIPTION = "Phosphor OpenBMC Mori BMC Firmware Upgrade Comman Daemon"
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
-DEPENDS:append = " phosphor-ipmi-flash"
-PROVIDES:append = " virtual/bmc-update"
-PR = "r1"
-
-SRC_URI = "file://config-bmc.json"
-
-do_install () {
-    install -d ${D}${datadir}/phosphor-ipmi-flash
-    install -m 0644 ${WORKDIR}/config-bmc.json \
-        ${D}${datadir}/phosphor-ipmi-flash
-}
-
-RDEPENDS:${PN}:append = " mori-fw"
-
-RPROVIDES:${PN}:append = " virtual/bmc-update"
-
-FILES:${PN}:append = " ${datadir}/phosphor-ipmi-flash/config-bmc.json"
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bmc-update/config-bmc.json b/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bmc-update/config-bmc.json
deleted file mode 100644
index 5aefeb3..0000000
--- a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bmc-update/config-bmc.json
+++ /dev/null
@@ -1,20 +0,0 @@
-[{
-    "blob": "/flash/image",
-    "handler": {
-        "type": "file",
-        "path": "/run/initramfs/image-bmc"
-    },
-    "actions": {
-        "preparation": {
-            "type": "skip"
-        },
-        "verification": {
-            "type": "skip"
-        },
-        "update": {
-            "type": "systemd",
-            "unit": "reboot.target",
-            "mode": "replace-irreversibly"
-        }
-    }
-}]
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update.bb b/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update.bb
deleted file mode 100644
index 1161c75..0000000
--- a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update.bb
+++ /dev/null
@@ -1,43 +0,0 @@
-SUMMARY = "Phosphor OpenBMC Mori CPLD Firmware Upgrade Command"
-DESCRIPTION = "Phosphor OpenBMC Mori CPLD Firmware Upgrade Comman Daemon"
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
-DEPENDS:append = " systemd phosphor-ipmi-flash"
-PROVIDES:append = " virtual/cpld-update"
-PR = "r1"
-
-SRC_URI = " \
-    file://phosphor-ipmi-flash-bmccpld-update.service \
-    file://phosphor-ipmi-flash-mbcpld-update.service \
-    file://config-bmccpld.json \
-    file://config-mbcpld.json \
-"
-
-SYSTEMD_SERVICE:${PN} = " \
-    phosphor-ipmi-flash-bmccpld-update.service \
-    phosphor-ipmi-flash-mbcpld-update.service \
-"
-
-inherit systemd obmc-phosphor-systemd
-
-do_install () {
-    install -d ${D}${datadir}/phosphor-ipmi-flash
-    install -m 0644 ${WORKDIR}/config-bmccpld.json \
-        ${D}${datadir}/phosphor-ipmi-flash
-    install -m 0644 ${WORKDIR}/config-mbcpld.json \
-        ${D}${datadir}/phosphor-ipmi-flash
-    install -d ${D}${systemd_system_unitdir}
-    install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-bmccpld-update.service \
-        ${D}${systemd_system_unitdir}
-    install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-mbcpld-update.service \
-        ${D}${systemd_system_unitdir}
-}
-
-RDEPENDS:${PN}:append = " libsystemd mori-fw"
-
-RPROVIDES:${PN}:append = " virtual/cpld-update"
-
-FILES:${PN}:append = " \
-    ${datadir}/phosphor-ipmi-flash/config-bmccpld.json \
-    ${datadir}/phosphor-ipmi-flash/config-mbcpld.json \
-"
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/config-bmccpld.json b/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/config-bmccpld.json
deleted file mode 100644
index 687aa11..0000000
--- a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/config-bmccpld.json
+++ /dev/null
@@ -1,19 +0,0 @@
-[{
-    "blob": "/flash/bmccpld",
-    "handler": {
-        "type": "file",
-        "path": "/run/initramfs/bmc-cpld.svf"
-    },
-    "actions": {
-        "preparation": {
-            "type": "skip"
-        },
-        "verification": {
-            "type": "skip"
-        },
-        "update": {
-            "type": "systemd",
-            "unit": "phosphor-ipmi-flash-bmccpld-update.service"
-        }
-    }
-}]
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/config-mbcpld.json b/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/config-mbcpld.json
deleted file mode 100644
index f5870bb..0000000
--- a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/config-mbcpld.json
+++ /dev/null
@@ -1,20 +0,0 @@
-[{
-    "blob": "/flash/mbcpld",
-    "handler": {
-        "type": "file",
-        "path": "/run/initramfs/mb-cpld.svf"
-    },
-    "actions": {
-        "preparation": {
-            "type": "skip"
-        },
-        "verification": {
-            "type": "skip"
-        },
-        "update": {
-            "type": "systemd",
-            "unit": "phosphor-ipmi-flash-mbcpld-update.service"
-        }
-    }
-}]
-
diff --git a/meta-fii/meta-mori/recipes-phosphor/image/obmc-phosphor-image.bbappend b/meta-fii/meta-mori/recipes-phosphor/image/obmc-phosphor-image.bbappend
index 99580a1..85392b6 100644
--- a/meta-fii/meta-mori/recipes-phosphor/image/obmc-phosphor-image.bbappend
+++ b/meta-fii/meta-mori/recipes-phosphor/image/obmc-phosphor-image.bbappend
@@ -36,9 +36,6 @@
 OBMC_IMAGE_EXTRA_INSTALL:append:mori = " mori-cmd"
 OBMC_IMAGE_EXTRA_INSTALL:append:mori = " mori-boot"
 OBMC_IMAGE_EXTRA_INSTALL:append:mori = " mori-fw"
-OBMC_IMAGE_EXTRA_INSTALL:append:mori = " virtual/bmc-update"
-OBMC_IMAGE_EXTRA_INSTALL:append:mori = " virtual/bios-update"
-OBMC_IMAGE_EXTRA_INSTALL:append:mori = " virtual/cpld-update"
 
 # Required for phosphor-ipmi-ssif
 OBMC_IMAGE_EXTRA_INSTALL:append:mori = " virtual-obmc-host-ipmi-hw"
diff --git a/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/bios-update/config-bios.json b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/bios-update/config-bios.json
new file mode 100644
index 0000000..6f26b84
--- /dev/null
+++ b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/bios-update/config-bios.json
@@ -0,0 +1,21 @@
+[
+    {
+        "blob": "/flash/bios",
+        "handler": {
+            "type": "file",
+            "path": "/run/initramfs/bios-image"
+        },
+        "actions": {
+            "preparation": {
+                "type": "skip"
+            },
+            "verification": {
+                "type": "skip"
+            },
+            "update": {
+                "type": "systemd",
+                "unit": "phosphor-ipmi-flash-bios-update.service"
+            }
+        }
+    }
+]
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bios-update/phosphor-ipmi-flash-bios-update.service b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/bios-update/phosphor-ipmi-flash-bios-update.service
similarity index 100%
rename from meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-bios-update/phosphor-ipmi-flash-bios-update.service
rename to meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/bios-update/phosphor-ipmi-flash-bios-update.service
diff --git a/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/bmc-update/config-bmc.json b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/bmc-update/config-bmc.json
new file mode 100644
index 0000000..a4369b9
--- /dev/null
+++ b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/bmc-update/config-bmc.json
@@ -0,0 +1,22 @@
+[
+    {
+        "blob": "/flash/image",
+        "handler": {
+            "type": "file",
+            "path": "/run/initramfs/image-bmc"
+        },
+        "actions": {
+            "preparation": {
+                "type": "skip"
+            },
+            "verification": {
+                "type": "skip"
+            },
+            "update": {
+                "type": "systemd",
+                "unit": "reboot.target",
+                "mode": "replace-irreversibly"
+            }
+        }
+    }
+]
diff --git a/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/config-bmccpld.json b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/config-bmccpld.json
new file mode 100644
index 0000000..61e5d0e
--- /dev/null
+++ b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/config-bmccpld.json
@@ -0,0 +1,21 @@
+[
+    {
+        "blob": "/flash/bmccpld",
+        "handler": {
+            "type": "file",
+            "path": "/run/initramfs/bmc-cpld.svf"
+        },
+        "actions": {
+            "preparation": {
+                "type": "skip"
+            },
+            "verification": {
+                "type": "skip"
+            },
+            "update": {
+                "type": "systemd",
+                "unit": "phosphor-ipmi-flash-bmccpld-update.service"
+            }
+        }
+    }
+]
diff --git a/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/config-mbcpld.json b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/config-mbcpld.json
new file mode 100644
index 0000000..e9a688b
--- /dev/null
+++ b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/config-mbcpld.json
@@ -0,0 +1,21 @@
+[
+    {
+        "blob": "/flash/mbcpld",
+        "handler": {
+            "type": "file",
+            "path": "/run/initramfs/mb-cpld.svf"
+        },
+        "actions": {
+            "preparation": {
+                "type": "skip"
+            },
+            "verification": {
+                "type": "skip"
+            },
+            "update": {
+                "type": "systemd",
+                "unit": "phosphor-ipmi-flash-mbcpld-update.service"
+            }
+        }
+    }
+]
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/phosphor-ipmi-flash-bmccpld-update.service b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/phosphor-ipmi-flash-bmccpld-update.service
similarity index 100%
rename from meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/phosphor-ipmi-flash-bmccpld-update.service
rename to meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/phosphor-ipmi-flash-bmccpld-update.service
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/phosphor-ipmi-flash-mbcpld-update.service b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/phosphor-ipmi-flash-mbcpld-update.service
similarity index 100%
rename from meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-cpld-update/phosphor-ipmi-flash-mbcpld-update.service
rename to meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash/cpld-update/phosphor-ipmi-flash-mbcpld-update.service
diff --git a/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend
index 905611a..94b1371 100644
--- a/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend
+++ b/meta-fii/meta-mori/recipes-phosphor/ipmi/phosphor-ipmi-flash_%.bbappend
@@ -1,2 +1,31 @@
-PACKAGECONFIG:append:mori = " nuvoton-p2a-mbox net-bridge"
-IPMI_FLASH_BMC_ADDRESS:mori = "0xF0848000"
+PACKAGECONFIG:append = " nuvoton-p2a-mbox net-bridge"
+IPMI_FLASH_BMC_ADDRESS = "0xF0848000"
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}/bmc-update:${THISDIR}/${PN}/bios-update:${THISDIR}/${PN}/cpld-update:"
+
+SRC_URI:append = " file://config-bmc.json \
+                   file://config-bios.json \
+                   file://config-bmccpld.json \
+                   file://config-mbcpld.json \
+                 "
+
+RPROVIDES:${PN}:append = " virtual/bmc-update \
+                         "
+SYSTEMD_SERVICE:${PN}:append = " phosphor-ipmi-flash-bios-update.service \
+                                 phosphor-ipmi-flash-bmccpld-update.service \
+                                 phosphor-ipmi-flash-mbcpld-update.service \
+                               "
+
+inherit obmc-phosphor-systemd
+
+do_install:append() {
+    install -d ${D}/${datadir}/phosphor-ipmi-flash
+    install -m 0644 ${WORKDIR}/config-bmc.json \
+        ${D}${datadir}/phosphor-ipmi-flash/
+    install -m 0644 ${WORKDIR}/config-bios.json \
+        ${D}${datadir}/phosphor-ipmi-flash/
+    install -m 0644 ${WORKDIR}/config-bmccpld.json \
+        ${D}${datadir}/phosphor-ipmi-flash/
+    install -m 0644 ${WORKDIR}/config-mbcpld.json \
+        ${D}${datadir}/phosphor-ipmi-flash/
+}