diff --git a/scripts/kwboot.c b/scripts/kwboot.c index afc8493..33c94b3 100644 --- a/scripts/kwboot.c +++ b/scripts/kwboot.c @@ -1,5 +1,6 @@ /* - * Boot a Marvell Kirkwood SoC, with Xmodem over UART0. + * Boot a Marvell SoC, with Xmodem over UART0. + * supports Kirkwood, Dove, Armada 370, Armada XP * * (c) 2012 Daniel Stodden * @@ -180,6 +181,9 @@ int rc; ssize_t n; + if (!buf) + return 0; + rc = -1; do { @@ -264,7 +268,10 @@ int rc; char c; - kwboot_printv("Sending boot message. Please reboot the target..."); + if (msg == NULL) + kwboot_printv("Please reboot the target into UART boot mode..."); + else + kwboot_printv("Sending boot message. Please reboot the target..."); do { rc = tcflush(tty, TCIOFLUSH); @@ -580,10 +587,13 @@ kwboot_usage(FILE *stream, char *progname) { fprintf(stream, - "Usage: %s [-d | -b ] [ -p ] [ -t ] " - "[-B ] \n", progname); + "Usage: %s [-d | -b | -D ] [ -t ] [-B ] \n", + progname); fprintf(stream, "\n"); - fprintf(stream, " -b : boot \n"); + fprintf(stream, + " -b : boot with preamble (Kirkwood, Armada 370/XP)\n"); + fprintf(stream, + " -D : boot without preamble (Dove)\n"); fprintf(stream, " -d: enter debug mode\n"); fprintf(stream, "\n"); fprintf(stream, " -t: mini terminal\n"); @@ -616,7 +626,7 @@ kwboot_verbose = isatty(STDOUT_FILENO); do { - int c = getopt(argc, argv, "hb:dptB:"); + int c = getopt(argc, argv, "hb:dtB:D:"); if (c < 0) break; @@ -626,6 +636,11 @@ imgpath = optarg; break; + case 'D': + bootmsg = NULL; + imgpath = optarg; + break; + case 'd': debugmsg = kwboot_msg_debug; break; @@ -675,9 +690,7 @@ perror("debugmsg"); goto out; } - } - - if (bootmsg) { + } else { rc = kwboot_bootmsg(tty, bootmsg); if (rc) { perror("bootmsg");