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>
This commit is contained in:
@@ -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]);
|
||||
|
Reference in New Issue
Block a user