summaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfstool.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2014-10-30 11:44:20 -0700
committerFurquan Shaikh <furquan@google.com>2014-11-04 00:52:33 +0100
commit405304aca34b3dab949e616486bb60a52fd5dae0 (patch)
tree1c8de61c28b31bdfa9e0cd07433dd3a7d266de4c /util/cbfstool/cbfstool.c
parentcc6f84c4116acc81b2c51c37ab7adb426fdf491e (diff)
cbfstool: Add option to ignore section in add-stage
Allow add-stage to have an optional parameter for ignoring any section. This is required to ensure proper operation of elf_to_stage in case of loadable segments with zero filesize. Change-Id: I49ad62c2a4260ab9cec173c80c0f16923fc66c79 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: http://review.coreboot.org/7304 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r--util/cbfstool/cbfstool.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index ca02ca6dcb..66c425bd7c 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -41,6 +41,7 @@ static struct param {
char *name;
char *filename;
char *bootblock;
+ char *ignore_section;
uint64_t u64val;
uint32_t type;
uint32_t baseaddress;
@@ -184,7 +185,7 @@ static int cbfstool_convert_mkstage(struct buffer *buffer, uint32_t *offset)
struct buffer output;
int ret;
ret = parse_elf_to_stage(buffer, &output, param.arch, param.algo,
- offset);
+ offset, param.ignore_section);
if (ret != 0)
return -1;
buffer_delete(buffer);
@@ -516,7 +517,7 @@ static int cbfs_update_fit(void)
static const struct command commands[] = {
{"add", "f:n:t:b:vh?", cbfs_add},
{"add-payload", "f:n:t:c:b:vh?C:I:", cbfs_add_payload},
- {"add-stage", "f:n:t:c:b:vh?", cbfs_add_stage},
+ {"add-stage", "f:n:t:c:b:S:vh?", cbfs_add_stage},
{"add-flat-binary", "f:n:l:e:c:b:vh?", cbfs_add_flat_binary},
{"add-int", "i:n:b:vh?", cbfs_add_integer},
{"remove", "n:vh?", cbfs_remove},
@@ -546,6 +547,7 @@ static struct option long_options[] = {
{"empty-fits", required_argument, 0, 'x' },
{"initrd", required_argument, 0, 'I' },
{"cmdline", required_argument, 0, 'C' },
+ {"ignore-sec", required_argument, 0, 'S' },
{"verbose", no_argument, 0, 'v' },
{"help", no_argument, 0, 'h' },
{NULL, 0, 0, 0 }
@@ -566,7 +568,8 @@ static void usage(char *name)
" add-payload -f FILE -n NAME [-c compression] [-b base] "
"Add a payload to the ROM\n"
" (linux specific: [-C cmdline] [-I initrd])\n"
- " add-stage -f FILE -n NAME [-c compression] [-b base] "
+ " add-stage -f FILE -n NAME [-c compression] [-b base] \\\n"
+ " [-S section-to-ignore] "
"Add a stage to the ROM\n"
" add-flat-binary -f FILE -n NAME -l load-address \\\n"
" -e entry-point [-c compression] [-b base] "
@@ -714,6 +717,9 @@ int main(int argc, char **argv)
case 'C':
param.cmdline = optarg;
break;
+ case 'S':
+ param.ignore_section = optarg;
+ break;
case 'h':
case '?':
usage(argv[0]);