coreboot-kgpe-d16/util
Ronald G. Minnich a8a133ded3 Add section header parsing and use it in the mk-payload step
This completes the improvements to the ELF file parsing code.  We can
now parse section headers too, across all 4 combinations of word size
and endianness. I had hoped to completely remove the use of htonl
until I found it in cbfs_image.c. That's a battle for another day.

There's now a handy macro to create magic numbers in host byte order.
I'm using it for all the PAYLOAD_SEGMENT_* constants and maybe
we can use it for the others too, but this is sensitive code and
I'd rather change one thing at a time.

To maximize the ease of use for users, elf parsing is accomplished with
just one function:

int
elf_headers(const struct buffer *pinput,
	    Elf64_Ehdr *ehdr,
	    Elf64_Phdr **pphdr,
	    Elf64_Shdr **pshdr)

which requires the ehdr and pphdr pointers to be non-NULL, but allows
the pshdr to be NULL. If pshdr is NULL, the code will not try to read
in section headers.

To satisfy our powerful scripts, I had to remove the ^M from an unrelated
microcode file.

BUG=None
TEST=Build a peppy image (known to boot) with old and new versions and verify they are bit-for-bit the same. This was also fully tested across all chromebooks for building and booting and running chromeos.
BRANCH=None

Change-Id: I54dad887d922428b6175fdb6a9cdfadd8a6bb889
Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Reviewed-on: https://chromium-review.googlesource.com/181272
Reviewed-by: Ronald Minnich <rminnich@chromium.org>
Commit-Queue: Ronald Minnich <rminnich@chromium.org>
Tested-by: Ronald Minnich <rminnich@chromium.org>
Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Reviewed-on: http://review.coreboot.org/5098
Tested-by: build bot (Jenkins)
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2014-02-02 20:18:55 +01:00
..
abuild abuild: improve --remove 2013-12-20 21:01:32 +01:00
acpi GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
amdtools Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
arm_boot_tools/mksunxiboot cpu/allwinner/a10: Provide utility to make a bootable image 2014-01-13 04:03:00 +01:00
board_status board_status.sh: Replace [[ with [. 2014-01-21 03:17:13 +01:00
cbfstool Add section header parsing and use it in the mk-payload step 2014-02-02 20:18:55 +01:00
cbmem util/cbmem/Makfile: Add rule `junit.xml` for Jenkins 2014-01-11 17:40:38 +01:00
crossgcc buildgcc: defer cleaning up the tree a bit 2013-12-22 04:53:12 +01:00
dtd_parser GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
dumpmmcr dumpmmcr: Fix compilation warnings in printf 2012-01-26 09:57:56 +01:00
ectool GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
genprof Rename devices -> device 2012-11-30 23:59:58 +01:00
getpir GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
gitconfig gitconfig: Match the Change-Id line more exactly 2012-08-27 15:41:33 +02:00
i915tool Fix whitespace leaked into tree 2013-09-17 21:04:35 +02:00
ifdfake ifdfake - Create an IFD with just a section layout 2013-06-24 17:56:42 +02:00
ifdtool ifdtool: Dump more registers from FD 2012-11-12 06:56:03 +01:00
inteltool utils: Install man pages as non-executable (chmod 644) 2014-01-31 20:14:58 +01:00
k8resdump GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
kconfig kconfig: fix choice dependency check 2013-05-26 11:50:11 +02:00
lbtdump Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
lint lint: check label style only on changed files 2014-01-11 10:56:54 +01:00
mkelfImage GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
mptable mptable: realign comments with code 2012-06-20 12:46:55 +02:00
msrtool msrtool: Fix verbose ignored by cpuid(). 2013-07-08 19:39:00 +02:00
nvramtool utils: Install man pages as non-executable (chmod 644) 2014-01-31 20:14:58 +01:00
optionlist GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
resetcf Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
romcc romcc: Fix off-by-one 2013-11-16 09:49:35 +01:00
runfw Add a clean target to the run firmware (runfw) Makefile 2013-01-30 21:22:04 +01:00
sconfig sconfig: don't "const" structs twice 2014-01-20 12:59:27 +01:00
showdevicetree Show the device tree. 2013-03-16 04:30:16 +01:00
spkmodem_recv Add spkmodem receiver 2013-06-12 05:18:24 +02:00
superiotool utils: Install man pages as non-executable (chmod 644) 2014-01-31 20:14:58 +01:00
vgabios Rename devices -> device 2012-11-30 23:59:58 +01:00
viatool viatool: Add utility to read various configuration bits on VIA systems 2013-06-04 22:36:26 +02:00
xcompile util/xcompile/xcompile: set up for aarch64 2013-11-10 04:41:30 +01:00