| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | # Put some miscellaneous rules here | 
|  | 2 |  | 
|  | 3 | # Pick a reasonable string to use to identify files. | 
|  | 4 | ifneq "" "$(filter eng.%,$(BUILD_NUMBER))" | 
|  | 5 | # BUILD_NUMBER has a timestamp in it, which means that | 
|  | 6 | # it will change every time.  Pick a stable value. | 
|  | 7 | FILE_NAME_TAG := eng.$(USER) | 
|  | 8 | else | 
|  | 9 | FILE_NAME_TAG := $(BUILD_NUMBER) | 
|  | 10 | endif | 
|  | 11 |  | 
|  | 12 | # ----------------------------------------------------------------- | 
|  | 13 | # Define rules to copy PRODUCT_COPY_FILES defined by the product. | 
|  | 14 | # PRODUCT_COPY_FILES contains words like <source file>:<dest file>. | 
|  | 15 | # <dest file> is relative to $(PRODUCT_OUT), so it should look like, | 
|  | 16 | # e.g., "system/etc/file.xml". | 
| Jean-Baptiste Queru | 518ce57 | 2010-03-01 16:18:59 -0800 | [diff] [blame] | 17 | # The filter part means "only eval the copy-one-file rule if this | 
| Ying Wang | 462d26b | 2010-11-02 21:31:47 -0700 | [diff] [blame] | 18 | # src:dest pair is the first one to match the same dest" | 
|  | 19 | unique_product_copy_files_destinations := $(sort \ | 
|  | 20 | $(foreach cf,$(PRODUCT_COPY_FILES), $(call word-colon,2,$(cf)))) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 21 | $(foreach cf,$(PRODUCT_COPY_FILES), \ | 
| Ying Wang | 462d26b | 2010-11-02 21:31:47 -0700 | [diff] [blame] | 22 | $(eval _src := $(call word-colon,1,$(cf))) \ | 
|  | 23 | $(eval _dest := $(call word-colon,2,$(cf))) \ | 
|  | 24 | $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \ | 
|  | 25 | $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \ | 
|  | 26 | $(eval $(call copy-one-file,$(_src),$(_fulldest))) \ | 
|  | 27 | $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \ | 
|  | 28 | $(eval unique_product_copy_files_destinations := $(filter-out $(_dest), \ | 
|  | 29 | $(unique_product_copy_files_destinations))))) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 30 |  | 
|  | 31 | # ----------------------------------------------------------------- | 
|  | 32 | # docs/index.html | 
|  | 33 | gen := $(OUT_DOCS)/index.html | 
|  | 34 | ALL_DOCS += $(gen) | 
|  | 35 | $(gen): frameworks/base/docs/docs-redirect-index.html | 
|  | 36 | @mkdir -p $(dir $@) | 
|  | 37 | @cp -f $< $@ | 
|  | 38 |  | 
|  | 39 | # ----------------------------------------------------------------- | 
|  | 40 | # default.prop | 
|  | 41 | INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop | 
|  | 42 | ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET) | 
|  | 43 | ADDITIONAL_DEFAULT_PROPERTIES := \ | 
|  | 44 | $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) | 
|  | 45 |  | 
|  | 46 | $(INSTALLED_DEFAULT_PROP_TARGET): | 
|  | 47 | @echo Target buildinfo: $@ | 
|  | 48 | @mkdir -p $(dir $@) | 
|  | 49 | $(hide) echo "#" > $@; \ | 
|  | 50 | echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \ | 
|  | 51 | echo "#" >> $@; | 
| Jean-Baptiste Queru | 0545c91 | 2010-09-07 10:51:12 -0700 | [diff] [blame] | 52 | $(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \ | 
|  | 53 | echo "$(line)" >> $@;) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 54 |  | 
|  | 55 | # ----------------------------------------------------------------- | 
|  | 56 | # build.prop | 
|  | 57 | INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop | 
|  | 58 | ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET) | 
|  | 59 | ADDITIONAL_BUILD_PROPERTIES := \ | 
|  | 60 | $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES)) | 
|  | 61 |  | 
|  | 62 | # A list of arbitrary tags describing the build configuration. | 
|  | 63 | # Force ":=" so we can use += | 
|  | 64 | BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS) | 
|  | 65 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 66 | BUILD_VERSION_TAGS += debug | 
|  | 67 | endif | 
|  | 68 | # Apps are always signed with test keys, and may be re-signed in a post-build | 
|  | 69 | # step.  If that happens, the "test-keys" tag will be removed by that step. | 
|  | 70 | BUILD_VERSION_TAGS += test-keys | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 71 | BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) | 
|  | 72 |  | 
|  | 73 | # A human-readable string that descibes this build in detail. | 
|  | 74 | build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS) | 
|  | 75 | $(INSTALLED_BUILD_PROP_TARGET): PRIVATE_BUILD_DESC := $(build_desc) | 
|  | 76 |  | 
|  | 77 | # The string used to uniquely identify this build;  used by the OTA server. | 
|  | 78 | ifeq (,$(strip $(BUILD_FINGERPRINT))) | 
| Doug Zongker | 135a120 | 2010-09-15 13:02:12 -0700 | [diff] [blame] | 79 | BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 80 | endif | 
|  | 81 | ifneq ($(words $(BUILD_FINGERPRINT)),1) | 
|  | 82 | $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)") | 
|  | 83 | endif | 
|  | 84 |  | 
| Sriram Raman | 7b64124 | 2009-03-24 22:40:59 -0700 | [diff] [blame] | 85 | # Display parameters shown under Settings -> About Phone | 
|  | 86 | ifeq ($(TARGET_BUILD_VARIANT),user) | 
|  | 87 | # User builds should show: | 
|  | 88 | # release build number or branch.buld_number non-release builds | 
|  | 89 |  | 
|  | 90 | # Dev. branches should have DISPLAY_BUILD_NUMBER set | 
|  | 91 | ifeq "true" "$(DISPLAY_BUILD_NUMBER)" | 
|  | 92 | BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER) | 
|  | 93 | else | 
|  | 94 | BUILD_DISPLAY_ID := $(BUILD_ID) | 
|  | 95 | endif | 
|  | 96 | else | 
|  | 97 | # Non-user builds should show detailed build information | 
|  | 98 | BUILD_DISPLAY_ID := $(build_desc) | 
|  | 99 | endif | 
|  | 100 |  | 
| Ying Wang | 77c882f | 2010-04-27 15:45:35 -0700 | [diff] [blame] | 101 | # Whether there is default locale set in PRODUCT_PROPERTY_OVERRIDES | 
| Ying Wang | 38d7f02 | 2010-07-21 14:58:42 -0700 | [diff] [blame] | 102 | product_property_override_locale_language := $(strip \ | 
|  | 103 | $(patsubst ro.product.locale.language=%,%,\ | 
| Ying Wang | 77c882f | 2010-04-27 15:45:35 -0700 | [diff] [blame] | 104 | $(filter ro.product.locale.language=%,$(PRODUCT_PROPERTY_OVERRIDES)))) | 
| Ying Wang | 38d7f02 | 2010-07-21 14:58:42 -0700 | [diff] [blame] | 105 | product_property_overrides_locale_region := $(strip \ | 
|  | 106 | $(patsubst ro.product.locale.region=%,%,\ | 
| Ying Wang | 77c882f | 2010-04-27 15:45:35 -0700 | [diff] [blame] | 107 | $(filter ro.product.locale.region=%,$(PRODUCT_PROPERTY_OVERRIDES)))) | 
|  | 108 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 109 | # Selects the first locale in the list given as the argument, | 
|  | 110 | # and splits it into language and region, which each may be | 
|  | 111 | # empty. | 
|  | 112 | define default-locale | 
|  | 113 | $(subst _, , $(firstword $(1))) | 
|  | 114 | endef | 
|  | 115 |  | 
|  | 116 | # Selects the first locale in the list given as the argument | 
| Ying Wang | 77c882f | 2010-04-27 15:45:35 -0700 | [diff] [blame] | 117 | # and returns the language (or the region), if it's not set in PRODUCT_PROPERTY_OVERRIDES; | 
|  | 118 | # Return empty string if it's already set in PRODUCT_PROPERTY_OVERRIDES. | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 119 | define default-locale-language | 
| Ying Wang | 38d7f02 | 2010-07-21 14:58:42 -0700 | [diff] [blame] | 120 | $(if $(product_property_override_locale_language),,$(word 1, $(call default-locale, $(1)))) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 121 | endef | 
|  | 122 | define default-locale-region | 
| Ying Wang | 38d7f02 | 2010-07-21 14:58:42 -0700 | [diff] [blame] | 123 | $(if $(product_property_overrides_locale_region),,$(word 2, $(call default-locale, $(1)))) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 124 | endef | 
|  | 125 |  | 
|  | 126 | BUILDINFO_SH := build/tools/buildinfo.sh | 
| Chih-Wei Huang | 75947ef | 2010-11-03 18:33:46 +0800 | [diff] [blame] | 127 | $(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(wildcard $(TARGET_DEVICE_DIR)/system.prop) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 128 | @echo Target buildinfo: $@ | 
|  | 129 | @mkdir -p $(dir $@) | 
|  | 130 | $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \ | 
|  | 131 | TARGET_DEVICE="$(TARGET_DEVICE)" \ | 
|  | 132 | PRODUCT_NAME="$(TARGET_PRODUCT)" \ | 
|  | 133 | PRODUCT_BRAND="$(PRODUCT_BRAND)" \ | 
|  | 134 | PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \ | 
|  | 135 | PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \ | 
| Robert Greenwalt | fbd10d9 | 2009-05-20 13:37:35 -0700 | [diff] [blame] | 136 | PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 137 | PRODUCT_MODEL="$(PRODUCT_MODEL)" \ | 
|  | 138 | PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \ | 
|  | 139 | PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \ | 
|  | 140 | BUILD_ID="$(BUILD_ID)" \ | 
|  | 141 | BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \ | 
|  | 142 | BUILD_NUMBER="$(BUILD_NUMBER)" \ | 
|  | 143 | PLATFORM_VERSION="$(PLATFORM_VERSION)" \ | 
|  | 144 | PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ | 
| Dianne Hackborn | 9537884 | 2009-05-08 12:06:17 -0700 | [diff] [blame] | 145 | PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 146 | BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ | 
|  | 147 | TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \ | 
|  | 148 | BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \ | 
|  | 149 | TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \ | 
| Dianne Hackborn | ecc70d7 | 2009-05-21 15:45:30 -0700 | [diff] [blame] | 150 | TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \ | 
| David 'Digit' Turner | 2edfb71 | 2009-11-06 15:12:00 -0800 | [diff] [blame] | 151 | TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \ | 
| Joe Onorato | 25939e2 | 2010-11-09 08:53:01 -0800 | [diff] [blame] | 152 | TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 153 | bash $(BUILDINFO_SH) > $@ | 
|  | 154 | $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \ | 
|  | 155 | cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \ | 
|  | 156 | fi | 
|  | 157 | $(if $(ADDITIONAL_BUILD_PROPERTIES), \ | 
|  | 158 | $(hide) echo >> $@; \ | 
|  | 159 | echo "#" >> $@; \ | 
|  | 160 | echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \ | 
|  | 161 | echo "#" >> $@; ) | 
| Jean-Baptiste Queru | 0545c91 | 2010-09-07 10:51:12 -0700 | [diff] [blame] | 162 | $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \ | 
|  | 163 | echo "$(line)" >> $@;) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 164 |  | 
|  | 165 | build_desc := | 
|  | 166 |  | 
|  | 167 | # ----------------------------------------------------------------- | 
|  | 168 | # sdk-build.prop | 
|  | 169 | # | 
|  | 170 | # There are certain things in build.prop that we don't want to | 
|  | 171 | # ship with the sdk; remove them. | 
|  | 172 |  | 
|  | 173 | # This must be a list of entire property keys followed by | 
|  | 174 | # "=" characters, without any internal spaces. | 
|  | 175 | sdk_build_prop_remove := \ | 
|  | 176 | ro.build.user= \ | 
|  | 177 | ro.build.host= \ | 
|  | 178 | ro.product.brand= \ | 
|  | 179 | ro.product.manufacturer= \ | 
|  | 180 | ro.product.device= | 
|  | 181 | # TODO: Remove this soon-to-be obsolete property | 
|  | 182 | sdk_build_prop_remove += ro.build.product= | 
|  | 183 | INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop | 
|  | 184 | $(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET) | 
|  | 185 | @echo SDK buildinfo: $@ | 
|  | 186 | @mkdir -p $(dir $@) | 
|  | 187 | $(hide) grep -v "$(subst $(space),\|,$(strip \ | 
|  | 188 | $(sdk_build_prop_remove)))" $< > $@.tmp | 
|  | 189 | $(hide) for x in $(sdk_build_prop_remove); do \ | 
|  | 190 | echo "$$x"generic >> $@.tmp; done | 
|  | 191 | $(hide) mv $@.tmp $@ | 
|  | 192 |  | 
|  | 193 | # ----------------------------------------------------------------- | 
|  | 194 | # package stats | 
|  | 195 | PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt | 
|  | 196 | PACKAGES_TO_STAT := \ | 
|  | 197 | $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \ | 
|  | 198 | $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES)))) | 
|  | 199 | $(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT) | 
|  | 200 | @echo Package stats: $@ | 
|  | 201 | @mkdir -p $(dir $@) | 
|  | 202 | $(hide) rm -f $@ | 
|  | 203 | $(hide) build/tools/dump-package-stats $^ > $@ | 
|  | 204 |  | 
|  | 205 | .PHONY: package-stats | 
|  | 206 | package-stats: $(PACKAGE_STATS_FILE) | 
|  | 207 |  | 
|  | 208 | # ----------------------------------------------------------------- | 
|  | 209 | # Cert-to-package mapping.  Used by the post-build signing tools. | 
|  | 210 | name := $(TARGET_PRODUCT) | 
|  | 211 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 212 | name := $(name)_debug | 
|  | 213 | endif | 
|  | 214 | name := $(name)-apkcerts-$(FILE_NAME_TAG) | 
|  | 215 | intermediates := \ | 
|  | 216 | $(call intermediates-dir-for,PACKAGING,apkcerts) | 
|  | 217 | APKCERTS_FILE := $(intermediates)/$(name).txt | 
|  | 218 | # Depending on the built packages isn't exactly right, | 
|  | 219 | # but it should guarantee that the apkcerts file is rebuilt | 
|  | 220 | # if any packages change which certs they're signed with. | 
|  | 221 | all_built_packages := $(foreach p,$(PACKAGES),$(ALL_MODULES.$(p).BUILT)) | 
| Ying Wang | efb2168 | 2010-07-23 16:42:13 -0700 | [diff] [blame] | 222 | ifneq ($(TARGET_BUILD_APPS),) | 
|  | 223 | # We don't need to really build all the modules for apps_only build. | 
|  | 224 | $(APKCERTS_FILE): | 
|  | 225 | else | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 226 | $(APKCERTS_FILE): $(all_built_packages) | 
| Ying Wang | efb2168 | 2010-07-23 16:42:13 -0700 | [diff] [blame] | 227 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 228 | @echo APK certs list: $@ | 
|  | 229 | @mkdir -p $(dir $@) | 
|  | 230 | @rm -f $@ | 
|  | 231 | $(hide) $(foreach p,$(PACKAGES),\ | 
| Doug Zongker | f6a53aa | 2009-12-15 15:06:55 -0800 | [diff] [blame] | 232 | $(if $(PACKAGES.$(p).EXTERNAL_KEY),\ | 
|  | 233 | echo 'name="$(p).apk" certificate="EXTERNAL" \ | 
|  | 234 | private_key=""' >> $@;,\ | 
|  | 235 | echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \ | 
|  | 236 | private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;)) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 237 |  | 
|  | 238 | .PHONY: apkcerts-list | 
|  | 239 | apkcerts-list: $(APKCERTS_FILE) | 
|  | 240 |  | 
| Ying Wang | efb2168 | 2010-07-23 16:42:13 -0700 | [diff] [blame] | 241 | $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt) | 
|  | 242 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 243 | # ----------------------------------------------------------------- | 
|  | 244 | # module info file | 
|  | 245 | ifdef CREATE_MODULE_INFO_FILE | 
|  | 246 | MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt | 
|  | 247 | $(info Generating $(MODULE_INFO_FILE)...) | 
|  | 248 | $(shell rm -f $(MODULE_INFO_FILE)) | 
|  | 249 | $(foreach m,$(ALL_MODULES), \ | 
|  | 250 | $(shell echo "NAME=\"$(m)\"" \ | 
|  | 251 | "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \ | 
|  | 252 | "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \ | 
|  | 253 | "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \ | 
|  | 254 | "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE))) | 
|  | 255 | endif | 
|  | 256 |  | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 257 | # ----------------------------------------------------------------- | 
|  | 258 |  | 
|  | 259 | # The test key is used to sign this package, and as the key required | 
|  | 260 | # for future OTA packages installed by this system.  Actual product | 
|  | 261 | # deliverables will be re-signed by hand.  We expect this file to | 
|  | 262 | # exist with the suffixes ".x509.pem" and ".pk8". | 
|  | 263 | DEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey | 
|  | 264 |  | 
|  | 265 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 266 | # Rules that need to be present for the simulator, even | 
|  | 267 | # if they don't do anything. | 
|  | 268 | .PHONY: systemimage | 
|  | 269 | systemimage: | 
|  | 270 |  | 
| Doug Zongker | 7e2f13b | 2010-02-16 16:01:43 -0800 | [diff] [blame] | 271 | # ----------------------------------------------------------------- | 
|  | 272 |  | 
|  | 273 | .PHONY: event-log-tags | 
|  | 274 |  | 
| Joe Onorato | b751053 | 2010-07-14 10:22:54 -0700 | [diff] [blame] | 275 | # Produce an event logs tag file for everything we know about, in order | 
|  | 276 | # to properly allocate numbers.  Then produce a file that's filtered | 
|  | 277 | # for what's going to be installed. | 
|  | 278 |  | 
|  | 279 | all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt | 
|  | 280 |  | 
|  | 281 | # Include tags from all packages that we know about | 
|  | 282 | all_event_log_tags_src := \ | 
|  | 283 | $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS))) | 
|  | 284 |  | 
|  | 285 | $(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src) | 
|  | 286 | $(all_event_log_tags_file): $(all_event_log_tags_src) | 
|  | 287 | $(hide) mkdir -p $(dir $@) | 
|  | 288 | $(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES) | 
|  | 289 |  | 
|  | 290 |  | 
| Doug Zongker | 7e2f13b | 2010-02-16 16:01:43 -0800 | [diff] [blame] | 291 | event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags | 
| Doug Zongker | 7e2f13b | 2010-02-16 16:01:43 -0800 | [diff] [blame] | 292 |  | 
|  | 293 | # Include tags from all packages included in this product. | 
|  | 294 | event_log_tags_src := \ | 
|  | 295 | $(sort $(foreach m,\ | 
|  | 296 | $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \ | 
|  | 297 | $(call module-names-for-tag-list,user), \ | 
|  | 298 | $(ALL_MODULES.$(m).EVENT_LOG_TAGS))) | 
|  | 299 |  | 
|  | 300 | $(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) | 
| Joe Onorato | b751053 | 2010-07-14 10:22:54 -0700 | [diff] [blame] | 301 | $(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file) | 
|  | 302 | $(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file) | 
| Doug Zongker | 7e2f13b | 2010-02-16 16:01:43 -0800 | [diff] [blame] | 303 | $(hide) mkdir -p $(dir $@) | 
| Joe Onorato | b751053 | 2010-07-14 10:22:54 -0700 | [diff] [blame] | 304 | $(hide) build/tools/merge-event-log-tags.py -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES) | 
| Doug Zongker | 7e2f13b | 2010-02-16 16:01:43 -0800 | [diff] [blame] | 305 |  | 
|  | 306 | event-log-tags: $(event_log_tags_file) | 
|  | 307 |  | 
|  | 308 | ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file) | 
|  | 309 |  | 
| Joe Onorato | b751053 | 2010-07-14 10:22:54 -0700 | [diff] [blame] | 310 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 311 | ifneq ($(TARGET_SIMULATOR),true) | 
|  | 312 |  | 
|  | 313 | # ################################################################# | 
|  | 314 | # Targets for boot/OS images | 
|  | 315 | # ################################################################# | 
|  | 316 |  | 
|  | 317 | # ----------------------------------------------------------------- | 
|  | 318 | # the ramdisk | 
|  | 319 | INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \ | 
|  | 320 | $(ALL_PREBUILT) \ | 
|  | 321 | $(ALL_COPIED_HEADERS) \ | 
|  | 322 | $(ALL_GENERATED_SOURCES) \ | 
|  | 323 | $(ALL_DEFAULT_INSTALLED_MODULES)) | 
|  | 324 |  | 
| Joe Onorato | 64d85d0 | 2009-04-09 19:31:12 -0700 | [diff] [blame] | 325 | BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img | 
|  | 326 |  | 
|  | 327 | # We just build this directly to the install location. | 
|  | 328 | INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET) | 
| Doug Zongker | 8b70e8c | 2009-05-27 09:14:25 -0700 | [diff] [blame] | 329 | $(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 330 | $(call pretty,"Target ram disk: $@") | 
| Doug Zongker | 8b70e8c | 2009-05-27 09:14:25 -0700 | [diff] [blame] | 331 | $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 332 |  | 
|  | 333 |  | 
|  | 334 | ifneq ($(strip $(TARGET_NO_KERNEL)),true) | 
|  | 335 |  | 
|  | 336 | # ----------------------------------------------------------------- | 
|  | 337 | # the boot image, which is a collection of other images. | 
|  | 338 | INTERNAL_BOOTIMAGE_ARGS := \ | 
|  | 339 | $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ | 
|  | 340 | --kernel $(INSTALLED_KERNEL_TARGET) \ | 
|  | 341 | --ramdisk $(INSTALLED_RAMDISK_TARGET) | 
|  | 342 |  | 
|  | 343 | INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS)) | 
|  | 344 |  | 
|  | 345 | BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE)) | 
|  | 346 | ifdef BOARD_KERNEL_CMDLINE | 
|  | 347 | INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)" | 
|  | 348 | endif | 
|  | 349 |  | 
| Dima Zavin | 1e0847c | 2009-05-07 19:43:08 -0700 | [diff] [blame] | 350 | BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE)) | 
|  | 351 | ifdef BOARD_KERNEL_BASE | 
|  | 352 | INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) | 
|  | 353 | endif | 
|  | 354 |  | 
| Ying Wang | ffff002 | 2010-08-23 12:56:25 -0700 | [diff] [blame] | 355 | BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE)) | 
|  | 356 | ifdef BOARD_KERNEL_PAGESIZE | 
|  | 357 | INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE) | 
|  | 358 | endif | 
|  | 359 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 360 | INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img | 
|  | 361 |  | 
|  | 362 | ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true) | 
|  | 363 | tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg | 
|  | 364 | INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image) | 
|  | 365 | INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG) | 
|  | 366 | $(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES) | 
|  | 367 | $(call pretty,"Target boot image: $@") | 
|  | 368 | $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@ | 
|  | 369 |  | 
|  | 370 | else # TARGET_BOOTIMAGE_USE_EXT2 != true | 
|  | 371 |  | 
|  | 372 | $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) | 
|  | 373 | $(call pretty,"Target boot image: $@") | 
|  | 374 | $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@ | 
| Doug Zongker | ed96e88 | 2009-08-26 09:37:07 -0700 | [diff] [blame] | 375 | $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 376 | endif # TARGET_BOOTIMAGE_USE_EXT2 | 
|  | 377 |  | 
|  | 378 | else	# TARGET_NO_KERNEL | 
|  | 379 | # HACK: The top-level targets depend on the bootimage.  Not all targets | 
|  | 380 | # can produce a bootimage, though, and emulator targets need the ramdisk | 
|  | 381 | # instead.  Fake it out by calling the ramdisk the bootimage. | 
|  | 382 | # TODO: make the emulator use bootimages, and make mkbootimg accept | 
|  | 383 | #       kernel-less inputs. | 
|  | 384 | INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET) | 
|  | 385 | endif | 
|  | 386 |  | 
|  | 387 | # ----------------------------------------------------------------- | 
|  | 388 | # NOTICE files | 
|  | 389 | # | 
|  | 390 | # This needs to be before the systemimage rules, because it adds to | 
|  | 391 | # ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files | 
|  | 392 | # go into the systemimage. | 
|  | 393 |  | 
|  | 394 | .PHONY: notice_files | 
|  | 395 |  | 
|  | 396 | # Create the rule to combine the files into text and html forms | 
|  | 397 | # $(1) - Plain text output file | 
|  | 398 | # $(2) - HTML output file | 
|  | 399 | # $(3) - File title | 
|  | 400 | # $(4) - Directory to use.  Notice files are all $(4)/src.  Other | 
|  | 401 | #		 directories in there will be used for scratch | 
|  | 402 | # $(5) - Dependencies for the output files | 
|  | 403 | # | 
|  | 404 | # The algorithm here is that we go collect a hash for each of the notice | 
|  | 405 | # files and write the names of the files that match that hash.  Then | 
|  | 406 | # to generate the real files, we go print out all of the files and their | 
|  | 407 | # hashes. | 
|  | 408 | # | 
|  | 409 | # These rules are fairly complex, so they depend on this makefile so if | 
|  | 410 | # it changes, they'll run again. | 
|  | 411 | # | 
|  | 412 | # TODO: We could clean this up so that we just record the locations of the | 
|  | 413 | # original notice files instead of making rules to copy them somwehere. | 
|  | 414 | # Then we could traverse that without quite as much bash drama. | 
|  | 415 | define combine-notice-files | 
|  | 416 | $(1) $(2): PRIVATE_MESSAGE := $(3) | 
|  | 417 | $(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4) | 
|  | 418 | $(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile | 
|  | 419 | @echo Finding NOTICE files: $$@ | 
|  | 420 | $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash | 
|  | 421 | $$(hide) mkdir -p $$(PRIVATE_DIR)/hash | 
|  | 422 | $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \ | 
|  | 423 | hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \ | 
|  | 424 | hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \ | 
|  | 425 | echo $$$$file >> $$$$hashfile; \ | 
|  | 426 | done | 
|  | 427 | $$(hide) touch $$@ | 
|  | 428 | $(1): $(4)/hash-timestamp | 
|  | 429 | @echo Combining NOTICE files: $$@ | 
|  | 430 | $$(hide) mkdir -p $$(dir $$@) | 
|  | 431 | $$(hide) echo $$(PRIVATE_MESSAGE) > $$@ | 
|  | 432 | $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \ | 
|  | 433 | sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1:" >> $$@ | 
|  | 434 | $$(hide) echo >> $$@ | 
|  | 435 | $$(hide) echo >> $$@ | 
|  | 436 | $$(hide) echo >> $$@ | 
|  | 437 | $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \ | 
|  | 438 | echo "============================================================"\ | 
|  | 439 | >> $$@; \ | 
|  | 440 | echo "Notices for file(s):" >> $$@; \ | 
|  | 441 | cat $$$$hashfile | sort | \ | 
|  | 442 | sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1:" >> \ | 
|  | 443 | $$@; \ | 
|  | 444 | echo "------------------------------------------------------------"\ | 
|  | 445 | >> $$@; \ | 
|  | 446 | echo >> $$@; \ | 
|  | 447 | orig=$$$$(head -n 1 $$$$hashfile); \ | 
|  | 448 | cat $$$$orig >> $$@; \ | 
|  | 449 | echo >> $$@; \ | 
|  | 450 | echo >> $$@; \ | 
|  | 451 | echo >> $$@; \ | 
|  | 452 | done | 
|  | 453 | $(2): $(4)/hash-timestamp | 
|  | 454 | @echo Combining NOTICE files: $$@ | 
|  | 455 | $$(hide) mkdir -p $$(dir $$@) | 
|  | 456 | $$(hide) echo "<html><head>" > $$@ | 
|  | 457 | $$(hide) echo "<style type=\"text/css\">" >> $$@ | 
|  | 458 | $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@ | 
|  | 459 | $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@ | 
|  | 460 | $$(hide) echo ".label { font-weight: bold; }" >> $$@ | 
|  | 461 | $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@ | 
|  | 462 | $$(hide) echo "</style>" >> $$@ | 
|  | 463 | $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@ | 
|  | 464 | $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \ | 
|  | 465 | >> $$@ | 
|  | 466 | $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \ | 
|  | 467 | cat $$$$hashfile | sort | \ | 
|  | 468 | sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  <a name=\"\1\"></a>:" >> \ | 
|  | 469 | $$@; \ | 
|  | 470 | echo "<tr><td class=\"same-license\">" >> $$@; \ | 
|  | 471 | echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \ | 
|  | 472 | echo "<div class=\"file-list\">" >> $$@; \ | 
|  | 473 | cat $$$$hashfile | sort | \ | 
|  | 474 | sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1<br/>:" >> $$@; \ | 
|  | 475 | echo "</div><!-- file-list -->" >> $$@; \ | 
|  | 476 | echo >> $$@; \ | 
|  | 477 | orig=$$$$(head -n 1 $$$$hashfile); \ | 
|  | 478 | echo "<pre class=\"license-text\">" >> $$@; \ | 
|  | 479 | cat $$$$orig | sed -e "s/\&/\&/g" | sed -e "s/</\</g" \ | 
|  | 480 | | sed -e "s/>/\>/g" >> $$@; \ | 
|  | 481 | echo "</pre><!-- license-text -->" >> $$@; \ | 
|  | 482 | echo "</td></tr><!-- same-license -->" >> $$@; \ | 
|  | 483 | echo >> $$@; \ | 
|  | 484 | echo >> $$@; \ | 
|  | 485 | echo >> $$@; \ | 
|  | 486 | done | 
|  | 487 | $$(hide) echo "</table>" >> $$@ | 
|  | 488 | $$(hide) echo "</body></html>" >> $$@ | 
|  | 489 | notice_files: $(1) $(2) | 
|  | 490 | endef | 
|  | 491 |  | 
|  | 492 | # TODO These intermediate NOTICE.txt/NOTICE.html files should go into | 
|  | 493 | # TARGET_OUT_NOTICE_FILES now that the notice files are gathered from | 
|  | 494 | # the src subdirectory. | 
|  | 495 |  | 
|  | 496 | target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt | 
|  | 497 | target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html | 
|  | 498 | target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz | 
|  | 499 | tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt | 
|  | 500 | tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html | 
|  | 501 |  | 
|  | 502 | kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt | 
|  | 503 |  | 
|  | 504 | $(eval $(call combine-notice-files, \ | 
|  | 505 | $(target_notice_file_txt), \ | 
|  | 506 | $(target_notice_file_html), \ | 
|  | 507 | "Notices for files contained in the filesystem images in this directory:", \ | 
|  | 508 | $(TARGET_OUT_NOTICE_FILES), \ | 
|  | 509 | $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file))) | 
|  | 510 |  | 
|  | 511 | $(eval $(call combine-notice-files, \ | 
|  | 512 | $(tools_notice_file_txt), \ | 
|  | 513 | $(tools_notice_file_html), \ | 
|  | 514 | "Notices for files contained in the tools directory:", \ | 
|  | 515 | $(HOST_OUT_NOTICE_FILES), \ | 
|  | 516 | $(ALL_DEFAULT_INSTALLED_MODULES))) | 
|  | 517 |  | 
|  | 518 | # Install the html file at /system/etc/NOTICE.html.gz. | 
|  | 519 | # This is not ideal, but this is very late in the game, after a lot of | 
|  | 520 | # the module processing has already been done -- in fact, we used the | 
|  | 521 | # fact that all that has been done to get the list of modules that we | 
|  | 522 | # need notice files for. | 
| Doug Zongker | 8b70e8c | 2009-05-27 09:14:25 -0700 | [diff] [blame] | 523 | $(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP) | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 524 | $(hide) $(MINIGZIP) -9 < $< > $@ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 525 | installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz | 
|  | 526 | $(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP) | 
|  | 527 | $(copy-file-to-target) | 
| Joe Onorato | 7b2845a | 2009-04-30 13:52:50 -0700 | [diff] [blame] | 528 |  | 
|  | 529 | # if we've been run my mm, mmm, etc, don't reinstall this every time | 
|  | 530 | ifeq ($(ONE_SHOT_MAKEFILE),) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 531 | ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz) | 
| Joe Onorato | 7b2845a | 2009-04-30 13:52:50 -0700 | [diff] [blame] | 532 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 533 |  | 
|  | 534 | # The kernel isn't really a module, so to get its module file in there, we | 
|  | 535 | # make the target NOTICE files depend on this particular file too, which will | 
|  | 536 | # then be in the right directory for the find in combine-notice-files to work. | 
|  | 537 | $(kernel_notice_file): \ | 
|  | 538 | prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \ | 
|  | 539 | | $(ACP) | 
|  | 540 | @echo Copying: $@ | 
|  | 541 | $(hide) mkdir -p $(dir $@) | 
|  | 542 | $(hide) $(ACP) $< $@ | 
|  | 543 |  | 
|  | 544 |  | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 545 | # ----------------------------------------------------------------- | 
|  | 546 | # Build a keystore with the authorized keys in it, used to verify the | 
|  | 547 | # authenticity of downloaded OTA packages. | 
|  | 548 | # | 
|  | 549 | # This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come | 
|  | 550 | # before the rules that use that variable to build the image. | 
|  | 551 | ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip | 
|  | 552 | $(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) | 
| Doug Zongker | 37c0e27 | 2009-06-15 15:36:16 -0700 | [diff] [blame] | 553 | $(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR)) | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 554 | $(hide) rm -f $@ | 
|  | 555 | $(hide) mkdir -p $(dir $@) | 
| Doug Zongker | 37c0e27 | 2009-06-15 15:36:16 -0700 | [diff] [blame] | 556 | $(hide) zip -qj $@ $< | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 557 |  | 
|  | 558 | .PHONY: otacerts | 
|  | 559 | otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip | 
|  | 560 |  | 
|  | 561 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 562 | # ################################################################# | 
|  | 563 | # Targets for user images | 
|  | 564 | # ################################################################# | 
|  | 565 |  | 
| Ying Wang | 933abf1 | 2010-06-16 14:31:34 -0700 | [diff] [blame] | 566 | INTERNAL_USERIMAGES_EXT_VARIANT := | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 567 | ifeq ($(TARGET_USERIMAGES_USE_EXT2),true) | 
| Colin Cross | 0a7b2c5 | 2010-05-07 02:23:59 -0700 | [diff] [blame] | 568 | INTERNAL_USERIMAGES_USE_EXT := true | 
|  | 569 | INTERNAL_USERIMAGES_EXT_VARIANT := ext2 | 
|  | 570 | else | 
|  | 571 | ifeq ($(TARGET_USERIMAGES_USE_EXT3),true) | 
|  | 572 | INTERNAL_USERIMAGES_USE_EXT := true | 
|  | 573 | INTERNAL_USERIMAGES_EXT_VARIANT := ext3 | 
|  | 574 | else | 
|  | 575 | ifeq ($(TARGET_USERIMAGES_USE_EXT4),true) | 
|  | 576 | INTERNAL_USERIMAGES_USE_EXT := true | 
|  | 577 | INTERNAL_USERIMAGES_EXT_VARIANT := ext4 | 
|  | 578 | endif | 
|  | 579 | endif | 
|  | 580 | endif | 
|  | 581 |  | 
| Ying Wang | 542903a | 2010-11-17 15:40:38 -0800 | [diff] [blame] | 582 | ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)) | 
|  | 583 | INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s | 
|  | 584 | endif | 
|  | 585 |  | 
| Colin Cross | 0a7b2c5 | 2010-05-07 02:23:59 -0700 | [diff] [blame] | 586 | ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) | 
| Ying Wang | 542903a | 2010-11-17 15:40:38 -0800 | [diff] [blame] | 587 | INTERNAL_USERIMAGES_DEPS := $(MKEXTUSERIMG) $(MAKE_EXT4FS) | 
| Ying Wang | 933abf1 | 2010-06-16 14:31:34 -0700 | [diff] [blame] | 588 | INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS))) | 
|  | 589 |  | 
| Ying Wang | c79f4da | 2010-06-16 14:58:50 -0700 | [diff] [blame] | 590 | # $(1): src directory | 
|  | 591 | # $(2): output file | 
| Ying Wang | 026f145 | 2010-09-27 17:49:03 -0700 | [diff] [blame] | 592 | # $(3): mount point | 
| Ying Wang | c79f4da | 2010-06-16 14:58:50 -0700 | [diff] [blame] | 593 | # $(4): ext variant (ext2, ext3, ext4) | 
| Colin Cross | e0a4021 | 2010-08-03 14:43:34 -0700 | [diff] [blame] | 594 | # $(5): size of the partition | 
| Ying Wang | c79f4da | 2010-06-16 14:58:50 -0700 | [diff] [blame] | 595 | define build-userimage-ext-target | 
|  | 596 | @mkdir -p $(dir $(2)) | 
| Ying Wang | 933abf1 | 2010-06-16 14:31:34 -0700 | [diff] [blame] | 597 | $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$(PATH) \ | 
| Ying Wang | 542903a | 2010-11-17 15:40:38 -0800 | [diff] [blame] | 598 | $(MKEXTUSERIMG) $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG) $(1) $(2) $(4) $(3) $(5) | 
| Ying Wang | c79f4da | 2010-06-16 14:58:50 -0700 | [diff] [blame] | 599 | endef | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 600 | else | 
| Colin Cross | 144b028 | 2010-05-10 13:04:47 -0700 | [diff] [blame] | 601 | INTERNAL_USERIMAGES_DEPS := $(MKYAFFS2) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 602 | endif | 
|  | 603 |  | 
|  | 604 | # ----------------------------------------------------------------- | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 605 | # Recovery image | 
| Doug Zongker | 8cebf1f | 2009-07-07 17:14:25 -0700 | [diff] [blame] | 606 |  | 
|  | 607 | # If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true | 
| Brian Swetland | 630b7d3 | 2009-08-07 18:09:44 -0700 | [diff] [blame] | 608 | ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID))) | 
| Doug Zongker | 8cebf1f | 2009-07-07 17:14:25 -0700 | [diff] [blame] | 609 |  | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 610 | INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img | 
|  | 611 |  | 
|  | 612 | recovery_initrc := $(call include-path-for, recovery)/etc/init.rc | 
|  | 613 | recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system | 
|  | 614 | recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img | 
|  | 615 | recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET) | 
|  | 616 | recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery | 
|  | 617 | recovery_resources_common := $(call include-path-for, recovery)/res | 
|  | 618 | recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)) | 
|  | 619 | recovery_resource_deps := $(shell find $(recovery_resources_common) \ | 
|  | 620 | $(recovery_resources_private) -type f) | 
| Doug Zongker | 9ce0fb6 | 2010-09-20 18:04:41 -0700 | [diff] [blame] | 621 | recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab)) | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 622 |  | 
|  | 623 | ifeq ($(recovery_resources_private),) | 
|  | 624 | $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE)) | 
|  | 625 | endif | 
|  | 626 |  | 
| Doug Zongker | 9ce0fb6 | 2010-09-20 18:04:41 -0700 | [diff] [blame] | 627 | ifeq ($(recovery_fstab),) | 
|  | 628 | $(info No recovery.fstab for TARGET_DEVICE $(TARGET_DEVICE)) | 
|  | 629 | endif | 
|  | 630 |  | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 631 | INTERNAL_RECOVERYIMAGE_ARGS := \ | 
|  | 632 | $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ | 
|  | 633 | --kernel $(recovery_kernel) \ | 
|  | 634 | --ramdisk $(recovery_ramdisk) | 
|  | 635 |  | 
|  | 636 | # Assumes this has already been stripped | 
|  | 637 | ifdef BOARD_KERNEL_CMDLINE | 
|  | 638 | INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)" | 
|  | 639 | endif | 
|  | 640 | ifdef BOARD_KERNEL_BASE | 
|  | 641 | INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) | 
|  | 642 | endif | 
| Ying Wang | 4de6b5b | 2010-08-25 14:29:34 -0700 | [diff] [blame] | 643 | BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE)) | 
|  | 644 | ifdef BOARD_KERNEL_PAGESIZE | 
|  | 645 | INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE) | 
|  | 646 | endif | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 647 |  | 
|  | 648 | # Keys authorized to sign OTA packages this build will accept.  The | 
|  | 649 | # build always uses test-keys for this; release packaging tools will | 
|  | 650 | # substitute other keys for this one. | 
|  | 651 | OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem | 
|  | 652 |  | 
|  | 653 | # Generate a file containing the keys that will be read by the | 
|  | 654 | # recovery binary. | 
|  | 655 | RECOVERY_INSTALL_OTA_KEYS := \ | 
|  | 656 | $(call intermediates-dir-for,PACKAGING,ota_keys)/keys | 
|  | 657 | DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar | 
|  | 658 | $(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS) | 
| Doug Zongker | e121d6a | 2011-02-01 14:13:52 -0800 | [diff] [blame] | 659 | $(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(TARGET_EXTRA_RECOVERY_KEYS)) | 
|  | 660 | $(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys) | 
|  | 661 | @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)" | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 662 | @rm -rf $@ | 
|  | 663 | @mkdir -p $(dir $@) | 
| Doug Zongker | e121d6a | 2011-02-01 14:13:52 -0800 | [diff] [blame] | 664 | java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@ | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 665 |  | 
|  | 666 | $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ | 
|  | 667 | $(INSTALLED_RAMDISK_TARGET) \ | 
|  | 668 | $(INSTALLED_BOOTIMAGE_TARGET) \ | 
|  | 669 | $(recovery_binary) \ | 
|  | 670 | $(recovery_initrc) $(recovery_kernel) \ | 
|  | 671 | $(INSTALLED_2NDBOOTLOADER_TARGET) \ | 
|  | 672 | $(recovery_build_prop) $(recovery_resource_deps) \ | 
| Doug Zongker | 9ce0fb6 | 2010-09-20 18:04:41 -0700 | [diff] [blame] | 673 | $(recovery_fstab) \ | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 674 | $(RECOVERY_INSTALL_OTA_KEYS) | 
|  | 675 | @echo ----- Making recovery image ------ | 
|  | 676 | rm -rf $(TARGET_RECOVERY_OUT) | 
|  | 677 | mkdir -p $(TARGET_RECOVERY_OUT) | 
|  | 678 | mkdir -p $(TARGET_RECOVERY_ROOT_OUT) | 
|  | 679 | mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc | 
|  | 680 | mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp | 
|  | 681 | echo Copying baseline ramdisk... | 
|  | 682 | cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) | 
| Doug Zongker | b4c7d32 | 2010-07-01 15:30:11 -0700 | [diff] [blame] | 683 | rm $(TARGET_RECOVERY_ROOT_OUT)/init*.rc | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 684 | echo Modifying ramdisk contents... | 
|  | 685 | cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/ | 
|  | 686 | cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/ | 
|  | 687 | cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/ | 
|  | 688 | $(foreach item,$(recovery_resources_private), \ | 
|  | 689 | cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/) | 
| Doug Zongker | 9ce0fb6 | 2010-09-20 18:04:41 -0700 | [diff] [blame] | 690 | $(foreach item,$(recovery_fstab), \ | 
|  | 691 | cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab) | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 692 | cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys | 
|  | 693 | cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \ | 
|  | 694 | > $(TARGET_RECOVERY_ROOT_OUT)/default.prop | 
|  | 695 | $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk) | 
|  | 696 | $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@ | 
|  | 697 | @echo ----- Made recovery image -------- $@ | 
| Doug Zongker | ed96e88 | 2009-08-26 09:37:07 -0700 | [diff] [blame] | 698 | $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw) | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 699 |  | 
|  | 700 | else | 
|  | 701 | INSTALLED_RECOVERYIMAGE_TARGET := | 
|  | 702 | endif | 
|  | 703 |  | 
|  | 704 | .PHONY: recoveryimage | 
|  | 705 | recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) | 
|  | 706 |  | 
| Dima Zavin | 1181898 | 2010-02-05 13:34:34 -0800 | [diff] [blame] | 707 | ifneq ($(BOARD_NAND_PAGE_SIZE),) | 
|  | 708 | mkyaffs2_extra_flags := -c $(BOARD_NAND_PAGE_SIZE) | 
|  | 709 | else | 
|  | 710 | mkyaffs2_extra_flags := | 
| Lars Svensson | 9cb8c28 | 2010-12-06 15:24:58 +0100 | [diff] [blame] | 711 | BOARD_NAND_PAGE_SIZE := 2048 | 
| Dima Zavin | 1181898 | 2010-02-05 13:34:34 -0800 | [diff] [blame] | 712 | endif | 
|  | 713 |  | 
| Naseer Ahmed | 5387188 | 2010-08-06 12:19:29 -0700 | [diff] [blame] | 714 | ifneq ($(BOARD_NAND_SPARE_SIZE),) | 
|  | 715 | mkyaffs2_extra_flags += -s $(BOARD_NAND_SPARE_SIZE) | 
| Lars Svensson | 9cb8c28 | 2010-12-06 15:24:58 +0100 | [diff] [blame] | 716 | else | 
|  | 717 | BOARD_NAND_SPARE_SIZE := 64 | 
| Naseer Ahmed | 5387188 | 2010-08-06 12:19:29 -0700 | [diff] [blame] | 718 | endif | 
|  | 719 |  | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 720 | # ----------------------------------------------------------------- | 
| Ying Wang | 0235237 | 2010-09-27 10:37:25 -0700 | [diff] [blame] | 721 | # system image | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 722 | # | 
| Ying Wang | 0235237 | 2010-09-27 10:37:25 -0700 | [diff] [blame] | 723 | systemimage_intermediates := \ | 
|  | 724 | $(call intermediates-dir-for,PACKAGING,systemimage) | 
|  | 725 | BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 726 |  | 
|  | 727 | INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \ | 
|  | 728 | $(ALL_PREBUILT) \ | 
|  | 729 | $(ALL_COPIED_HEADERS) \ | 
|  | 730 | $(ALL_GENERATED_SOURCES) \ | 
|  | 731 | $(ALL_DEFAULT_INSTALLED_MODULES)) | 
|  | 732 |  | 
| Colin Cross | 0a7b2c5 | 2010-05-07 02:23:59 -0700 | [diff] [blame] | 733 | ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) | 
|  | 734 | ## generate an ext image | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 735 | # $(1): output file | 
|  | 736 | define build-systemimage-target | 
|  | 737 | @echo "Target system fs image: $(1)" | 
| Colin Cross | e0a4021 | 2010-08-03 14:43:34 -0700 | [diff] [blame] | 738 | $(call build-userimage-ext-target,$(TARGET_OUT),$(1),system,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 739 | endef | 
|  | 740 |  | 
| Colin Cross | 0a7b2c5 | 2010-05-07 02:23:59 -0700 | [diff] [blame] | 741 | else # INTERNAL_USERIMAGES_USE_EXT != true | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 742 |  | 
|  | 743 | ## generate a yaffs2 image | 
|  | 744 | # $(1): output file | 
|  | 745 | define build-systemimage-target | 
|  | 746 | @echo "Target system fs image: $(1)" | 
|  | 747 | @mkdir -p $(dir $(1)) | 
| Dima Zavin | 1181898 | 2010-02-05 13:34:34 -0800 | [diff] [blame] | 748 | $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 749 | endef | 
| Colin Cross | 0a7b2c5 | 2010-05-07 02:23:59 -0700 | [diff] [blame] | 750 | endif # INTERNAL_USERIMAGES_USE_EXT | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 751 |  | 
| Ying Wang | 0235237 | 2010-09-27 10:37:25 -0700 | [diff] [blame] | 752 | $(BUILT_SYSTEMIMAGE): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 753 | $(call build-systemimage-target,$@) | 
|  | 754 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 755 | INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img | 
| Ying Wang | 0235237 | 2010-09-27 10:37:25 -0700 | [diff] [blame] | 756 | SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 757 |  | 
| Doug Zongker | 73ef825 | 2009-07-23 15:12:53 -0700 | [diff] [blame] | 758 | # The system partition needs room for the recovery image as well.  We | 
|  | 759 | # now store the recovery image as a binary patch using the boot image | 
|  | 760 | # as the source (since they are very similar).  Generate the patch so | 
|  | 761 | # we can see how big it's going to be, and include that in the system | 
|  | 762 | # image size check calculation. | 
| Sriram Raman | 1e96ac8 | 2009-07-24 13:52:32 -0700 | [diff] [blame] | 763 | ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) | 
| Doug Zongker | 73ef825 | 2009-07-23 15:12:53 -0700 | [diff] [blame] | 764 | intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch) | 
|  | 765 | RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p | 
|  | 766 | $(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \ | 
|  | 767 | $(INSTALLED_BOOTIMAGE_TARGET) \ | 
| Doug Zongker | 22bc517 | 2009-07-23 18:27:43 -0700 | [diff] [blame] | 768 | $(HOST_OUT_EXECUTABLES)/imgdiff \ | 
|  | 769 | $(HOST_OUT_EXECUTABLES)/bsdiff | 
| Doug Zongker | 73ef825 | 2009-07-23 15:12:53 -0700 | [diff] [blame] | 770 | @echo "Construct recovery from boot" | 
|  | 771 | mkdir -p $(dir $@) | 
| Doug Zongker | b003d89 | 2009-07-23 18:48:38 -0700 | [diff] [blame] | 772 | PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@ | 
| Sriram Raman | 1e96ac8 | 2009-07-24 13:52:32 -0700 | [diff] [blame] | 773 | endif | 
|  | 774 |  | 
| Doug Zongker | 73ef825 | 2009-07-23 15:12:53 -0700 | [diff] [blame] | 775 |  | 
|  | 776 | $(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 777 | @echo "Install system fs image: $@" | 
|  | 778 | $(copy-file-to-target) | 
| Doug Zongker | ed96e88 | 2009-08-26 09:37:07 -0700 | [diff] [blame] | 779 | $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 780 |  | 
|  | 781 | systemimage: $(INSTALLED_SYSTEMIMAGE) | 
|  | 782 |  | 
|  | 783 | .PHONY: systemimage-nodeps snod | 
|  | 784 | systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \ | 
| Colin Cross | 144b028 | 2010-05-10 13:04:47 -0700 | [diff] [blame] | 785 | | $(INTERNAL_USERIMAGES_DEPS) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 786 | @echo "make $@: ignoring dependencies" | 
|  | 787 | $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE)) | 
| Doug Zongker | ed96e88 | 2009-08-26 09:37:07 -0700 | [diff] [blame] | 788 | $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 789 |  | 
|  | 790 | ####### | 
|  | 791 | ## system tarball | 
|  | 792 | define build-systemtarball-target | 
|  | 793 | $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)") | 
|  | 794 | $(MKTARBALL) $(FS_GET_STATS) \ | 
|  | 795 | $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \ | 
|  | 796 | $(INSTALLED_SYSTEMTARBALL_TARGET) | 
|  | 797 | endef | 
|  | 798 |  | 
| Bruce Beare | 69ef5ce | 2010-06-11 12:05:57 -0700 | [diff] [blame] | 799 | ifndef SYSTEM_TARBALL_FORMAT | 
|  | 800 | SYSTEM_TARBALL_FORMAT := bz2 | 
|  | 801 | endif | 
|  | 802 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 803 | system_tar := $(PRODUCT_OUT)/system.tar | 
| Bruce Beare | 69ef5ce | 2010-06-11 12:05:57 -0700 | [diff] [blame] | 804 | INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 805 | $(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar) | 
|  | 806 | $(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES) | 
|  | 807 | $(build-systemtarball-target) | 
|  | 808 |  | 
|  | 809 | .PHONY: systemtarball-nodeps | 
|  | 810 | systemtarball-nodeps: $(FS_GET_STATS) \ | 
|  | 811 | $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS)) | 
|  | 812 | $(build-systemtarball-target) | 
|  | 813 |  | 
|  | 814 | .PHONY: stnod | 
|  | 815 | stnod: systemtarball-nodeps | 
|  | 816 |  | 
|  | 817 |  | 
| Bruce Beare | 52aac20 | 2010-06-04 15:24:49 -0700 | [diff] [blame] | 818 | ####### | 
|  | 819 | ## boot tarball | 
|  | 820 | define build-boottarball-target | 
| Bruce Beare | 45ac434 | 2010-06-24 14:02:00 -0700 | [diff] [blame] | 821 | $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)" | 
| Bruce Beare | 52aac20 | 2010-06-04 15:24:49 -0700 | [diff] [blame] | 822 | $(hide) mkdir -p $(PRODUCT_OUT)/boot | 
|  | 823 | $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/. | 
|  | 824 | $(hide) echo $(BOARD_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline | 
|  | 825 | $(hide) $(MKTARBALL) $(FS_GET_STATS) \ | 
|  | 826 | $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \ | 
|  | 827 | $(INSTALLED_BOOTTARBALL_TARGET) | 
|  | 828 | endef | 
|  | 829 |  | 
|  | 830 | ifndef BOOT_TARBALL_FORMAT | 
|  | 831 | BOOT_TARBALL_FORMAT := bz2 | 
|  | 832 | endif | 
|  | 833 |  | 
|  | 834 | boot_tar := $(PRODUCT_OUT)/boot.tar | 
|  | 835 | INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT) | 
|  | 836 | $(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar) | 
|  | 837 | $(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES) | 
|  | 838 | $(build-boottarball-target) | 
|  | 839 |  | 
|  | 840 | .PHONY: boottarball-nodeps btnod | 
|  | 841 | boottarball-nodeps btnod: $(FS_GET_STATS) \ | 
|  | 842 | $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS)) | 
|  | 843 | $(build-boottarball-target) | 
|  | 844 |  | 
|  | 845 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 846 | # ----------------------------------------------------------------- | 
|  | 847 | # data partition image | 
|  | 848 | INTERNAL_USERDATAIMAGE_FILES := \ | 
|  | 849 | $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) | 
|  | 850 |  | 
| Colin Cross | 0a7b2c5 | 2010-05-07 02:23:59 -0700 | [diff] [blame] | 851 | ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 852 | ## Generate an ext2 image | 
|  | 853 | define build-userdataimage-target | 
|  | 854 | $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") | 
|  | 855 | @mkdir -p $(TARGET_OUT_DATA) | 
| Ying Wang | 026f145 | 2010-09-27 17:49:03 -0700 | [diff] [blame] | 856 | $(call build-userimage-ext-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),data,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_USERDATAIMAGE_PARTITION_SIZE)) | 
| Doug Zongker | ed96e88 | 2009-08-26 09:37:07 -0700 | [diff] [blame] | 857 | $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 858 | endef | 
|  | 859 |  | 
| Colin Cross | 0a7b2c5 | 2010-05-07 02:23:59 -0700 | [diff] [blame] | 860 | else # INTERNAL_USERIMAGES_USE_EXT != true | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 861 |  | 
|  | 862 | ## Generate a yaffs2 image | 
|  | 863 | define build-userdataimage-target | 
|  | 864 | $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") | 
|  | 865 | @mkdir -p $(TARGET_OUT_DATA) | 
| Dima Zavin | 1181898 | 2010-02-05 13:34:34 -0800 | [diff] [blame] | 866 | $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET) | 
| Doug Zongker | ed96e88 | 2009-08-26 09:37:07 -0700 | [diff] [blame] | 867 | $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 868 | endef | 
| Colin Cross | 0a7b2c5 | 2010-05-07 02:23:59 -0700 | [diff] [blame] | 869 | endif # INTERNAL_USERIMAGES_USE_EXT | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 870 |  | 
| Joe Onorato | 64d85d0 | 2009-04-09 19:31:12 -0700 | [diff] [blame] | 871 | BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img | 
|  | 872 |  | 
|  | 873 | # We just build this directly to the install location. | 
|  | 874 | INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET) | 
| Colin Cross | 144b028 | 2010-05-10 13:04:47 -0700 | [diff] [blame] | 875 | $(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 876 | $(INTERNAL_USERDATAIMAGE_FILES) | 
|  | 877 | $(build-userdataimage-target) | 
|  | 878 |  | 
|  | 879 | .PHONY: userdataimage-nodeps | 
| Colin Cross | 144b028 | 2010-05-10 13:04:47 -0700 | [diff] [blame] | 880 | userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 881 | $(build-userdataimage-target) | 
|  | 882 |  | 
|  | 883 | ####### | 
|  | 884 | ## data partition tarball | 
|  | 885 | define build-userdatatarball-target | 
|  | 886 | $(call pretty,"Target userdata fs tarball: " \ | 
|  | 887 | "$(INSTALLED_USERDATATARBALL_TARGET)") | 
|  | 888 | $(MKTARBALL) $(FS_GET_STATS) \ | 
|  | 889 | $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \ | 
|  | 890 | $(INSTALLED_USERDATATARBALL_TARGET) | 
|  | 891 | endef | 
|  | 892 |  | 
|  | 893 | userdata_tar := $(PRODUCT_OUT)/userdata.tar | 
|  | 894 | INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2 | 
|  | 895 | $(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar) | 
|  | 896 | $(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES) | 
|  | 897 | $(build-userdatatarball-target) | 
|  | 898 |  | 
|  | 899 | .PHONY: userdatatarball-nodeps | 
|  | 900 | userdatatarball-nodeps: $(FS_GET_STATS) | 
|  | 901 | $(build-userdatatarball-target) | 
|  | 902 |  | 
|  | 903 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 904 | # ----------------------------------------------------------------- | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 905 | # bring in the installer image generation defines if necessary | 
|  | 906 | ifeq ($(TARGET_USE_DISKINSTALLER),true) | 
|  | 907 | include bootable/diskinstaller/config.mk | 
|  | 908 | endif | 
|  | 909 |  | 
|  | 910 | # ----------------------------------------------------------------- | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 911 | # host tools needed to build OTA packages | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 912 |  | 
| Ying Wang | 0689866 | 2010-06-17 17:52:18 -0700 | [diff] [blame] | 913 | OTATOOLS :=  $(HOST_OUT_EXECUTABLES)/minigzip \ | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 914 | $(HOST_OUT_EXECUTABLES)/mkbootfs \ | 
|  | 915 | $(HOST_OUT_EXECUTABLES)/mkbootimg \ | 
|  | 916 | $(HOST_OUT_EXECUTABLES)/fs_config \ | 
|  | 917 | $(HOST_OUT_EXECUTABLES)/mkyaffs2image \ | 
|  | 918 | $(HOST_OUT_EXECUTABLES)/zipalign \ | 
|  | 919 | $(HOST_OUT_EXECUTABLES)/aapt \ | 
|  | 920 | $(HOST_OUT_EXECUTABLES)/bsdiff \ | 
| Doug Zongker | c494d7c | 2009-06-18 08:43:44 -0700 | [diff] [blame] | 921 | $(HOST_OUT_EXECUTABLES)/imgdiff \ | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 922 | $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \ | 
| Ying Wang | 933abf1 | 2010-06-16 14:31:34 -0700 | [diff] [blame] | 923 | $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \ | 
|  | 924 | $(HOST_OUT_EXECUTABLES)/mkuserimg.sh \ | 
|  | 925 | $(HOST_OUT_EXECUTABLES)/genext2fs \ | 
|  | 926 | $(HOST_OUT_EXECUTABLES)/tune2fs \ | 
| Sriram Raman | ff83c85 | 2010-11-30 15:09:19 -0500 | [diff] [blame] | 927 | $(HOST_OUT_EXECUTABLES)/e2fsck \ | 
| Sriram Raman | c647aec | 2010-11-29 18:51:20 -0500 | [diff] [blame] | 928 | $(HOST_OUT_EXECUTABLES)/make_ext4fs | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 929 |  | 
| Ying Wang | 0689866 | 2010-06-17 17:52:18 -0700 | [diff] [blame] | 930 | .PHONY: otatools | 
|  | 931 | otatools: $(OTATOOLS) | 
|  | 932 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 933 | # ----------------------------------------------------------------- | 
|  | 934 | # A zip of the directories that map to the target filesystem. | 
|  | 935 | # This zip can be used to create an OTA package or filesystem image | 
|  | 936 | # as a post-build step. | 
|  | 937 | # | 
|  | 938 | name := $(TARGET_PRODUCT) | 
|  | 939 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 940 | name := $(name)_debug | 
|  | 941 | endif | 
|  | 942 | name := $(name)-target_files-$(FILE_NAME_TAG) | 
|  | 943 |  | 
|  | 944 | intermediates := $(call intermediates-dir-for,PACKAGING,target_files) | 
|  | 945 | BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip | 
|  | 946 | $(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates) | 
|  | 947 | $(BUILT_TARGET_FILES_PACKAGE): \ | 
|  | 948 | zip_root := $(intermediates)/$(name) | 
|  | 949 |  | 
|  | 950 | # $(1): Directory to copy | 
|  | 951 | # $(2): Location to copy it to | 
|  | 952 | # The "ls -A" is to prevent "acp s/* d" from failing if s is empty. | 
|  | 953 | define package_files-copy-root | 
|  | 954 | if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \ | 
|  | 955 | mkdir -p $(2) && \ | 
|  | 956 | $(ACP) -rd $(strip $(1))/* $(2); \ | 
|  | 957 | fi | 
|  | 958 | endef | 
|  | 959 |  | 
|  | 960 | built_ota_tools := \ | 
| Doug Zongker | 17c83cf | 2009-04-01 15:48:46 -0700 | [diff] [blame] | 961 | $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \ | 
| Doug Zongker | 6c77046 | 2009-07-22 18:27:31 -0700 | [diff] [blame] | 962 | $(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \ | 
| Doug Zongker | a406c1e | 2009-06-12 16:57:08 -0700 | [diff] [blame] | 963 | $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \ | 
|  | 964 | $(call intermediates-dir-for,EXECUTABLES,updater)/updater | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 965 | $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools) | 
|  | 966 |  | 
| Doug Zongker | b1134dd | 2009-06-17 17:09:40 -0700 | [diff] [blame] | 967 | $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION) | 
|  | 968 |  | 
| Doug Zongker | c18736b | 2009-09-30 09:20:32 -0700 | [diff] [blame] | 969 | ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),) | 
|  | 970 | # default to common dir for device vendor | 
|  | 971 | $(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common | 
|  | 972 | else | 
|  | 973 | $(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS) | 
|  | 974 | endif | 
|  | 975 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 976 | # Depending on the various images guarantees that the underlying | 
|  | 977 | # directories are up-to-date. | 
|  | 978 | $(BUILT_TARGET_FILES_PACKAGE): \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 979 | $(INSTALLED_BOOTIMAGE_TARGET) \ | 
|  | 980 | $(INSTALLED_RADIOIMAGE_TARGET) \ | 
|  | 981 | $(INSTALLED_RECOVERYIMAGE_TARGET) \ | 
| Doug Zongker | 4647f12 | 2009-07-02 09:00:54 -0700 | [diff] [blame] | 982 | $(INSTALLED_SYSTEMIMAGE) \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 983 | $(INSTALLED_USERDATAIMAGE_TARGET) \ | 
|  | 984 | $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 985 | $(built_ota_tools) \ | 
|  | 986 | $(APKCERTS_FILE) \ | 
| Doug Zongker | 283e2a1 | 2010-03-15 17:52:32 -0700 | [diff] [blame] | 987 | $(HOST_OUT_EXECUTABLES)/fs_config \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 988 | | $(ACP) | 
|  | 989 | @echo "Package target files: $@" | 
|  | 990 | $(hide) rm -rf $@ $(zip_root) | 
|  | 991 | $(hide) mkdir -p $(dir $@) $(zip_root) | 
|  | 992 | @# Components of the recovery image | 
|  | 993 | $(hide) mkdir -p $(zip_root)/RECOVERY | 
|  | 994 | $(hide) $(call package_files-copy-root, \ | 
|  | 995 | $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK) | 
|  | 996 | ifdef INSTALLED_KERNEL_TARGET | 
|  | 997 | $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel | 
|  | 998 | endif | 
|  | 999 | ifdef INSTALLED_2NDBOOTLOADER_TARGET | 
|  | 1000 | $(hide) $(ACP) \ | 
|  | 1001 | $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second | 
|  | 1002 | endif | 
|  | 1003 | ifdef BOARD_KERNEL_CMDLINE | 
|  | 1004 | $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline | 
|  | 1005 | endif | 
| Doug Zongker | 38a649f | 2009-06-17 09:07:09 -0700 | [diff] [blame] | 1006 | ifdef BOARD_KERNEL_BASE | 
|  | 1007 | $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base | 
|  | 1008 | endif | 
| Ying Wang | 4de6b5b | 2010-08-25 14:29:34 -0700 | [diff] [blame] | 1009 | ifdef BOARD_KERNEL_PAGESIZE | 
|  | 1010 | $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize | 
|  | 1011 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1012 | @# Components of the boot image | 
|  | 1013 | $(hide) mkdir -p $(zip_root)/BOOT | 
|  | 1014 | $(hide) $(call package_files-copy-root, \ | 
|  | 1015 | $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK) | 
|  | 1016 | ifdef INSTALLED_KERNEL_TARGET | 
|  | 1017 | $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel | 
|  | 1018 | endif | 
|  | 1019 | ifdef INSTALLED_2NDBOOTLOADER_TARGET | 
|  | 1020 | $(hide) $(ACP) \ | 
|  | 1021 | $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second | 
|  | 1022 | endif | 
|  | 1023 | ifdef BOARD_KERNEL_CMDLINE | 
|  | 1024 | $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline | 
|  | 1025 | endif | 
| Doug Zongker | 38a649f | 2009-06-17 09:07:09 -0700 | [diff] [blame] | 1026 | ifdef BOARD_KERNEL_BASE | 
|  | 1027 | $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base | 
|  | 1028 | endif | 
| Ying Wang | 4de6b5b | 2010-08-25 14:29:34 -0700 | [diff] [blame] | 1029 | ifdef BOARD_KERNEL_PAGESIZE | 
|  | 1030 | $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize | 
|  | 1031 | endif | 
| Doug Zongker | e01100c | 2009-06-19 17:12:18 -0700 | [diff] [blame] | 1032 | $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\ | 
|  | 1033 | mkdir -p $(zip_root)/RADIO; \ | 
|  | 1034 | $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1035 | @# Contents of the system image | 
|  | 1036 | $(hide) $(call package_files-copy-root, \ | 
|  | 1037 | $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM) | 
|  | 1038 | @# Contents of the data image | 
|  | 1039 | $(hide) $(call package_files-copy-root, \ | 
|  | 1040 | $(TARGET_OUT_DATA),$(zip_root)/DATA) | 
|  | 1041 | @# Extra contents of the OTA package | 
|  | 1042 | $(hide) mkdir -p $(zip_root)/OTA/bin | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1043 | $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/ | 
|  | 1044 | $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/ | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 1045 | @# Files that do not end up in any images, but are necessary to | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1046 | @# build them. | 
|  | 1047 | $(hide) mkdir -p $(zip_root)/META | 
|  | 1048 | $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt | 
| Doug Zongker | 17c83cf | 2009-04-01 15:48:46 -0700 | [diff] [blame] | 1049 | $(hide)	echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt | 
| Doug Zongker | 3797473 | 2010-09-16 17:44:38 -0700 | [diff] [blame] | 1050 | $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt | 
| Doug Zongker | b4c7d32 | 2010-07-01 15:30:11 -0700 | [diff] [blame] | 1051 | ifdef BOARD_FLASH_BLOCK_SIZE | 
| Doug Zongker | 3797473 | 2010-09-16 17:44:38 -0700 | [diff] [blame] | 1052 | $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt | 
| Doug Zongker | b4c7d32 | 2010-07-01 15:30:11 -0700 | [diff] [blame] | 1053 | endif | 
|  | 1054 | ifdef BOARD_BOOTIMAGE_PARTITION_SIZE | 
| Ying Wang | 0083671 | 2011-01-14 11:30:56 -0800 | [diff] [blame] | 1055 | $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt | 
| Doug Zongker | b4c7d32 | 2010-07-01 15:30:11 -0700 | [diff] [blame] | 1056 | endif | 
|  | 1057 | ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE | 
| Ying Wang | 0083671 | 2011-01-14 11:30:56 -0800 | [diff] [blame] | 1058 | $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt | 
| Doug Zongker | b4c7d32 | 2010-07-01 15:30:11 -0700 | [diff] [blame] | 1059 | endif | 
|  | 1060 | ifdef BOARD_SYSTEMIMAGE_PARTITION_SIZE | 
| Ying Wang | 0083671 | 2011-01-14 11:30:56 -0800 | [diff] [blame] | 1061 | $(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt | 
| Doug Zongker | b4c7d32 | 2010-07-01 15:30:11 -0700 | [diff] [blame] | 1062 | endif | 
|  | 1063 | ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE | 
| Ying Wang | 0083671 | 2011-01-14 11:30:56 -0800 | [diff] [blame] | 1064 | $(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt | 
| Doug Zongker | b4c7d32 | 2010-07-01 15:30:11 -0700 | [diff] [blame] | 1065 | endif | 
| Doug Zongker | 3797473 | 2010-09-16 17:44:38 -0700 | [diff] [blame] | 1066 | $(hide) echo "tool_extensions=$(tool_extensions)" >> $(zip_root)/META/misc_info.txt | 
| Ying Wang | d421f57 | 2010-08-25 20:39:41 -0700 | [diff] [blame] | 1067 | ifdef mkyaffs2_extra_flags | 
| Doug Zongker | 3797473 | 2010-09-16 17:44:38 -0700 | [diff] [blame] | 1068 | $(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(zip_root)/META/misc_info.txt | 
| Ying Wang | d421f57 | 2010-08-25 20:39:41 -0700 | [diff] [blame] | 1069 | endif | 
| Ying Wang | c5a07ce | 2010-11-17 17:45:36 -0800 | [diff] [blame] | 1070 | ifdef INTERNAL_USERIMAGES_SPARSE_EXT_FLAG | 
|  | 1071 | $(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(zip_root)/META/misc_info.txt | 
|  | 1072 | endif | 
| Doug Zongker | e121d6a | 2011-02-01 14:13:52 -0800 | [diff] [blame] | 1073 | ifdef TARGET_EXTRA_RECOVERY_KEYS | 
|  | 1074 | $(hide) echo "extra_recovery_keys=$(TARGET_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt | 
|  | 1075 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1076 | @# Zip everything up, preserving symlinks | 
|  | 1077 | $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) | 
| Doug Zongker | 283e2a1 | 2010-03-15 17:52:32 -0700 | [diff] [blame] | 1078 | @# Run fs_config on all the system files in the zip, and save the output | 
|  | 1079 | $(hide) zipinfo -1 $@ | awk -F/ 'BEGIN { OFS="/" } /^SYSTEM\// {$$1 = "system"; print}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/filesystem_config.txt | 
|  | 1080 | $(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/filesystem_config.txt) | 
|  | 1081 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1082 |  | 
|  | 1083 | target-files-package: $(BUILT_TARGET_FILES_PACKAGE) | 
|  | 1084 |  | 
| Doug Zongker | 367910f | 2009-06-15 18:56:51 -0700 | [diff] [blame] | 1085 |  | 
|  | 1086 | ifneq ($(TARGET_SIMULATOR),true) | 
|  | 1087 | ifneq ($(TARGET_PRODUCT),sdk) | 
| Ying Wang | 910dcbe | 2010-03-24 23:22:33 -0700 | [diff] [blame] | 1088 | ifneq ($(TARGET_DEVICE),generic) | 
| Ying Wang | fb0a347 | 2010-08-25 16:06:06 -0700 | [diff] [blame] | 1089 | ifneq ($(TARGET_NO_KERNEL),true) | 
| Doug Zongker | 367910f | 2009-06-15 18:56:51 -0700 | [diff] [blame] | 1090 |  | 
| Ying Wang | 09a00a6 | 2010-10-20 14:01:09 -0700 | [diff] [blame] | 1091 | # ----------------------------------------------------------------- | 
|  | 1092 | # OTA update package | 
|  | 1093 |  | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 1094 | name := $(TARGET_PRODUCT) | 
|  | 1095 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 1096 | name := $(name)_debug | 
|  | 1097 | endif | 
|  | 1098 | name := $(name)-ota-$(FILE_NAME_TAG) | 
|  | 1099 |  | 
|  | 1100 | INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip | 
|  | 1101 |  | 
|  | 1102 | $(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) | 
|  | 1103 |  | 
| Ying Wang | 0689866 | 2010-06-17 17:52:18 -0700 | [diff] [blame] | 1104 | $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS) | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 1105 | @echo "Package OTA: $@" | 
| Ying Wang | 68bb651 | 2010-08-25 15:23:21 -0700 | [diff] [blame] | 1106 | $(hide) ./build/tools/releasetools/ota_from_target_files -v \ | 
| Doug Zongker | 602a84e | 2009-06-18 08:35:12 -0700 | [diff] [blame] | 1107 | -p $(HOST_OUT) \ | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 1108 | -k $(KEY_CERT_PAIR) \ | 
|  | 1109 | $(BUILT_TARGET_FILES_PACKAGE) $@ | 
|  | 1110 |  | 
|  | 1111 | .PHONY: otapackage | 
|  | 1112 | otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) | 
|  | 1113 |  | 
| Ying Wang | 09a00a6 | 2010-10-20 14:01:09 -0700 | [diff] [blame] | 1114 | # ----------------------------------------------------------------- | 
|  | 1115 | # The update package | 
|  | 1116 |  | 
|  | 1117 | name := $(TARGET_PRODUCT) | 
|  | 1118 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 1119 | name := $(name)_debug | 
|  | 1120 | endif | 
|  | 1121 | name := $(name)-img-$(FILE_NAME_TAG) | 
|  | 1122 |  | 
|  | 1123 | INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip | 
|  | 1124 |  | 
|  | 1125 | ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),) | 
|  | 1126 | # default to common dir for device vendor | 
|  | 1127 | $(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common | 
|  | 1128 | else | 
|  | 1129 | $(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS) | 
|  | 1130 | endif | 
|  | 1131 |  | 
|  | 1132 | $(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS) | 
|  | 1133 | @echo "Package: $@" | 
|  | 1134 | $(hide) ./build/tools/releasetools/img_from_target_files -v \ | 
|  | 1135 | -s $(extensions) \ | 
|  | 1136 | -p $(HOST_OUT) \ | 
|  | 1137 | $(BUILT_TARGET_FILES_PACKAGE) $@ | 
|  | 1138 |  | 
|  | 1139 | .PHONY: updatepackage | 
|  | 1140 | updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET) | 
|  | 1141 |  | 
| Ying Wang | fb0a347 | 2010-08-25 16:06:06 -0700 | [diff] [blame] | 1142 | endif    # TARGET_NO_KERNEL != true | 
| Ying Wang | 910dcbe | 2010-03-24 23:22:33 -0700 | [diff] [blame] | 1143 | endif    # TARGET_DEVICE != generic | 
| Doug Zongker | 367910f | 2009-06-15 18:56:51 -0700 | [diff] [blame] | 1144 | endif    # TARGET_PRODUCT != sdk | 
|  | 1145 | endif    # TARGET_SIMULATOR != true | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 1146 |  | 
|  | 1147 | # ----------------------------------------------------------------- | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1148 | # installed file list | 
|  | 1149 | # Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it | 
|  | 1150 | # gets the DexOpt one if we're doing that. | 
|  | 1151 | INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt | 
|  | 1152 | $(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE) | 
|  | 1153 | @echo Installed file list: $@ | 
|  | 1154 | @mkdir -p $(dir $@) | 
|  | 1155 | @rm -f $@ | 
|  | 1156 | $(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@ | 
|  | 1157 |  | 
|  | 1158 | .PHONY: installed-file-list | 
|  | 1159 | installed-file-list: $(INSTALLED_FILES_FILE) | 
| Ying Wang | a37a2cb | 2010-04-28 12:59:51 -0700 | [diff] [blame] | 1160 | ifneq ($(filter sdk,$(MAKECMDGOALS)),) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1161 | $(call dist-for-goals, sdk, $(INSTALLED_FILES_FILE)) | 
| Ying Wang | a37a2cb | 2010-04-28 12:59:51 -0700 | [diff] [blame] | 1162 | endif | 
|  | 1163 | ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),) | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 1164 | $(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE)) | 
| Ying Wang | a37a2cb | 2010-04-28 12:59:51 -0700 | [diff] [blame] | 1165 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1166 |  | 
|  | 1167 | # ----------------------------------------------------------------- | 
|  | 1168 | # A zip of the tests that are built when running "make tests". | 
|  | 1169 | # This is very similar to BUILT_TARGET_FILES_PACKAGE, but we | 
|  | 1170 | # only grab SYSTEM and DATA, and it's called "*-tests-*.zip". | 
|  | 1171 | # | 
|  | 1172 | name := $(TARGET_PRODUCT) | 
|  | 1173 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 1174 | name := $(name)_debug | 
|  | 1175 | endif | 
|  | 1176 | name := $(name)-tests-$(FILE_NAME_TAG) | 
|  | 1177 |  | 
|  | 1178 | intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip) | 
|  | 1179 | BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip | 
|  | 1180 | $(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates) | 
|  | 1181 | $(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name) | 
|  | 1182 |  | 
|  | 1183 | # Depending on the images guarantees that the underlying | 
|  | 1184 | # directories are up-to-date. | 
|  | 1185 | $(BUILT_TESTS_ZIP_PACKAGE): \ | 
|  | 1186 | $(BUILT_SYSTEMIMAGE) \ | 
|  | 1187 | $(INSTALLED_USERDATAIMAGE_TARGET) \ | 
|  | 1188 | | $(ACP) | 
|  | 1189 | @echo "Package test files: $@" | 
|  | 1190 | $(hide) rm -rf $@ $(zip_root) | 
|  | 1191 | $(hide) mkdir -p $(dir $@) $(zip_root) | 
|  | 1192 | @# Some parts of the system image | 
|  | 1193 | $(hide) $(call package_files-copy-root, \ | 
|  | 1194 | $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin) | 
|  | 1195 | $(hide) $(call package_files-copy-root, \ | 
|  | 1196 | $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib) | 
|  | 1197 | $(hide) $(call package_files-copy-root, \ | 
|  | 1198 | $(SYSTEMIMAGE_SOURCE_DIR)/framework, \ | 
|  | 1199 | $(zip_root)/SYSTEM/framework) | 
|  | 1200 | $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM | 
|  | 1201 | @# Contents of the data image | 
|  | 1202 | $(hide) $(call package_files-copy-root, \ | 
|  | 1203 | $(TARGET_OUT_DATA),$(zip_root)/DATA) | 
|  | 1204 | $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) | 
|  | 1205 |  | 
| Ying Wang | 9c76255 | 2010-09-10 14:39:33 -0700 | [diff] [blame] | 1206 | .PHONY: tests-zip-package | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1207 | tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE) | 
|  | 1208 |  | 
| Ying Wang | db2cb63 | 2010-09-14 16:07:56 -0700 | [diff] [blame] | 1209 | # Target needed by tests build | 
|  | 1210 | .PHONY: tests-build-target | 
|  | 1211 | tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE) \ | 
|  | 1212 | $(BUILT_USERDATAIMAGE_TARGET) | 
|  | 1213 |  | 
|  | 1214 | ifneq (,$(filter $(MAKECMDGOALS),tests-build-target)) | 
|  | 1215 | $(call dist-for-goals, tests-build-target, \ | 
|  | 1216 | $(BUILT_TESTS_ZIP_PACKAGE) \ | 
|  | 1217 | $(BUILT_USERDATAIMAGE_TARGET)) | 
| Ying Wang | 9c76255 | 2010-09-10 14:39:33 -0700 | [diff] [blame] | 1218 | endif | 
|  | 1219 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1220 | # ----------------------------------------------------------------- | 
|  | 1221 | # A zip of the symbols directory.  Keep the full paths to make it | 
|  | 1222 | # more obvious where these files came from. | 
|  | 1223 | # | 
|  | 1224 | name := $(TARGET_PRODUCT) | 
|  | 1225 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 1226 | name := $(name)_debug | 
|  | 1227 | endif | 
|  | 1228 | name := $(name)-symbols-$(FILE_NAME_TAG) | 
|  | 1229 |  | 
|  | 1230 | SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip | 
|  | 1231 | $(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET) | 
|  | 1232 | @echo "Package symbols: $@" | 
|  | 1233 | $(hide) rm -rf $@ | 
|  | 1234 | $(hide) mkdir -p $(dir $@) | 
|  | 1235 | $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED) | 
|  | 1236 |  | 
|  | 1237 | # ----------------------------------------------------------------- | 
|  | 1238 | # A zip of the Android Apps. Not keeping full path so that we don't | 
|  | 1239 | # include product names when distributing | 
|  | 1240 | # | 
|  | 1241 | name := $(TARGET_PRODUCT) | 
|  | 1242 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 1243 | name := $(name)_debug | 
|  | 1244 | endif | 
|  | 1245 | name := $(name)-apps-$(FILE_NAME_TAG) | 
|  | 1246 |  | 
|  | 1247 | APPS_ZIP := $(PRODUCT_OUT)/$(name).zip | 
|  | 1248 | $(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE) | 
|  | 1249 | @echo "Package apps: $@" | 
|  | 1250 | $(hide) rm -rf $@ | 
|  | 1251 | $(hide) mkdir -p $(dir $@) | 
|  | 1252 | $(hide) zip -qj $@ $(TARGET_OUT_APPS)/* | 
|  | 1253 |  | 
| Guang Zhu | 0198d6e | 2010-04-23 11:54:37 -0700 | [diff] [blame] | 1254 |  | 
|  | 1255 | #------------------------------------------------------------------ | 
|  | 1256 | # A zip of emma code coverage meta files. Generated for fully emma | 
|  | 1257 | # instrumented build. | 
|  | 1258 | # | 
|  | 1259 | EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip | 
|  | 1260 | $(EMMA_META_ZIP): $(INSTALLED_SYSTEMIMAGE) | 
|  | 1261 | @echo "Collecting Emma coverage meta files." | 
|  | 1262 | $(hide) find $(TARGET_COMMON_OUT_ROOT) -name "coverage.em" | \ | 
|  | 1263 | zip -@ -q $@ | 
|  | 1264 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1265 | endif	# TARGET_SIMULATOR != true | 
|  | 1266 |  | 
|  | 1267 | # ----------------------------------------------------------------- | 
|  | 1268 | # dalvik something | 
|  | 1269 | .PHONY: dalvikfiles | 
|  | 1270 | dalvikfiles: $(INTERNAL_DALVIK_MODULES) | 
|  | 1271 |  | 
|  | 1272 | # ----------------------------------------------------------------- | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1273 | # The emulator package | 
|  | 1274 |  | 
|  | 1275 | ifneq ($(TARGET_SIMULATOR),true) | 
|  | 1276 |  | 
|  | 1277 | INTERNAL_EMULATOR_PACKAGE_FILES += \ | 
|  | 1278 | $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \ | 
|  | 1279 | prebuilt/android-arm/kernel/kernel-qemu \ | 
|  | 1280 | $(INSTALLED_RAMDISK_TARGET) \ | 
|  | 1281 | $(INSTALLED_SYSTEMIMAGE) \ | 
|  | 1282 | $(INSTALLED_USERDATAIMAGE_TARGET) | 
|  | 1283 |  | 
|  | 1284 | name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG) | 
|  | 1285 |  | 
|  | 1286 | INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip | 
|  | 1287 |  | 
|  | 1288 | $(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES) | 
|  | 1289 | @echo "Package: $@" | 
|  | 1290 | $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES) | 
|  | 1291 |  | 
|  | 1292 | endif | 
|  | 1293 |  | 
|  | 1294 | # ----------------------------------------------------------------- | 
|  | 1295 | # The pdk package (Platform Development Kit) | 
|  | 1296 |  | 
|  | 1297 | ifneq (,$(filter pdk,$(MAKECMDGOALS))) | 
|  | 1298 | include development/pdk/Pdk.mk | 
|  | 1299 | endif | 
|  | 1300 |  | 
|  | 1301 | # ----------------------------------------------------------------- | 
|  | 1302 | # The SDK | 
|  | 1303 |  | 
|  | 1304 | ifneq ($(TARGET_SIMULATOR),true) | 
|  | 1305 |  | 
|  | 1306 | # The SDK includes host-specific components, so it belongs under HOST_OUT. | 
|  | 1307 | sdk_dir := $(HOST_OUT)/sdk | 
|  | 1308 |  | 
|  | 1309 | # Build a name that looks like: | 
|  | 1310 | # | 
|  | 1311 | #     linux-x86   --> android-sdk_12345_linux-x86 | 
|  | 1312 | #     darwin-x86  --> android-sdk_12345_mac-x86 | 
|  | 1313 | #     windows-x86 --> android-sdk_12345_windows | 
|  | 1314 | # | 
|  | 1315 | sdk_name := android-sdk_$(FILE_NAME_TAG) | 
|  | 1316 | ifeq ($(HOST_OS),darwin) | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 1317 | INTERNAL_SDK_HOST_OS_NAME := mac | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1318 | else | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 1319 | INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1320 | endif | 
|  | 1321 | ifneq ($(HOST_OS),windows) | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 1322 | INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(HOST_ARCH) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1323 | endif | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 1324 | sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1325 |  | 
|  | 1326 | sdk_dep_file := $(sdk_dir)/sdk_deps.mk | 
|  | 1327 |  | 
|  | 1328 | ATREE_FILES := | 
|  | 1329 | -include $(sdk_dep_file) | 
|  | 1330 |  | 
|  | 1331 | # if we don't have a real list, then use "everything" | 
|  | 1332 | ifeq ($(strip $(ATREE_FILES)),) | 
|  | 1333 | ATREE_FILES := \ | 
|  | 1334 | $(ALL_PREBUILT) \ | 
|  | 1335 | $(ALL_COPIED_HEADERS) \ | 
|  | 1336 | $(ALL_GENERATED_SOURCES) \ | 
|  | 1337 | $(ALL_DEFAULT_INSTALLED_MODULES) \ | 
|  | 1338 | $(INSTALLED_RAMDISK_TARGET) \ | 
|  | 1339 | $(ALL_DOCS) \ | 
|  | 1340 | $(ALL_SDK_FILES) | 
|  | 1341 | endif | 
|  | 1342 |  | 
|  | 1343 | atree_dir := development/build | 
|  | 1344 |  | 
|  | 1345 | sdk_atree_files := \ | 
|  | 1346 | $(atree_dir)/sdk.exclude.atree \ | 
|  | 1347 | $(atree_dir)/sdk.atree \ | 
| Xavier Ducrohet | ffd5087 | 2010-09-27 15:51:32 -0700 | [diff] [blame] | 1348 | $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree \ | 
|  | 1349 | sdk/build/tools.atree | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1350 |  | 
|  | 1351 | deps := \ | 
|  | 1352 | $(target_notice_file_txt) \ | 
|  | 1353 | $(tools_notice_file_txt) \ | 
|  | 1354 | $(OUT_DOCS)/offline-sdk-timestamp \ | 
| Ying Wang | 139e332 | 2010-03-31 17:29:04 -0700 | [diff] [blame] | 1355 | $(SYMBOLS_ZIP) \ | 
| Doug Zongker | dddd957 | 2009-06-15 21:25:32 -0700 | [diff] [blame] | 1356 | $(INSTALLED_SYSTEMIMAGE) \ | 
|  | 1357 | $(INSTALLED_USERDATAIMAGE_TARGET) \ | 
|  | 1358 | $(INSTALLED_RAMDISK_TARGET) \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1359 | $(INSTALLED_SDK_BUILD_PROP_TARGET) \ | 
| Ying Wang | 139e332 | 2010-03-31 17:29:04 -0700 | [diff] [blame] | 1360 | $(INSTALLED_BUILD_PROP_TARGET) \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1361 | $(ATREE_FILES) \ | 
|  | 1362 | $(atree_dir)/sdk.atree \ | 
| Xavier Ducrohet | ffd5087 | 2010-09-27 15:51:32 -0700 | [diff] [blame] | 1363 | sdk/build/tools.atree \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1364 | $(HOST_OUT_EXECUTABLES)/atree \ | 
|  | 1365 | $(HOST_OUT_EXECUTABLES)/line_endings | 
|  | 1366 |  | 
|  | 1367 | INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip | 
|  | 1368 | $(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name) | 
|  | 1369 | $(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name) | 
|  | 1370 | $(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file) | 
|  | 1371 | $(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files) | 
|  | 1372 |  | 
|  | 1373 | # Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built. | 
|  | 1374 | # | 
|  | 1375 | #SDK_GNU_ERROR := true | 
|  | 1376 |  | 
| Raphael | 7a6a9c3 | 2011-02-01 13:30:00 -0800 | [diff] [blame] | 1377 | ifeq ($(HOST_OS),darwin) | 
|  | 1378 | HOST_STRIP_SDK_LLVM := strip | 
|  | 1379 | else | 
|  | 1380 | HOST_STRIP_SDK_LLVM := strip --strip-all | 
|  | 1381 | endif | 
|  | 1382 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1383 | $(INTERNAL_SDK_TARGET): $(deps) | 
|  | 1384 | @echo "Package SDK: $@" | 
|  | 1385 | $(hide) rm -rf $(PRIVATE_DIR) $@ | 
|  | 1386 | $(hide) for f in $(target_gnu_MODULES); do \ | 
|  | 1387 | if [ -f $$f ]; then \ | 
|  | 1388 | echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \ | 
|  | 1389 | including GNU target $$f >&2; \ | 
|  | 1390 | FAIL=$(SDK_GNU_ERROR); \ | 
|  | 1391 | fi; \ | 
|  | 1392 | done; \ | 
|  | 1393 | if [ $$FAIL ]; then exit 1; fi | 
|  | 1394 | $(hide) ( \ | 
|  | 1395 | $(HOST_OUT_EXECUTABLES)/atree \ | 
|  | 1396 | $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \ | 
|  | 1397 | -m $(PRIVATE_DEP_FILE) \ | 
|  | 1398 | -I . \ | 
|  | 1399 | -I $(PRODUCT_OUT) \ | 
|  | 1400 | -I $(HOST_OUT) \ | 
|  | 1401 | -I $(TARGET_COMMON_OUT_ROOT) \ | 
|  | 1402 | -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \ | 
| Raphael Moll | 7558ad5 | 2011-01-05 14:58:17 -0800 | [diff] [blame] | 1403 | -v "OUT_DIR=$(OUT_DIR)" \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1404 | -o $(PRIVATE_DIR) && \ | 
|  | 1405 | cp -f $(target_notice_file_txt) \ | 
|  | 1406 | $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \ | 
|  | 1407 | cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \ | 
| Raphael | 7a6a9c3 | 2011-02-01 13:30:00 -0800 | [diff] [blame] | 1408 | if [ -f $(PRIVATE_DIR)/platform-tools/llvm-rs-cc ]; then \ | 
|  | 1409 | $(HOST_STRIP_SDK_LLVM) $(PRIVATE_DIR)/platform-tools/llvm-rs-cc; \ | 
|  | 1410 | fi && \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1411 | HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \ | 
| Raphael | 7a6a9c3 | 2011-02-01 13:30:00 -0800 | [diff] [blame] | 1412 | development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1413 | chmod -R ug+rwX $(PRIVATE_DIR) && \ | 
|  | 1414 | cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \ | 
|  | 1415 | ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 ) | 
|  | 1416 |  | 
| Raphael | 3d224a0 | 2010-04-16 17:50:09 -0700 | [diff] [blame] | 1417 |  | 
|  | 1418 | # Is a Windows SDK requested? If so, we need some definitions from here | 
|  | 1419 | # in order to find the Linux SDK used to create the Windows one. | 
|  | 1420 | ifneq ($(filter win_sdk,$(MAKECMDGOALS)),) | 
|  | 1421 | LINUX_SDK_NAME := $(sdk_name) | 
|  | 1422 | LINUX_SDK_DIR  := $(sdk_dir) | 
|  | 1423 | include $(TOPDIR)development/build/tools/windows_sdk.mk | 
|  | 1424 | endif | 
|  | 1425 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1426 | endif # !simulator | 
|  | 1427 |  | 
|  | 1428 | # ----------------------------------------------------------------- | 
|  | 1429 | # Findbugs | 
|  | 1430 | INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml | 
|  | 1431 | INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html | 
|  | 1432 | $(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES) | 
|  | 1433 | @echo UnionBugs: $@ | 
|  | 1434 | $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \ | 
|  | 1435 | > $@ | 
|  | 1436 | $(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET) | 
|  | 1437 | @echo ConvertXmlToText: $@ | 
|  | 1438 | $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \ | 
|  | 1439 | $(INTERNAL_FINDBUGS_XML_TARGET)	> $@ | 
|  | 1440 |  | 
|  | 1441 | # ----------------------------------------------------------------- | 
|  | 1442 | # Findbugs | 
|  | 1443 |  | 
|  | 1444 | # ----------------------------------------------------------------- | 
|  | 1445 | # These are some additional build tasks that need to be run. | 
|  | 1446 | include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk)) | 
| Claes Elgemark | e22ad67 | 2010-11-12 15:46:00 +0100 | [diff] [blame] | 1447 | -include $(sort $(wildcard vendor/*/build/tasks/*.mk)) |