diff options
author | David Zeuthen <zeuthen@google.com> | 2015-10-01 16:40:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-10-01 16:40:21 +0000 |
commit | 7f78980823b5002d12a9c4d99d58f605891baeb1 (patch) | |
tree | 8e4a1e018b0dd2b1854b8e86b74c2aa4210c07b5 | |
parent | c2b743c4ecfc240c0ce275e4cfc031f95637d745 (diff) | |
parent | aafce087117c928dca2ea724ef92b61f3feeb1f4 (diff) | |
download | dragonboard-7f78980823b5002d12a9c4d99d58f605891baeb1.tar.gz |
Merge "dragonboard: Move to using 'provision' from build/envsetup.sh" into mnc-brillo-dev
-rw-r--r-- | BoardConfig.mk | 3 | ||||
-rwxr-xr-x | brillo-provision-dragonboard410c.sh | 192 | ||||
-rw-r--r-- | partitions/README | 3 | ||||
-rw-r--r-- | partitions/misc.bin | bin | 0 -> 1048576 bytes | |||
-rw-r--r-- | partitions/partition-tables.bin | bin | 0 -> 34304 bytes | |||
-rwxr-xr-x | provision-device | 28 |
6 files changed, 33 insertions, 193 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk index 4b28d93..f57fbf5 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -27,4 +27,5 @@ BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456 TARGET_BOARD_INFO_FILE := device/qcom/dragonboard/board-info.txt PRODUCT_COPY_FILES += \ - device/qcom/dragonboard/fstab:root/fstab.${soc_name} + device/qcom/dragonboard/fstab:root/fstab.${soc_name} \ + device/qcom/dragonboard/provision-device:provision-device diff --git a/brillo-provision-dragonboard410c.sh b/brillo-provision-dragonboard410c.sh deleted file mode 100755 index e80a165..0000000 --- a/brillo-provision-dragonboard410c.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/bash - -# -# Copyright 2015 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set -e - -# Location of where the Brillo OS image is built. -BRILLO_OUT_DIR=${BRILLO_OUT_DIR:-${ANDROID_PRODUCT_OUT}} - -# Location of binary blobs supplied by the vendor. -VENDOR_DIR=$(dirname "${0}")/vendor_partitions - -# Check if user really wants to do this. -echo "This script will repartition your Dragonboard 410c device so it " -echo "can be used with Brillo." -echo "" -echo "When the script completes, the device will contain OS image from" -echo "${BRILLO_OUT_DIR} and vendor-specific blobs" -echo "from ${VENDOR_DIR}" -echo "" -echo "ALL DATA ON THE DEVICE WILL BE IRREVOCABLY ERASED." -echo "" -echo "Before continuing, please ensure that your device is connected " -echo "and in fastboot mode. This can be achieved by either powering" -echo "the board with Vol- pressed down or by issuing the command" -echo "\"reboot bootloader\" from a shell on the device." -echo "" -read -p "Are you sure you want to do this (yes/no)? " -if [[ "${REPLY}" != "yes" ]] ; then - echo "Not taking any action. Exiting." - exit 1 -fi - -# Check that user has gdisk installed. -if ! SGDISK="$(type -p sgdisk)" || [ -z "${SGDISK}" ] ; then - echo "" - echo "The sgdisk command is not installed. You may install it via " - echo "e.g. \"sudo apt-get install gdisk\"." - exit 1 -fi - -# Create temporary working directory and ensure we clean it up when -# we're done. -WORKDIR=$(mktemp --tmpdir --directory brillo-provisioning.XXXXXXXXXX) - -function cleanup() { - rm -rf "${WORKDIR}" -} - -trap cleanup INT -trap cleanup EXIT - -DISK_IMAGE=${WORKDIR}/diskimage.bin -DISK_IMAGE_SIZE_BYTES=$((2048*1024*1024)) - -# The GUID partition type for a Linux partition. -LINUX_GUID_TYPE="0fc63daf-8483-4772-8e79-3d69d8477de4" - -# The BOARD_PARTITONS variable is used to specify what the -# partitioning looks like. -BOARD_PARTITIONS="" - -# Vendor specific partitions. -BOARD_PARTITIONS+="modem:ebd0a0a2-b9e5-4433-87c0-68b6b72699c7:65536K:${VENDOR_DIR}/modem.bin " -BOARD_PARTITIONS+="fsc:57b90a16-22c9-e33b-8f5d-0e81686a68cb:1K:${VENDOR_DIR}/fsc.bin " -BOARD_PARTITIONS+="ssd:2c86e742-745e-4fdd-bfd8-b6a7ac638772:8K: " -BOARD_PARTITIONS+="sbl1:dea0ba2c-cbdd-4805-b4f9-f428251c3e98:512K:${VENDOR_DIR}/sbl1.bin " -BOARD_PARTITIONS+="sbl1bak:ebd0a0a2-b9e5-4433-87c0-68b6b72699c7:512K:${VENDOR_DIR}/sbl1.bin " -BOARD_PARTITIONS+="rpm:098df793-d712-413d-9d4e-89d711772228:512K:${VENDOR_DIR}/rpm.bin " -BOARD_PARTITIONS+="rpmbak:ebd0a0a2-b9e5-4433-87c0-68b6b72699c7:512K:${VENDOR_DIR}/rpm.bin " -BOARD_PARTITIONS+="tz:a053aa7f-40b8-4b1c-ba08-2f68ac71a4f4:512K:${VENDOR_DIR}/tz.bin " -BOARD_PARTITIONS+="tzbak:ebd0a0a2-b9e5-4433-87c0-68b6b72699c7:512K:${VENDOR_DIR}/tz.bin " -BOARD_PARTITIONS+="hyp:e1a6a689-0c8d-4cc6-b4e8-55a4320fbd8a:512K:${VENDOR_DIR}/hyp.bin " -BOARD_PARTITIONS+="hypbak:ebd0a0a2-b9e5-4433-87c0-68b6b72699c7:512K:${VENDOR_DIR}/hyp.bin " -BOARD_PARTITIONS+="modemst1:ebbeadaf-22c9-e33b-8f5d-0e81686a68cb:1536K:${VENDOR_DIR}/modemst1.bin " -BOARD_PARTITIONS+="modemst2:0a288b1f-22c9-e33b-8f5d-0e81686a68cb:1536K:${VENDOR_DIR}/modemst2.bin " -BOARD_PARTITIONS+="DDR:20a0c19c-286a-42fa-9ce7-f64c3226a794:32K:${VENDOR_DIR}/DDR.bin " -BOARD_PARTITIONS+="fsg:638ff8e2-22c9-e33b-8f5d-0e81686a68cb:1536K:${VENDOR_DIR}/fsg.bin " -BOARD_PARTITIONS+="sec:303e6ac3-af15-4c54-9e9b-d9a8fbecf401:16K:${VENDOR_DIR}/sec.bin " -BOARD_PARTITIONS+="aboot:400ffdcd-22e0-47e7-9a23-f16ed9382388:1024K:${VENDOR_DIR}/aboot.bin " -BOARD_PARTITIONS+="abootbak:ebd0a0a2-b9e5-4433-87c0-68b6b72699c7:1024K:${VENDOR_DIR}/aboot.bin " - -# Setup the Android misc partition with slot_suffix (at offset 864, -# see bootable/recovery/bootloader.h) indicating it should use the -# first slot. Also include boot_control_copy specific data (see -# system/extras/boot_control_copy/bootinfo.h). -MISC_PART="${WORKDIR}/misc.bin" -MISC_PART_SIZE_BYTES=$((1024*1024)) -MISC_PART_SLOT_SUFFIX_OFFSET=864 -SLOT_SUFFIX_DATA="_a\\x00\x00BCc\\x00\\x00\\x01" -dd if=/dev/zero of="${MISC_PART}" bs=1 count=0 \ - seek=${MISC_PART_SIZE_BYTES} status=none -echo -n -e ${SLOT_SUFFIX_DATA} > "${WORKDIR}/slot_suffix" -dd if="${WORKDIR}/slot_suffix" of="${MISC_PART}" bs=1 count=32 \ - seek=${MISC_PART_SLOT_SUFFIX_OFFSET} status=none conv=notrunc -BOARD_PARTITIONS+="misc:${LINUX_GUID_TYPE}:${MISC_PART_SIZE_BYTES}:${MISC_PART} " - -# The boot partition, used by system/extras/boot_control_copy as the -# destination when making a slot active. -BOARD_PARTITIONS+="boot:${LINUX_GUID_TYPE}:32M:${BRILLO_OUT_DIR}/boot.img " - -# Brillo-specific partitions. - -# TODO(zeuthen): For now, this partition type GUID is used for all -# partitions. We likely want type GUIDs depending on A/B and usage. -BRILLO_GUID_TYPE="7762a6b9-9d60-476a-8d40-a6a8850f80e9" - -# For now, put the OS in both slot A and B (in the future once updates -# are working, only put it in slot A). -BOARD_PARTITIONS+="boot_a:${BRILLO_GUID_TYPE}:32M:${BRILLO_OUT_DIR}/boot.img " -BOARD_PARTITIONS+="system_a:${BRILLO_GUID_TYPE}:256M:${BRILLO_OUT_DIR}/system.img " -BOARD_PARTITIONS+="oem_a:${BRILLO_GUID_TYPE}:64M: " -BOARD_PARTITIONS+="boot_b:${BRILLO_GUID_TYPE}:32M:${BRILLO_OUT_DIR}/boot.img " -BOARD_PARTITIONS+="system_b:${BRILLO_GUID_TYPE}:256M:${BRILLO_OUT_DIR}/system.img " -BOARD_PARTITIONS+="oem_b:${BRILLO_GUID_TYPE}:64M: " - -# Last partition takes up the rest of the disk - we use this for -# userdata. -BOARD_PARTITIONS+="userdata:${BRILLO_GUID_TYPE}:256M:${BRILLO_OUT_DIR}/userdata.img " - -# Create disk image file and add partitions specified in -# BOARD_PARTITIONS in order. -echo "Creating sparse disk image of size ${DISK_IMAGE_SIZE_BYTES} bytes." -rm -f "${DISK_IMAGE}" -dd if=/dev/zero of="${DISK_IMAGE}" bs=1 count=0 \ - seek=${DISK_IMAGE_SIZE_BYTES} status=none -${SGDISK} --clear --mbrtogpt "${DISK_IMAGE}" > /dev/null - -partnumber=1 -for i in ${BOARD_PARTITIONS}; do - arr=(${i//:/ }) - partname=${arr[0]} - parttype=${arr[1]} - partsize=${arr[2]} - partdata=${arr[3]} - offset_sectors=$(${SGDISK} --first-aligned-in-largest ${DISK_IMAGE}) - echo "Creating partition ${partnumber}: \"${partname}\" of size ${partsize}" - ${SGDISK} --new=${partnumber}:0:+${partsize} \ - --typecode=${partnumber}:${parttype} \ - --change-name=${partnumber}:${partname} \ - ${DISK_IMAGE} > /dev/null - - # TODO(zeuthen): Extend this tool so it can be used to create disk - # images suitable for SD cards. Basically, it entails only copying - # the blobs into place like it's done in the commented code below - # and then putting the disk image somewhere the user expects. - # - # if [ "${partdata}" != "" ] ; then - # dd if=${partdata} of=${DISK_IMAGE} bs=512 seek=${offset_sectors} \ - # count=${partsize} iflag=count_bytes conv=notrunc status=none - # fi - partnumber=$((${partnumber} + 1)) -done - -# Now send to device via fastboot - first we need to compute a file -# that contains the MBR, primary GPT and secondary GPT concatenated -# together. This is board-specific and what the board expects. -PARTITION_TABLES_FILE=${WORKDIR}/partition-tables.bin -dd if=${DISK_IMAGE} of=${PARTITION_TABLES_FILE} bs=512 count=34 status=none -dd if=${DISK_IMAGE} of=${PARTITION_TABLES_FILE} bs=512 seek=34 count=33 \ - skip=$((${DISK_IMAGE_SIZE_BYTES}/512 - 33)) count=33 conv=notrunc status=none - -# Send partition file. -fastboot flash partition ${PARTITION_TABLES_FILE} - -# Send each individual partition. -partnumber=1 -for i in $BOARD_PARTITIONS; do - arr=(${i//:/ }) - partname=${arr[0]} - parttype=${arr[1]} - partsize=${arr[2]} - partdata=${arr[3]} - if [ "${partdata}" != "" ] ; then - fastboot flash ${partname} ${partdata} - fi - partnumber=$((${partnumber} + 1)) -done diff --git a/partitions/README b/partitions/README new file mode 100644 index 0000000..52f8e35 --- /dev/null +++ b/partitions/README @@ -0,0 +1,3 @@ +This directory contain partitions not supplied by the vendor and +currently used for provisioning. In the future these partitions will +be generated as part of the build process. diff --git a/partitions/misc.bin b/partitions/misc.bin Binary files differnew file mode 100644 index 0000000..3a9f72d --- /dev/null +++ b/partitions/misc.bin diff --git a/partitions/partition-tables.bin b/partitions/partition-tables.bin Binary files differnew file mode 100644 index 0000000..41bbd62 --- /dev/null +++ b/partitions/partition-tables.bin diff --git a/provision-device b/provision-device new file mode 100755 index 0000000..1856621 --- /dev/null +++ b/provision-device @@ -0,0 +1,28 @@ +#!/bin/sh + +fastboot \ + flash partition ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/partitions/partition-tables.bin \ + flash modem ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/modem.bin \ + flash fsc ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/fsc.bin \ + flash sbl1 ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/sbl1.bin \ + flash sbl1bak ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/sbl1.bin \ + flash rpm ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/rpm.bin \ + flash rpmbak ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/rpm.bin \ + flash tz ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/tz.bin \ + flash tzbak ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/tz.bin \ + flash hyp ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/hyp.bin \ + flash hypbak ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/hyp.bin \ + flash modemst1 ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/modemst1.bin \ + flash modemst2 ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/modemst2.bin \ + flash DDR ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/DDR.bin \ + flash fsg ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/fsg.bin \ + flash sec ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/sec.bin \ + flash aboot ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/aboot.bin \ + flash abootbak ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/vendor_partitions/aboot.bin \ + flash misc ${ANDROID_BUILD_TOP}/device/qcom/dragonboard/partitions/misc.bin \ + flash boot ${ANDROID_PRODUCT_OUT}/boot.img \ + flash boot_a ${ANDROID_PRODUCT_OUT}/boot.img \ + flash system_a ${ANDROID_PRODUCT_OUT}/system.img \ + flash boot_b ${ANDROID_PRODUCT_OUT}/boot.img \ + flash system_b ${ANDROID_PRODUCT_OUT}/system.img \ + flash userdata ${ANDROID_PRODUCT_OUT}/userdata.img "$@" |