diff options
author | Patrick Georgi <pgeorgi@chromium.org> | 2015-07-15 20:49:00 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-09-01 14:51:09 +0000 |
commit | 2c61506630b8e76bed93b3a5ac0ab2089376f548 (patch) | |
tree | efb84eaa9a3f23eb05885f85c6b5f52a291b02a4 /util/cbfstool/cbfs.h | |
parent | 4a666423c6d71614b7c2b539afa33d823c1896d5 (diff) |
cbfstool: add extended file attributes for cbfs_file
cbfs_file_first_attr(struct cbfs_file *) and
cbfs_file_next_attr(struct cbfs_file *, struct cbfs_file_attribute *)
help navigate through extended attributes.
cbfs_add_file_attr(header, tag, size) adds a new file attribute to
header.
Change-Id: I325965286c44f31abd95df684d340cebb0e68b75
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/10934
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util/cbfstool/cbfs.h')
-rw-r--r-- | util/cbfstool/cbfs.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs.h b/util/cbfstool/cbfs.h index 3f80a046f4..185bddebf6 100644 --- a/util/cbfstool/cbfs.h +++ b/util/cbfstool/cbfs.h @@ -21,6 +21,10 @@ #include <stdint.h> +/* cbfstool will fail when trying to build a cbfs_file header that's larger + * than MAX_CBFS_FILE_HEADER_BUFFER. 1K should give plenty of room. */ +#define MAX_CBFS_FILE_HEADER_BUFFER 1024 + /* create a magic number in host-byte order. * b3 is the high order byte. * in the coreboot tools, we go with the 32-bit @@ -77,6 +81,7 @@ struct cbfs_file { /* length of file data */ uint32_t len; uint32_t type; + /* offset to struct cbfs_file_attribute or 0 */ uint32_t attributes_offset; /* length of header incl. variable data */ uint32_t offset; @@ -95,6 +100,11 @@ struct cbfs_file_attribute { uint8_t data[0]; } __PACKED; +/* Depending on how the header was initialized, it may be backed with 0x00 or + * 0xff. Support both. */ +#define CBFS_FILE_ATTR_TAG_UNUSED 0 +#define CBFS_FILE_ATTR_TAG_UNUSED2 0xffffffff + struct cbfs_stage { uint32_t compression; uint64_t entry; @@ -155,6 +165,7 @@ struct cbfs_payload { #define CBFS_COMPONENT_NULL 0xFFFFFFFF #define CBFS_SUBHEADER(_p) ( (void *) ((((uint8_t *) (_p)) + ntohl((_p)->offset))) ) + /* cbfs_image.c */ uint32_t get_cbfs_entry_type(const char *name, uint32_t default_value); uint32_t get_cbfs_compression(const char *name, uint32_t unknown); |