Skip to content

Commit

Permalink
Support release build for tar.gz images
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
GangSecurity committed Sep 3, 2024
1 parent b6348d7 commit 2ab4a64
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 29 deletions.
56 changes: 37 additions & 19 deletions releasetools/flashfiles_from_target_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "========================"
Expand All @@ -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
Expand Down
35 changes: 25 additions & 10 deletions tasks/flashfiles.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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 $@)
Expand Down Expand Up @@ -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 ..."
Expand Down

0 comments on commit 2ab4a64

Please sign in to comment.