| Index: cbootimage.c
|
| diff --git a/cbootimage.c b/cbootimage.c
|
| index 1792749c6e3a75066b0f86a466379a701a861bfb..1df62387f9ecfe605b78d703f56569960c67d08a 100644
|
| --- a/cbootimage.c
|
| +++ b/cbootimage.c
|
| @@ -59,6 +59,7 @@ usage(void)
|
| printf(" options:\n");
|
| printf(" -h, --help, -? Display this message.\n");
|
| printf(" -d, --debug Output debugging information.\n");
|
| + printf(" -gbct Generate the new bct file.\n");
|
| printf(" configfile File with configuration information\n");
|
| printf(" imagename Output image name\n");
|
| }
|
| @@ -68,6 +69,8 @@ process_command_line(int argc, char *argv[], build_image_context *context)
|
| {
|
| int arg = 1;
|
|
|
| + context->generate_bct = 0;
|
| +
|
| while (arg < argc) {
|
| /* Process the next argument. */
|
| if (!strcmp(argv[arg], "-h") ||
|
| @@ -80,6 +83,9 @@ process_command_line(int argc, char *argv[], build_image_context *context)
|
| !strcmp(argv[arg], "--debug")) {
|
| enable_debug = 1;
|
| arg++;
|
| + } else if (!strcmp(argv[arg], "-gbct")) {
|
| + context->generate_bct = 1;
|
| + arg++;
|
| } else if (argv[arg][0] == '-') {
|
| printf("Illegal option %s\n", argv[arg]);
|
| usage();
|
| @@ -168,6 +174,20 @@ main(int argc, char *argv[])
|
| /* Parse & process the contents of the config file. */
|
| process_config_file(&context);
|
|
|
| + /* Generate the new bct file */
|
| + if (context.generate_bct != 0) {
|
| + /* Signing the bct. */
|
| + e = sign_bct(&context, context.bct);
|
| + if (e != 0)
|
| + printf("Signing BCT failed, error: %d.\n", e);
|
| +
|
| + fwrite(context.bct, 1, sizeof(nvboot_config_table),
|
| + context.raw_file);
|
| + printf("New BCT file %s has been successfully generated!\n",
|
| + context.image_filename);
|
| + goto fail;
|
| + }
|
| +
|
| /* Update the bct file */
|
| /* Update the add on file */
|
| e = update_addon_item(&context);
|
|
|