From 4464f9f77c4f918d0c3d26735a3f016fc021a685 Mon Sep 17 00:00:00 2001 From: Will McVicker Date: Mon, 27 Nov 2023 14:28:19 -0800 Subject: build_utils.sh: update the SPL for development The SPL in the platform build is being updated more frequently than originally anticipated (previously it was updated quarterly in the trunk_staging builds). Now the trunk staging SPL follows the monthly SPL. To accomidate this, this patch updates the development build's SPL to pick the QPR date after the next QPR, e.g. Nov 2023 builds would pick March 2024. Note, as a reminder, this is only applied for development GKI boot images (not certified GKI boot images). Bug: 274825778 Change-Id: I4b746e417d8b0403ad7a2cb21a83001cd1ecbd40 Signed-off-by: Will McVicker --- build_utils.sh | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/build_utils.sh b/build_utils.sh index 23076151..3b48cbe8 100644 --- a/build_utils.sh +++ b/build_utils.sh @@ -647,12 +647,12 @@ function gki_get_boot_img_size() { echo "${!boot_size_var}" } -# gki_add_avb_footer +# gki_add_avb_footer function gki_add_avb_footer() { - local spl_month="$3" + local spl_date="$3" local additional_props="" - if [ -n "${spl_month}" ]; then - additional_props="--prop com.android.build.boot.security_patch:$(date +'%Y')-${spl_month}-05" + if [ -n "${spl_date}" ]; then + additional_props="--prop com.android.build.boot.security_patch:${spl_date}" fi avbtool add_hash_footer --image "$1" \ @@ -660,18 +660,18 @@ function gki_add_avb_footer() { ${additional_props} } -# gki_dry_run_certify_bootimg +# gki_dry_run_certify_bootimg # The certify_bootimg script will be executed on a server over a GKI # boot.img during the official certification process, which embeds # a GKI certificate into the boot.img. The certificate is for Android # VTS to verify that a GKI boot.img is authentic. # Dry running the process here so we can catch related issues early. function gki_dry_run_certify_bootimg() { - local spl_month="$3" + local spl_date="$3" local additional_props=() - if [ -n "${spl_month}" ]; then + if [ -n "${spl_date}" ]; then additional_props+=("--extra_footer_args" \ - "--prop com.android.build.boot.security_patch:$(date +'%Y')-${spl_month}-05") + "--prop com.android.build.boot.security_patch:${spl_date}") fi certify_bootimg --boot_img "$1" \ @@ -705,11 +705,23 @@ function build_gki_artifacts_info() { # kernel images are optional, e.g., ${DIST_DIR}/Image.gz. function build_gki_boot_images() { local uncompressed_kernel_path=$1 - local spl_month=$(date +'%m') + # Pick a SPL date far enough in the future so that you can flash + # development GKI kernels on an unlocked device without wiping the + # userdata. This is for development purposes only and should be + # overwritten by the Android platform build to include an accurate SPL. + # Note, the certified GKI release builds will not include the SPL + # property. + local spl_month=$((($(date +'%m') + 3) % 12)) + local spl_year="$(date +'%Y')" if [ $((${spl_month} % 3)) -gt 0 ]; then - # Round up to the closest quarterly month + # Round up to the next quarterly platform release (QPR) month spl_month=$((${spl_month} + 3 - (${spl_month} % 3))) fi + if [ "${spl_month}" -lt "$(date +'%m')" ]; then + # rollover to the next year + spl_year="$((${spl_year} + 1))" + fi + local spl_date=$(printf "%d-%02d-05\n" ${spl_year} ${spl_month}) if ! [ -f "${uncompressed_kernel_path}" ]; then echo "ERROR: '${uncompressed_kernel_path}' doesn't exist" >&2 @@ -746,9 +758,9 @@ function build_gki_boot_images() { "${MKBOOTIMG_PATH}" "${GKI_MKBOOTIMG_ARGS[@]}" gki_add_avb_footer "${boot_image_path}" \ - "$(gki_get_boot_img_size "${compression}")" "${spl_month}" + "$(gki_get_boot_img_size "${compression}")" "${spl_date}" gki_dry_run_certify_bootimg "${boot_image_path}" \ - "${GKI_ARTIFACTS_INFO_FILE}" "${spl_month}" + "${GKI_ARTIFACTS_INFO_FILE}" "${spl_date}" images_to_pack+=("${boot_image}") done -- cgit v1.2.3