[U-Boot] [PATCH 10/10] tools: Add support for Dove to kwboot

Sebastian Hesselbarth sebastian.hesselbarth at gmail.com
Sun Dec 2 15:36:22 CET 2012


On Dove kwboot can also be used to boot an u-boot image into RAM.
In contrast to Kirkwood, Dove does not support the UART boot mode
sequence but requires the UART boot mode to be selected through
strap pins. The SolidRun CuBox has a push button to allow uart
boot mode but fails on the boot sequence sent by kwboot.

This patch adds another cmdline option to allow to send a boot
image without the boot sequence and adds support for Dove.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth at gmail.com>
---
Cc: u-boot at lists.denx.de
Cc: Sebastian Hesselbarth <sebastian.hesselbarth at gmail.com>
Cc: Rabeeh Khoury <rabeeh at solid-run.com>
Cc: Albert Aribaud <albert.u.boot at aribaud.net>
Cc: Prafulla Wadaskar <prafulla at marvell.com>
Cc: Andy Fleming <afleming at gmail.com>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
Cc: Daniel Stodden <daniel.stodden at gmail.com>
Cc: Dieter Kiermaier <dk-arm-linux at gmx.de>
---
 tools/Makefile |    2 ++
 tools/kwboot.c |   44 ++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 686840a..845384f 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -73,6 +73,7 @@ BIN_FILES-$(CONFIG_MX28) += mxsboot$(SFX)
 BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX)
 BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
 BIN_FILES-$(CONFIG_KIRKWOOD) += kwboot$(SFX)
+BIN_FILES-$(CONFIG_DOVE) += kwboot$(SFX)
 
 # Source files which exist outside the tools directory
 EXT_OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += common/env_embedded.o
@@ -104,6 +105,7 @@ NOPED_OBJ_FILES-y += os_support.o
 OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
 NOPED_OBJ_FILES-y += ublimage.o
 OBJ_FILES-$(CONFIG_KIRKWOOD) += kwboot.o
+OBJ_FILES-$(CONFIG_DOVE) += kwboot.o
 
 # Don't build by default
 #ifeq ($(ARCH),ppc)
diff --git a/tools/kwboot.c b/tools/kwboot.c
index e773f01..199678a 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -293,6 +293,30 @@ kwboot_bootmsg(int tty, void *msg)
 }
 
 static int
+kwboot_bootmsg_uartmode(int tty)
+{
+	int rc;
+	char c;
+
+	kwboot_printv("Please reboot the target into UART boot mode...");
+
+	do {
+		rc = tcflush(tty, TCIOFLUSH);
+		if (rc)
+			break;
+
+		rc = kwboot_tty_recv(tty, &c, 1, KWBOOT_MSG_RSP_TIMEO);
+
+		kwboot_spinner();
+
+	} while (rc || c != NAK);
+
+	kwboot_printv("\n");
+
+	return rc;
+}
+
+static int
 kwboot_xm_makeblock(struct kwboot_block *block, const void *data,
 		    size_t size, int pnum)
 {
@@ -601,10 +625,11 @@ static void
 kwboot_usage(FILE *stream, char *progname)
 {
 	fprintf(stream,
-		"Usage: %s -b <image> [ -p ] [ -t ] "
+		"Usage: %s -b <image> [ -p ] [ -t ] [ -u ] "
 		"[-B <baud> ] <TTY>\n", progname);
 	fprintf(stream, "\n");
 	fprintf(stream, "  -b <image>: boot <image>\n");
+	fprintf(stream, "  -u: target requires UART boot mode (e.g. Dove)\n");
 	fprintf(stream, "  -p: patch <image> to type 0x69 (uart boot)\n");
 	fprintf(stream, "\n");
 	fprintf(stream, "  -t: mini terminal\n");
@@ -617,7 +642,7 @@ int
 main(int argc, char **argv)
 {
 	const char *ttypath, *imgpath;
-	int rv, rc, tty, term, prot, patch;
+	int rv, rc, tty, uartmode, term, prot, patch;
 	void *bootmsg;
 	void *img;
 	size_t size;
@@ -628,6 +653,7 @@ main(int argc, char **argv)
 	bootmsg = NULL;
 	imgpath = NULL;
 	img = NULL;
+	uartmode = 0;
 	term = 0;
 	patch = 0;
 	size = 0;
@@ -636,7 +662,7 @@ main(int argc, char **argv)
 	kwboot_verbose = isatty(STDOUT_FILENO);
 
 	do {
-		int c = getopt(argc, argv, "hb:ptB:");
+		int c = getopt(argc, argv, "hb:ptuB:");
 		if (c < 0)
 			break;
 
@@ -654,6 +680,10 @@ main(int argc, char **argv)
 			term = 1;
 			break;
 
+		case 'u':
+			uartmode = 1;
+			break;
+
 		case 'B':
 			speed = kwboot_tty_speed(atoi(optarg));
 			if (speed == -1)
@@ -702,7 +732,13 @@ main(int argc, char **argv)
 		}
 	}
 
-	if (bootmsg) {
+	if (uartmode) {
+		rc = kwboot_bootmsg_uartmode(tty);
+		if (rc) {
+			perror("bootmsg");
+			goto out;
+		}
+	} else if (bootmsg) {
 		rc = kwboot_bootmsg(tty, bootmsg);
 		if (rc) {
 			perror("bootmsg");
-- 
1.7.10.4



More information about the U-Boot mailing list