diff options
author | Julien Duraj <julien.duraj@linaro.org> | 2016-10-20 11:00:23 +0100 |
---|---|---|
committer | Julien Duraj <julien.duraj@linaro.org> | 2016-11-09 17:06:45 +0000 |
commit | 6800c812db4da841f148bc5179066e3ee9cc4813 (patch) | |
tree | 49a505bf54b53b9e4d28e743a91a6d45c4d86b5d /devices | |
parent | f2e5e33d1cd1c3361b8e887130f71c3869388941 (diff) |
Refactor scripts to new snapshots
Update device image snapshots urls
Refresh wget to new url pattern
Bundle vendor , radio and bootloader img where necessary
Remove the check for VENDOR_FINGERPRINT
Change-Id: Ib2fb635f97bb130c40cb48e62b54be240f2ca353
Diffstat (limited to 'devices')
-rw-r--r--[-rwxr-xr-x] | devices/flash_device.sh | 50 | ||||
-rwxr-xr-x | devices/flash_nexus5x.sh | 25 | ||||
-rwxr-xr-x | devices/flash_nexus6p.sh | 26 | ||||
-rwxr-xr-x | devices/flash_nexus9.sh | 21 |
4 files changed, 88 insertions, 34 deletions
diff --git a/devices/flash_device.sh b/devices/flash_device.sh index e0fc03e..3f9c493 100755..100644 --- a/devices/flash_device.sh +++ b/devices/flash_device.sh @@ -2,11 +2,9 @@ # Used for updating the Nexus system images. -readonly local_path=$(dirname "$0") source "${local_path}/../utils/utils.sh" source "${local_path}/../utils/utils_android.sh" -declare -a images=("boot.img" "system.img" "cache.img" "userdata.img") temp_dir= booted_to_fastboot="false" @@ -17,7 +15,6 @@ usage() { log I " SNAPSHOTS_URL := link to the Jenkins .img artifacts;" log I " BUILD_NO := the build that you would like to try;" log I " BOARD := the device that you will be flashing;" - log I " VENDOR_FINGERPRINT := the fingerprint of the vendor partition." log I " -h - help" log I " -v - verbose" log I " -f - skip the adb checks, the device is booted to fastboot" @@ -47,7 +44,7 @@ argument_parser() { download_image() { log I "Downloading $1 to ${temp_dir} ... " - safe wget "${SNAPSHOTS_URL}/${BUILD_NO}/$1" -O "${temp_dir}/$1" + safe wget "${SNAPSHOTS_URL}/${BUILD_NO}/${BUILD_TARGET}/$1" -O "${temp_dir}/$1" } @@ -64,20 +61,40 @@ download_images() { # Don't leave a mess behind and make sure we clean-up before exiting. trap clean_up EXIT - for image in "${images[@]}"; do + if [[ -v BOOTLOADER_IMAGE ]]; then + download_image "${BOOTLOADER_IMAGE}" + fi + if [[ -v RADIO_IMAGE ]]; then + download_image "${RADIO_IMAGE}" + fi + for image in "${USERSPACE_IMAGES[@]}"; do download_image "${image}" done } fastboot_flash_image() { - log I "Flashing $1 ..." - safe fastboot flash "${1%'.img'}" "${temp_dir}/$1" + log I "Flashing $2 to partition $1 ..." + safe fastboot flash "$1" "${temp_dir}/$2" } fastboot_flash_images() { - for image in "${images[@]}"; do - fastboot_flash_image "${image}" + if [[ -v BOOTLOADER_IMAGE ]]; then + fastboot_flash_image bootloader "${BOOTLOADER_IMAGE}" + safe fastboot reboot bootloader + sleep 5 + fi + + if [[ -v RADIO_IMAGE ]]; then + fastboot_flash_image radio "${RADIO_IMAGE}" + safe fastboot reboot bootloader + sleep 5 + fi + + for partition in "${!USERSPACE_IMAGES[@]}"; do + fastboot_flash_image "${partition}" "${USERSPACE_IMAGES[$partition]}" done + safe fastboot format userdata + safe fastboot format cache } adb_check_device() { @@ -97,17 +114,6 @@ adb_check_device() { fi } -adb_check_vendor_fingerprint() { - local adb_vendor_fingerprint=$(safe adb_shell_strip getprop ro.vendor.build.fingerprint) - if [[ ! ${adb_vendor_fingerprint} =~ ${VENDOR_FINGERPRINT} ]]; then - log E "Your device is using an untested vendor image: ${adb_vendor_fingerprint}" - log E "These images are known to work with the following vendor image: ${VENDOR_FINGERPRINT}" - log E "Please download and flash the appropriate image from:" - log E "https://developers.google.com/android/nexus/images" - exit 1 - fi -} - build_fastboot() { log I "Building fastboot..." # We want to make sure that fastboot is built from source and it is not part @@ -123,12 +129,11 @@ build_fastboot() { } check_environemnt() { - if ! [[ -v SNAPSHOTS_URL && -v BUILD_NO && -v BOARD && -v VENDOR_FINGERPRINT ]]; then + if ! [[ -v SNAPSHOTS_URL && -v BUILD_NO && -v BOARD ]]; then log E "Your environemnt does not have the following one of the following variables:" log E " SNAPSHOTS_URL := link to the Jenkins .img artifacts;" log E " BUILD_NO := the build that you would like to try;" log E " BOARD := the device that you will be flashing;" - log E " VENDOR_FINGERPRINT := the fingerprint of the vendor partition." exit 1 fi } @@ -141,7 +146,6 @@ main() { if ! ${booted_to_fastboot}; then adb_check_device - adb_check_vendor_fingerprint safe adb reboot-bootloader fi download_images diff --git a/devices/flash_nexus5x.sh b/devices/flash_nexus5x.sh index 3b4286c..c8570e9 100755 --- a/devices/flash_nexus5x.sh +++ b/devices/flash_nexus5x.sh @@ -4,10 +4,23 @@ readonly local_path=$(dirname "$0") # NOTE: Only modify these variables; all the other changes should be applied to flash_device.sh. -export BOARD="bullhead" -export BUILD_NO="393" -export SNAPSHOTS_URL="http://snapshots.linaro.org/android/linaro-art-tip-build-nexus5x-MicroBenchmarks-Baseline" -export VENDOR_FINGERPRINT="google/bullhead/bullhead:6.0.1/MTC19T/2741993:user/release-keys" +# shellcheck disable=SC2034 +BOARD="bullhead" +# shellcheck disable=SC2034 +BUILD_NO="4" +# shellcheck disable=SC2034 +BUILD_TARGET="aosp_bullhead-userdebug" +# shellcheck disable=SC2034 +SNAPSHOTS_URL="http://snapshots.linaro.org/android/android-generic-build/" +# shellcheck disable=SC2034 +BOOTLOADER_IMAGE="bootloader-bullhead-bhz11f.img" +# shellcheck disable=SC2034 +RADIO_IMAGE="radio-bullhead-m8994f-2.6.33.2.14.img" +declare -A USERSPACE_IMAGES +# shellcheck disable=SC2034 +USERSPACE_IMAGES=([boot]="boot.img" + [system]="system.img" + [vendor]="vendor.img") -# Call main script. -"${local_path}/flash_device.sh" "$@" +# Source main script. +source "${local_path}/flash_device.sh" "$@" diff --git a/devices/flash_nexus6p.sh b/devices/flash_nexus6p.sh new file mode 100755 index 0000000..2a6c4dc --- /dev/null +++ b/devices/flash_nexus6p.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Convenience wrapper script! It exports variables used by ./flash_device.sh +readonly local_path=$(dirname "$0") + +# NOTE: Only modify these variables; all the other changes should be applied to flash_device.sh. +# shellcheck disable=SC2034 +BOARD="angler" +# shellcheck disable=SC2034 +BUILD_NO="5" +# shellcheck disable=SC2034 +BUILD_TARGET="aosp_angler-userdebug" +# shellcheck disable=SC2034 +SNAPSHOTS_URL="http://snapshots.linaro.org/android/android-generic-build/" +# shellcheck disable=SC2034 +BOOTLOADER_IMAGE="bootloader-angler-angler-03.61.img" +# shellcheck disable=SC2034 +RADIO_IMAGE="radio-angler-angler-03.72.img" +declare -A USERSPACE_IMAGES +# shellcheck disable=SC2034 +USERSPACE_IMAGES=([boot]="boot.img" + [system]="system.img" + [vendor]="vendor.img") + +# Source main script. +source "${local_path}/flash_device.sh" "$@" diff --git a/devices/flash_nexus9.sh b/devices/flash_nexus9.sh index a2bf1d2..4d524be 100755 --- a/devices/flash_nexus9.sh +++ b/devices/flash_nexus9.sh @@ -4,10 +4,21 @@ readonly local_path=$(dirname "$0") # NOTE: Only modify these variables; all the other changes should be applied to flash_device.sh. -export BOARD="flounder" -export BUILD_NO="663" -export SNAPSHOTS_URL="http://snapshots.linaro.org/android/linaro-art-tip-build-nexus9-MicroBenchmarks-Baseline" -export VENDOR_FINGERPRINT="google/volantis/flounder:6.0.1/MMB29S/2489379:user/release-keys" +# shellcheck disable=SC2034 +BOARD="flounder" +# shellcheck disable=SC2034 +BUILD_NO="3" +# shellcheck disable=SC2034 +BUILD_TARGET="aosp_flounder-userdebug" +# shellcheck disable=SC2034 +SNAPSHOTS_URL="http://snapshots.linaro.org/android/android-generic-build/" +# shellcheck disable=SC2034 +BOOTLOADER_IMAGE="bootloader-flounder-3.48.0.0139.img" +declare -A USERSPACE_IMAGES +# shellcheck disable=SC2034 +USERSPACE_IMAGES=([boot]="boot.img" + [system]="system.img" + [vendor]="vendor.img") # Call main script. -"${local_path}/flash_device.sh" "$@" +source "${local_path}/flash_device.sh" "$@" |