cros_bundle_firmware: Do not fail when using extracted BL2
To generate a flasher write_firmware takes the image apart, and then
modifies SPL to make it use the changed u-boot blob size. At this
point SPL blob is retrieved from the binary image, so its size is
likely to be larger than the actual blob. This poses a problem for
image verification, which expects the the value in the header size
field to exactly match the blob size.
To address this - allow blob size to exceed the size value in the blob
header.
BUG=chrome-os-partner:18447
TEST=manual
. with u-boot/ebuild modifications enabling variable size SPL ran
the following commands
$ emerge-peach_pit chromeos-bootimage chromeos-u-boot exynos-pre-boot
$ sudo cros_write_firmware -b peach -w sd:. -M exynos --board peach \
-i /build/peach_pit/firmware/image-peach_pit.bin \
--dt /tmp/u-peach/dts/exynos5420-peach_pit.dtb -F spi \
-U /build/peach_pit/firmware/u-boot.bin
observed the generated SD card flash the onboard SPI flash on
peach_pit, and then observed the peach_pit boot from SPI flash
after reset
. unittests still pass
$ FEATURES=test sudo -E emerge cros-devutils
Change-Id: Ie32343409d1c2d2cf0ba8e78dd078ee278b4995f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58226
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/host/lib/write_firmware.py b/host/lib/write_firmware.py
index c486423..4363606 100644
--- a/host/lib/write_firmware.py
+++ b/host/lib/write_firmware.py
@@ -680,7 +680,8 @@
spl_load_size = os.stat(raw_image).st_size
bl2_handler = ExynosBl2(self._tools, self._out)
- bl2_file = bl2_handler.Configure(self._fdt, spl_load_size, bl2, 'flasher')
+ bl2_file = bl2_handler.Configure(self._fdt, spl_load_size,
+ bl2, 'flasher', False)
data = self._tools.ReadFile(bl1) + self._tools.ReadFile(bl2_file)
# Pad BL2 out to the required size.