aosp_arm64 Copy boot image from $OUT to target files

If BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES is defined,
in target files, instead of rebuilding the boot image, copy the boot
image already built in $OUT to target files package directly so that
they are the same package.

Define BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES for aosp_arm64.

The GKI APEX is built using the boot image in $OUT. If the boot image in
$OUT is different from the boot image in target files, aka the generic
boot image we release, the GKI APEX we built is invalid.

If another device needs to copy $OUT/boot.img to target files, it can
define BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES.

Fixes: 172682114
Test: lunch aosp_arm64 &&
Change-Id: I10fc7a5aa36e976dbeaf25434239687455bba061
This commit is contained in:
Yifan Hong 2020-11-09 11:52:52 -08:00
parent 4cecc43796
commit 49968aa137
3 changed files with 12 additions and 3 deletions

View File

@ -4446,7 +4446,8 @@ endif
ifdef BUILDING_BOOT_IMAGE ifdef BUILDING_BOOT_IMAGE
$(BUILT_TARGET_FILES_PACKAGE): $(INTERNAL_RAMDISK_FILES) $(BUILT_TARGET_FILES_PACKAGE): $(INTERNAL_RAMDISK_FILES)
else ifdef INTERNAL_PREBUILT_BOOTIMAGE endif
ifneq (,$(INTERNAL_PREBUILT_BOOTIMAGE) $(filter true,$(BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES)))
$(BUILT_TARGET_FILES_PACKAGE): $(INSTALLED_BOOTIMAGE_TARGET) $(BUILT_TARGET_FILES_PACKAGE): $(INSTALLED_BOOTIMAGE_TARGET)
endif endif
@ -4745,10 +4746,12 @@ ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES $(hide) mkdir -p $(zip_root)/IMAGES
$(hide) cp $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) $(zip_root)/IMAGES/ $(hide) cp $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) $(zip_root)/IMAGES/
endif endif
ifdef INTERNAL_PREBUILT_BOOTIMAGE ifneq (,$(INTERNAL_PREBUILT_BOOTIMAGE) $(filter true,$(BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES)))
ifdef INSTALLED_BOOTIMAGE_TARGET
$(hide) mkdir -p $(zip_root)/IMAGES $(hide) mkdir -p $(zip_root)/IMAGES
$(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/ $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
endif endif # INSTALLED_BOOTIMAGE_TARGET
endif # INTERNAL_PREBUILT_BOOTIMAGE != "" || BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES == true
ifdef BOARD_PREBUILT_ODMIMAGE ifdef BOARD_PREBUILT_ODMIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES $(hide) mkdir -p $(zip_root)/IMAGES
$(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/ $(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/

View File

@ -107,11 +107,14 @@ _board_strip_readonly_list += \
# recovery resources are built to vendor_boot. # recovery resources are built to vendor_boot.
# - BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT controls whether GSI AVB keys are # - BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT controls whether GSI AVB keys are
# built to vendor_boot. # built to vendor_boot.
# - BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES controls whether boot images in $OUT are added
# to target files package directly.
_board_strip_readonly_list += \ _board_strip_readonly_list += \
BOARD_USES_GENERIC_KERNEL_IMAGE \ BOARD_USES_GENERIC_KERNEL_IMAGE \
BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE \ BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE \
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT \ BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT \
BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT \ BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT \
BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES \
_build_broken_var_list := \ _build_broken_var_list := \
BUILD_BROKEN_DUP_RULES \ BUILD_BROKEN_DUP_RULES \

View File

@ -82,6 +82,9 @@ BOARD_USES_RECOVERY_AS_BOOT :=
TARGET_NO_KERNEL := false TARGET_NO_KERNEL := false
BOARD_USES_GENERIC_KERNEL_IMAGE := true BOARD_USES_GENERIC_KERNEL_IMAGE := true
BOARD_KERNEL_MODULE_INTERFACE_VERSIONS := 5.4-android12-0 BOARD_KERNEL_MODULE_INTERFACE_VERSIONS := 5.4-android12-0
# Copy boot image in $OUT to target files. This is defined for targets where
# the installed GKI APEXes are built from source.
BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES := true
# No vendor_boot # No vendor_boot
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT := BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT :=