cbfstool: add code to serialize the header using the new xdr functions
This change adds a header serialization function. Programmers can thus just set up a header as needed, without worrying about forgetting if and how to use the [hn]to[hn]* functions. In the long term, we will work to remove swab.h, i.e. we need to get to the point where programmers don't have to try to remember [hn]to[nh]* and where it goes. To date, even the best programmers we have have made an error with those functions, and those errors have persisted for 6 or 7 years now. It's very easy to make that mistake. BUG=None TEST=Build a peppy image and verify that it's bit for bit the same. All chromebooks use this code and build and boot correctly. BRANCH=None Change-Id: I0f9b8e7cac5f52d0ea330ba948650fa0803aa0d5 Signed-off-by: Ronald G. Minnich <rminnich@google.com> Reviewed-on: https://chromium-review.googlesource.com/181552 Reviewed-by: Ronald Minnich <rminnich@chromium.org> Commit-Queue: Ronald Minnich <rminnich@chromium.org> Tested-by: Ronald Minnich <rminnich@chromium.org> Reviewed-on: http://review.coreboot.org/5100 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
committed by
Ronald G. Minnich
parent
a8a133ded3
commit
b5adeee1cc
@@ -31,6 +31,10 @@ struct cbfs_image {
|
||||
struct cbfs_header *header;
|
||||
};
|
||||
|
||||
/* Given a pointer, serialize the header from host-native byte format
|
||||
* to cbfs format, i.e. big-endian. */
|
||||
void cbfs_put_header(void *dest, const struct cbfs_header *header);
|
||||
|
||||
/* Creates an empty CBFS image by given size, and description to its content
|
||||
* (bootblock, align, header location, starting offset of CBFS entries.
|
||||
* The output image will contain a valid cbfs_header, with one cbfs_file
|
||||
|
Reference in New Issue
Block a user