platform: msm-shared: Add UBI image awareness to fastboot code

Current implementation of flasher in LK just writes the provided image as RAW data.
This is not good enough when writing a UBI image since some UBI META data should
be preserved.

When flashing a UBI image, the flasher should do the following for each non-bad PEB.
- Read the content of this PEB from the UBI image (PEB size bytes) into a buffer.
- Stripe min. I/O units full of 0xFF bytes from the end of the buffer Erase the PEB.
- Change the EC header in the buffer - put the new erase counter value there and
  re-calculate the CRC-32 checksum.
- Write the buffer to the physical eraseblock.

Sometimes the flashed image is smaller than the partition. The remaining PEBs should be
erased and a new ec header written to them.
For each erased PEB a valid ec header should be written.

With the above mentioned changes the first boot time after flashing the image was
reduced by ~50%.

When flashing on an erased partition there is no need to re-erase the blocks. With this
change flashing time was reduced by additional 3%.

Change-Id: Ie131cc2ccbf64e92510a055fb57389ae17a7f45f
diff --git a/platform/msm_shared/rules.mk b/platform/msm_shared/rules.mk
index 2040e16..15e664b 100755
--- a/platform/msm_shared/rules.mk
+++ b/platform/msm_shared/rules.mk
@@ -330,6 +330,7 @@
 			$(LOCAL_DIR)/board.o \
 			$(LOCAL_DIR)/spmi.o \
 			$(LOCAL_DIR)/qpic_nand.o \
+			$(LOCAL_DIR)/flash-ubi.o \
 			$(LOCAL_DIR)/bam.o \
 			$(LOCAL_DIR)/scm.o \
 			$(LOCAL_DIR)/dev_tree.o \
@@ -352,6 +353,7 @@
 			$(LOCAL_DIR)/board.o \
 			$(LOCAL_DIR)/spmi.o \
 			$(LOCAL_DIR)/qpic_nand.o \
+			$(LOCAL_DIR)/flash-ubi.o \
 			$(LOCAL_DIR)/bam.o \
 			$(LOCAL_DIR)/dev_tree.o \
 			$(LOCAL_DIR)/clock.o \