summaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfstool.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r--util/cbfstool/cbfstool.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index fc49ed2c8f..34002a9e3d 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -57,6 +57,9 @@ static struct param {
uint32_t top_aligned;
int fit_empty_entries;
comp_algo algo;
+ /* for linux payloads */
+ char *initrd;
+ char *cmdline;
} param = {
/* All variables not listed are initialized as zero. */
.algo = CBFS_COMPRESS_NONE,
@@ -194,6 +197,11 @@ static int cbfstool_convert_mkpayload(struct buffer *buffer, uint32_t *offset) {
if (ret != 0)
ret = parse_fv_to_payload(buffer, &output, param.algo);
+ /* If it's neither ELF nor UEFI Fv, try bzImage */
+ if (ret != 0)
+ ret = parse_bzImage_to_payload(buffer, &output,
+ param.initrd, param.cmdline, param.algo);
+
/* Not a supported payload type */
if (ret != 0) {
ERROR("Not a supported payload type (ELF / FV).\n");
@@ -502,7 +510,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?", cbfs_add_payload},
+ {"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-flat-binary", "f:n:l:e:c:b:vh?", cbfs_add_flat_binary},
{"add-int", "i:n:b:vh?", cbfs_add_integer},
@@ -531,6 +539,8 @@ static struct option long_options[] = {
{"int", required_argument, 0, 'i' },
{"machine", required_argument, 0, 'm' },
{"empty-fits", required_argument, 0, 'x' },
+ {"initrd", required_argument, 0, 'I' },
+ {"cmdline", required_argument, 0, 'C' },
{"verbose", no_argument, 0, 'v' },
{"help", no_argument, 0, 'h' },
{NULL, 0, 0, 0 }
@@ -550,6 +560,7 @@ static void usage(char *name)
"Add a component\n"
" 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 a stage to the ROM\n"
" add-flat-binary -f FILE -n NAME -l load-address \\\n"
@@ -691,6 +702,12 @@ int main(int argc, char **argv)
case 'm':
arch = string_to_arch(optarg);
break;
+ case 'I':
+ param.initrd = optarg;
+ break;
+ case 'C':
+ param.cmdline = optarg;
+ break;
case 'h':
case '?':
usage(argv[0]);