cros_bundle_firmware: Add blob data to cb_with_fmap

All "blob" regions should be identical pre- and post processing now.

BUG=chromium:595715
BRANCH=none
TEST=verify bit-equivalence of region between image.bin and cb_with_fmap
with CL:397219 or similar.

Change-Id: Ib907a52ed9f167f1c17c9d4e01e2643942887508
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/397179
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index 48c61d7..67e3acb 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -766,9 +766,14 @@
     Raises:
       CmdError if a command fails.
     """
+    cb_copy = pack.GetProperty('cb_with_fmap')
     if blob_type == 'coreboot':
       pass
     elif blob_type == 'legacy':
+      self._tools.Run('cbfstool', [cb_copy, 'write',
+                      '-f', self.seabios_fname,
+                      '--force',
+                      '-r', 'RW_LEGACY'])
       pack.AddProperty('legacy', self.seabios_fname)
     elif blob_type.startswith('cbfs'):
       self._PrepareCbfs(pack, blob_type)
@@ -779,7 +784,6 @@
     elif blob_type == 'ifwi' or blob_type == 'sig2':
       # Copy IFWI/CSE_SIGN(sig2) regions from coreboot copy and build a blob
       # for the blob_type
-      cb_copy = pack.GetProperty('cb_with_fmap')
       blob_start, blob_size = fdt.GetFlashPart('ro', blob_type)
       blob_file = blob_type + '.bin'
       blob_path = os.path.join(self._tools.outdir, blob_file)
@@ -787,6 +791,10 @@
       self._tools.WriteFile(blob_path, data[blob_start:blob_start+blob_size])
       pack.AddProperty(blob_type, blob_path)
     elif blob_type in self.blobs:
+      self._tools.Run('cbfstool', [cb_copy, 'write',
+                      '--fill-upward',
+                      '-f', self.blobs[blob_type],
+                      '-r', _FdtNameToFmap(blob_type)])
       pack.AddProperty(blob_type, self.blobs[blob_type])
     else:
       raise CmdError("Unknown blob type '%s' required in flash map" %