summaryrefslogtreecommitdiff
path: root/flash_tools/brillo-flashall-edison.sh
blob: 693bfd2fb7d287734672eb1df90ac17eb3ad6eaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash

# Only execute this script on a Brillo provisioned Edison.
# See your Brillo-Edison online information for initial provisioning and recovery.

set -e

function dir_with_file() {
    local file=${1}; shift
    local dir;
    for dir; do
        if [ -z "${dir}" ]; then continue; fi
        if [ -r "${dir}/${file}" ]; then
            echo ${dir}
            return
        fi
    done
    echo "Could not find ${file}, looked in $@" >&2
    return 1
}

LOCAL_DIR=$(dirname "${0}")

# Location of where the Brillo OS image is built.
_EDISON_IMG_DIR=$(dir_with_file boot.img \
    "${LOCAL_DIR}" \
    "${BRILLO_OUT_DIR}" \
    "${ANDROID_PRODUCT_OUT}")

# Location of binary blobs supplied by the vendor.
_EDISON_UBOOT_DIR=$(dir_with_file u-boot-edison.bin \
    "${LOCAL_DIR}" \
    "${ANDROID_BUILD_TOP}/device/intel/edison/uboot_firmware")

fastboot flash gpt     "${_EDISON_IMG_DIR}"/gpt.bin \
	flash u-boot   "${_EDISON_UBOOT_DIR}"/u-boot-edison.bin \
	flash boot_a   "${_EDISON_IMG_DIR}"/boot.img \
	flash system_a "${_EDISON_IMG_DIR}"/system.img \
	flash userdata "${_EDISON_IMG_DIR}"/userdata.img \
	oem set_active 0 "$@"