From 694fd133905ba6c87b2cef59b841660d1d82aeaa Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Wed, 28 Oct 2015 11:39:34 -0500 Subject: cbfstool: extract rmodules as ELFs properly With the previous ELF stage extract support the resulting ELF files wouldn't handle rmodules correctly in that the rmodule header as well as the relocations were a part of the program proper. Instead, try an initial pass at converting the stage as if it was an rmodule first. If it doesn't work fall back on the normal ELF extraction. TEST=Pulled an rmodule out of Chrome OS shellball. Manually matched up the metadata and relocations. Change-Id: Iaf222f92d145116ca4dfaa955fb7278e583161f2 Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/12222 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi Reviewed-by: Paul Menzel --- util/cbfstool/rmodule.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'util/cbfstool/rmodule.h') diff --git a/util/cbfstool/rmodule.h b/util/cbfstool/rmodule.h index 9a65677418..fa717659a1 100644 --- a/util/cbfstool/rmodule.h +++ b/util/cbfstool/rmodule.h @@ -88,4 +88,11 @@ int rmodule_collect_relocations(struct rmod_context *c, struct reloc_filter *f); /* Clean up the memory consumed by the rmdoule context. */ void rmodule_cleanup(struct rmod_context *ctx); +/* + * Create an ELF file from the passed in rmodule in the buffer. The buffer + * contents will be replaced with an ELF file. Returns 1 if buff doesn't + * contain an rmodule and < 0 on failure, 0 on success. + */ +int rmodule_stage_to_elf(Elf64_Ehdr *ehdr, struct buffer *buff); + #endif /* TOOL_RMODULE_H */ -- cgit v1.2.3