码迷,mamicode.com
首页 > 移动开发 > 详细

Android Build -- make otapackage(Overall)

时间:2016-05-09 18:52:57      阅读:392      评论:0      收藏:0      [点我收藏+]

标签:android build ota

Android make otapackage的流程分析,基于4.0.4_r2-1

代码文件目录:AOSP/build/core/Makefile

.PHONY: otapackage
otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
        @echo "Package OTA: $@"
        $(hide) ./build/tools/releasetools/ota_from_target_files -v            -p $(HOST_OUT)            -k $(KEY_CERT_PAIR) \ 
           $(BUILT_TARGET_FILES_PACKAGE) $@

1行:就是我们需要生成的目标,$(PRODUCT_OUT)/$(name).zip。包含了路径$(PRODUCT_OUT)和文件名$(name).zip

$(PRODUCT_OUT)


# Depending on the various images guarantees that the underlying
# directories are up-to-date.
$(BUILT_TARGET_FILES_PACKAGE):                 $(INSTALLED_BOOTIMAGE_TARGET)                 $(INSTALLED_RADIOIMAGE_TARGET)                 $(INSTALLED_RECOVERYIMAGE_TARGET)                 $(INSTALLED_SYSTEMIMAGE)                 $(INSTALLED_USERDATAIMAGE_TARGET)                 $(INSTALLED_ANDROID_INFO_TXT_TARGET)                 $(built_ota_tools)                 $(APKCERTS_FILE)                 $(HOST_OUT_EXECUTABLES)/fs_config                 | $(ACP)
        @echo "Package target files: $@"
        $(hide) rm -rf $@ $(zip_root)
        $(hide) mkdir -p $(dir $@) $(zip_root)
        @# Components of the recovery image
        $(hide) mkdir -p $(zip_root)/RECOVERY
        $(hide) $(call package_files-copy-root,                 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
ifdef INSTALLED_KERNEL_TARGET
        $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
endif
ifdef INSTALLED_2NDBOOTLOADER_TARGET
        $(hide) $(ACP)                 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
endif
ifdef BOARD_KERNEL_CMDLINE
        $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
endif
ifdef BOARD_KERNEL_BASE
        $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
endif
ifdef BOARD_KERNEL_PAGESIZE
        $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize
endif
        @# Components of the boot image
        $(hide) mkdir -p $(zip_root)/BOOT
        $(hide) $(call package_files-copy-root,                 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
ifdef INSTALLED_KERNEL_TARGET
        $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
endif
ifdef INSTALLED_2NDBOOTLOADER_TARGET
        $(hide) $(ACP)                 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
endif
ifdef BOARD_KERNEL_CMDLINE
        $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
endif
ifdef BOARD_KERNEL_BASE
        $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
endif
ifdef BOARD_KERNEL_PAGESIZE
        $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
endif
        $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),                    mkdir -p $(zip_root)/RADIO;                     $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
        @# Contents of the system image
        $(hide) $(call package_files-copy-root,                 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
        @# Contents of the data image
        $(hide) $(call package_files-copy-root,                 $(TARGET_OUT_DATA),$(zip_root)/DATA)
        @# Extra contents of the OTA package
        $(hide) mkdir -p $(zip_root)/OTA/bin
        $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
        $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
        @# Files that do not end up in any images, but are necessary to
        @# build them.
        $(hide) mkdir -p $(zip_root)/META
        $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
        $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
        $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
ifdef BOARD_FLASH_BLOCK_SIZE
        $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
        $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
        $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
ifdef BOARD_SYSTEMIMAGE_PARTITION_SIZE
        $(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
        $(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
        $(hide) echo "tool_extensions=$(tool_extensions)" >> $(zip_root)/META/misc_info.txt
ifdef mkyaffs2_extra_flags
        $(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(zip_root)/META/misc_info.txt
endif
ifdef INTERNAL_USERIMAGES_SPARSE_EXT_FLAG
        $(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(zip_root)/META/misc_info.txt
endif
        $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
ifdef PRODUCT_EXTRA_RECOVERY_KEYS
        $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
endif
        @# Zip everything up, preserving symlinks
        $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
        @# Run fs_config on all the system, boot ramdisk, and recovery ramdisk files in the zip, and save the output
        $(hide) zipinfo -1 $@ | awk ‘BEGIN { FS="SYSTEM/" } /^SYSTEM\// {print "system/" $$2}‘ | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/filesystem_config.txt
        $(hide) zipinfo -1 $@ | awk ‘BEGIN { FS="BOOT/RAMDISK/" } /^BOOT\/RAMDISK\// {print $$2}‘ | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/boot_filesystem_config.txt
        $(hide) zipinfo -1 $@ | awk ‘BEGIN { FS="RECOVERY/RAMDISK/" } /^RECOVERY\/RAMDISK\// {print $$2}‘ | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/recovery_filesystem_config.txt
        $(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/*filesystem_config.txt)


本文出自 “Android” 博客,请务必保留此出处http://rosemary.blog.51cto.com/9548014/1771546

Android Build -- make otapackage(Overall)

标签:android build ota

原文地址:http://rosemary.blog.51cto.com/9548014/1771546

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!