1
0
Fork 0
forked from len0rd/rockbox

mkimxboot: add an option to extract the of without processing

Change-Id: Ie370f152f4efff4428ee023a9211b82a77fd1df4
This commit is contained in:
Amaury Pouly 2013-01-26 18:24:06 +00:00
parent b6cad07f33
commit f6e4456cc4
3 changed files with 119 additions and 2 deletions

View file

@ -53,6 +53,7 @@ static void usage(void)
printf(" -t <type>\tSet type (dualboot, singleboot, recovery)\n");
printf(" -v <v>\tSet variant\n");
printf(" -x\t\tDump device informations\n");
printf(" -w\tExtract the original firmware\n");
printf("Supported variants: (default is standard)\n");
printf(" ");
for(size_t i = 0; i < NR_VARIANTS; i++)
@ -74,6 +75,7 @@ int main(int argc, char *argv[])
enum imx_firmware_variant_t variant = VARIANT_DEFAULT;
enum imx_output_type_t type = IMX_DUALBOOT;
bool debug = false;
bool extract_of = false;
if(argc == 1)
usage();
@ -93,7 +95,7 @@ int main(int argc, char *argv[])
{0, 0, 0, 0}
};
int c = getopt_long(argc, argv, "?di:o:b:t:v:x", long_options, NULL);
int c = getopt_long(argc, argv, "?di:o:b:t:v:xw", long_options, NULL);
if(c == -1)
break;
switch(c)
@ -150,6 +152,9 @@ int main(int argc, char *argv[])
for(int i = 0; i < sizeof(imx_variants) / sizeof(imx_variants[0]); i++)
printf(" %s -> variant=%d\n", imx_variants[i].name, imx_variants[i].variant);
break;
case 'w':
extract_of = true;
break;
default:
abort();
}
@ -165,7 +170,7 @@ int main(int argc, char *argv[])
printf("You must specify an output file\n");
return 1;
}
if(!bootfile)
if(!bootfile && !extract_of)
{
printf("You must specify an boot file\n");
return 1;
@ -176,6 +181,13 @@ int main(int argc, char *argv[])
return 1;
}
if(extract_of)
{
enum imx_error_t err = extract_firmware(infile, variant, outfile);
printf("Result: %d\n", err);
return 0;
}
struct imx_option_t opt;
memset(&opt, 0, sizeof(opt));
opt.debug = debug;