diff options
author | Ronald G. Minnich <rminnich@google.com> | 2013-12-03 11:13:35 -0800 |
---|---|---|
committer | Alexandru Gagniuc <mr.nuke.me@gmail.com> | 2014-01-29 20:03:44 +0100 |
commit | aa2f739ae87386b8a29068ecfdc2b25bcf4a19ca (patch) | |
tree | 7d69d6c6edc92c633ff6138f6d8b626151522c0a /util/cbfstool/fit.c | |
parent | 8449b5e0a9e5eca3c91c1d9351d5f21eaa0ba582 (diff) | |
download | coreboot-aa2f739ae87386b8a29068ecfdc2b25bcf4a19ca.tar.xz |
cbfs: fix issues with word size and endianness.
Add XDR functions and use them to convert the ELF headers
to native headers, using the Elf64 structs to ensure we accomodate
all word sizes. Also, use these XDR functions for output.
This may seem overly complex but it turned out to be much the easiest
way to do this. Note that the basic elf parsing function
in cbfs-mkstage.c now works over all ELF files, for all architectures,
endian, and word size combinations. At the same time, the basic elf
parsing in cbfs-mkstage.c is a loop that has no architecture-specific
conditionals.
Add -g to the LDFLAGS while we're here. It's on the CFLAGS so there is
no harm done.
This code has been tested on all chromebooks that use coreboot to date.
I added most of the extra checks from ChromeOS and they triggered a
lot of warnings, hence the other changes. I had to take -Wshadow back
out due to the many errors it triggers in LZMA.
BUG=None
TEST=Build and boot for Peppy; works fine. Build and boot for nyan,
works fine. Build for qemu targets and armv8 targets.
BRANCH=None
Change-Id: I5a4cee9854799189115ac701e22efc406a8d902f
Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Reviewed-on: https://chromium-review.googlesource.com/178606
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/4817
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'util/cbfstool/fit.c')
-rw-r--r-- | util/cbfstool/fit.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/util/cbfstool/fit.c b/util/cbfstool/fit.c index c76ba480ad..f15ccf510b 100644 --- a/util/cbfstool/fit.c +++ b/util/cbfstool/fit.c @@ -104,9 +104,9 @@ static inline int fit_entry_type(struct fit_entry *entry) * in the host address space at [4G - romsize -> 4G). It also assume all * pointers have values within this address range. */ -static inline int ptr_to_offset(uint32_t romsize, uint32_t host_ptr) +static inline int ptr_to_offset(uint32_t theromsize, uint32_t host_ptr) { - return (int)(romsize + host_ptr); + return (int)(theromsize + host_ptr); } /* @@ -114,9 +114,9 @@ static inline int ptr_to_offset(uint32_t romsize, uint32_t host_ptr) * in the host address space at [4G - romsize -> 4G). It also assume all * pointers have values within this address range. */ -static inline uint32_t offset_to_ptr(uint32_t romsize, int offset) +static inline uint32_t offset_to_ptr(uint32_t theromsize, int offset) { - return -(romsize - (uint32_t )offset); + return -(theromsize - (uint32_t )offset); } static struct fit_table *locate_fit_table(struct cbfs_image *image) |