summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAntonello Dettori <dev@dettori.io>2016-06-26 00:24:25 +0200
committerAaron Durbin <adurbin@chromium.org>2016-07-02 03:27:33 +0200
commit0b806285a7819397a5fede24cfdcf7c09d0caa1c (patch)
tree779b447ba65c3fc67fc228d1a2126e7adb3e6271 /util
parent24a594f42a16b523534667ced65b06eb32bef1a0 (diff)
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. Change-Id: I8ffe90a6af24e76739fd25456383a566edb0da7e Signed-off-by: Antonello Dettori <dev@dettori.io> Reviewed-on: https://review.coreboot.org/15438 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/cbfs_image.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 5142a7a7d8..1e38e4ea8b 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -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;