cros_bundle_firmware: Allow SPL to specify what it loads

Rather than hard-code the areas that U-Boot SPL loads (to be U-Boot
plus the FDT) we might as well specify it explicitly. This lets us
easily change it later if needed.

BUG=chromium-os:32034
TEST=manual
$ FEATURES=test emerge-daisy cros-devutils
Run cros_bundle_firmware -b daisy, and see that it still produces an
image that boots, and that the listed SPL payload size looks correct.

Change-Id: Id54f7885cce6529d96c3b2f9b53eb120659bd2fd
Reviewed-on: https://gerrit.chromium.org/gerrit/25864
Commit-Ready: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index 4bff9e8..4aa4123 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -727,7 +727,22 @@
     elif blob_type == 'ecbin':
       pack.AddProperty(blob_type, self.ecbin_fname)
     elif blob_type == 'exynos-bl2':
-      spl_load_size = os.stat(pack.GetProperty('boot+dtb')).st_size
+      spl_payload = pack.GetBlobParams(blob_type)
+
+      # TODO(sjg@chromium): Remove this later, when we remove boot+dtb
+      # from all flash map files.
+      if not spl_payload:
+        spl_load_size = os.stat(pack.GetProperty('boot+dtb')).st_size
+        prop_list = 'boot+dtb'
+
+        # Do this later, when we remove boot+dtb.
+        # raise CmdError("No parameters provided for blob type '%s'" %
+        #     blob_type)
+      else:
+        prop_list = spl_payload[0].split(',')
+        spl_load_size = len(pack.ConcatPropContents(prop_list)[0])
+      self._out.Info("BL2/SPL contains '%s', size is %d / %#x" %
+          (', '.join(prop_list), spl_load_size, spl_load_size))
       bl2 = self.ConfigureExynosBl2(fdt, spl_load_size, self.exynos_bl2)
       pack.AddProperty(blob_type, bl2)
     elif pack.GetProperty(blob_type):