From 2ab4a642e2d39daa03f9ec74efc4b44b8f019b76 Mon Sep 17 00:00:00 2001 From: "Chen, Gang G" Date: Mon, 2 Sep 2024 15:13:43 +0800 Subject: [PATCH] Support release build for tar.gz images release key is used for release images Test Done: build and boot success make flashfiles -j20 make flashfiles -j20 iso_image=false use_tar=true make flashfiles -j20 RELEASE_BUILD=true make flashfiles -j00 iso_image=false use_tar=true RELEASE_BUILD=true make flashfiles -j20 publish_gptimage RELEASE_BUILD=true iso_image=false use_tar=true Tracked-On: OAM-124136 Signed-off-by: Chen, Gang G --- releasetools/flashfiles_from_target_files.sh | 56 +++++++++++++------- tasks/flashfiles.mk | 35 ++++++++---- 2 files changed, 62 insertions(+), 29 deletions(-) diff --git a/releasetools/flashfiles_from_target_files.sh b/releasetools/flashfiles_from_target_files.sh index a598ca6..92abf2a 100755 --- a/releasetools/flashfiles_from_target_files.sh +++ b/releasetools/flashfiles_from_target_files.sh @@ -13,6 +13,16 @@ VARIANT=`grep -i "ro.system.build.type=" $PRODUCT_OUT/system/build.prop | cut -d TARGET=`grep -i "ro.build.product=" $PRODUCT_OUT/system/build.prop | cut -d '=' -f2` ANDROID_ROOT=${PWD} +for arg in "$@" +do + case $arg in + RELEASE_BUILD=*) + RELEASE_BUILD="${arg#*=}" + shift + ;; + esac +done + echo "========================" echo "Images / Files to be packed" echo "========================" @@ -38,25 +48,33 @@ mkdir $flashfile_dir for i in $IMAGES do - echo "Adding $i" - if [[ $i == "super.img" ]]; then - SUPER_IMG=true - cp ./obj/PACKAGING/super.img_intermediates/super.img $flashfile_dir/. - else - if [[ $i == "installer.efi" ]]; then - cp efi/installer.efi $flashfile_dir/. - else - if [[ $i == "startup.nsh" ]]; then - cp efi/startup.nsh $flashfile_dir/. - else - if [[ $i == "system.img" || $i == "odm.img" || $i == "vbmeta.img" || $i == "vendor_boot.img" ]]; then - cp obj/PACKAGING/target_files_intermediates/$TARGET-target_files-*/IMAGES/$i $flashfile_dir/. - else - cp $i $flashfile_dir/. - fi - fi - fi - fi + echo "Adding $i" + if [[ $i == "super.img" ]]; then + SUPER_IMG=true + if [[ "$RELEASE_BUILD" == "true" ]]; then + cp release_sign/super.img $flashfile_dir/. + else + cp ./obj/PACKAGING/super.img_intermediates/super.img $flashfile_dir/. + fi + else + if [[ $i == "installer.efi" ]]; then + cp efi/installer.efi $flashfile_dir/. + else + if [[ $i == "startup.nsh" ]]; then + cp efi/startup.nsh $flashfile_dir/. + else + if [[ $i == "boot.img" || $i == "odm.img" || $i == "vbmeta.img" || $i == "vendor_boot.img" ]]; then + if [[ "$RELEASE_BUILD" == "true" ]]; then + cp ff_temp/IMAGES/$i $flashfile_dir/. + else + cp obj/PACKAGING/target_files_intermediates/$TARGET-target_files-*/IMAGES/$i $flashfile_dir/. + fi + else + cp $i $flashfile_dir/. + fi + fi + fi + fi done cd $ANDROID_ROOT diff --git a/tasks/flashfiles.mk b/tasks/flashfiles.mk index 5b74073..6e0fbee 100755 --- a/tasks/flashfiles.mk +++ b/tasks/flashfiles.mk @@ -5,6 +5,13 @@ endif ifeq ($(TARGET_BUILD_TYPE),debug) name := $(name)_debug endif + +ifeq ($(use_tar),true) + fn_compress_format := tar.gz +else + fn_compress_format := zip +endif + ifeq ($(RELEASE_BUILD),true) flash_name := $(name)-sign-flashfiles-$(FILE_NAME_TAG) target_name := $(name)-sign-targetfile-$(FILE_NAME_TAG) @@ -13,7 +20,7 @@ endif name := $(name)-flashfiles-$(FILE_NAME_TAG) BUILDNUM := $(shell $(DATE) +%H%M%3S) ifeq ($(RELEASE_BUILD),true) -BUILT_RELEASE_FLASH_FILES_PACKAGE := $(PRODUCT_OUT)/$(flash_name).zip +BUILT_RELEASE_FLASH_FILES_PACKAGE := $(PRODUCT_OUT)/$(flash_name).$(fn_compress_format) BUILT_RELEASE_TARGET_FILES_PACKAGE := $(PRODUCT_OUT)/$(target_name).zip ifeq ($(SUPER_IMG_IN_FLASHZIP),true) BUILT_RELEASE_SUPER_IMAGE := $(PRODUCT_OUT)/release_sign/super.img @@ -58,9 +65,13 @@ endif ifeq ($(BUILD_GPTIMAGE), true) $(gpt_name):$(BUILT_RELEASE_FLASH_FILES_PACKAGE) +ifeq ($(use_tar),true) + tar -xvzf $< -C $(GPT_DIR) +else rm -rf $(GPT_DIR) mkdir -p $(GPT_DIR) unzip $< -d $(GPT_DIR) +endif $(SIMG2IMG) $(GPT_DIR)/super.img $(GPT_DIR)/super.img.raw $(SIMG2IMG) $(GPT_DIR)/config.img $(GPT_DIR)/config.img.raw @@ -85,29 +96,32 @@ $(gpt_name): @echo "skip build gptimages" endif +ifeq ($(use_tar),true) +$(BUILT_RELEASE_FLASH_FILES_PACKAGE):$(BUILT_RELEASE_SUPER_IMAGE) $(BUILT_RELEASE_TARGET_FILES_PACKAGE) $(fftf) $(legacy_fftf) $(UEFI_ADDITIONAL_TOOLS) + rm -rf $(GPT_DIR) + mkdir -p $(GPT_DIR) + unzip $(BUILT_RELEASE_TARGET_FILES_PACKAGE) -d $(GPT_DIR) + $(fftf) $@ RELEASE_BUILD=true + rm -rf $(GPT_DIR) +else $(BUILT_RELEASE_FLASH_FILES_PACKAGE):$(BUILT_RELEASE_SUPER_IMAGE) $(legacy_fftf) $(UEFI_ADDITIONAL_TOOLS) $(hide) mkdir -p $(dir $@) $(legacy_fftf) $(FLASHFILES_ADD_ARGS) --mv_config_default=$(notdir $(mvcfg_default_arg)) --add_image=$(BUILT_RELEASE_SUPER_IMAGE) $(BUILT_RELEASE_TARGET_FILES_PACKAGE) $@ #remove system.img vendor.img product.img from flashfiles.zip $(hide)zip -d $@ "system.img" "product.img" "vendor.img"; +endif else $(BUILT_RELEASE_FLASH_FILES_PACKAGE):$(BUILT_RELEASE_TARGET_FILES_PACKAGE) $(legacy_fftf) $(UEFI_ADDITIONAL_TOOLS) $(hide) mkdir -p $(dir $@) $(legacy_fftf) $(FLASHFILES_ADD_ARGS) --mv_config_default=$(notdir $(mvcfg_default_arg)) $(BUILT_RELEASE_TARGET_FILES_PACKAGE) $@ -endif -endif +endif #SUPER_IMG_IN_FLASHZIP +endif #RELEASE_BUILD ifeq ($(USE_INTEL_FLASHFILES),true) fftf := $(INTEL_PATH_BUILD)/releasetools/flashfiles_from_target_files.sh legacy_fftf := $(INTEL_PATH_BUILD)/releasetools/flashfiles_from_target_files odf := $(INTEL_PATH_BUILD)/releasetools/ota_deployment_fixup -ifeq ($(use_tar),true) - fn_compress_format := tar.gz -else - fn_compress_format := zip -endif - ifneq ($(FLASHFILE_VARIANTS),) # Generate variant specific flashfiles if VARIANT_SPECIFIC_FLASHFILES is True ifeq ($(VARIANT_SPECIFIC_FLASHFILES),true) @@ -170,6 +184,7 @@ else mvcfg_default_arg = $(MV_CONFIG_DEFAULT_TYPE) endif + ifeq ($(SUPER_IMG_IN_FLASHZIP),true) $(INTEL_FACTORY_FLASHFILES_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(fftf) $(legacy_fftf) $(UEFI_ADDITIONAL_TOOLS) $(INTERNAL_SUPERIMAGE_DIST_TARGET) $(hide) mkdir -p $(dir $@) @@ -333,7 +348,7 @@ LOCAL_TOOL:= \ .PHONY: flashfiles ifeq ($(RELEASE_BUILD),true) -flashfiles: $(INTEL_FACTORY_FLASHFILES_TARGET) $(BUILT_RELEASE_FLASH_FILES_PACKAGE) $(gpt_name) publish_mkdir_dest publish_vertical host-pkg sepolicy_freeze_test check-vintf-all +flashfiles: $(BUILT_RELEASE_FLASH_FILES_PACKAGE) $(gpt_name) publish_mkdir_dest publish_vertical host-pkg sepolicy_freeze_test check-vintf-all @$(ACP) $(BUILT_RELEASE_FLASH_FILES_PACKAGE) $(publish_dest) ifeq (,$(filter base_aaos aaos_iasw,$(TARGET_PRODUCT))) @echo "Publishing Release files started ..."