Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 1 | #!/bin/bash -ex |
| 2 | usage () { |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 3 | echo "Create a Mixed Build archive with the given system and device archives." |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 4 | echo |
Justin Yun | ec96edb | 2018-10-26 12:21:24 +0900 | [diff] [blame] | 5 | echo "Usage: $0 [-v <vendor_version>] [-m <modify_system_image_path>]" |
| 6 | echo " [-t <prebuilt_otatools_path>] [-p <override_vbmeta_image_path>]" |
Hyunwoo Ko | aabbd91 | 2019-05-16 18:01:35 +0900 | [diff] [blame] | 7 | echo " [-b <override_boot_image_path>]" |
Justin Yun | 07a77c8 | 2018-11-20 13:12:12 +0900 | [diff] [blame] | 8 | echo " [-s] system_build_dir device_build_dir out_dir [check_tool]" |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 9 | echo |
Hyunwoo Ko | aabbd91 | 2019-05-16 18:01:35 +0900 | [diff] [blame] | 10 | echo "Options -v, -m, -t, -p, -b, -s must precede positional arguments." |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 11 | echo |
Jae Shin | d5fd24f | 2018-08-14 14:20:12 +0900 | [diff] [blame] | 12 | echo "vendor_version is the version of the vendor image when Keymaster v3" |
| 13 | echo " related modifications to the system image is necessary. Optional." |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 14 | echo " eg. 8.1.0 for a mixed build of GSI and O-MR1 vendor image." |
| 15 | echo "modify_system_image_path is the path to the script that modifies the" |
Jae Shin | d5fd24f | 2018-08-14 14:20:12 +0900 | [diff] [blame] | 16 | echo " system image, needed for Keymaster v3. Optional." |
Justin Yun | ec96edb | 2018-10-26 12:21:24 +0900 | [diff] [blame] | 17 | echo "prebuilt_otatools_path is the path to otatools.zip file that has all" |
| 18 | echo " required host binaries to modify system image. Optional." |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 19 | echo "override_vbmeta_image_path is the path to a vbmeta.img to use" |
| 20 | echo " to override the existing vbmeta.img of device. Optional." |
Hyunwoo Ko | aabbd91 | 2019-05-16 18:01:35 +0900 | [diff] [blame] | 21 | echo "override_boot_image_path is the path to a boot imgage to use to" |
| 22 | echo " override the existing boot.img of device. Optional." |
Justin Yun | 07a77c8 | 2018-11-20 13:12:12 +0900 | [diff] [blame] | 23 | echo "-s is used to fetch and flash both product.img and system.img from" |
| 24 | echo " the system_build_dir for devices with a product partition." |
Justin Yun | 74b00cb | 2019-01-04 14:45:08 +0900 | [diff] [blame] | 25 | echo " product.img will be removed if system_build_dir does not have" |
| 26 | echo " product.img when -s option is declared." |
Justin Yun | 07a77c8 | 2018-11-20 13:12:12 +0900 | [diff] [blame] | 27 | echo " By default, only system.img is flashed to the target device for" |
| 28 | echo " independent system update. No parameter required. Optional" |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 29 | echo "system_build_dir is the path to the system build" |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 30 | echo " eg. aosp_arm64_ab-userdebug." |
| 31 | echo "device_build_dir is the path to the device build" |
| 32 | echo " eg. sailfish-user." |
| 33 | echo "out_dir is the path to where the new build will be placed." |
| 34 | echo "check_tool is the path to the checkvintf executable that will be" |
| 35 | echo " used to verify the compatibility of the given images. Optional." |
| 36 | } |
| 37 | |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 38 | # Print error message and exit. |
| 39 | # Usage: exit_badparam message |
| 40 | # |
| 41 | # message is a string to be displayed before exit. |
| 42 | exit_badparam () { |
| 43 | echo "ERROR: $1" >&2 |
| 44 | usage |
| 45 | exit 1 |
| 46 | } |
| 47 | |
| 48 | cleanup_and_exit () { |
Michael Schwartz | 66fe283 | 2017-12-22 11:48:14 -0800 | [diff] [blame] | 49 | readonly result="$?" |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 50 | rm -rf "$TEMP_DIR" |
Michael Schwartz | 66fe283 | 2017-12-22 11:48:14 -0800 | [diff] [blame] | 51 | exit "$result" |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | trap cleanup_and_exit EXIT |
| 55 | |
Hyunwoo Ko | aabbd91 | 2019-05-16 18:01:35 +0900 | [diff] [blame] | 56 | while getopts :v:m:p:b:t:s opt; do |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 57 | case "$opt" in |
| 58 | v) |
| 59 | readonly VENDOR_VERSION="$OPTARG" |
| 60 | ;; |
| 61 | m) |
| 62 | readonly MODIFY_SYSTEM_SCRIPT="$OPTARG" |
| 63 | ;; |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 64 | p) |
| 65 | readonly OVERRIDE_VBMETA_IMAGE_PATH="$OPTARG" |
| 66 | ;; |
Hyunwoo Ko | aabbd91 | 2019-05-16 18:01:35 +0900 | [diff] [blame] | 67 | b) |
| 68 | readonly OVERRIDE_BOOT_IMAGE_PATH="$OPTARG" |
| 69 | ;; |
Justin Yun | 40da678 | 2018-10-05 14:54:17 +0900 | [diff] [blame] | 70 | t) |
| 71 | readonly OTATOOLS_ZIP="$OPTARG" |
| 72 | ;; |
Justin Yun | 07a77c8 | 2018-11-20 13:12:12 +0900 | [diff] [blame] | 73 | s) |
| 74 | readonly INCLUDE_PRODUCT=true |
| 75 | ;; |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 76 | \?) |
| 77 | exit_badparam "Invalid options: -"$OPTARG"" |
| 78 | ;; |
| 79 | :) |
| 80 | exit_badparam "Option -"$OPTARG" requires an argument." |
| 81 | ;; |
| 82 | esac |
| 83 | done |
| 84 | |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 85 | if [[ -z "${VENDOR_VERSION+x}" && ! -z "${MODIFY_SYSTEM_SCRIPT+x}" ]] || [[ ! -z "${VENDOR_VERSION+x}" && -z "${MODIFY_SYSTEM_SCRIPT+x}" ]]; then |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 86 | exit_badparam "Options -v and -m must be set together." |
| 87 | fi |
| 88 | |
| 89 | shift "$((OPTIND-1))" |
| 90 | |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 91 | if [[ $# -lt 3 ]]; then |
| 92 | exit_badparam "Unexpected number of arguments" |
| 93 | fi |
| 94 | |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 95 | readonly SYSTEM_DIR="$1" |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 96 | readonly DEVICE_DIR="$2" |
| 97 | readonly DIST_DIR="$3" |
| 98 | readonly CHECK_TOOL="$4" |
| 99 | readonly TEMP_DIR="$(mktemp -d /tmp/"$(basename $0)"_XXXXXXXX)" |
| 100 | |
Justin Yun | 83631d6 | 2018-10-05 14:24:12 +0900 | [diff] [blame] | 101 | readonly SYSTEM_TARGET_FILES_ARCHIVE="$(find "$SYSTEM_DIR" -name "*-target_files-*.zip" -print)" |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 102 | if [[ ! -f "$SYSTEM_TARGET_FILES_ARCHIVE" ]]; then |
| 103 | exit_badparam "Could not find system target files archive in $SYSTEM_DIR." |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 104 | fi |
| 105 | |
Justin Yun | 83631d6 | 2018-10-05 14:24:12 +0900 | [diff] [blame] | 106 | readonly DEVICE_ARCHIVE="$(find "$DEVICE_DIR" -name "*-img-*.zip" -print)" |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 107 | if [[ ! -f "$DEVICE_ARCHIVE" ]]; then |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 108 | exit_badparam "Could not find device img archive in $DEVICE_DIR." |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 109 | fi |
| 110 | |
Justin Yun | 83631d6 | 2018-10-05 14:24:12 +0900 | [diff] [blame] | 111 | readonly DEVICE_TARGET_FILES_ARCHIVE="$(find "$DEVICE_DIR" -name "*-target_files-*.zip" -print)" |
Paul Trautrim | d2d8ac9 | 2018-06-29 16:19:10 +0900 | [diff] [blame] | 112 | if [[ ! -f "$DEVICE_TARGET_FILES_ARCHIVE" ]]; then |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 113 | exit_badparam "Could not find device target_files archive in $DEVICE_DIR." |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 114 | fi |
| 115 | |
Jae Shin | f418b9b | 2018-08-09 12:57:20 +0900 | [diff] [blame] | 116 | if [[ ! -z "${MODIFY_SYSTEM_SCRIPT+x}" && ! -f "$MODIFY_SYSTEM_SCRIPT" ]]; then |
| 117 | exit_badparam "Script not found: "$MODIFY_SYSTEM_SCRIPT"" |
| 118 | fi |
| 119 | |
| 120 | if [[ ! -z "${OVERRIDE_VBMETA_IMAGE_PATH+x}" && ! -f "$OVERRIDE_VBMETA_IMAGE_PATH" ]]; then |
| 121 | exit_badparam "Specified vbmeta.img not found: "$OVERRIDE_VBMETA_IMAGE_PATH"" |
| 122 | fi |
| 123 | |
Hyunwoo Ko | aabbd91 | 2019-05-16 18:01:35 +0900 | [diff] [blame] | 124 | if [[ ! -z "${OVERRIDE_BOOT_IMAGE_PATH+x}" && ! -f "$OVERRIDE_BOOT_IMAGE_PATH" ]]; then |
| 125 | exit_badparam "Specified boot image not found: "$OVERRIDE_BOOT_IMAGE_PATH"" |
| 126 | fi |
| 127 | |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 128 | readonly DEVICE_ARTIFACTS_DIR="$TEMP_DIR"/device_archive_artifacts |
| 129 | readonly DEVICE_IMAGES_DIR="$DEVICE_ARTIFACTS_DIR"/IMAGES |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 130 | readonly SYSTEM_ARTIFACTS_DIR="$TEMP_DIR"/system_artifacts |
| 131 | readonly SYSTEM_IMAGES_DIR="$SYSTEM_ARTIFACTS_DIR"/IMAGES |
Justin Yun | 40da678 | 2018-10-05 14:54:17 +0900 | [diff] [blame] | 132 | readonly OTATOOLS_DIR="$TEMP_DIR"/otatools |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 133 | |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 134 | readonly SPL_PROPERTY_NAME="ro.build.version.security_patch" |
| 135 | readonly SYSTEM_BUILD_PROP="SYSTEM/build.prop" |
| 136 | |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 137 | ### |
| 138 | # Uncompress the archives. |
Justin Yun | 07a77c8 | 2018-11-20 13:12:12 +0900 | [diff] [blame] | 139 | declare -a EXTRACT_FILE_LIST |
| 140 | EXTRACT_FILE_LIST=( |
| 141 | IMAGES/system.img \ |
| 142 | IMAGES/vbmeta.img \ |
| 143 | META/system_matrix.xml \ |
| 144 | META/system_manifest.xml \ |
| 145 | "$SYSTEM_BUILD_PROP" \ |
| 146 | ) |
| 147 | |
| 148 | if [[ "$INCLUDE_PRODUCT" == true ]]; then |
Justin Yun | 74b00cb | 2019-01-04 14:45:08 +0900 | [diff] [blame] | 149 | unzip -l "$SYSTEM_TARGET_FILES_ARCHIVE" | grep -q IMAGES/product.img && |
Justin Yun | 07a77c8 | 2018-11-20 13:12:12 +0900 | [diff] [blame] | 150 | EXTRACT_FILE_LIST+=(IMAGES/product.img) |
| 151 | fi |
| 152 | |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 153 | mkdir -p "$SYSTEM_ARTIFACTS_DIR" |
| 154 | # Get the system images and meta data. |
Justin Yun | 07a77c8 | 2018-11-20 13:12:12 +0900 | [diff] [blame] | 155 | # ${EXTRACT_FILE_LIST[*]} cannot be quoted to list each file for unzipping |
| 156 | unzip "$SYSTEM_TARGET_FILES_ARCHIVE" ${EXTRACT_FILE_LIST[*]} -d "$SYSTEM_ARTIFACTS_DIR" |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 157 | |
| 158 | mkdir -p "$DEVICE_IMAGES_DIR" |
| 159 | # Get the device images. |
| 160 | unzip "$DEVICE_ARCHIVE" -d "$DEVICE_IMAGES_DIR" |
| 161 | # Get the device meta data. |
| 162 | unzip "$DEVICE_TARGET_FILES_ARCHIVE" \ |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 163 | META/vendor_matrix.xml META/vendor_manifest.xml "$SYSTEM_BUILD_PROP" \ |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 164 | -d "$DEVICE_ARTIFACTS_DIR" |
| 165 | |
Justin Yun | 40da678 | 2018-10-05 14:54:17 +0900 | [diff] [blame] | 166 | if [[ -f "$OTATOOLS_ZIP" ]]; then |
| 167 | # Uncompress otatools |
| 168 | mkdir -p "$OTATOOLS_DIR" |
Justin Yun | ec96edb | 2018-10-26 12:21:24 +0900 | [diff] [blame] | 169 | unzip "$OTATOOLS_ZIP" bin/* lib64/* -d "$OTATOOLS_DIR" |
Justin Yun | 40da678 | 2018-10-05 14:54:17 +0900 | [diff] [blame] | 170 | # Set paths for using prebuilt host binaries. |
| 171 | export PATH="$OTATOOLS_DIR"/bin:"$PATH" |
| 172 | export LD_LIBRARY_PATH="$OTATOOLS_DIR"/lib64:"$LD_LIBRARY_PATH" |
| 173 | fi |
| 174 | |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 175 | ### |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 176 | # Check compatibility between the system and device. |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 177 | if [[ -f "$CHECK_TOOL" ]]; then |
Jae Shin | 58bd771 | 2018-06-07 10:25:57 +0900 | [diff] [blame] | 178 | chmod 755 "$CHECK_TOOL" |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 179 | "$CHECK_TOOL" \ |
| 180 | "$DEVICE_ARTIFACTS_DIR"/META/vendor_manifest.xml \ |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 181 | "$SYSTEM_ARTIFACTS_DIR"/META/system_matrix.xml |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 182 | "$CHECK_TOOL" \ |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 183 | "$SYSTEM_ARTIFACTS_DIR"/META/system_manifest.xml \ |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 184 | "$DEVICE_ARTIFACTS_DIR"/META/vendor_matrix.xml |
| 185 | fi |
| 186 | |
| 187 | ### |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 188 | # Modify system.img if vendor version is provided. |
| 189 | if [[ ! -z "${VENDOR_VERSION+x}" ]]; then |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 190 | # Create copy of system target files package that can be modified |
| 191 | # since the original $SYSTEM_TARGET_FILES_ARCHIVE is a symlink to |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 192 | # prebuilt files in cache |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 193 | cp "$SYSTEM_TARGET_FILES_ARCHIVE" "$TEMP_DIR" |
| 194 | readonly COPY_SYSTEM_TARGET_FILES_ARCHIVE="$TEMP_DIR"/"$(basename "$SYSTEM_TARGET_FILES_ARCHIVE")" |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 195 | |
| 196 | # Check compatibility of security patch level |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 197 | readonly SYSTEM_SPL=$(sed -n -r "s/^"$SPL_PROPERTY_NAME"=(.*)$/\1/p" "$SYSTEM_ARTIFACTS_DIR"/"$SYSTEM_BUILD_PROP") |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 198 | readonly VENDOR_SPL=$(sed -n -r "s/^"$SPL_PROPERTY_NAME"=(.*)$/\1/p" "$DEVICE_ARTIFACTS_DIR"/"$SYSTEM_BUILD_PROP") |
| 199 | declare -a args |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 200 | args=(-v "$VENDOR_VERSION" "$COPY_SYSTEM_TARGET_FILES_ARCHIVE") |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 201 | if [[ "$SYSTEM_SPL" != "$VENDOR_SPL" ]]; then |
| 202 | echo "Security patch level mismatch detected..." |
| 203 | echo " SPL of system: "$SYSTEM_SPL"" |
| 204 | echo " SPL of vendor: "$VENDOR_SPL"" |
| 205 | args+=("$VENDOR_SPL") |
| 206 | fi |
| 207 | "$MODIFY_SYSTEM_SCRIPT" "${args[@]}" |
| 208 | # Replace system.img with newly modified system.img |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 209 | unzip -o "$COPY_SYSTEM_TARGET_FILES_ARCHIVE" IMAGES/system.img -d "$SYSTEM_ARTIFACTS_DIR" |
Jae Shin | 3af4201 | 2018-05-08 17:56:34 +0900 | [diff] [blame] | 210 | fi |
| 211 | |
| 212 | ### |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 213 | # Overwrite artifacts in the device archive to create the Mixed Build artifacts. |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 214 | cp "$SYSTEM_IMAGES_DIR"/system.img "$DEVICE_IMAGES_DIR"/ |
Justin Yun | 07a77c8 | 2018-11-20 13:12:12 +0900 | [diff] [blame] | 215 | if [[ "$INCLUDE_PRODUCT" == true ]]; then |
Justin Yun | 74b00cb | 2019-01-04 14:45:08 +0900 | [diff] [blame] | 216 | if [[ -f "$SYSTEM_IMAGES_DIR"/product.img ]]; then |
| 217 | cp "$SYSTEM_IMAGES_DIR"/product.img "$DEVICE_IMAGES_DIR"/ |
| 218 | else |
| 219 | rm -f "$DEVICE_IMAGES_DIR"/product.img |
| 220 | # Removed product partition from required partition list |
| 221 | sed -i "/partition-exists=product$/d" "$DEVICE_IMAGES_DIR"/android-info.txt |
| 222 | fi |
Justin Yun | 07a77c8 | 2018-11-20 13:12:12 +0900 | [diff] [blame] | 223 | fi |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 224 | |
| 225 | # Only override vbmeta if it is already present since fastboot update will try |
| 226 | # to flash whatever is in the archive. |
| 227 | if [[ -f "$DEVICE_IMAGES_DIR"/vbmeta.img ]]; then |
Jae Shin | 341a55f | 2018-06-04 16:55:26 +0900 | [diff] [blame] | 228 | readonly VBMETA_IMAGE_PATH="${OVERRIDE_VBMETA_IMAGE_PATH:-"$SYSTEM_IMAGES_DIR"/vbmeta.img}" |
| 229 | cp "$VBMETA_IMAGE_PATH" "$DEVICE_IMAGES_DIR"/ |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 230 | fi |
| 231 | |
Hyunwoo Ko | aabbd91 | 2019-05-16 18:01:35 +0900 | [diff] [blame] | 232 | # Override boot.img with the provided boot image file since fastboot update cmd |
| 233 | # will try to flash boot.img in the archive. |
| 234 | if [[ ! -z "${OVERRIDE_BOOT_IMAGE_PATH+x}" && -f "$DEVICE_IMAGES_DIR"/boot.img ]]; then |
| 235 | cp "$OVERRIDE_BOOT_IMAGE_PATH" "$DEVICE_IMAGES_DIR"/boot.img |
| 236 | fi |
| 237 | |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 238 | ### |
| 239 | # Create the Mixed Build archive. |
| 240 | ( |
| 241 | cd "$DEVICE_IMAGES_DIR" |
| 242 | zip -r mixed.zip ./* |
| 243 | ) |
| 244 | |
| 245 | ### |
| 246 | # Archive the artifacts. |
| 247 | if [ -n "$DIST_DIR" ]; then |
| 248 | mkdir -p "$DIST_DIR" || true |
| 249 | fi |
| 250 | # Archive all the device artifacts. |
Michael Schwartz | 56e3388 | 2018-05-24 20:57:29 -0700 | [diff] [blame] | 251 | rsync --archive --verbose --copy-links --exclude='logs' \ |
| 252 | "$DEVICE_DIR"/* "$DIST_DIR" |
Michael Schwartz | a0d9bd5 | 2017-11-02 10:19:42 -0700 | [diff] [blame] | 253 | # Overwrite the image archive with the Mixed Build archive. |
| 254 | OUT_ARCHIVE="$DIST_DIR"/"$(basename $DEVICE_ARCHIVE)" |
| 255 | cp "$DEVICE_IMAGES_DIR"/mixed.zip "$OUT_ARCHIVE" |
Justin Yun | 247e95a | 2019-01-07 10:36:49 +0900 | [diff] [blame] | 256 | # Overwrite android-info.txt with the updated one. |
| 257 | cp "$DEVICE_IMAGES_DIR"/android-info.txt "$DIST_DIR"/ |