1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2011 by Amaury Pouly
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
26 #include "mkimxboot.h"
28 static void usage(void)
30 printf("Usage: elftosb [options | file]...\n");
32 printf(" -?/--help\tDisplay this message\n");
33 printf(" -o <file>\tSet output file\n");
34 printf(" -i <file>\tSet input file\n");
35 printf(" -b <file>\tSet boot file\n");
36 printf(" -d/--debug\tEnable debug output\n");
37 printf(" -t <type>\tSet type (dualboot, singleboot, recovery)\n");
38 printf("By default a dualboot image is built\n");
42 int main(int argc
, char *argv
[])
46 char *bootfile
= NULL
;
47 enum imx_output_type_t type
= IMX_DUALBOOT
;
55 static struct option long_options
[] =
57 {"help", no_argument
, 0, '?'},
58 {"in-file", no_argument
, 0, 'i'},
59 {"out-file", required_argument
, 0, 'o'},
60 {"boot-file", required_argument
, 0, 'b'},
61 {"debug", no_argument
, 0, 'd'},
62 {"type", required_argument
, 0, 't'},
66 int c
= getopt_long(argc
, argv
, "?di:o:b:t:", long_options
, NULL
);
89 if(strcmp(optarg
, "dualboot") == 0)
91 else if(strcmp(optarg
, "singleboot") == 0)
92 type
= IMX_SINGLEBOOT
;
93 else if(strcmp(optarg
, "recovery") == 0)
97 printf("Invalid boot type '%s'\n", optarg
);
108 printf("You must specify an input file\n");
113 printf("You must specify an output file\n");
118 printf("You must specify an boot file\n");
123 printf("Extra arguments on command line\n");
127 struct imx_option_t opt
;
130 enum imx_error_t err
= mkimxboot(infile
, bootfile
, outfile
, opt
);
131 printf("Result: %d\n", err
);