cbfstool: support parsing UEFI firmware volumes

This removes the hack implemented in http://review.coreboot.org/#/c/2280
(and should make using 64bit Tiano easier, but that's not yet supported)

Change-Id: Ie30129c4102dfbd41584177f39057b31f5a937fd
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/2281
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Stefan Reinauer
2013-02-04 15:39:13 -08:00
committed by Stefan Reinauer
parent c13e4bf3e1
commit 543a682458
6 changed files with 257 additions and 15 deletions

View File

@@ -138,8 +138,20 @@ static int cbfstool_convert_mkstage(struct buffer *buffer, uint32_t *offset) {
static int cbfstool_convert_mkpayload(struct buffer *buffer, uint32_t *offset) {
struct buffer output;
if (parse_elf_to_payload(buffer, &output, param.algo) != 0)
int ret;
/* per default, try and see if payload is an ELF binary */
ret = parse_elf_to_payload(buffer, &output, param.algo);
/* If it's not an ELF, see if it's a UEFI FV */
if (ret != 0)
ret = parse_fv_to_payload(buffer, &output, param.algo);
/* Not a supported payload type */
if (ret != 0) {
ERROR("Not a supported payload type (ELF / FV).\n");
return -1;
}
buffer_delete(buffer);
// direct assign, no dupe.
memcpy(buffer, &output, sizeof(*buffer));