diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2018-01-10 12:48:16 +0100 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2018-10-23 21:15:05 +0000 |
commit | c82900b661420989856a969cd9edf27410b758eb (patch) | |
tree | 2f0ac2c60530769830ee6386047712fb46cdccd0 /libflashrom.h | |
parent | 4acc3f3a8990cda15f04e5eabf028c5cda0d6619 (diff) | |
download | flashrom-c82900b661420989856a969cd9edf27410b758eb.tar.gz flashrom-c82900b661420989856a969cd9edf27410b758eb.tar.bz2 flashrom-c82900b661420989856a969cd9edf27410b758eb.zip |
Add support to get layout from fmap (e.g. coreboot rom)
Flashmap, or simply fmap, is a binary data format for describing
region offsets, sizes, and certain attributes and is widely used by
coreboot. This patch adds support for the fmap data format version 1.1
and adds --fmap and --fmap-file arguments.
Using --fmap will make flashrom to search the ROM content for fmap
data. Using --fmap-file will make flashrom search a supplied file
for fmap data.
An example of how to update the COREBOOT region of a ROM:
flashrom -p programmer --fmap -w coreboot.rom -i COREBOOT
flashrom -p programmer --fmap-file coreboot.rom -w coreboot.rom -i COREBOOT
The fmap functions are mostly copied from cbfstool.
Currently it is made mutually exclusive with other layout options until
we are more clever about this input.
Change-Id: I0e7fad38ed79a84d41358e1f175c36d255786c12
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Signed-off-by: David Hendricks <dhendricks@fb.com>
Reviewed-on: https://review.coreboot.org/23203
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Tested-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'libflashrom.h')
-rw-r--r-- | libflashrom.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libflashrom.h b/libflashrom.h index 04907b2af..4fbcd35cc 100644 --- a/libflashrom.h +++ b/libflashrom.h @@ -61,8 +61,12 @@ int flashrom_image_verify(struct flashrom_flashctx *, const void *buffer, size_t struct flashrom_layout; int flashrom_layout_read_from_ifd(struct flashrom_layout **, struct flashrom_flashctx *, const void *dump, size_t len); +int flashrom_layout_read_fmap_from_rom(struct flashrom_layout **, + struct flashrom_flashctx *, off_t offset, size_t length); +int flashrom_layout_read_fmap_from_buffer(struct flashrom_layout **layout, + struct flashrom_flashctx *, const uint8_t *buf, size_t len); int flashrom_layout_include_region(struct flashrom_layout *, const char *name); void flashrom_layout_release(struct flashrom_layout *); void flashrom_layout_set(struct flashrom_flashctx *, const struct flashrom_layout *); -#endif /* !__LIBFLASHROM_H__ */
\ No newline at end of file +#endif /* !__LIBFLASHROM_H__ */ |