From aabbd91ab57e7a594a960d0110d0a96ea2725def Mon Sep 17 00:00:00 2001 From: Hyunwoo Ko Date: Thu, 16 May 2019 18:01:35 +0900 Subject: [PATCH] Add boot.img substitution to the build_mixed script. Bug: 131879395 Test: ./build_mixed -b boot-debug.img Change-Id: I2877e79522b5836e876c87f38221ca6890c41ce6 Merged-In: I2877e79522b5836e876c87f38221ca6890c41ce6 (cherry picked from commit 22da1576b115eab873519f5f31a531aec836ccd6) --- vndk/tools/build_mixed | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/vndk/tools/build_mixed b/vndk/tools/build_mixed index 09d929271..f2fdafdee 100755 --- a/vndk/tools/build_mixed +++ b/vndk/tools/build_mixed @@ -4,9 +4,10 @@ usage () { echo echo "Usage: $0 [-v ] [-m ]" echo " [-t ] [-p ]" + echo " [-b ]" echo " [-s] system_build_dir device_build_dir out_dir [check_tool]" echo - echo "Options -v, -m, -t, -p, -s must precede positional arguments." + echo "Options -v, -m, -t, -p, -b, -s must precede positional arguments." echo echo "vendor_version is the version of the vendor image when Keymaster v3" echo " related modifications to the system image is necessary. Optional." @@ -17,6 +18,8 @@ usage () { echo " required host binaries to modify system image. Optional." echo "override_vbmeta_image_path is the path to a vbmeta.img to use" echo " to override the existing vbmeta.img of device. Optional." + echo "override_boot_image_path is the path to a boot imgage to use to" + echo " override the existing boot.img of device. Optional." echo "-s is used to fetch and flash both product.img and system.img from" echo " the system_build_dir for devices with a product partition." echo " product.img will be removed if system_build_dir does not have" @@ -50,7 +53,7 @@ cleanup_and_exit () { trap cleanup_and_exit EXIT -while getopts :v:m:p:t:s opt; do +while getopts :v:m:p:b:t:s opt; do case "$opt" in v) readonly VENDOR_VERSION="$OPTARG" @@ -61,6 +64,9 @@ while getopts :v:m:p:t:s opt; do p) readonly OVERRIDE_VBMETA_IMAGE_PATH="$OPTARG" ;; + b) + readonly OVERRIDE_BOOT_IMAGE_PATH="$OPTARG" + ;; t) readonly OTATOOLS_ZIP="$OPTARG" ;; @@ -115,6 +121,10 @@ if [[ ! -z "${OVERRIDE_VBMETA_IMAGE_PATH+x}" && ! -f "$OVERRIDE_VBMETA_IMAGE_PAT exit_badparam "Specified vbmeta.img not found: "$OVERRIDE_VBMETA_IMAGE_PATH"" fi +if [[ ! -z "${OVERRIDE_BOOT_IMAGE_PATH+x}" && ! -f "$OVERRIDE_BOOT_IMAGE_PATH" ]]; then + exit_badparam "Specified boot image not found: "$OVERRIDE_BOOT_IMAGE_PATH"" +fi + readonly DEVICE_ARTIFACTS_DIR="$TEMP_DIR"/device_archive_artifacts readonly DEVICE_IMAGES_DIR="$DEVICE_ARTIFACTS_DIR"/IMAGES readonly SYSTEM_ARTIFACTS_DIR="$TEMP_DIR"/system_artifacts @@ -219,6 +229,12 @@ if [[ -f "$DEVICE_IMAGES_DIR"/vbmeta.img ]]; then cp "$VBMETA_IMAGE_PATH" "$DEVICE_IMAGES_DIR"/ fi +# Override boot.img with the provided boot image file since fastboot update cmd +# will try to flash boot.img in the archive. +if [[ ! -z "${OVERRIDE_BOOT_IMAGE_PATH+x}" && -f "$DEVICE_IMAGES_DIR"/boot.img ]]; then + cp "$OVERRIDE_BOOT_IMAGE_PATH" "$DEVICE_IMAGES_DIR"/boot.img +fi + ### # Create the Mixed Build archive. (