UPSTREAM: cbfstool: Require "-m ARCH" to extract payloads and stages

Require the user to specify which architecture the payload/stage
was built for before extracting it.

BUG=None
BRANCH=None
TEST=None

Change-Id: I8ffe90a6af24e76739fd25456383a566edb0da7e
Original-Signed-off-by: Antonello Dettori <dev@dettori.io>
Original-Reviewed-on: https://review.coreboot.org/15438
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/358595
Reviewed-by: Martin Roth <martinroth@chromium.org>
This commit is contained in:
Antonello Dettori 2016-06-26 00:24:25 +02:00 committed by chrome-bot
commit 9c8fd208f3

View file

@ -966,6 +966,11 @@ static int cbfs_stage_make_elf(struct buffer *buff, uint32_t arch)
size_t empty_sz;
int rmod_ret;
if (arch == CBFS_ARCHITECTURE_UNKNOWN) {
ERROR("You need to specify -m ARCH.\n");
return -1;
}
if (cbfs_stage_decompress(&stage, buff)) {
ERROR("Failed to decompress stage.\n");
return -1;
@ -1047,6 +1052,11 @@ static int cbfs_payload_make_elf(struct buffer *buff, uint32_t arch)
size_t empty_sz;
int segments = 0;
if (arch == CBFS_ARCHITECTURE_UNKNOWN) {
ERROR("You need to specify -m ARCH.\n");
return -1;
}
/* Count the number of segments inside buffer */
while (true) {
uint32_t payload_type = 0;