obmc-flash-bmc: Add u-boot update

Add function to update the u-boot mtd by doing a direct flash write.
Add it to the read-only function since u-boot is considered a
non-writable partition.

Change-Id: I73e76ba7153f18b03418ac9b181abc5d31f61f17
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
index 9af24ac..c452225 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
@@ -145,7 +145,19 @@
     fw_setenv "$varName" "$value"
 }
 
+mtd_write() {
+  flashmtd="$(findmtd "${reqmtd}")"
+  img="/tmp/images/${version}/${imgfile}"
+  flashcp -v ${img} /dev/${flashmtd}
+}
+
 case "$1" in
+  mtduboot)
+    reqmtd="$2"
+    version="$3"
+    imgfile="image-u-boot"
+    mtd_write
+    ;;
   ubirw)
     reqmtd="$2"
     name="$3"
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubiro@.service b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubiro@.service
index 3e4c15d..7c2a252 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubiro@.service
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-ubiro@.service
@@ -1,9 +1,10 @@
 [Unit]
-Description=Create read-only ubi volumes %I
+Description=Store read-only images %I to BMC storage
 
 [Service]
 Type=oneshot
 RemainAfterExit=no
 ExecStart=/usr/bin/env obmc-flash-bmc ubiro {RO_MTD} rofs-%i %i
 ExecStart=/usr/bin/env obmc-flash-bmc ubikernel {KERNEL_MTD} kernel-%i %i
+ExecStart=/usr/bin/env obmc-flash-bmc mtduboot u-boot %i
 SyslogIdentifier=obmc-flash-bmc