cros_bundle_firmware: Pass the bundle into write_firmware
We need to be able to access the bundle from write_firmware, so we
can configure the BL2 of the flasher that we create. Add this as an
additional parameter.
BUG=chromium-os:28394
TEST=manual:
cros_bundle_firmware -b daisy -w usb
cros_bundle_firmware -b daisy -w sd:.
See that it still produces a booting image in each case
Change-Id: Ib4270f33a5c4f9b22060bdee57194ec5738d3dfc
Reviewed-on: https://gerrit.chromium.org/gerrit/23404
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/cros_bundle_firmware b/host/cros_bundle_firmware
index 46437ff..e7f904c 100755
--- a/host/cros_bundle_firmware
+++ b/host/cros_bundle_firmware
@@ -101,7 +101,7 @@
text_base = bundle.CalcTextBase('flasher ', fdt, flasher)
file_list = bundle.GetFiles()
write_firmware.DoWriteFirmware(output, tools, fdt, flasher,
- file_list, out_fname, text_base, dest=options.write,
+ file_list, out_fname, bundle, text_base, dest=options.write,
flash_dest=options.flash_dest)
except (CmdError, ValueError) as err:
diff --git a/host/cros_write_firmware b/host/cros_write_firmware
index e6c1d36..40a6802 100755
--- a/host/cros_write_firmware
+++ b/host/cros_write_firmware
@@ -67,7 +67,7 @@
text_base = bundle.CalcTextBase('flasher ', fdt, flasher)
file_list = bundle.GetFiles()
write_firmware.DoWriteFirmware(output, tools, fdt, flasher,
- file_list, options.image, text_base, update, verify, dest,
+ file_list, options.image, bundle, text_base, update, verify, dest,
flash_dest=options.flash_dest)
except (CmdError, ValueError) as err:
diff --git a/host/lib/write_firmware.py b/host/lib/write_firmware.py
index c721a3a..a0c118d 100644
--- a/host/lib/write_firmware.py
+++ b/host/lib/write_firmware.py
@@ -36,17 +36,19 @@
full Chrome OS image consisting of U-Boot, some keys and verification
information, images and a map of the flash memory.
"""
- def __init__(self, tools, fdt, output):
+ def __init__(self, tools, fdt, output, bundle):
"""Set up a new WriteFirmware object.
Args:
tools: A tools library for us to use.
fdt: An fdt which gives us some info that we need.
output: An output object to use for printing progress and messages.
+ bundle: A BundleFirmware object which created the image.
"""
self._tools = tools
self._fdt = fdt
self._out = output
+ self._bundle = bundle
self.text_base = self._fdt.GetInt('/chromeos-config', 'textbase');
# For speed, use the 'update' algorithm and don't verify
@@ -518,8 +520,8 @@
def DoWriteFirmware(output, tools, fdt, flasher, file_list, image_fname,
- text_base=None, update=True, verify=False, dest=None,
- flash_dest=None):
+ bundle, text_base=None, update=True, verify=False,
+ dest=None, flash_dest=None):
"""A simple function to write firmware to a device.
This creates a WriteFirmware object and uses it to write the firmware image
@@ -532,13 +534,14 @@
flasher: U-Boot binary to use as the flasher.
file_list: Dictionary containing files that we might need.
image_fname: Filename of image to write.
+ bundle: The bundle object which created the image.
text_base: U-Boot text base (base of executable image), None for default.
update: Use faster update algorithm rather then full device erase.
verify: Verify the write by doing a readback and CRC.
dest: Destination device to write firmware to (usb, sd).
flash_dest: Destination device for flasher to program payload into.
"""
- write = WriteFirmware(tools, fdt, output)
+ write = WriteFirmware(tools, fdt, output, bundle)
if text_base:
write.text_base = text_base
write.update = update