cros_bundle_firmware: Move fdt selection earlier
At present the fdt preamble flags are updated after the fdt has already
been used by PackFirmware to obtain its parameters. Move the fdt update
earlier so that these flags actually take effect.
The test used on the previous commit was insufficient.
BUG=chromium-os:35369
BRANCH=snow
TEST=manual
$ cros_bundle_firmware -b daisy -O out -v4
See that vbutil_firmware is invoked with --flags 0 when --force-rw is
used and 1 when it is not.
I would like to test with something like this:
vbutil_firmware --verify out/vblock.vblock-a \
--signpubkey /usr/share/vboot/devkeys/dev_firmware_data_key.vbpubk \
--fv out/input.vblock-a
but it always gives this:
ERROR: Error verifying key block.
Change-Id: Iffb996eca818570a69271d986d3b3e46be31c804
Reviewed-on: https://gerrit.chromium.org/gerrit/39040
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Simon Glass <sjg@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index e36af70..b7118a6 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -985,6 +985,10 @@
# Get the flashmap so we know what to build
pack = PackFirmware(self._tools, self._out)
default_flashmap = default_flashmaps.get(self._board)
+ if self._force_rw:
+ fdt.PutInteger('/flash/rw-a-vblock', 'preamble-flags', 0)
+ fdt.PutInteger('/flash/rw-b-vblock', 'preamble-flags', 0)
+
pack.SelectFdt(fdt, self._board, default_flashmap)
# Get all our blobs ready
@@ -992,10 +996,6 @@
pack.AddProperty('skeleton', self.skeleton_fname)
pack.AddProperty('dtb', fdt.fname)
- if self._force_rw:
- fdt.PutInteger('/flash/rw-a-vblock', 'preamble-flags', 0)
- fdt.PutInteger('/flash/rw-b-vblock', 'preamble-flags', 0)
-
# Let's create some copies of the fdt for vboot. These can be used to
# pass a different fdt to each firmware type. For now it is just used to
# check that the right fdt comes through.