bundle_firmware: allow removal of files in RW regions through cbfs-files
In addition to allowing
cbfs-files { foo = "add -n foo"; };
also support
cbfs-files { bar = "remove -n bar"; };
BUG=none
BRANCH=tot
TEST=add a cbfs-files { } remove statement as outlined above (eg. for
"revision"), build depthcharge and chromeos-bootimage and observe that
the file was removed as requested.
Change-Id: Ie7932388d57c7bfb541aa0c1b812ea600ac6ea9e
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/321630
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index 4256708..67f0974 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -946,8 +946,8 @@
for val in cbfs_config.itervalues():
f = val.split(' ')
command = f[0]
- if command[:3] != 'add':
- raise CmdError("first argument in '%s' must start with 'add'", f)
+ if command[:3] != 'add' and command != 'remove':
+ raise CmdError("'%s' doesn't add or remove a file", f)
if f[1] != '-n':
raise CmdError("second argument in '%s' must be '-n'", f)
cbfsname = f[2]
@@ -967,6 +967,8 @@
command = f[0]
cbfsname = f[2]
args = f[3:]
+ if command == 'remove':
+ continue
# Call through shell so variable expansion can happen. With a change
# to the ebuild this enables specifying filename arguments to
# cbfstool as -f romstage.elf${COREBOOT_VARIANT} and have that be