1#!/bin/sh
2# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6alert() {
7  echo "$*" >&2
8}
9
10die() {
11  alert "ERROR: $*"
12  exit 1
13}
14
15case "$(crossystem fwid 2>/dev/null || true)" in
16  Mario.* )
17    die "Sorry, your platform does not support booting from USB."
18    ;;
19
20  Alex.* | ZGB.* )
21    # For these legacy platforms, we need to re-flash firmware to get USB boot.
22    chromeos-firmwareupdate --mode=todev || die "Failed to enable USB boot."
23    ;;
24
25  "" )
26    die "Sorry, your firmware does not look like ChromeOS firmware."
27    ;;
28
29  * )
30    crossystem dev_boot_usb=1 2>/dev/null || die "Failed to enable USB boot."
31    echo "
32    SUCCESS: Booting any self-signed kernel from SSD/USB/SDCard slot is enabled.
33
34    Insert bootable media into USB / SDCard slot and press Ctrl-U in developer
35    screen to boot your self-signed image.
36    "
37    ;;
38esac
39