Commit 2aa86681 authored by Marek Vasut's avatar Marek Vasut
Browse files

mxssb: Make input files paths configurable



Parse command line options so the input files from which u-boot.sb
is generated can be configured at runtime using these options.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent 016e4b8c
......@@ -26,12 +26,7 @@
#include "mxssb.h"
/* Tweak here only if needed! */
const char *output_filename = "u-boot.sb";
const char *spl_filename = "spl/u-boot-spl.bin";
const char *uboot_filename = "u-boot.bin";
const int verbose_boot = 1;
static int verbose_boot = 0;
#define SB_IVT_LOAD_ADDR 0x8000
#define SB_SPL_LOAD_ADDR 0x0
......@@ -526,11 +521,62 @@ static int sb_save_image(const char *filename, uint8_t *image, int len)
return 0;
}
int main(void)
static void print_help(const char *pn)
{
printf(
"Usage: %s -s FILE -u FILE -o FILE [-v] [-h]\n\n"
" -s FILE ..... path to U-Boot SPL (spl/u-boot-spl.bin)\n"
" -u FILE ..... path to U-Boot (u-boot.bin)\n"
" -o FILE ..... path to output SB file (u-boot.sb)\n"
" -v .......... verbose boot output from BootROM\n"
" -h .......... print help\n", pn);
}
int main(int argc, char **argv)
{
uint8_t *image;
int image_size;
int ret;
int opt;
char *output_filename = NULL;
char *spl_filename = NULL;
char *uboot_filename = NULL;
while ((opt = getopt(argc, argv, "s:u:o:v:h")) != -1) {
switch (opt) {
case 's':
spl_filename = optarg;
break;
case 'u':
uboot_filename = optarg;
break;
case 'o':
output_filename = optarg;
break;
case 'v':
verbose_boot = 1;
break;
case 'h':
print_help(argv[0]);
return -1;
default:
fprintf(stderr, "ERROR: Invalid option '%c'.\n\n", opt);
print_help(argv[0]);
return -1;
}
}
if (optind >= argc) {
fprintf(stderr, "ERROR: Expected argument after options!\n\n");
print_help(argv[0]);
return -1;
}
if (!spl_filename || !uboot_filename || !output_filename) {
fprintf(stderr, "ERROR: Input files not specified!\n\n");
print_help(argv[0]);
return -1;
}
ret = sb_load_binary(spl_filename, 1);
if (ret)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment