cros_bundle_firmware: Support generation of RW firmware
The only difference between RO and RW firmware is the preamable flags. Add
an easy option to force the flags to 0 (thus forcing RO firmware to boot
through RW).
BUG=chromium-os:35369
BRANCH=snow
TEST=manual
(auto test to come later before I close the bug)
$ cros_bundle_firmware -b daisy -d board/samsung/dts/exynos5250-snow.dts \
-I cros/dts -I arch/arm/dts -O out
$ fdtdump out/updated.dtb |grep pream
preamble-flags = <0x00000001>;
preamble-flags = <0x00000001>;
$ cros_bundle_firmware -b daisy -d board/samsung/dts/exynos5250-snow.dts \
-I cros/dts -I arch/arm/dts -O out --force-rw
$ fdtdump out/updated.dtb |grep pream
preamble-flags = <0x00000000>;
preamble-flags = <0x00000000>;
Change-Id: I429bb92c0b45b7325aa69c1e62a40420d32622f4
Reviewed-on: https://gerrit.chromium.org/gerrit/36738
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 3cf180d..c9bf6e4 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -174,16 +174,19 @@
self.ecro_fname = ecro
self.kernel_fname = kernel
- def SetOptions(self, small, gbb_flags):
+ def SetOptions(self, small, gbb_flags, force_rw=False):
"""Set up options supported by Bundle.
Args:
small: Only create a signed U-Boot - don't produce the full packed
firmware image. This is useful for devs who want to replace just the
U-Boot part while keeping the keys, gbb, etc. the same.
+ gbb_flags: Specification for string containing adjustments to make.
+ force_rw: Force firmware into RW mode.
"""
self._small = small
self._gbb_flags = gbb_flags
+ self._force_rw = force_rw
def CheckOptions(self):
"""Check provided options and select defaults."""
@@ -910,6 +913,10 @@
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.