summaryrefslogtreecommitdiffstats
path: root/rbutil/mkimxboot/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/mkimxboot/main.c')
-rw-r--r--rbutil/mkimxboot/main.c56
1 files changed, 55 insertions, 1 deletions
diff --git a/rbutil/mkimxboot/main.c b/rbutil/mkimxboot/main.c
index 95fc226db1..68387c25c0 100644
--- a/rbutil/mkimxboot/main.c
+++ b/rbutil/mkimxboot/main.c
@@ -25,6 +25,22 @@
#include <string.h>
#include "mkimxboot.h"
+struct imx_variant_t
+{
+ const char *name;
+ enum imx_firmware_variant_t variant;
+};
+
+struct imx_variant_t imx_variants[] =
+{
+ { "default", VARIANT_DEFAULT },
+ { "zenxfi2-recovery", VARIANT_ZENXFI2_RECOVERY },
+ { "zenxfi2-nand", VARIANT_ZENXFI2_NAND },
+ { "zenxfi2-sd", VARIANT_ZENXFI2_SD },
+};
+
+#define NR_VARIANTS sizeof(imx_variants) / sizeof(imx_variants[0])
+
static void usage(void)
{
printf("Usage: elftosb [options | file]...\n");
@@ -35,6 +51,17 @@ static void usage(void)
printf(" -b <file>\tSet boot file\n");
printf(" -d/--debug\tEnable debug output\n");
printf(" -t <type>\tSet type (dualboot, singleboot, recovery)\n");
+ printf(" -v <v>\tSet variant\n");
+ printf(" -x\t\tDump device informations\n");
+ printf("Supported variants: (default is standard)\n");
+ printf(" ");
+ for(size_t i = 0; i < NR_VARIANTS; i++)
+ {
+ if(i != 0)
+ printf(", ");
+ printf("%s", imx_variants[i].name);
+ }
+ printf("\n");
printf("By default a dualboot image is built\n");
exit(1);
}
@@ -44,6 +71,7 @@ int main(int argc, char *argv[])
char *infile = NULL;
char *outfile = NULL;
char *bootfile = NULL;
+ enum imx_firmware_variant_t variant = VARIANT_DEFAULT;
enum imx_output_type_t type = IMX_DUALBOOT;
bool debug = false;
@@ -60,10 +88,12 @@ int main(int argc, char *argv[])
{"boot-file", required_argument, 0, 'b'},
{"debug", no_argument, 0, 'd'},
{"type", required_argument, 0, 't'},
+ {"variant", required_argument, 0, 'v'},
+ {"dev-info", no_argument, 0, 'x'},
{0, 0, 0, 0}
};
- int c = getopt_long(argc, argv, "?di:o:b:t:", long_options, NULL);
+ int c = getopt_long(argc, argv, "?di:o:b:t:v:x", long_options, NULL);
if(c == -1)
break;
switch(c)
@@ -98,6 +128,28 @@ int main(int argc, char *argv[])
return 1;
}
break;
+ case 'v':
+ {
+ for(size_t i = 0; i < NR_VARIANTS; i++)
+ {
+ if(strcmp(optarg, imx_variants[i].name) == 0)
+ {
+ variant = imx_variants[i].variant;
+ goto Lok;
+ }
+ }
+ printf("Invalid variant '%s'\n", optarg);
+ return 1;
+
+ Lok:
+ break;
+ }
+ case 'x':
+ dump_imx_dev_info("");
+ printf("variant mapping:\n");
+ 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;
default:
abort();
}
@@ -125,8 +177,10 @@ int main(int argc, char *argv[])
}
struct imx_option_t opt;
+ memset(&opt, 0, sizeof(opt));
opt.debug = debug;
opt.output = type;
+ opt.fw_variant = variant;
enum imx_error_t err = mkimxboot(infile, bootfile, outfile, opt);
printf("Result: %d\n", err);
return 0;