meta-ampere: mtjade: Add Host firmware update support

Enable flash_bios feature and configure to use backend script to flash
UEFI firmware via Redfish, WebUI and Rest.

Tested:
1. Flash UEFI firmware via WebUI.
2. Flash UEFI firmware via Redfish UpdateService
3. Flash UEFI firmware via Rest interface.

Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: I772e6a409414e374ed01e72e3c69985d0b413cb5
diff --git a/meta-ampere/meta-common/recipes-ac01/packagegroups/packagegroup-ampere-apps.bb b/meta-ampere/meta-common/recipes-ac01/packagegroups/packagegroup-ampere-apps.bb
index 2990d8e..0831988 100644
--- a/meta-ampere/meta-common/recipes-ac01/packagegroups/packagegroup-ampere-apps.bb
+++ b/meta-ampere/meta-common/recipes-ac01/packagegroups/packagegroup-ampere-apps.bb
@@ -7,13 +7,16 @@
 PROVIDES = "${PACKAGES}"
 PACKAGES = " \
         ${PN}-chassis \
+        ${PN}-flash \
         ${PN}-system \
         "
 
 PROVIDES += "virtual/obmc-chassis-mgmt"
+PROVIDES += "virtual/obmc-flash-mgmt"
 PROVIDES += "virtual/obmc-system-mgmt"
 
 RPROVIDES_${PN}-chassis += "virtual-obmc-chassis-mgmt"
+RPROVIDES_${PN}-flash += "virtual-obmc-flash-mgmt"
 RPROVIDES_${PN}-system += "virtual-obmc-system-mgmt"
 
 SUMMARY_${PN}-chassis = "Ampere Chassis"
@@ -25,3 +28,8 @@
 SUMMARY_${PN}-system = "Ampere System"
 RDEPENDS_${PN}-system = " \
         "
+
+SUMMARY_${PN}-flash = "Ampere Flash"
+RDEPENDS_${PN}-flash = " \
+        ampere-flash-utils \
+        "
diff --git a/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-host-bios@.service b/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-host-bios@.service
new file mode 100644
index 0000000..c344600
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-host-bios@.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Ampere service for flashing the Host firmware image
+
+[Service]
+Type=oneshot
+RemainAfterExit=no
+ExecStart=/usr/sbin/ampere_flash_bios.sh /tmp/images/%I/*.img
diff --git a/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend b/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend
new file mode 100644
index 0000000..5d75c71
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend
@@ -0,0 +1,7 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+PACKAGECONFIG[flash_bios] = "-Dhost-bios-upgrade=enabled, -Dhost-bios-upgrade=disabled"
+
+PACKAGECONFIG_append_ = " flash_bios"
+
+SYSTEMD_SERVICE_${PN}-updater += "${@bb.utils.contains('PACKAGECONFIG', 'flash_bios', 'obmc-flash-host-bios@.service', '', d)}"