summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2012-09-12 11:39:18 +0800
committerGerrit <chrome-bot@google.com>2012-09-12 20:39:46 -0700
commitb4b324a8b42f6c21ec9f61e3999f91c1c0d27e52 (patch)
tree92dc0de24b8382fe9d5c34614e9a2a14a99e6a18
parent22bd8b0c29b485ccdaa4f63e6fdac9f097b60aab (diff)
downloadvboot-b4b324a8b42f6c21ec9f61e3999f91c1c0d27e52.tar.gz
utility: Add "enable_dev_usb_boot".
A shortcut and easier way to enable USB booting without always calling the huge firmware updater. BRANCH=none BUG=none TEST=./enable_dev_usb_boot # successfully set dev_usb_boot value. Change-Id: I9ebb3ce79ef58bc0a32926866d5e1827a92b6e74 Reviewed-on: https://gerrit.chromium.org/gerrit/33046 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org>
-rw-r--r--utility/Makefile5
-rwxr-xr-xutility/enable_dev_usb_boot38
2 files changed, 43 insertions, 0 deletions
diff --git a/utility/Makefile b/utility/Makefile
index f3808987..68e09413 100644
--- a/utility/Makefile
+++ b/utility/Makefile
@@ -42,6 +42,7 @@ TARGET_NAMES = $(AU_TARGETS) \
dev_make_keypair \
dev_sign_file \
dev_debug_vboot \
+ enable_dev_usb_boot \
vbutil_what_keys
ifeq ($(MINIMAL),)
@@ -165,6 +166,10 @@ ${BUILD_ROOT}/dev_debug_vboot: dev_debug_vboot
cp -f $< $@
chmod +x $@
+${BUILD_ROOT}/enable_dev_usb_boot: enable_dev_usb_boot
+ cp -f $< $@
+ chmod +x $@
+
${BUILD_ROOT}/vbutil_what_keys: vbutil_what_keys
cp -f $< $@
chmod +x $@
diff --git a/utility/enable_dev_usb_boot b/utility/enable_dev_usb_boot
new file mode 100755
index 00000000..8cf16bab
--- /dev/null
+++ b/utility/enable_dev_usb_boot
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+alert() {
+ echo "$*" >&2
+}
+
+die() {
+ alert "ERROR: $*"
+ exit 1
+}
+
+case "$(crossystem fwid 2>/dev/null || true)" in
+ Mario.* )
+ die "Sorry, your platform does not support booting from USB."
+ ;;
+
+ Alex.* | ZGB.* )
+ # For these legacy platforms, we need to re-flash firmware to get USB boot.
+ chromeos-firmwareupdate --mode=todev || die "Failed to enable USB boot."
+ ;;
+
+ "" )
+ die "Sorry, your firmware does not look like ChromeOS firmware."
+ ;;
+
+ * )
+ crossystem dev_boot_usb=1 2>/dev/null || die "Failed to enable USB boot."
+ echo "
+ SUCCESS: Booting any self-signed kernel from SSD/USB/SDCard slot is enabled.
+
+ Insert bootable media into USB / SDCard slot and press Ctrl-U in developer
+ screen to boot your self-signed image.
+ "
+ ;;
+esac