openpower-software-manager: Support migration to ubifs

A ubiattach is the first step for any ubi operations. If this
service fails, it could be that the pnor chip is formatted
differently, as with the case of flashing it with pflash.
Enhance the service to:
  Check if the chip is formatted as a ubi device.
  If it's not, format it as ubi with a new ubiformat script.
  Reattempt the attach.
This allows a pnor code update without the user having
to manually reformat the chip.

Closes openbmc/openbmc#1637

Change-Id: Id73b5eae40af68cd49e0ba0deb56efc36bd03981
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb
index bf8a122..931a07d 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb
@@ -24,6 +24,17 @@
         sdbusplus \
         "
 
+S = "${WORKDIR}"
+SRC_URI += " \
+        file://bios-ubiattach \
+        file://bios-ubiformat"
+
+do_install() {
+        install -d ${D}${sbindir}
+        install -m 0755 ${WORKDIR}/bios-ubiattach ${D}${sbindir}/bios-ubiattach
+        install -m 0755 ${WORKDIR}/bios-ubiformat ${D}${sbindir}/bios-ubiformat
+}
+
 DBUS_SERVICE_${PN} += "org.open_power.Software.Host.Updater.service"
 SYSTEMD_SERVICE_${PN} += " \
         obmc-flash-bios-ubiattach.service \