diff options
author | Joel Kitching <kitching@google.com> | 2018-08-09 17:49:52 +0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-11-16 09:47:35 +0000 |
commit | 21fdd89b0c9b0c135c0febeacbae5f83e33a3c70 (patch) | |
tree | 4fda2132c0f9f03d873dc63c5975e529e669ea7a /util/cbfstool/cbfs_image.h | |
parent | 73bbcee9327a25da8117a4caf864f8e3162a55c8 (diff) | |
download | coreboot-21fdd89b0c9b0c135c0febeacbae5f83e33a3c70.tar.xz |
cbfstool: add unprocessed flag for file exporting
Add an unprocessed flag (-U) which modifies how files are exported.
In the case of a compressed raw file, extract without decompressing.
In the case of a stage or payload, extract without decompressing or
converting to an ELF.
This can be useful for verifying the integrity of a stage or payload,
since converting to an ELF may not be a deterministic process on
different platforms or coreboot versions.
BUG=b:111577108
TEST=USE=cb_legacy_tianocore emerge-eve edk2 coreboot-utils chromeos-bootimage
cd /build/eve/firmware
/build/eve/usr/bin/cbfstool image.bin extract -r RW_LEGACY \
-n payload -f /tmp/payload_1 -U
START=$((16#`xxd -s 20 -l 4 -p tianocore.cbfs`))
SIZE=$((16#`xxd -s 8 -l 4 -p tianocore.cbfs`))
dd if=tianocore.cbfs skip=$START count=$SIZE bs=1 > /tmp/payload_2
diff /tmp/payload_1 /tmp/payload_2
rm /tmp/payload_1 /tmp/payload_2
Change-Id: I351d471d699daedd51adf4a860661877f25607e6
Signed-off-by: Joel Kitching <kitching@chromium.org>
Reviewed-on: https://review.coreboot.org/29616
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'util/cbfstool/cbfs_image.h')
-rw-r--r-- | util/cbfstool/cbfs_image.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h index 5772b1ba15..1f8b162d7c 100644 --- a/util/cbfstool/cbfs_image.h +++ b/util/cbfstool/cbfs_image.h @@ -95,10 +95,11 @@ int cbfs_image_delete(struct cbfs_image *image); /* Returns a pointer to entry by name, or NULL if name is not found. */ struct cbfs_file *cbfs_get_entry(struct cbfs_image *image, const char *name); -/* Exports an entry to external file. +/* Exports an entry to external file. If do_processing is true, file contents + * will be decompressed, and also turned into an ELF if appropriate. * Returns 0 on success, otherwise (ex, not found) non-zero. */ int cbfs_export_entry(struct cbfs_image *image, const char *entry_name, - const char *filename, uint32_t arch); + const char *filename, uint32_t arch, bool do_processing); /* Adds an entry to CBFS image by given name and type. If content_offset is * non-zero, try to align "content" (CBFS_SUBHEADER(p)) at content_offset. |