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/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiattach.service b/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiattach.service
index 90013ff..f90c437 100644
--- a/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiattach.service
+++ b/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios-ubiattach.service
@@ -4,5 +4,5 @@
 [Service]
 Type=oneshot
 RemainAfterExit=yes
-ExecStart=/bin/sh -c 'grep pnor /proc/mtd |cut -c 4 |xargs {sbindir}/ubiattach /dev/ubi_ctrl -m'
+ExecStart={sbindir}/bios-ubiattach
 ExecStop=/bin/sh -c 'grep pnor /proc/mtd |cut -c 4 |xargs {sbindir}/ubidetach /dev/ubi_ctrl -m'