aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike J. Chen <mjchen@google.com>2012-03-14 16:51:51 -0700
committerMike J. Chen <mjchen@google.com>2012-03-14 16:51:51 -0700
commit6671d3fe57d47e341530a7c6deb3c8d43bad202e (patch)
tree4489c9a64395dbf55b9138875a0922680dfa19a4
parent9bd0eb3e4504f0f71cb21ad7199c1884775bf4d3 (diff)
downloaduboot-6671d3fe57d47e341530a7c6deb3c8d43bad202e.tar.gz
FASTBOOT: Don't allow cmd_fastboot to be run twice
It's possible to make it work, but it's not a typical path and we'd rather make it an error than add support for it when it's going to be rarely used and will probably be fragile. Change-Id: I9a6f801a37c1cbe6e8c69ba6eb132d3ec116baa8 Signed-off-by: Mike J. Chen <mjchen@google.com>
-rw-r--r--common/cmd_fastboot.c13
-rw-r--r--include/fastboot.h4
2 files changed, 15 insertions, 2 deletions
diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index 0cef2ec06..b7d883088 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -2122,6 +2122,19 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc,
return -1;
}
+ /* currently we don't allow restarting fastboot if you've run
+ * it before and exited to u-boot prompt. it's possible to
+ * support, but there's are edge cases that we're not
+ * sure the answer to (e.g. do we reload the partition table
+ * or not) and it's just not a common situation so we're
+ * just saying no for now.
+ */
+ if (priv.flag & FASTBOOT_FLAG_HAS_RUN) {
+ printf("fastboot can't be restarted\n");
+ return -1;
+ }
+ priv.flag |= FASTBOOT_FLAG_HAS_RUN;
+
printf("Starting fastboot protocol\n");
board_fbt_start();
diff --git a/include/fastboot.h b/include/fastboot.h
index 044b4a21f..ae131316b 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -101,8 +101,8 @@
#define FASTBOOT_RESPONSE_SIZE 64
/* Flags */
-#define FASTBOOT_FLAG_RESPONSE 1
-#define FASTBOOT_FLAG_DOWNLOAD 1
+#define FASTBOOT_FLAG_RESPONSE 0x1
+#define FASTBOOT_FLAG_HAS_RUN 0x2
#define FASTBOOT_MAX_INFO_NAMELEN 32
#define FASTBOOT_MAX_NUM_DEVICE_INFO 32