Makefile revision e121d6acf47c3056e079ff62c82171e889cec3e0
188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Put some miscellaneous rules here
288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Pick a reasonable string to use to identify files.
488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  # BUILD_NUMBER has a timestamp in it, which means that
688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  # it will change every time.  Pick a stable value.
788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  FILE_NAME_TAG := eng.$(USER)
888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectelse
988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  FILE_NAME_TAG := $(BUILD_NUMBER)
1088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
1188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
1288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
1388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Define rules to copy PRODUCT_COPY_FILES defined by the product.
1488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# PRODUCT_COPY_FILES contains words like <source file>:<dest file>.
1588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# <dest file> is relative to $(PRODUCT_OUT), so it should look like,
1688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# e.g., "system/etc/file.xml".
17518ce5753a95355eccf396f8ed9c36960c83274bJean-Baptiste Queru# The filter part means "only eval the copy-one-file rule if this
18462d26bd322ff934ed685da8939e4b63277a8987Ying Wang# src:dest pair is the first one to match the same dest"
19462d26bd322ff934ed685da8939e4b63277a8987Ying Wangunique_product_copy_files_destinations := $(sort \
20462d26bd322ff934ed685da8939e4b63277a8987Ying Wang    $(foreach cf,$(PRODUCT_COPY_FILES), $(call word-colon,2,$(cf))))
2188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(foreach cf,$(PRODUCT_COPY_FILES), \
22462d26bd322ff934ed685da8939e4b63277a8987Ying Wang    $(eval _src := $(call word-colon,1,$(cf))) \
23462d26bd322ff934ed685da8939e4b63277a8987Ying Wang    $(eval _dest := $(call word-colon,2,$(cf))) \
24462d26bd322ff934ed685da8939e4b63277a8987Ying Wang    $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
25462d26bd322ff934ed685da8939e4b63277a8987Ying Wang        $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
26462d26bd322ff934ed685da8939e4b63277a8987Ying Wang        $(eval $(call copy-one-file,$(_src),$(_fulldest))) \
27462d26bd322ff934ed685da8939e4b63277a8987Ying Wang        $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
28462d26bd322ff934ed685da8939e4b63277a8987Ying Wang        $(eval unique_product_copy_files_destinations := $(filter-out $(_dest), \
29462d26bd322ff934ed685da8939e4b63277a8987Ying Wang            $(unique_product_copy_files_destinations)))))
3088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
3188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
3288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# docs/index.html
3388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectgen := $(OUT_DOCS)/index.html
3488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectALL_DOCS += $(gen)
3588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(gen): frameworks/base/docs/docs-redirect-index.html
3688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@mkdir -p $(dir $@)
3788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@cp -f $< $@
3888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
3988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
4088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# default.prop
4188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
4288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
4388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectADDITIONAL_DEFAULT_PROPERTIES := \
4488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
4588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
4688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_DEFAULT_PROP_TARGET):
4788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo Target buildinfo: $@
4888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@mkdir -p $(dir $@)
4988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) echo "#" > $@; \
5088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	        echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
5188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	        echo "#" >> $@;
520545c9160d0d3dde4675184609cc7656de5558b0Jean-Baptiste Queru	$(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \
530545c9160d0d3dde4675184609cc7656de5558b0Jean-Baptiste Queru		echo "$(line)" >> $@;)
5488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
5588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
5688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# build.prop
5788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
5888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
5988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectADDITIONAL_BUILD_PROPERTIES := \
6088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
6188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
6288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# A list of arbitrary tags describing the build configuration.
6388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Force ":=" so we can use +=
6488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectBUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
6588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(TARGET_BUILD_TYPE),debug)
6688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  BUILD_VERSION_TAGS += debug
6788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
6888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Apps are always signed with test keys, and may be re-signed in a post-build
6988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# step.  If that happens, the "test-keys" tag will be removed by that step.
7088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectBUILD_VERSION_TAGS += test-keys
7188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectBUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
7288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
7388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# A human-readable string that descibes this build in detail.
7488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectbuild_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS)
7588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_BUILD_PROP_TARGET): PRIVATE_BUILD_DESC := $(build_desc)
7688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
7788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# The string used to uniquely identify this build;  used by the OTA server.
7888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq (,$(strip $(BUILD_FINGERPRINT)))
79135a120e3904d782623e4a3fc958ed098e8de384Doug Zongker  BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
8088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
8188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifneq ($(words $(BUILD_FINGERPRINT)),1)
8288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)")
8388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
8488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
857b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman# Display parameters shown under Settings -> About Phone
867b64124f0baabfa7216727a03e23fa1330fc6fadSriram Ramanifeq ($(TARGET_BUILD_VARIANT),user)
877b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman  # User builds should show:
887b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman  # release build number or branch.buld_number non-release builds
897b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman
907b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman  # Dev. branches should have DISPLAY_BUILD_NUMBER set
917b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman  ifeq "true" "$(DISPLAY_BUILD_NUMBER)"
927b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman    BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER)
937b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman  else
947b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman    BUILD_DISPLAY_ID := $(BUILD_ID)
957b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman  endif
967b64124f0baabfa7216727a03e23fa1330fc6fadSriram Ramanelse
977b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman  # Non-user builds should show detailed build information
987b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman  BUILD_DISPLAY_ID := $(build_desc)
997b64124f0baabfa7216727a03e23fa1330fc6fadSriram Ramanendif
1007b64124f0baabfa7216727a03e23fa1330fc6fadSriram Raman
10177c882ff88686d3cd312e7ed752ddcd7ad93a169Ying Wang# Whether there is default locale set in PRODUCT_PROPERTY_OVERRIDES
10238d7f02c50aae9b1578b575cf6dd12d73249368aYing Wangproduct_property_override_locale_language := $(strip \
10338d7f02c50aae9b1578b575cf6dd12d73249368aYing Wang    $(patsubst ro.product.locale.language=%,%,\
10477c882ff88686d3cd312e7ed752ddcd7ad93a169Ying Wang    $(filter ro.product.locale.language=%,$(PRODUCT_PROPERTY_OVERRIDES))))
10538d7f02c50aae9b1578b575cf6dd12d73249368aYing Wangproduct_property_overrides_locale_region := $(strip \
10638d7f02c50aae9b1578b575cf6dd12d73249368aYing Wang    $(patsubst ro.product.locale.region=%,%,\
10777c882ff88686d3cd312e7ed752ddcd7ad93a169Ying Wang    $(filter ro.product.locale.region=%,$(PRODUCT_PROPERTY_OVERRIDES))))
10877c882ff88686d3cd312e7ed752ddcd7ad93a169Ying Wang
10988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Selects the first locale in the list given as the argument,
11088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# and splits it into language and region, which each may be
11188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# empty.
11288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine default-locale
11388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(subst _, , $(firstword $(1)))
11488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
11588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
11688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Selects the first locale in the list given as the argument
11777c882ff88686d3cd312e7ed752ddcd7ad93a169Ying Wang# and returns the language (or the region), if it's not set in PRODUCT_PROPERTY_OVERRIDES;
11877c882ff88686d3cd312e7ed752ddcd7ad93a169Ying Wang# Return empty string if it's already set in PRODUCT_PROPERTY_OVERRIDES.
11988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine default-locale-language
12038d7f02c50aae9b1578b575cf6dd12d73249368aYing Wang$(if $(product_property_override_locale_language),,$(word 1, $(call default-locale, $(1))))
12188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
12288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine default-locale-region
12338d7f02c50aae9b1578b575cf6dd12d73249368aYing Wang$(if $(product_property_overrides_locale_region),,$(word 2, $(call default-locale, $(1))))
12488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
12588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
12688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectBUILDINFO_SH := build/tools/buildinfo.sh
12775947ef5efe12b6664bcec6528f528c6ee261b0bChih-Wei Huang$(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
12888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo Target buildinfo: $@
12988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@mkdir -p $(dir $@)
13088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
13188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			TARGET_DEVICE="$(TARGET_DEVICE)" \
13288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			PRODUCT_NAME="$(TARGET_PRODUCT)" \
13388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			PRODUCT_BRAND="$(PRODUCT_BRAND)" \
13488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \
13588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \
136fbd10d940d9dca8aba940f91fceade4098c6cb92Robert Greenwalt			PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
13788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			PRODUCT_MODEL="$(PRODUCT_MODEL)" \
13888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
13988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
14088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			BUILD_ID="$(BUILD_ID)" \
14188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
14288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			BUILD_NUMBER="$(BUILD_NUMBER)" \
14388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			PLATFORM_VERSION="$(PLATFORM_VERSION)" \
14488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
1459537884b0dabe81bf612c79d12c7b4bf40de10a5Dianne Hackborn			PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
14688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
14788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
14888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \
14988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
150ecc70d705ab8ad6461f23d8be97791227f4219eaDianne Hackborn			TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
1512edfb71d01bff3632598e66eae7a32d656af8447David 'Digit' Turner			TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
15225939e224e1cc0522f9028d3decafa878c3b171cJoe Onorato			TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
15388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	        bash $(BUILDINFO_SH) > $@
15488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \
15588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	          cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \
15688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	        fi
15788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(if $(ADDITIONAL_BUILD_PROPERTIES), \
15888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(hide) echo >> $@; \
15988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		        echo "#" >> $@; \
16088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		        echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
16188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		        echo "#" >> $@; )
1620545c9160d0d3dde4675184609cc7656de5558b0Jean-Baptiste Queru	$(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \
1630545c9160d0d3dde4675184609cc7656de5558b0Jean-Baptiste Queru		echo "$(line)" >> $@;)
16488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
16588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectbuild_desc :=
16688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
16788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
16888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# sdk-build.prop
16988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
17088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# There are certain things in build.prop that we don't want to
17188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# ship with the sdk; remove them.
17288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
17388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# This must be a list of entire property keys followed by
17488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# "=" characters, without any internal spaces.
17588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsdk_build_prop_remove := \
17688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	ro.build.user= \
17788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	ro.build.host= \
17888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	ro.product.brand= \
17988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	ro.product.manufacturer= \
18088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	ro.product.device=
18188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# TODO: Remove this soon-to-be obsolete property
18288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsdk_build_prop_remove += ro.build.product=
18388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
18488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
18588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo SDK buildinfo: $@
18688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@mkdir -p $(dir $@)
18788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) grep -v "$(subst $(space),\|,$(strip \
18888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				$(sdk_build_prop_remove)))" $< > $@.tmp
18988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) for x in $(sdk_build_prop_remove); do \
19088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				echo "$$x"generic >> $@.tmp; done
19188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mv $@.tmp $@
19288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
19388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
19488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# package stats
19588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectPACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
19688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectPACKAGES_TO_STAT := \
19788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
19888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
19988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
20088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo Package stats: $@
20188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@mkdir -p $(dir $@)
20288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) rm -f $@
20388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) build/tools/dump-package-stats $^ > $@
20488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
20588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: package-stats
20688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectpackage-stats: $(PACKAGE_STATS_FILE)
20788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
20888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
20988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Cert-to-package mapping.  Used by the post-build signing tools.
21088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(TARGET_PRODUCT)
21188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(TARGET_BUILD_TYPE),debug)
21288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  name := $(name)_debug
21388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
21488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(name)-apkcerts-$(FILE_NAME_TAG)
21588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectintermediates := \
21688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(call intermediates-dir-for,PACKAGING,apkcerts)
21788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectAPKCERTS_FILE := $(intermediates)/$(name).txt
21888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Depending on the built packages isn't exactly right,
21988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# but it should guarantee that the apkcerts file is rebuilt
22088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# if any packages change which certs they're signed with.
22188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectall_built_packages := $(foreach p,$(PACKAGES),$(ALL_MODULES.$(p).BUILT))
222efb21682668cfcd924560cb03a747d07d73892aaYing Wangifneq ($(TARGET_BUILD_APPS),)
223efb21682668cfcd924560cb03a747d07d73892aaYing Wang# We don't need to really build all the modules for apps_only build.
224efb21682668cfcd924560cb03a747d07d73892aaYing Wang$(APKCERTS_FILE):
225efb21682668cfcd924560cb03a747d07d73892aaYing Wangelse
22688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(APKCERTS_FILE): $(all_built_packages)
227efb21682668cfcd924560cb03a747d07d73892aaYing Wangendif
22888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo APK certs list: $@
22988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@mkdir -p $(dir $@)
23088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@rm -f $@
23188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(foreach p,$(PACKAGES),\
232f6a53aa5f24878ad9098409ed3d3f41bb5c63fb5Doug Zongker          $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
233f6a53aa5f24878ad9098409ed3d3f41bb5c63fb5Doug Zongker	    echo 'name="$(p).apk" certificate="EXTERNAL" \
234f6a53aa5f24878ad9098409ed3d3f41bb5c63fb5Doug Zongker	         private_key=""' >> $@;,\
235f6a53aa5f24878ad9098409ed3d3f41bb5c63fb5Doug Zongker	    echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
236f6a53aa5f24878ad9098409ed3d3f41bb5c63fb5Doug Zongker	         private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;))
23788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
23888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: apkcerts-list
23988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectapkcerts-list: $(APKCERTS_FILE)
24088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
241efb21682668cfcd924560cb03a747d07d73892aaYing Wang$(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
242efb21682668cfcd924560cb03a747d07d73892aaYing Wang
24388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
24488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# module info file
24588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifdef CREATE_MODULE_INFO_FILE
24688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt
24788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  $(info Generating $(MODULE_INFO_FILE)...)
24888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  $(shell rm -f $(MODULE_INFO_FILE))
24988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  $(foreach m,$(ALL_MODULES), \
25088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(shell echo "NAME=\"$(m)\"" \
25188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	"PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \
25288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	"TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \
25388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	"BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \
25488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	"INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE)))
25588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
25688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
2578678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# -----------------------------------------------------------------
2588678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
2598678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# The test key is used to sign this package, and as the key required
2608678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# for future OTA packages installed by this system.  Actual product
2618678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# deliverables will be re-signed by hand.  We expect this file to
2628678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# exist with the suffixes ".x509.pem" and ".pk8".
2638678df4c064a17575137bbacf8f5856052dd5bd7Doug ZongkerDEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey
2648678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
2658678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
26688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Rules that need to be present for the simulator, even
26788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# if they don't do anything.
26888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: systemimage
26988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsystemimage:
27088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
2717e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker# -----------------------------------------------------------------
2727e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker
2737e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker.PHONY: event-log-tags
2747e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker
275b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato# Produce an event logs tag file for everything we know about, in order
276b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato# to properly allocate numbers.  Then produce a file that's filtered
277b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato# for what's going to be installed.
278b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato
279b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onoratoall_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
280b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato
281b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato# Include tags from all packages that we know about
282b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onoratoall_event_log_tags_src := \
283b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato    $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
284b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato
285b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src)
286b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato$(all_event_log_tags_file): $(all_event_log_tags_src)
287b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato	$(hide) mkdir -p $(dir $@)
288b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato	$(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
289b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato
290b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato
2917e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongkerevent_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
2927e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker
2937e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker# Include tags from all packages included in this product.
2947e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongkerevent_log_tags_src := \
2957e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker    $(sort $(foreach m,\
2967e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker      $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
2977e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker      $(call module-names-for-tag-list,user), \
2987e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker      $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
2997e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker
3007e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
301b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
302b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file)
3037e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker	$(hide) mkdir -p $(dir $@)
304b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato	$(hide) build/tools/merge-event-log-tags.py -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
3057e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker
3067e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongkerevent-log-tags: $(event_log_tags_file)
3077e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker
3087e2f13b43a4a80f0739913368d4f21616caa33dbDoug ZongkerALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
3097e2f13b43a4a80f0739913368d4f21616caa33dbDoug Zongker
310b75105315187ec2719bdc8adfdea6fc4f6b296efJoe Onorato
31188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifneq ($(TARGET_SIMULATOR),true)
31288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
31388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# #################################################################
31488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Targets for boot/OS images
31588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# #################################################################
31688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
31788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
31888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# the ramdisk
31988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
32088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_PREBUILT) \
32188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_COPIED_HEADERS) \
32288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_GENERATED_SOURCES) \
32388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_DEFAULT_INSTALLED_MODULES))
32488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
32564d85d0d827489c514f6aec075482563c80cda73Joe OnoratoBUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
32664d85d0d827489c514f6aec075482563c80cda73Joe Onorato
32764d85d0d827489c514f6aec075482563c80cda73Joe Onorato# We just build this directly to the install location.
32864d85d0d827489c514f6aec075482563c80cda73Joe OnoratoINSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
3298b70e8c6574e6e6e80aaa84fe1a9426995fa0a78Doug Zongker$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
33088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(call pretty,"Target ram disk: $@")
3318b70e8c6574e6e6e80aaa84fe1a9426995fa0a78Doug Zongker	$(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
33288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
33388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
33488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifneq ($(strip $(TARGET_NO_KERNEL)),true)
33588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
33688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
33788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# the boot image, which is a collection of other images.
33888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_BOOTIMAGE_ARGS := \
33988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
34088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	--kernel $(INSTALLED_KERNEL_TARGET) \
34188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	--ramdisk $(INSTALLED_RAMDISK_TARGET)
34288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
34388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
34488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
34588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectBOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
34688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifdef BOARD_KERNEL_CMDLINE
34788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
34888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
34988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
3501e0847c2fcbe1b95464f32a719d2b9e620d1e6ecDima ZavinBOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
3511e0847c2fcbe1b95464f32a719d2b9e620d1e6ecDima Zavinifdef BOARD_KERNEL_BASE
3521e0847c2fcbe1b95464f32a719d2b9e620d1e6ecDima Zavin  INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
3531e0847c2fcbe1b95464f32a719d2b9e620d1e6ecDima Zavinendif
3541e0847c2fcbe1b95464f32a719d2b9e620d1e6ecDima Zavin
355ffff0028ae9a83893f71efa370d283e2247bcdd4Ying WangBOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
356ffff0028ae9a83893f71efa370d283e2247bcdd4Ying Wangifdef BOARD_KERNEL_PAGESIZE
357ffff0028ae9a83893f71efa370d283e2247bcdd4Ying Wang  INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
358ffff0028ae9a83893f71efa370d283e2247bcdd4Ying Wangendif
359ffff0028ae9a83893f71efa370d283e2247bcdd4Ying Wang
36088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
36188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
36288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
36388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projecttmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg
36488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image)
36588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG)
36688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES)
36788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(call pretty,"Target boot image: $@")
36888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
36988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
37088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectelse # TARGET_BOOTIMAGE_USE_EXT2 != true
37188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
37288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
37388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(call pretty,"Target boot image: $@")
37488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
375ed96e88850b471d4ebbbdd1c2acd3efdc6b19a10Doug Zongker	$(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
37688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif # TARGET_BOOTIMAGE_USE_EXT2
37788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
37888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectelse	# TARGET_NO_KERNEL
37988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# HACK: The top-level targets depend on the bootimage.  Not all targets
38088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# can produce a bootimage, though, and emulator targets need the ramdisk
38188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# instead.  Fake it out by calling the ramdisk the bootimage.
38288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# TODO: make the emulator use bootimages, and make mkbootimg accept
38388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#       kernel-less inputs.
38488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
38588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
38688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
38788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
38888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# NOTICE files
38988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
39088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# This needs to be before the systemimage rules, because it adds to
39188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
39288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# go into the systemimage.
39388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
39488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: notice_files
39588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
39688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Create the rule to combine the files into text and html forms
39788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(1) - Plain text output file
39888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(2) - HTML output file
39988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(3) - File title
40088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(4) - Directory to use.  Notice files are all $(4)/src.  Other
40188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#		 directories in there will be used for scratch
40288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(5) - Dependencies for the output files
40388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
40488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# The algorithm here is that we go collect a hash for each of the notice
40588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# files and write the names of the files that match that hash.  Then
40688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# to generate the real files, we go print out all of the files and their
40788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# hashes.
40888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
40988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# These rules are fairly complex, so they depend on this makefile so if
41088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# it changes, they'll run again.
41188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
41288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# TODO: We could clean this up so that we just record the locations of the
41388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# original notice files instead of making rules to copy them somwehere.
41488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Then we could traverse that without quite as much bash drama.
41588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine combine-notice-files
41688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(1) $(2): PRIVATE_MESSAGE := $(3)
41788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4)
41888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile
41988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo Finding NOTICE files: $$@
42088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash
42188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) mkdir -p $$(PRIVATE_DIR)/hash
42288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \
42388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \
42488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \
42588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo $$$$file >> $$$$hashfile; \
42688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		done
42788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) touch $$@
42888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(1): $(4)/hash-timestamp
42988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo Combining NOTICE files: $$@
43088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) mkdir -p $$(dir $$@)
43188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo $$(PRIVATE_MESSAGE) > $$@
43288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \
43388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1:" >> $$@
43488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo >> $$@
43588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo >> $$@
43688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo >> $$@
43788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
43888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "============================================================"\
43988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				>> $$@; \
44088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "Notices for file(s):" >> $$@; \
44188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			cat $$$$hashfile | sort | \
44288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1:" >> \
44388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				$$@; \
44488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "------------------------------------------------------------"\
44588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				>> $$@; \
44688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo >> $$@; \
44788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			orig=$$$$(head -n 1 $$$$hashfile); \
44888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			cat $$$$orig >> $$@; \
44988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo >> $$@; \
45088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo >> $$@; \
45188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo >> $$@; \
45288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		done
45388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(2): $(4)/hash-timestamp
45488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo Combining NOTICE files: $$@
45588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) mkdir -p $$(dir $$@)
45688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo "<html><head>" > $$@
45788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo "<style type=\"text/css\">" >> $$@
45888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@
45988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@
46088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo ".label { font-weight: bold; }" >> $$@
46188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@
46288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo "</style>" >> $$@
46388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@
46488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \
46588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		>> $$@
46688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
46788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			cat $$$$hashfile | sort | \
46888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  <a name=\"\1\"></a>:" >> \
46988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				$$@; \
47088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "<tr><td class=\"same-license\">" >> $$@; \
47188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \
47288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "<div class=\"file-list\">" >> $$@; \
47388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			cat $$$$hashfile | sort | \
47488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1<br/>:" >> $$@; \
47588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "</div><!-- file-list -->" >> $$@; \
47688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo >> $$@; \
47788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			orig=$$$$(head -n 1 $$$$hashfile); \
47888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "<pre class=\"license-text\">" >> $$@; \
47988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			cat $$$$orig | sed -e "s/\&/\&amp;/g" | sed -e "s/</\&lt;/g" \
48088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project					| sed -e "s/>/\&gt;/g" >> $$@; \
48188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "</pre><!-- license-text -->" >> $$@; \
48288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo "</td></tr><!-- same-license -->" >> $$@; \
48388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo >> $$@; \
48488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo >> $$@; \
48588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			echo >> $$@; \
48688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		done
48788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo "</table>" >> $$@
48888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$$(hide) echo "</body></html>" >> $$@
48988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectnotice_files: $(1) $(2)
49088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
49188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
49288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
49388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
49488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# the src subdirectory.
49588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
49688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projecttarget_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
49788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projecttarget_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
49888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projecttarget_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
49988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projecttools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
50088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projecttools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
50188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
50288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectkernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
50388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
50488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(eval $(call combine-notice-files, \
50588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			$(target_notice_file_txt), \
50688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			$(target_notice_file_html), \
50788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			"Notices for files contained in the filesystem images in this directory:", \
50888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			$(TARGET_OUT_NOTICE_FILES), \
50988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			$(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file)))
51088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
51188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(eval $(call combine-notice-files, \
51288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			$(tools_notice_file_txt), \
51388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			$(tools_notice_file_html), \
51488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			"Notices for files contained in the tools directory:", \
51588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			$(HOST_OUT_NOTICE_FILES), \
51688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			$(ALL_DEFAULT_INSTALLED_MODULES)))
51788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
51888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Install the html file at /system/etc/NOTICE.html.gz.
51988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# This is not ideal, but this is very late in the game, after a lot of
52088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# the module processing has already been done -- in fact, we used the
52188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# fact that all that has been done to get the list of modules that we
52288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# need notice files for.
5238b70e8c6574e6e6e80aaa84fe1a9426995fa0a78Doug Zongker$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
5248678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	$(hide) $(MINIGZIP) -9 < $< > $@
52588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectinstalled_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
52688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
52788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(copy-file-to-target)
5287b2845ab1a47324a6fb25261048510e79656a732Joe Onorato
5297b2845ab1a47324a6fb25261048510e79656a732Joe Onorato# if we've been run my mm, mmm, etc, don't reinstall this every time
5307b2845ab1a47324a6fb25261048510e79656a732Joe Onoratoifeq ($(ONE_SHOT_MAKEFILE),)
53188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz)
5327b2845ab1a47324a6fb25261048510e79656a732Joe Onoratoendif
53388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
53488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# The kernel isn't really a module, so to get its module file in there, we
53588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# make the target NOTICE files depend on this particular file too, which will
53688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# then be in the right directory for the find in combine-notice-files to work.
53788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(kernel_notice_file): \
53888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	    prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \
53988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	    | $(ACP)
54088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo Copying: $@
54188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mkdir -p $(dir $@)
54288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(ACP) $< $@
54388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
54488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
5458678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# -----------------------------------------------------------------
5468678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# Build a keystore with the authorized keys in it, used to verify the
5478678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# authenticity of downloaded OTA packages.
5488678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker#
5498678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
5508678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# before the rules that use that variable to build the image.
5518678df4c064a17575137bbacf8f5856052dd5bd7Doug ZongkerALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
5528678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
55337c0e274d16b1b340f1fe1bd7d11e19aa2e73e26Doug Zongker$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
5548678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	$(hide) rm -f $@
5558678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	$(hide) mkdir -p $(dir $@)
55637c0e274d16b1b340f1fe1bd7d11e19aa2e73e26Doug Zongker	$(hide) zip -qj $@ $<
5578678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
5588678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker.PHONY: otacerts
5598678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongkerotacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
5608678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
5618678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
56288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# #################################################################
56388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Targets for user images
56488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# #################################################################
56588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
566933abf15bcd66138ba4e5fba7071e239a8662c6bYing WangINTERNAL_USERIMAGES_EXT_VARIANT :=
56788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
5680a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin CrossINTERNAL_USERIMAGES_USE_EXT := true
5690a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin CrossINTERNAL_USERIMAGES_EXT_VARIANT := ext2
5700a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crosselse
5710a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
5720a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin CrossINTERNAL_USERIMAGES_USE_EXT := true
5730a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin CrossINTERNAL_USERIMAGES_EXT_VARIANT := ext3
5740a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crosselse
5750a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
5760a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin CrossINTERNAL_USERIMAGES_USE_EXT := true
5770a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin CrossINTERNAL_USERIMAGES_EXT_VARIANT := ext4
5780a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossendif
5790a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossendif
5800a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossendif
5810a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Cross
582542903a27b5837ce04d57e14d888b43b06e9d82fYing Wangifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
583542903a27b5837ce04d57e14d888b43b06e9d82fYing Wang  INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
584542903a27b5837ce04d57e14d888b43b06e9d82fYing Wangendif
585542903a27b5837ce04d57e14d888b43b06e9d82fYing Wang
5860a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
587542903a27b5837ce04d57e14d888b43b06e9d82fYing WangINTERNAL_USERIMAGES_DEPS := $(MKEXTUSERIMG) $(MAKE_EXT4FS)
588933abf15bcd66138ba4e5fba7071e239a8662c6bYing WangINTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
589933abf15bcd66138ba4e5fba7071e239a8662c6bYing Wang
590c79f4da0ef8a030d0aaf342e6107a4f4788471a4Ying Wang# $(1): src directory
591c79f4da0ef8a030d0aaf342e6107a4f4788471a4Ying Wang# $(2): output file
592026f1451ce0c92c4630ca2d2d95f2fb9d68e9568Ying Wang# $(3): mount point
593c79f4da0ef8a030d0aaf342e6107a4f4788471a4Ying Wang# $(4): ext variant (ext2, ext3, ext4)
594e0a40217df12c274f591da212d30bf66c923524cColin Cross# $(5): size of the partition
595c79f4da0ef8a030d0aaf342e6107a4f4788471a4Ying Wangdefine build-userimage-ext-target
596c79f4da0ef8a030d0aaf342e6107a4f4788471a4Ying Wang  @mkdir -p $(dir $(2))
597933abf15bcd66138ba4e5fba7071e239a8662c6bYing Wang  $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$(PATH) \
598542903a27b5837ce04d57e14d888b43b06e9d82fYing Wang	  $(MKEXTUSERIMG) $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG) $(1) $(2) $(4) $(3) $(5)
599c79f4da0ef8a030d0aaf342e6107a4f4788471a4Ying Wangendef
60088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectelse
601144b028eac600bdf4817648dd23c577abba01134Colin CrossINTERNAL_USERIMAGES_DEPS := $(MKYAFFS2)
60288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
60388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
60488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
6054647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker# Recovery image
6068cebf1ff7836a5dc365e49f7a14d7546a651d9c7Doug Zongker
6078cebf1ff7836a5dc365e49f7a14d7546a651d9c7Doug Zongker# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
608630b7d3ffaac72873f5b91e7e215daa9c2818935Brian Swetlandifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID)))
6098cebf1ff7836a5dc365e49f7a14d7546a651d9c7Doug Zongker
6104647f12a4ff9dc54247184f17ff3de1cc423f213Doug ZongkerINSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
6114647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
6124647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerrecovery_initrc := $(call include-path-for, recovery)/etc/init.rc
6134647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerrecovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
6144647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerrecovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
6154647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerrecovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
6164647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerrecovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
6174647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerrecovery_resources_common := $(call include-path-for, recovery)/res
6184647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerrecovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))
6194647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerrecovery_resource_deps := $(shell find $(recovery_resources_common) \
6204647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker  $(recovery_resources_private) -type f)
6219ce0fb6e59415669074896cfa01e1f0cf97979b7Doug Zongkerrecovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
6224647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
6234647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerifeq ($(recovery_resources_private),)
6244647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker  $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE))
6254647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerendif
6264647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
6279ce0fb6e59415669074896cfa01e1f0cf97979b7Doug Zongkerifeq ($(recovery_fstab),)
6289ce0fb6e59415669074896cfa01e1f0cf97979b7Doug Zongker  $(info No recovery.fstab for TARGET_DEVICE $(TARGET_DEVICE))
6299ce0fb6e59415669074896cfa01e1f0cf97979b7Doug Zongkerendif
6309ce0fb6e59415669074896cfa01e1f0cf97979b7Doug Zongker
6314647f12a4ff9dc54247184f17ff3de1cc423f213Doug ZongkerINTERNAL_RECOVERYIMAGE_ARGS := \
6324647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	$(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
6334647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	--kernel $(recovery_kernel) \
6344647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	--ramdisk $(recovery_ramdisk)
6354647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
6364647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker# Assumes this has already been stripped
6374647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerifdef BOARD_KERNEL_CMDLINE
6384647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker  INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
6394647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerendif
6404647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerifdef BOARD_KERNEL_BASE
6414647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker  INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
6424647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerendif
6434de6b5bfc89de95b18514e75329a2ec7491bebbdYing WangBOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
6444de6b5bfc89de95b18514e75329a2ec7491bebbdYing Wangifdef BOARD_KERNEL_PAGESIZE
6454de6b5bfc89de95b18514e75329a2ec7491bebbdYing Wang  INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
6464de6b5bfc89de95b18514e75329a2ec7491bebbdYing Wangendif
6474647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
6484647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker# Keys authorized to sign OTA packages this build will accept.  The
6494647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker# build always uses test-keys for this; release packaging tools will
6504647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker# substitute other keys for this one.
6514647f12a4ff9dc54247184f17ff3de1cc423f213Doug ZongkerOTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem
6524647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
6534647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker# Generate a file containing the keys that will be read by the
6544647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker# recovery binary.
6554647f12a4ff9dc54247184f17ff3de1cc423f213Doug ZongkerRECOVERY_INSTALL_OTA_KEYS := \
6564647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	$(call intermediates-dir-for,PACKAGING,ota_keys)/keys
6574647f12a4ff9dc54247184f17ff3de1cc423f213Doug ZongkerDUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
6584647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
659e121d6acf47c3056e079ff62c82171e889cec3e0Doug Zongker$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(TARGET_EXTRA_RECOVERY_KEYS))
660e121d6acf47c3056e079ff62c82171e889cec3e0Doug Zongker$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
661e121d6acf47c3056e079ff62c82171e889cec3e0Doug Zongker	@echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"
6624647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	@rm -rf $@
6634647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	@mkdir -p $(dir $@)
664e121d6acf47c3056e079ff62c82171e889cec3e0Doug Zongker	java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
6654647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
6664647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
6674647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker		$(INSTALLED_RAMDISK_TARGET) \
6684647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker		$(INSTALLED_BOOTIMAGE_TARGET) \
6694647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker		$(recovery_binary) \
6704647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker		$(recovery_initrc) $(recovery_kernel) \
6714647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker		$(INSTALLED_2NDBOOTLOADER_TARGET) \
6724647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker		$(recovery_build_prop) $(recovery_resource_deps) \
6739ce0fb6e59415669074896cfa01e1f0cf97979b7Doug Zongker		$(recovery_fstab) \
6744647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker		$(RECOVERY_INSTALL_OTA_KEYS)
6754647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	@echo ----- Making recovery image ------
6764647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	rm -rf $(TARGET_RECOVERY_OUT)
6774647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	mkdir -p $(TARGET_RECOVERY_OUT)
6784647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	mkdir -p $(TARGET_RECOVERY_ROOT_OUT)
6794647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc
6804647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp
6814647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	echo Copying baseline ramdisk...
6824647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
683b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongker	rm $(TARGET_RECOVERY_ROOT_OUT)/init*.rc
6844647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	echo Modifying ramdisk contents...
6854647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
6864647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
6874647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/
6884647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	$(foreach item,$(recovery_resources_private), \
6894647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	  cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)
6909ce0fb6e59415669074896cfa01e1f0cf97979b7Doug Zongker	$(foreach item,$(recovery_fstab), \
6919ce0fb6e59415669074896cfa01e1f0cf97979b7Doug Zongker	  cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
6924647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
6934647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
6944647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	        > $(TARGET_RECOVERY_ROOT_OUT)/default.prop
6954647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	$(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
6964647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	$(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
6974647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker	@echo ----- Made recovery image -------- $@
698ed96e88850b471d4ebbbdd1c2acd3efdc6b19a10Doug Zongker	$(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
6994647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
7004647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerelse
7014647f12a4ff9dc54247184f17ff3de1cc423f213Doug ZongkerINSTALLED_RECOVERYIMAGE_TARGET :=
7024647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerendif
7034647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
7044647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker.PHONY: recoveryimage
7054647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongkerrecoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET)
7064647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker
7071181898e547c16dc2fe2f81990f0d481e523f45fDima Zavinifneq ($(BOARD_NAND_PAGE_SIZE),)
7081181898e547c16dc2fe2f81990f0d481e523f45fDima Zavinmkyaffs2_extra_flags := -c $(BOARD_NAND_PAGE_SIZE)
7091181898e547c16dc2fe2f81990f0d481e523f45fDima Zavinelse
7101181898e547c16dc2fe2f81990f0d481e523f45fDima Zavinmkyaffs2_extra_flags :=
7119cb8c2835232c8dc99cecca85a7e99bdee7109a9Lars SvenssonBOARD_NAND_PAGE_SIZE := 2048
7121181898e547c16dc2fe2f81990f0d481e523f45fDima Zavinendif
7131181898e547c16dc2fe2f81990f0d481e523f45fDima Zavin
71453871886bd5d3ab286f822b92b2a1c39fc9b4959Naseer Ahmedifneq ($(BOARD_NAND_SPARE_SIZE),)
71553871886bd5d3ab286f822b92b2a1c39fc9b4959Naseer Ahmedmkyaffs2_extra_flags += -s $(BOARD_NAND_SPARE_SIZE)
7169cb8c2835232c8dc99cecca85a7e99bdee7109a9Lars Svenssonelse
7179cb8c2835232c8dc99cecca85a7e99bdee7109a9Lars SvenssonBOARD_NAND_SPARE_SIZE := 64
71853871886bd5d3ab286f822b92b2a1c39fc9b4959Naseer Ahmedendif
71953871886bd5d3ab286f822b92b2a1c39fc9b4959Naseer Ahmed
7204647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker# -----------------------------------------------------------------
7210235237805991b48831dc8add072a50c478b2fcbYing Wang# system image
72288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
7230235237805991b48831dc8add072a50c478b2fcbYing Wangsystemimage_intermediates := \
7240235237805991b48831dc8add072a50c478b2fcbYing Wang	$(call intermediates-dir-for,PACKAGING,systemimage)
7250235237805991b48831dc8add072a50c478b2fcbYing WangBUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
72688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
72788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
72888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_PREBUILT) \
72988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_COPIED_HEADERS) \
73088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_GENERATED_SOURCES) \
73188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_DEFAULT_INSTALLED_MODULES))
73288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
7330a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
7340a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Cross## generate an ext image
73588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(1): output file
73688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine build-systemimage-target
73788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    @echo "Target system fs image: $(1)"
738e0a40217df12c274f591da212d30bf66c923524cColin Cross    $(call build-userimage-ext-target,$(TARGET_OUT),$(1),system,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
73988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
74088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
7410a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crosselse # INTERNAL_USERIMAGES_USE_EXT != true
74288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
74388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project## generate a yaffs2 image
74488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(1): output file
74588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine build-systemimage-target
74688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    @echo "Target system fs image: $(1)"
74788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    @mkdir -p $(dir $(1))
7481181898e547c16dc2fe2f81990f0d481e523f45fDima Zavin    $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1)
74988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
7500a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossendif # INTERNAL_USERIMAGES_USE_EXT
75188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
7520235237805991b48831dc8add072a50c478b2fcbYing Wang$(BUILT_SYSTEMIMAGE): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
75388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(call build-systemimage-target,$@)
75488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
75588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
7560235237805991b48831dc8add072a50c478b2fcbYing WangSYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
75788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
75873ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker# The system partition needs room for the recovery image as well.  We
75973ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker# now store the recovery image as a binary patch using the boot image
76073ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker# as the source (since they are very similar).  Generate the patch so
76173ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker# we can see how big it's going to be, and include that in the system
76273ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker# image size check calculation.
7631e96ac8430da922332e4c85e7eed0e95442ff2ceSriram Ramanifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
76473ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongkerintermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
76573ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug ZongkerRECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
76673ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \
76773ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker                             $(INSTALLED_BOOTIMAGE_TARGET) \
76822bc517cdfb6b7ee5f90f61de425516c1d7b0245Doug Zongker			     $(HOST_OUT_EXECUTABLES)/imgdiff \
76922bc517cdfb6b7ee5f90f61de425516c1d7b0245Doug Zongker	                     $(HOST_OUT_EXECUTABLES)/bsdiff
77073ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker	@echo "Construct recovery from boot"
77173ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker	mkdir -p $(dir $@)
772b003d89ee3a6d39a0ad3ca6e9c8a61f39ef3b92aDoug Zongker	PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
7731e96ac8430da922332e4c85e7eed0e95442ff2ceSriram Ramanendif
7741e96ac8430da922332e4c85e7eed0e95442ff2ceSriram Raman
77573ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker
77673ef8257ce54ce1ddc2d4cfc3b3814ca734c0e11Doug Zongker$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
77788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo "Install system fs image: $@"
77888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(copy-file-to-target)
779ed96e88850b471d4ebbbdd1c2acd3efdc6b19a10Doug Zongker	$(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)
78088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
78188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsystemimage: $(INSTALLED_SYSTEMIMAGE)
78288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
78388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: systemimage-nodeps snod
78488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsystemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
785144b028eac600bdf4817648dd23c577abba01134Colin Cross	            | $(INTERNAL_USERIMAGES_DEPS)
78688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo "make $@: ignoring dependencies"
78788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
788ed96e88850b471d4ebbbdd1c2acd3efdc6b19a10Doug Zongker	$(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)
78988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
79088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#######
79188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project## system tarball
79288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine build-systemtarball-target
79388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
79488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(MKTARBALL) $(FS_GET_STATS) \
79588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
79688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_SYSTEMTARBALL_TARGET)
79788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
79888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
79969ef5ce4f0e0adfac1ff12f8cc3dde65fab36486Bruce Beareifndef SYSTEM_TARBALL_FORMAT
80069ef5ce4f0e0adfac1ff12f8cc3dde65fab36486Bruce Beare    SYSTEM_TARBALL_FORMAT := bz2
80169ef5ce4f0e0adfac1ff12f8cc3dde65fab36486Bruce Beareendif
80269ef5ce4f0e0adfac1ff12f8cc3dde65fab36486Bruce Beare
80388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsystem_tar := $(PRODUCT_OUT)/system.tar
80469ef5ce4f0e0adfac1ff12f8cc3dde65fab36486Bruce BeareINSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
80588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
80688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
80788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(build-systemtarball-target)
80888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
80988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: systemtarball-nodeps
81088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsystemtarball-nodeps: $(FS_GET_STATS) \
81188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project                      $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
81288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(build-systemtarball-target)
81388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
81488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: stnod
81588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectstnod: systemtarball-nodeps
81688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
81788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
81852aac20307073b8149a31d01b0b295651ea4b042Bruce Beare#######
81952aac20307073b8149a31d01b0b295651ea4b042Bruce Beare## boot tarball
82052aac20307073b8149a31d01b0b295651ea4b042Bruce Bearedefine build-boottarball-target
82145ac4341515f7ff4d483cfb8e2fba8d3c2cb1f6eBruce Beare    $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
82252aac20307073b8149a31d01b0b295651ea4b042Bruce Beare    $(hide) mkdir -p $(PRODUCT_OUT)/boot
82352aac20307073b8149a31d01b0b295651ea4b042Bruce Beare    $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
82452aac20307073b8149a31d01b0b295651ea4b042Bruce Beare    $(hide) echo $(BOARD_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
82552aac20307073b8149a31d01b0b295651ea4b042Bruce Beare    $(hide) $(MKTARBALL) $(FS_GET_STATS) \
82652aac20307073b8149a31d01b0b295651ea4b042Bruce Beare                 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
82752aac20307073b8149a31d01b0b295651ea4b042Bruce Beare                 $(INSTALLED_BOOTTARBALL_TARGET)
82852aac20307073b8149a31d01b0b295651ea4b042Bruce Beareendef
82952aac20307073b8149a31d01b0b295651ea4b042Bruce Beare
83052aac20307073b8149a31d01b0b295651ea4b042Bruce Beareifndef BOOT_TARBALL_FORMAT
83152aac20307073b8149a31d01b0b295651ea4b042Bruce Beare    BOOT_TARBALL_FORMAT := bz2
83252aac20307073b8149a31d01b0b295651ea4b042Bruce Beareendif
83352aac20307073b8149a31d01b0b295651ea4b042Bruce Beare
83452aac20307073b8149a31d01b0b295651ea4b042Bruce Beareboot_tar := $(PRODUCT_OUT)/boot.tar
83552aac20307073b8149a31d01b0b295651ea4b042Bruce BeareINSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
83652aac20307073b8149a31d01b0b295651ea4b042Bruce Beare$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
83752aac20307073b8149a31d01b0b295651ea4b042Bruce Beare$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
83852aac20307073b8149a31d01b0b295651ea4b042Bruce Beare	$(build-boottarball-target)
83952aac20307073b8149a31d01b0b295651ea4b042Bruce Beare
84052aac20307073b8149a31d01b0b295651ea4b042Bruce Beare.PHONY: boottarball-nodeps btnod
84152aac20307073b8149a31d01b0b295651ea4b042Bruce Beareboottarball-nodeps btnod: $(FS_GET_STATS) \
84252aac20307073b8149a31d01b0b295651ea4b042Bruce Beare                      $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
84352aac20307073b8149a31d01b0b295651ea4b042Bruce Beare	$(build-boottarball-target)
84452aac20307073b8149a31d01b0b295651ea4b042Bruce Beare
84552aac20307073b8149a31d01b0b295651ea4b042Bruce Beare
84688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
84788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# data partition image
84888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_USERDATAIMAGE_FILES := \
84988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
85088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
8510a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
85288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project## Generate an ext2 image
85388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine build-userdataimage-target
85488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
85588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    @mkdir -p $(TARGET_OUT_DATA)
856026f1451ce0c92c4630ca2d2d95f2fb9d68e9568Ying Wang    $(call build-userimage-ext-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),data,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
857ed96e88850b471d4ebbbdd1c2acd3efdc6b19a10Doug Zongker    $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
85888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
85988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
8600a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crosselse # INTERNAL_USERIMAGES_USE_EXT != true
86188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
86288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project## Generate a yaffs2 image
86388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine build-userdataimage-target
86488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
86588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    @mkdir -p $(TARGET_OUT_DATA)
8661181898e547c16dc2fe2f81990f0d481e523f45fDima Zavin    $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
867ed96e88850b471d4ebbbdd1c2acd3efdc6b19a10Doug Zongker    $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
86888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
8690a7b2c5c13dfd3d3c38bceb79fa2bd4a360addf8Colin Crossendif # INTERNAL_USERIMAGES_USE_EXT
87088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
87164d85d0d827489c514f6aec075482563c80cda73Joe OnoratoBUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
87264d85d0d827489c514f6aec075482563c80cda73Joe Onorato
87364d85d0d827489c514f6aec075482563c80cda73Joe Onorato# We just build this directly to the install location.
87464d85d0d827489c514f6aec075482563c80cda73Joe OnoratoINSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
875144b028eac600bdf4817648dd23c577abba01134Colin Cross$(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) \
87688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project                                   $(INTERNAL_USERDATAIMAGE_FILES)
87788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(build-userdataimage-target)
87888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
87988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: userdataimage-nodeps
880144b028eac600bdf4817648dd23c577abba01134Colin Crossuserdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
88188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(build-userdataimage-target)
88288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
88388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#######
88488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project## data partition tarball
88588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine build-userdatatarball-target
88688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(call pretty,"Target userdata fs tarball: " \
88788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project                  "$(INSTALLED_USERDATATARBALL_TARGET)")
88888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(MKTARBALL) $(FS_GET_STATS) \
88988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
89088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_USERDATATARBALL_TARGET)
89188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
89288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
89388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectuserdata_tar := $(PRODUCT_OUT)/userdata.tar
89488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
89588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
89688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
89788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(build-userdatatarball-target)
89888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
89988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: userdatatarball-nodeps
90088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectuserdatatarball-nodeps: $(FS_GET_STATS)
90188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(build-userdatatarball-target)
90288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
90388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
90488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
90588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# bring in the installer image generation defines if necessary
90688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(TARGET_USE_DISKINSTALLER),true)
90788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectinclude bootable/diskinstaller/config.mk
90888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
90988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
91088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
9118678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# host tools needed to build OTA packages
9128678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
913068986605b2afcd5e044b62f22ac6ecd5c15b519Ying WangOTATOOLS :=  $(HOST_OUT_EXECUTABLES)/minigzip \
9148678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	  $(HOST_OUT_EXECUTABLES)/mkbootfs \
9158678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	  $(HOST_OUT_EXECUTABLES)/mkbootimg \
9168678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	  $(HOST_OUT_EXECUTABLES)/fs_config \
9178678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	  $(HOST_OUT_EXECUTABLES)/mkyaffs2image \
9188678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	  $(HOST_OUT_EXECUTABLES)/zipalign \
9198678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	  $(HOST_OUT_EXECUTABLES)/aapt \
9208678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	  $(HOST_OUT_EXECUTABLES)/bsdiff \
921c494d7cee85d980647ca915ea64355b71fe817ebDoug Zongker	  $(HOST_OUT_EXECUTABLES)/imgdiff \
9228678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	  $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
923933abf15bcd66138ba4e5fba7071e239a8662c6bYing Wang	  $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
924933abf15bcd66138ba4e5fba7071e239a8662c6bYing Wang	  $(HOST_OUT_EXECUTABLES)/mkuserimg.sh \
925933abf15bcd66138ba4e5fba7071e239a8662c6bYing Wang	  $(HOST_OUT_EXECUTABLES)/genext2fs \
926933abf15bcd66138ba4e5fba7071e239a8662c6bYing Wang	  $(HOST_OUT_EXECUTABLES)/tune2fs \
927ff83c8593ec3fbcd916227cd4745404fc3bf1ea8Sriram Raman	  $(HOST_OUT_EXECUTABLES)/e2fsck \
928c647aecabb9cf03d73cfc34836e3bfc886b54c2eSriram Raman	  $(HOST_OUT_EXECUTABLES)/make_ext4fs
92988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
930068986605b2afcd5e044b62f22ac6ecd5c15b519Ying Wang.PHONY: otatools
931068986605b2afcd5e044b62f22ac6ecd5c15b519Ying Wangotatools: $(OTATOOLS)
932068986605b2afcd5e044b62f22ac6ecd5c15b519Ying Wang
93388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
93488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# A zip of the directories that map to the target filesystem.
93588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# This zip can be used to create an OTA package or filesystem image
93688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# as a post-build step.
93788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
93888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(TARGET_PRODUCT)
93988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(TARGET_BUILD_TYPE),debug)
94088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  name := $(name)_debug
94188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
94288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(name)-target_files-$(FILE_NAME_TAG)
94388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
94488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectintermediates := $(call intermediates-dir-for,PACKAGING,target_files)
94588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectBUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
94688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
94788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(BUILT_TARGET_FILES_PACKAGE): \
94888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		zip_root := $(intermediates)/$(name)
94988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
95088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(1): Directory to copy
95188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# $(2): Location to copy it to
95288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
95388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdefine package_files-copy-root
95488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
95588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    mkdir -p $(2) && \
95688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(ACP) -rd $(strip $(1))/* $(2); \
95788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  fi
95888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendef
95988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
96088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectbuilt_ota_tools := \
96117c83cf22c426c628b4b21bc65128a0d80866d31Doug Zongker	$(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \
9626c770467fb4faad2c252c9c1b881ec0f253a3059Doug Zongker	$(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \
963a406c1e7a1ae22945d2b8bb766d46b7e3544e039Doug Zongker	$(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \
964a406c1e7a1ae22945d2b8bb766d46b7e3544e039Doug Zongker	$(call intermediates-dir-for,EXECUTABLES,updater)/updater
96588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
96688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
967b1134dd04900416e74bc1ee51f65d4e066d90334Doug Zongker$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
968b1134dd04900416e74bc1ee51f65d4e066d90334Doug Zongker
969c18736b1a777c386dc3c5e3f878249770b5edd78Doug Zongkerifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
970c18736b1a777c386dc3c5e3f878249770b5edd78Doug Zongker# default to common dir for device vendor
971c18736b1a777c386dc3c5e3f878249770b5edd78Doug Zongker$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common
972c18736b1a777c386dc3c5e3f878249770b5edd78Doug Zongkerelse
973c18736b1a777c386dc3c5e3f878249770b5edd78Doug Zongker$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
974c18736b1a777c386dc3c5e3f878249770b5edd78Doug Zongkerendif
975c18736b1a777c386dc3c5e3f878249770b5edd78Doug Zongker
97688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Depending on the various images guarantees that the underlying
97788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# directories are up-to-date.
97888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(BUILT_TARGET_FILES_PACKAGE): \
97988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_BOOTIMAGE_TARGET) \
98088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_RADIOIMAGE_TARGET) \
98188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_RECOVERYIMAGE_TARGET) \
9824647f12a4ff9dc54247184f17ff3de1cc423f213Doug Zongker		$(INSTALLED_SYSTEMIMAGE) \
98388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_USERDATAIMAGE_TARGET) \
98488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
98588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(built_ota_tools) \
98688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(APKCERTS_FILE) \
987283e2a1e1bae4e21824969a15da6420204633dddDoug Zongker		$(HOST_OUT_EXECUTABLES)/fs_config \
98888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		| $(ACP)
98988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo "Package target files: $@"
99088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) rm -rf $@ $(zip_root)
99188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mkdir -p $(dir $@) $(zip_root)
99288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@# Components of the recovery image
99388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mkdir -p $(zip_root)/RECOVERY
99488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(call package_files-copy-root, \
99588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
99688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifdef INSTALLED_KERNEL_TARGET
99788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
99888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
99988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifdef INSTALLED_2NDBOOTLOADER_TARGET
100088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(ACP) \
100188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
100288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
100388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifdef BOARD_KERNEL_CMDLINE
100488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
100588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
100638a649f873da8d4df7df14619cbd967570d2de9bDoug Zongkerifdef BOARD_KERNEL_BASE
100738a649f873da8d4df7df14619cbd967570d2de9bDoug Zongker	$(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
100838a649f873da8d4df7df14619cbd967570d2de9bDoug Zongkerendif
10094de6b5bfc89de95b18514e75329a2ec7491bebbdYing Wangifdef BOARD_KERNEL_PAGESIZE
10104de6b5bfc89de95b18514e75329a2ec7491bebbdYing Wang	$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize
10114de6b5bfc89de95b18514e75329a2ec7491bebbdYing Wangendif
101288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@# Components of the boot image
101388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mkdir -p $(zip_root)/BOOT
101488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(call package_files-copy-root, \
101588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
101688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifdef INSTALLED_KERNEL_TARGET
101788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
101888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
101988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifdef INSTALLED_2NDBOOTLOADER_TARGET
102088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(ACP) \
102188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
102288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
102388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifdef BOARD_KERNEL_CMDLINE
102488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
102588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
102638a649f873da8d4df7df14619cbd967570d2de9bDoug Zongkerifdef BOARD_KERNEL_BASE
102738a649f873da8d4df7df14619cbd967570d2de9bDoug Zongker	$(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
102838a649f873da8d4df7df14619cbd967570d2de9bDoug Zongkerendif
10294de6b5bfc89de95b18514e75329a2ec7491bebbdYing Wangifdef BOARD_KERNEL_PAGESIZE
10304de6b5bfc89de95b18514e75329a2ec7491bebbdYing Wang	$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
10314de6b5bfc89de95b18514e75329a2ec7491bebbdYing Wangendif
1032e01100c7ac15bd884ca02c64f42b908b93e37c26Doug Zongker	$(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
1033e01100c7ac15bd884ca02c64f42b908b93e37c26Doug Zongker	            mkdir -p $(zip_root)/RADIO; \
1034e01100c7ac15bd884ca02c64f42b908b93e37c26Doug Zongker	            $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
103588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@# Contents of the system image
103688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(call package_files-copy-root, \
103788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
103888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@# Contents of the data image
103988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(call package_files-copy-root, \
104088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(TARGET_OUT_DATA),$(zip_root)/DATA)
104188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@# Extra contents of the OTA package
104288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mkdir -p $(zip_root)/OTA/bin
104388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
104488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
10458678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	@# Files that do not end up in any images, but are necessary to
104688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@# build them.
104788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mkdir -p $(zip_root)/META
104888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
104917c83cf22c426c628b4b21bc65128a0d80866d31Doug Zongker	$(hide)	echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
105037974731fcb4e32b1de5f213d34bd832ca889869Doug Zongker	$(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
1051b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerifdef BOARD_FLASH_BLOCK_SIZE
105237974731fcb4e32b1de5f213d34bd832ca889869Doug Zongker	$(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
1053b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerendif
1054b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerifdef BOARD_BOOTIMAGE_PARTITION_SIZE
1055008367111ee3429bfe33d8d8021493596d3c1d6aYing Wang	$(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
1056b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerendif
1057b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
1058008367111ee3429bfe33d8d8021493596d3c1d6aYing Wang	$(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
1059b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerendif
1060b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerifdef BOARD_SYSTEMIMAGE_PARTITION_SIZE
1061008367111ee3429bfe33d8d8021493596d3c1d6aYing Wang	$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
1062b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerendif
1063b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
1064008367111ee3429bfe33d8d8021493596d3c1d6aYing Wang	$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
1065b4c7d32cbac0ef36062c4e2f348b47e027610eefDoug Zongkerendif
106637974731fcb4e32b1de5f213d34bd832ca889869Doug Zongker	$(hide) echo "tool_extensions=$(tool_extensions)" >> $(zip_root)/META/misc_info.txt
1067d421f57d22009e4d9ce71298c2f93636ff9e7d9dYing Wangifdef mkyaffs2_extra_flags
106837974731fcb4e32b1de5f213d34bd832ca889869Doug Zongker	$(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(zip_root)/META/misc_info.txt
1069d421f57d22009e4d9ce71298c2f93636ff9e7d9dYing Wangendif
1070c5a07ce038d7aeb62a5c02886cd2ecbf56687e9dYing Wangifdef INTERNAL_USERIMAGES_SPARSE_EXT_FLAG
1071c5a07ce038d7aeb62a5c02886cd2ecbf56687e9dYing Wang	$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(zip_root)/META/misc_info.txt
1072c5a07ce038d7aeb62a5c02886cd2ecbf56687e9dYing Wangendif
1073e121d6acf47c3056e079ff62c82171e889cec3e0Doug Zongkerifdef TARGET_EXTRA_RECOVERY_KEYS
1074e121d6acf47c3056e079ff62c82171e889cec3e0Doug Zongker	$(hide) echo "extra_recovery_keys=$(TARGET_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
1075e121d6acf47c3056e079ff62c82171e889cec3e0Doug Zongkerendif
107688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@# Zip everything up, preserving symlinks
107788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
1078283e2a1e1bae4e21824969a15da6420204633dddDoug Zongker	@# Run fs_config on all the system files in the zip, and save the output
1079283e2a1e1bae4e21824969a15da6420204633dddDoug Zongker	$(hide) zipinfo -1 $@ | awk -F/ 'BEGIN { OFS="/" } /^SYSTEM\// {$$1 = "system"; print}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/filesystem_config.txt
1080283e2a1e1bae4e21824969a15da6420204633dddDoug Zongker	$(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/filesystem_config.txt)
1081283e2a1e1bae4e21824969a15da6420204633dddDoug Zongker
108288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
108388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projecttarget-files-package: $(BUILT_TARGET_FILES_PACKAGE)
108488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
1085367910fc6dd41e1d84789b305e6bd9cbafb78fbcDoug Zongker
1086367910fc6dd41e1d84789b305e6bd9cbafb78fbcDoug Zongkerifneq ($(TARGET_SIMULATOR),true)
1087367910fc6dd41e1d84789b305e6bd9cbafb78fbcDoug Zongkerifneq ($(TARGET_PRODUCT),sdk)
1088910dcbebc07a63debb0848e7cc157664508016ffYing Wangifneq ($(TARGET_DEVICE),generic)
1089fb0a347b747a91173c8a9f845a0362e3f8a9701fYing Wangifneq ($(TARGET_NO_KERNEL),true)
1090367910fc6dd41e1d84789b305e6bd9cbafb78fbcDoug Zongker
109109a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang# -----------------------------------------------------------------
109209a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang# OTA update package
109309a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang
10948678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongkername := $(TARGET_PRODUCT)
10958678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongkerifeq ($(TARGET_BUILD_TYPE),debug)
10968678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker  name := $(name)_debug
10978678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongkerendif
10988678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongkername := $(name)-ota-$(FILE_NAME_TAG)
10998678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
11008678df4c064a17575137bbacf8f5856052dd5bd7Doug ZongkerINTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
11018678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
11028678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
11038678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
1104068986605b2afcd5e044b62f22ac6ecd5c15b519Ying Wang$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
11058678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker	@echo "Package OTA: $@"
110668bb65177cc6839e985c0a54343f44494de61d62Ying Wang	$(hide) ./build/tools/releasetools/ota_from_target_files -v \
1107602a84e0bbf1807a9403cfa50184241f6fc035c4Doug Zongker	   -p $(HOST_OUT) \
11088678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker           -k $(KEY_CERT_PAIR) \
11098678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker           $(BUILT_TARGET_FILES_PACKAGE) $@
11108678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
11118678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker.PHONY: otapackage
11128678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongkerotapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
11138678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
111409a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang# -----------------------------------------------------------------
111509a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang# The update package
111609a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang
111709a00a672bb18dccc97af6090739ea275c39d8a3Ying Wangname := $(TARGET_PRODUCT)
111809a00a672bb18dccc97af6090739ea275c39d8a3Ying Wangifeq ($(TARGET_BUILD_TYPE),debug)
111909a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang  name := $(name)_debug
112009a00a672bb18dccc97af6090739ea275c39d8a3Ying Wangendif
112109a00a672bb18dccc97af6090739ea275c39d8a3Ying Wangname := $(name)-img-$(FILE_NAME_TAG)
112209a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang
112309a00a672bb18dccc97af6090739ea275c39d8a3Ying WangINTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
112409a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang
112509a00a672bb18dccc97af6090739ea275c39d8a3Ying Wangifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
112609a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang# default to common dir for device vendor
112709a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common
112809a00a672bb18dccc97af6090739ea275c39d8a3Ying Wangelse
112909a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
113009a00a672bb18dccc97af6090739ea275c39d8a3Ying Wangendif
113109a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang
113209a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
113309a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang	@echo "Package: $@"
113409a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang	$(hide) ./build/tools/releasetools/img_from_target_files -v \
113509a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang	   -s $(extensions) \
113609a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang	   -p $(HOST_OUT) \
113709a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang	   $(BUILT_TARGET_FILES_PACKAGE) $@
113809a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang
113909a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang.PHONY: updatepackage
114009a00a672bb18dccc97af6090739ea275c39d8a3Ying Wangupdatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
114109a00a672bb18dccc97af6090739ea275c39d8a3Ying Wang
1142fb0a347b747a91173c8a9f845a0362e3f8a9701fYing Wangendif    # TARGET_NO_KERNEL != true
1143910dcbebc07a63debb0848e7cc157664508016ffYing Wangendif    # TARGET_DEVICE != generic
1144367910fc6dd41e1d84789b305e6bd9cbafb78fbcDoug Zongkerendif    # TARGET_PRODUCT != sdk
1145367910fc6dd41e1d84789b305e6bd9cbafb78fbcDoug Zongkerendif    # TARGET_SIMULATOR != true
11468678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker
11478678df4c064a17575137bbacf8f5856052dd5bd7Doug Zongker# -----------------------------------------------------------------
114888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# installed file list
114988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it
115088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# gets the DexOpt one if we're doing that.
115188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
115288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE)
115388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo Installed file list: $@
115488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@mkdir -p $(dir $@)
115588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@rm -f $@
115688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@
115788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
115888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: installed-file-list
115988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectinstalled-file-list: $(INSTALLED_FILES_FILE)
1160a37a2cb23159709260f248b46428987c9aeb2998Ying Wangifneq ($(filter sdk,$(MAKECMDGOALS)),)
116188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(call dist-for-goals, sdk, $(INSTALLED_FILES_FILE))
1162a37a2cb23159709260f248b46428987c9aeb2998Ying Wangendif
1163a37a2cb23159709260f248b46428987c9aeb2998Ying Wangifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
116403fbe40d5346eb4d5258aa55a00a9a7cb18f8551Joe Onorato$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE))
1165a37a2cb23159709260f248b46428987c9aeb2998Ying Wangendif
116688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
116788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
116888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# A zip of the tests that are built when running "make tests".
116988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
117088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
117188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
117288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(TARGET_PRODUCT)
117388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(TARGET_BUILD_TYPE),debug)
117488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  name := $(name)_debug
117588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
117688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(name)-tests-$(FILE_NAME_TAG)
117788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
117888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectintermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
117988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectBUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
118088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
118188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
118288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
118388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Depending on the images guarantees that the underlying
118488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# directories are up-to-date.
118588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(BUILT_TESTS_ZIP_PACKAGE): \
118688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(BUILT_SYSTEMIMAGE) \
118788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_USERDATAIMAGE_TARGET) \
118888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		| $(ACP)
118988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo "Package test files: $@"
119088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) rm -rf $@ $(zip_root)
119188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mkdir -p $(dir $@) $(zip_root)
119288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@# Some parts of the system image
119388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(call package_files-copy-root, \
119488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin)
119588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(call package_files-copy-root, \
119688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib)
119788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(call package_files-copy-root, \
119888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(SYSTEMIMAGE_SOURCE_DIR)/framework, \
119988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(zip_root)/SYSTEM/framework)
120088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM
120188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@# Contents of the data image
120288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) $(call package_files-copy-root, \
120388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(TARGET_OUT_DATA),$(zip_root)/DATA)
120488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
120588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
12069c76255031d4ecf7f587eec96eb5d9bf37ef19d5Ying Wang.PHONY: tests-zip-package
120788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projecttests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
120888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
1209db2cb63612af2bc9e8bd7ea6d33da2218a33de2dYing Wang# Target needed by tests build
1210db2cb63612af2bc9e8bd7ea6d33da2218a33de2dYing Wang.PHONY: tests-build-target
1211db2cb63612af2bc9e8bd7ea6d33da2218a33de2dYing Wangtests-build-target: $(BUILT_TESTS_ZIP_PACKAGE) \
1212db2cb63612af2bc9e8bd7ea6d33da2218a33de2dYing Wang                    $(BUILT_USERDATAIMAGE_TARGET)
1213db2cb63612af2bc9e8bd7ea6d33da2218a33de2dYing Wang
1214db2cb63612af2bc9e8bd7ea6d33da2218a33de2dYing Wangifneq (,$(filter $(MAKECMDGOALS),tests-build-target))
1215db2cb63612af2bc9e8bd7ea6d33da2218a33de2dYing Wang  $(call dist-for-goals, tests-build-target, \
1216db2cb63612af2bc9e8bd7ea6d33da2218a33de2dYing Wang          $(BUILT_TESTS_ZIP_PACKAGE) \
1217db2cb63612af2bc9e8bd7ea6d33da2218a33de2dYing Wang          $(BUILT_USERDATAIMAGE_TARGET))
12189c76255031d4ecf7f587eec96eb5d9bf37ef19d5Ying Wangendif
12199c76255031d4ecf7f587eec96eb5d9bf37ef19d5Ying Wang
122088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
122188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# A zip of the symbols directory.  Keep the full paths to make it
122288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# more obvious where these files came from.
122388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
122488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(TARGET_PRODUCT)
122588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(TARGET_BUILD_TYPE),debug)
122688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  name := $(name)_debug
122788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
122888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(name)-symbols-$(FILE_NAME_TAG)
122988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
123088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectSYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
123188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET)
123288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo "Package symbols: $@"
123388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) rm -rf $@
123488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mkdir -p $(dir $@)
123588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
123688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
123788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
123888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# A zip of the Android Apps. Not keeping full path so that we don't
123988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# include product names when distributing
124088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
124188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(TARGET_PRODUCT)
124288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(TARGET_BUILD_TYPE),debug)
124388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  name := $(name)_debug
124488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
124588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(name)-apps-$(FILE_NAME_TAG)
124688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
124788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectAPPS_ZIP := $(PRODUCT_OUT)/$(name).zip
124888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
124988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo "Package apps: $@"
125088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) rm -rf $@
125188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) mkdir -p $(dir $@)
125288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
125388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
12540198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu
12550198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu#------------------------------------------------------------------
12560198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu# A zip of emma code coverage meta files. Generated for fully emma
12570198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu# instrumented build.
12580198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu#
12590198d6ebb457d11797deb414c51b8897c67f7f10Guang ZhuEMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip
12600198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu$(EMMA_META_ZIP): $(INSTALLED_SYSTEMIMAGE)
12610198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu	@echo "Collecting Emma coverage meta files."
12620198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu	$(hide) find $(TARGET_COMMON_OUT_ROOT) -name "coverage.em" | \
12630198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu		zip -@ -q $@
12640198d6ebb457d11797deb414c51b8897c67f7f10Guang Zhu
126588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif	# TARGET_SIMULATOR != true
126688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
126788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
126888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# dalvik something
126988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project.PHONY: dalvikfiles
127088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdalvikfiles: $(INTERNAL_DALVIK_MODULES)
127188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
127288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
127388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# The emulator package
127488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
127588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifneq ($(TARGET_SIMULATOR),true)
127688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
127788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_EMULATOR_PACKAGE_FILES += \
127888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project        $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
127988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project        prebuilt/android-arm/kernel/kernel-qemu \
128088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project        $(INSTALLED_RAMDISK_TARGET) \
128188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_SYSTEMIMAGE) \
128288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(INSTALLED_USERDATAIMAGE_TARGET)
128388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
128488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectname := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
128588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
128688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
128788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
128888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
128988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo "Package: $@"
129088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
129188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
129288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
129388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
129488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
129588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# The pdk package (Platform Development Kit)
129688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
129788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifneq (,$(filter pdk,$(MAKECMDGOALS)))
129888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project  include development/pdk/Pdk.mk
129988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
130088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
130188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
130288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# The SDK
130388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
130488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifneq ($(TARGET_SIMULATOR),true)
130588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
130688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# The SDK includes host-specific components, so it belongs under HOST_OUT.
130788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsdk_dir := $(HOST_OUT)/sdk
130888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
130988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Build a name that looks like:
131088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
131188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#     linux-x86   --> android-sdk_12345_linux-x86
131288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#     darwin-x86  --> android-sdk_12345_mac-x86
131388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#     windows-x86 --> android-sdk_12345_windows
131488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
131588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsdk_name := android-sdk_$(FILE_NAME_TAG)
131688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(HOST_OS),darwin)
131703fbe40d5346eb4d5258aa55a00a9a7cb18f8551Joe Onorato  INTERNAL_SDK_HOST_OS_NAME := mac
131888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectelse
131903fbe40d5346eb4d5258aa55a00a9a7cb18f8551Joe Onorato  INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
132088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
132188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifneq ($(HOST_OS),windows)
132203fbe40d5346eb4d5258aa55a00a9a7cb18f8551Joe Onorato  INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(HOST_ARCH)
132388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
132403fbe40d5346eb4d5258aa55a00a9a7cb18f8551Joe Onoratosdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
132588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
132688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsdk_dep_file := $(sdk_dir)/sdk_deps.mk
132788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
132888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectATREE_FILES :=
132988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project-include $(sdk_dep_file)
133088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
133188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# if we don't have a real list, then use "everything"
133288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectifeq ($(strip $(ATREE_FILES)),)
133388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectATREE_FILES := \
133488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_PREBUILT) \
133588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_COPIED_HEADERS) \
133688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_GENERATED_SOURCES) \
133788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_DEFAULT_INSTALLED_MODULES) \
133888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(INSTALLED_RAMDISK_TARGET) \
133988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_DOCS) \
134088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ALL_SDK_FILES)
134188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif
134288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
134388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectatree_dir := development/build
134488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
134588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectsdk_atree_files := \
134688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(atree_dir)/sdk.exclude.atree \
134788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(atree_dir)/sdk.atree \
1348ffd5087ec81a281b1299048b4282dad593ccd703Xavier Ducrohet	$(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree \
1349ffd5087ec81a281b1299048b4282dad593ccd703Xavier Ducrohet	sdk/build/tools.atree
135088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
135188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectdeps := \
135288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(target_notice_file_txt) \
135388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(tools_notice_file_txt) \
135488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(OUT_DOCS)/offline-sdk-timestamp \
1355139e33243bbe92858f39919c220a4d65fe8790bdYing Wang	$(SYMBOLS_ZIP) \
1356dddd957c74ead7246026e618ab40edf92037aad4Doug Zongker	$(INSTALLED_SYSTEMIMAGE) \
1357dddd957c74ead7246026e618ab40edf92037aad4Doug Zongker	$(INSTALLED_USERDATAIMAGE_TARGET) \
1358dddd957c74ead7246026e618ab40edf92037aad4Doug Zongker	$(INSTALLED_RAMDISK_TARGET) \
135988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(INSTALLED_SDK_BUILD_PROP_TARGET) \
1360139e33243bbe92858f39919c220a4d65fe8790bdYing Wang	$(INSTALLED_BUILD_PROP_TARGET) \
136188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(ATREE_FILES) \
136288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(atree_dir)/sdk.atree \
1363ffd5087ec81a281b1299048b4282dad593ccd703Xavier Ducrohet	sdk/build/tools.atree \
136488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(HOST_OUT_EXECUTABLES)/atree \
136588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project    $(HOST_OUT_EXECUTABLES)/line_endings
136688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
136788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
136888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
136988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
137088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
137188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
137288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
137388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
137488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#
137588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project#SDK_GNU_ERROR := true
137688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
137788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INTERNAL_SDK_TARGET): $(deps)
137888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo "Package SDK: $@"
137988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) rm -rf $(PRIVATE_DIR) $@
138088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) for f in $(target_gnu_MODULES); do \
138188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	  if [ -f $$f ]; then \
138288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	    echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
138388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	        including GNU target $$f >&2; \
138488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	    FAIL=$(SDK_GNU_ERROR); \
138588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	  fi; \
138688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	done; \
138788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	if [ $$FAIL ]; then exit 1; fi
138888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) ( \
138988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(HOST_OUT_EXECUTABLES)/atree \
139088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		$(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
139188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			-m $(PRIVATE_DEP_FILE) \
139288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			-I . \
139388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			-I $(PRODUCT_OUT) \
139488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			-I $(HOST_OUT) \
139588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			-I $(TARGET_COMMON_OUT_ROOT) \
139688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			-v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
13977558ad55ce34db67cc17059faade2a5908e20c8aRaphael Moll			-v "OUT_DIR=$(OUT_DIR)" \
139888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project			-o $(PRIVATE_DIR) && \
139988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		cp -f $(target_notice_file_txt) \
140088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project				$(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \
140188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
140288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
14031ae988040777f88f766fc421af79a61175e917afXavier Ducrohet                development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
140488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		chmod -R ug+rwX $(PRIVATE_DIR) && \
140588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project		cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
140688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
140788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
14083d224a0fc9ed34ac4c3c79c479d5c6dc5c31b87cRaphael
14093d224a0fc9ed34ac4c3c79c479d5c6dc5c31b87cRaphael# Is a Windows SDK requested? If so, we need some definitions from here
14103d224a0fc9ed34ac4c3c79c479d5c6dc5c31b87cRaphael# in order to find the Linux SDK used to create the Windows one.
14113d224a0fc9ed34ac4c3c79c479d5c6dc5c31b87cRaphaelifneq ($(filter win_sdk,$(MAKECMDGOALS)),)
14123d224a0fc9ed34ac4c3c79c479d5c6dc5c31b87cRaphaelLINUX_SDK_NAME := $(sdk_name)
14133d224a0fc9ed34ac4c3c79c479d5c6dc5c31b87cRaphaelLINUX_SDK_DIR  := $(sdk_dir)
14143d224a0fc9ed34ac4c3c79c479d5c6dc5c31b87cRaphaelinclude $(TOPDIR)development/build/tools/windows_sdk.mk
14153d224a0fc9ed34ac4c3c79c479d5c6dc5c31b87cRaphaelendif
14163d224a0fc9ed34ac4c3c79c479d5c6dc5c31b87cRaphael
141788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectendif # !simulator
141888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
141988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
142088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Findbugs
142188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
142288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source ProjectINTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
142388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
142488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo UnionBugs: $@
142588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \
142688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	> $@
142788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
142888b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	@echo ConvertXmlToText: $@
142988b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
143088b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project	$(INTERNAL_FINDBUGS_XML_TARGET)	> $@
143188b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
143288b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
143388b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# Findbugs
143488b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project
143588b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# -----------------------------------------------------------------
143688b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Project# These are some additional build tasks that need to be run.
143788b607994a148f4af5bffee163e39ce8296750c6The Android Open Source Projectinclude $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
1438e22ad6784ca5123fd0dcd6c1c18beb47bfd3ae20Claes Elgemark-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
1439