Skip to content

Commit

Permalink
download_gki: Add support for downloading from gsi-sc-dev
Browse files Browse the repository at this point in the history
The next phase of GKI for P21 is to switch to directly using boot image
binaries from the GKI release. Modify download_gki to grab images from
the GKI release, which includes both full boot images as well as the
various kernel build outputs necessary for mixed build support.

Note that, for now, we need to use fetch_artifact because
download_from_ci doesn't support downloading from our internal builds.
As a result, this will most likely not work with WFH machines; it will,
however, work on any machines located in office or cloudtop instances.
This solution is intended to be temporary while we work on one which
doesn't have these limitations.

Bug: 191764119
Signed-off-by: J. Avila <[email protected]>
Change-Id: I8ff957253475d781ff4af35f5e4f7f2547af83e0
  • Loading branch information
J. Avila authored and Petri Gynther committed Jul 2, 2021
1 parent 164514c commit edcba76
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions download_gki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,32 @@ mkdir -p ${GKI_PREBUILTS_DIR}
TEMP_DIR=$(mktemp -d)

cd ${TEMP_DIR}
echo "Downloading GKI binaries from build ab/${GKI_BUILD}..."
${CUR_DIR}/build/gki/download_from_ci ${GKI_BUILD} kernel_aarch64
exit_and_clean_if_error $? "Could not download prebuilts"
echo "Downloading GKI binaries from build ab/${GKI_BUILD} via fetch_artifact..."
for file in $(cat ${FILES_LIST}); do
if grep -q "boot.*\.img" <<< ${file} ; then
BOOT_IMG_NAME=${file}
file="gsi_arm64-img-${GKI_BUILD}.zip"
fi
/google/data/ro/projects/android/fetch_artifact \
--bid ${GKI_BUILD} \
--target gsi_arm64_with_kernel-userdebug ${file}
exit_and_clean_if_error $? "Error downloading ${file}"
done

for file in $(ls ./*.zip); do
unzip ${file}
done

if [ -f "${BOOT_IMG_NAME}" ]; then
SHA_FILE="${BOOT_IMG_NAME}"
elif [ -f "vmlinux" ]; then
SHA_FILE="vmlinux"
else
exit_and_clean_if_error 1 "No vmlinux or boot image downloaded"
fi

echo "Checking if GKI binaries match the current aosp/ revision..."
PREBUILTS_SHA=$(strings vmlinux | grep "Linux version [0-9]\+\.[0-9]\+" |
PREBUILTS_SHA=$(strings ${SHA_FILE} | grep "Linux version [0-9]\+\.[0-9]\+" |
sed -n "s/^.*-g\([0-9a-fA-F]\{12\}\)-.*/\1/p")
MANIFEST_SHA=$(cat ${CUR_DIR}/.repo/manifests/default.xml |
grep "path=\"aosp\"" |
Expand All @@ -49,10 +69,14 @@ mv $(cat ${FILES_LIST}) ${GKI_PREBUILTS_DIR}
exit_and_clean_if_error $? "Unable to copy all files"

cd ${GKI_PREBUILTS_DIR}
if [ -n "${BOOT_IMG_NAME}" -a -f "${BOOT_IMG_NAME}" ]; then
echo "Renaming ${BOOT_IMG_NAME} to boot.img for convenience."
mv ${BOOT_IMG_NAME} boot.img
fi
echo "Update the GKI binaries to ab/${GKI_BUILD}
Update the GKI binaries based on the given build. The prebuilts now have
the following SHA, taken from the vmlinux banner: ${PREBUILTS_SHA}
the following SHA, taken from the ${SHA_FILE} banner: ${PREBUILTS_SHA}
" > ${TEMP_DIR}\commit_body
git add *
git commit -s -F ${TEMP_DIR}\commit_body
Expand Down

0 comments on commit edcba76

Please sign in to comment.