diff options
author | David Zeuthen <zeuthen@google.com> | 2015-08-17 13:27:44 -0400 |
---|---|---|
committer | David Zeuthen <zeuthen@google.com> | 2015-08-18 11:42:58 -0400 |
commit | 6828ffa3619913fa6b89a6876008488900371a51 (patch) | |
tree | e3ed0fe462f9ede2ed9511af97627123eb036c6b | |
parent | f5d7d72a52e8df80222c5629f64006d859b1eb86 (diff) | |
download | dragonboard-6828ffa3619913fa6b89a6876008488900371a51.tar.gz |
Add provisioning script and vendor blobs for Dragonboard 410c.
The vendors blobs are from dragonboard410c_sdcard_install_android-40-66.zip
Change-Id: I59ffae777a69b9d0ad01ae22d756c5804d0fa49d
-rwxr-xr-x | brillo-provision-dragonboard410c.sh | 187 | ||||
-rw-r--r-- | vendor_partitions/DDR.bin | bin | 0 -> 32768 bytes | |||
-rw-r--r-- | vendor_partitions/aboot.bin | bin | 0 -> 1048576 bytes | |||
-rw-r--r-- | vendor_partitions/fsc.bin | bin | 0 -> 1024 bytes | |||
-rw-r--r-- | vendor_partitions/fsg.bin | bin | 0 -> 1572864 bytes | |||
-rw-r--r-- | vendor_partitions/hyp.bin | bin | 0 -> 524288 bytes | |||
-rw-r--r-- | vendor_partitions/modem.bin | bin | 0 -> 67108864 bytes | |||
-rw-r--r-- | vendor_partitions/modemst1.bin | bin | 0 -> 1572864 bytes | |||
-rw-r--r-- | vendor_partitions/modemst2.bin | bin | 0 -> 1572864 bytes | |||
-rw-r--r-- | vendor_partitions/rpm.bin | bin | 0 -> 524288 bytes | |||
-rw-r--r-- | vendor_partitions/sbl1.bin | bin | 0 -> 524288 bytes | |||
-rw-r--r-- | vendor_partitions/sec.bin | bin | 0 -> 16384 bytes | |||
-rw-r--r-- | vendor_partitions/tz.bin | bin | 0 -> 524288 bytes |
13 files changed, 187 insertions, 0 deletions
diff --git a/brillo-provision-dragonboard410c.sh b/brillo-provision-dragonboard410c.sh new file mode 100755 index 0000000..32b2292 --- /dev/null +++ b/brillo-provision-dragonboard410c.sh @@ -0,0 +1,187 @@ +#!/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_BUILD_TOP}/out/target/product/brillo_dragon} + +# 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 " + +# The Android misc partition. +# +# TODO(zeuthen): Use a host-version of bootctl to populate the misc +# partition with data indicating that slot A is GOOD. +BOARD_PARTITIONS+="misc:${LINUX_GUID_TYPE}:1024K: " + +# TODO(zeuthen): replace {boot,system} by just a single boot partition +# containing the Brillo Boot Selector kernel and initramfs. +BOARD_PARTITIONS+="boot:${LINUX_GUID_TYPE}:32M:${BRILLO_OUT_DIR}/boot.img " +BOARD_PARTITIONS+="system:${LINUX_GUID_TYPE}:256M:${BRILLO_OUT_DIR}/system.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 slot A and make slot B empty. +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: " +BOARD_PARTITIONS+="system_b:${BRILLO_GUID_TYPE}:256M: " +BOARD_PARTITIONS+="oem_b:${BRILLO_GUID_TYPE}:64M: " + +# Last partition takes up the rest of the disk - we use this for +# userdata which is created with the mkuserimg.sh tool. +echo "Creating \"userdata\" file system." +USER_DATA_IMAGE="${WORKDIR}/userdata.bin" +mkuserimg.sh usrimg "${USER_DATA_IMAGE}" ext4 /data 256M > /dev/null +BOARD_PARTITIONS+="userdata:${BRILLO_GUID_TYPE}:256M:${USER_DATA_IMAGE} " + +# 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/vendor_partitions/DDR.bin b/vendor_partitions/DDR.bin Binary files differnew file mode 100644 index 0000000..8c2299c --- /dev/null +++ b/vendor_partitions/DDR.bin diff --git a/vendor_partitions/aboot.bin b/vendor_partitions/aboot.bin Binary files differnew file mode 100644 index 0000000..2da470f --- /dev/null +++ b/vendor_partitions/aboot.bin diff --git a/vendor_partitions/fsc.bin b/vendor_partitions/fsc.bin Binary files differnew file mode 100644 index 0000000..06d7405 --- /dev/null +++ b/vendor_partitions/fsc.bin diff --git a/vendor_partitions/fsg.bin b/vendor_partitions/fsg.bin Binary files differnew file mode 100644 index 0000000..3e050d6 --- /dev/null +++ b/vendor_partitions/fsg.bin diff --git a/vendor_partitions/hyp.bin b/vendor_partitions/hyp.bin Binary files differnew file mode 100644 index 0000000..bfd728f --- /dev/null +++ b/vendor_partitions/hyp.bin diff --git a/vendor_partitions/modem.bin b/vendor_partitions/modem.bin Binary files differnew file mode 100644 index 0000000..36bd83a --- /dev/null +++ b/vendor_partitions/modem.bin diff --git a/vendor_partitions/modemst1.bin b/vendor_partitions/modemst1.bin Binary files differnew file mode 100644 index 0000000..cce7764 --- /dev/null +++ b/vendor_partitions/modemst1.bin diff --git a/vendor_partitions/modemst2.bin b/vendor_partitions/modemst2.bin Binary files differnew file mode 100644 index 0000000..9a5b016 --- /dev/null +++ b/vendor_partitions/modemst2.bin diff --git a/vendor_partitions/rpm.bin b/vendor_partitions/rpm.bin Binary files differnew file mode 100644 index 0000000..f4abef4 --- /dev/null +++ b/vendor_partitions/rpm.bin diff --git a/vendor_partitions/sbl1.bin b/vendor_partitions/sbl1.bin Binary files differnew file mode 100644 index 0000000..de5788b --- /dev/null +++ b/vendor_partitions/sbl1.bin diff --git a/vendor_partitions/sec.bin b/vendor_partitions/sec.bin Binary files differnew file mode 100644 index 0000000..ea6c75b --- /dev/null +++ b/vendor_partitions/sec.bin diff --git a/vendor_partitions/tz.bin b/vendor_partitions/tz.bin Binary files differnew file mode 100644 index 0000000..bef6450 --- /dev/null +++ b/vendor_partitions/tz.bin |