Precompute the hash of each part of multipart blobs.

One of these sections is the EC RW image, and this hash can be used to short
circuit EC software sync and save some boot time. The hash is computed using
the hashlib library. It's then broken into bytes which is stored in the "hash"
property using the fdtput and the byte data type.

I decided to only add "hash" properties to multipart blobs in order to reduce
the amount of stuff being added to the device tree.

BUG=chrome-os-partner:17606
TEST=Built and booted U-Boot on Link and Snow with images created using this
version of cros_bundle_firmware. Made U-Boot print out the hash it was using
to verify that it was correct and complete.
BRANCH=None

Change-Id: I8e62e8b9d8c2b1b126e42fad2d5fe24f185ea852
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/42723
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index fd0a73a..7bd0036 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -1038,9 +1038,9 @@
     pack.CheckProperties()
 
     # Record position and size of all blob members in the FDT
-    pack.UpdateBlobPositions(fdt)
-    pack.UpdateBlobPositions(fdt_rwa)
-    pack.UpdateBlobPositions(fdt_rwb)
+    pack.UpdateBlobPositionsAndHashes(fdt)
+    pack.UpdateBlobPositionsAndHashes(fdt_rwa)
+    pack.UpdateBlobPositionsAndHashes(fdt_rwb)
 
     # Make a copy of the fdt for the bootstub
     fdt_data = self._tools.ReadFile(fdt.fname)