aboutsummaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfstool.c
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2013-08-27 20:22:21 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2013-08-31 08:58:34 +0200
commitde36d333c27c258bc05ecc0b6649fbdafcae619f (patch)
treed80a0dea660b4f74dc8031acfa9e9fa9a597f04e /util/cbfstool/cbfstool.c
parentdcccbd13966379eeaee79b08db0d58d024536ae8 (diff)
Add a (b)zImage parser to cbfstool
In the great tradition of LinuxBIOS this allows adding a kernel as payload. add-payload is extended to also allow adding an initial ramdisk (-I filename) and a command line (-C console=ttyS0). Change-Id: Iaca499a98b0adf0134e78d6bf020b6531a626aaa Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com> Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/3302 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
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]);