summaryrefslogtreecommitdiff
path: root/flash_tools/brillo-flashall-edison.sh
blob: 761301b98e5e5b9bb675477b23522a0c658d1d26 (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
42
43
44
45
#!/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.
OS=$(dir_with_file boot.img \
    "${ANDROID_PROVISION_OS_PARTITIONS}" \
    "${LOCAL_DIR}" \
    "${BRILLO_OUT_DIR}" \
    "${ANDROID_PRODUCT_OUT}")

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

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