cros_bundle_firmware: Support the z machine parameter for u-boot compression
SPL u-boot may load a compressed u-boot. A new machine parameter 'z' tells
SPL u-boot what type of compression the u-boot uses. The compression type
is configured in the FDT.
BUG=chromium-os:37724
TEST=manual
Use a FDT in which RO u-boot flashmap has the property: compress = "lzo".
Run cros_bundle_firmware -v3 and check the following output:
Compression type: 0x1
Change-Id: I7d1977fb049b19cd2dd529f4e9da65a2785a5ba7
Reviewed-on: https://gerrit.chromium.org/gerrit/42692
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index 2a0cfec..42720f9 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -828,6 +828,13 @@
else:
raise CmdError("Invalid boot source '%s'" % self.spl_source)
self._out.Info(' Boot source: %#0x' % value)
+ elif param == 'z':
+ compress = fdt.GetString('/flash/ro-boot', 'compress', 'none')
+ compress_types = ['none', 'lzo']
+ if not compress in compress_types:
+ raise CmdError("Unknown compression type '%s'" % compress)
+ value = compress_types.index(compress)
+ self._out.Info(' Compression type: %#0x' % value)
else:
self._out.Warning("Unknown machine parameter type '%s'" % param)
self._out.Info(' Unknown value: %#0x' % value)