From 4378d4c30449fe68cf8910d7b7df3e3fe2752d10 Mon Sep 17 00:00:00 2001 From: Robin Peng Date: Thu, 27 Oct 2022 15:44:26 +0000 Subject: [PATCH] download_gki: Modify BASE_TARGET to kernel_aarch64 GKI prebuilt boot.img are now released from the kernel AB builder directly. Needs to modify download_gki.sh to fit for this change. Bug: 255962463 Change-Id: I15b1a28d2ed412f0551de71f94aabd5e9a2ef7b2 Signed-off-by: Robin Peng --- download_gki.sh | 64 +++++++++++++++---------------------------------- 1 file changed, 19 insertions(+), 45 deletions(-) diff --git a/download_gki.sh b/download_gki.sh index d66a22423557..9447a7d13e50 100755 --- a/download_gki.sh +++ b/download_gki.sh @@ -16,15 +16,16 @@ GKI_FILES=( vmlinux.symvers modules.builtin modules.builtin.modinfo - boot-5.10-lz4.img + boot-lz4.img + Image.lz4 ) GKI_PREBUILTS_DIR=${2:-${CUR_DIR}/prebuilts/boot-artifacts/kernel/} GKI_BUILD=$1 ALLOW_PREBUILTS_MISMATCH=${ALLOW_PREBUILTS_MISMATCH:-0} USE_UNSIGNED_USER_IMG=${USE_UNSIGNED_USER_IMG:-0} -BASE_TARGET="gki_arm64" +BASE_TARGET="kernel_aarch64" FETCH_ARTIFACT_CMD="/google/data/ro/projects/android/fetch_artifact" -IMG_ZIP_BASE="${BASE_TARGET}-img-${GKI_BUILD}" +IMG_TAR_FILE="certified-boot-img-${GKI_BUILD}.tar.gz" if [ -z "${GKI_BUILD}" ]; then echo "No GKI build number provided." @@ -37,55 +38,34 @@ TEMP_DIR=$(mktemp -d) cd ${TEMP_DIR} echo "Downloading GKI binaries from build ab/${GKI_BUILD} via fetch_artifact..." if [ "${USE_UNSIGNED_USER_IMG}" = "0" ]; then - file="signed/signed-${IMG_ZIP_BASE}.zip" - echo "Taking signed user image." -else - file="${IMG_ZIP_BASE}.zip" - echo "Taking unsigned user image." + file="signed/${IMG_TAR_FILE}" + echo "Downloading signed boot.img..." + ${FETCH_ARTIFACT_CMD} \ + --bid ${GKI_BUILD} \ + --target ${BASE_TARGET} ${file} + exit_and_clean_if_error $? "Unable to download signed boot image" fi -echo "Downloading -user variant boot.img..." -${FETCH_ARTIFACT_CMD} \ - --bid ${GKI_BUILD} \ - --target ${BASE_TARGET}-user ${file} -exit_and_clean_if_error $? "Unable to download -user boot image" -mv *${IMG_ZIP_BASE}.zip ${IMG_ZIP_BASE}-user.zip -echo "Downloading -userdebug prebuilts..." +echo "Downloading prebuilts..." for file in "${GKI_FILES[@]}"; do if grep -q "boot.*\.img" <<< ${file} ; then BOOT_IMG_NAME=${file} - file="${IMG_ZIP_BASE}.zip" - else - file="kernel/5.10/${file}" fi ${FETCH_ARTIFACT_CMD} \ --bid ${GKI_BUILD} \ - --target ${BASE_TARGET}-userdebug ${file} + --target ${BASE_TARGET} ${file} exit_and_clean_if_error $? "Error downloading ${file}" done -for file in $(ls ./*.zip); do - if grep -q "user" <<< ${file} ; then - USER_IMG_DIR=${TEMP_DIR}/user_images/ - mkdir ${USER_IMG_DIR} - unzip ${file} ${BOOT_IMG_NAME} -d ${USER_IMG_DIR} - else - unzip ${file} ${BOOT_IMG_NAME} - fi -done +if [ "${USE_UNSIGNED_USER_IMG}" = "0" ]; then + tar -zxvf ${IMG_TAR_FILE} + exit_and_clean_if_error $? "Failed to extract ${IMG_TAR_FILE}" +fi -if [ -f "${BOOT_IMG_NAME}" ]; then - UNPACKED_BOOT_DIR=${TEMP_DIR}/boot_img_unpacked/ - ${CUR_DIR}/tools/mkbootimg/unpack_bootimg.py --boot_img ${BOOT_IMG_NAME} \ - --out ${UNPACKED_BOOT_DIR} - exit_and_clean_if_error $? "Unable to unpack ${BOOT_IMG_NAME}" - mv ${UNPACKED_BOOT_DIR}/kernel ./Image.lz4 - lz4 -d ./Image.lz4 ./Image - SHA_FILE="Image" -elif [ -f "vmlinux" ]; then +if [ -f "vmlinux" ]; then SHA_FILE="vmlinux" else - exit_and_clean_if_error 1 "No vmlinux or boot image downloaded" + exit_and_clean_if_error 1 "No vmlinux downloaded" fi echo "Checking if GKI binaries match the current aosp/ revision..." @@ -107,17 +87,11 @@ fi echo "Copying GKI files to ${GKI_PREBUILTS_DIR}..." mv -v ${GKI_FILES[@]} ${GKI_PREBUILTS_DIR} exit_and_clean_if_error $? "Unable to copy all files" -if [ -f ${USER_IMG_DIR}/${BOOT_IMG_NAME} ]; then - mv ${USER_IMG_DIR}/${BOOT_IMG_NAME} ${GKI_PREBUILTS_DIR}/boot-user.img - echo "Copied user variant ${BOOT_IMG_NAME} to boot-user.img." -fi cd ${GKI_PREBUILTS_DIR} if [ -n "${BOOT_IMG_NAME}" -a -f "${BOOT_IMG_NAME}" ]; then mv ${BOOT_IMG_NAME} boot.img - echo "Copied userdebug variant ${BOOT_IMG_NAME} to boot.img." - mv ${TEMP_DIR}/Image.lz4 ./ - echo "Copied Image.lz4 unpacked from ${BOOT_IMG_NAME}." + echo "Copied ${BOOT_IMG_NAME} to boot.img." fi echo "Update the GKI binaries to ab/${GKI_BUILD}