| 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". | 
|  | 17 | $(foreach cf,$(PRODUCT_COPY_FILES), \ | 
| Joe Onorato | 64d85d0 | 2009-04-09 19:31:12 -0700 | [diff] [blame] | 18 | $(eval _src := $(call word-colon,1,$(cf))) \ | 
|  | 19 | $(eval _dest := $(call \ | 
|  | 20 | append-path,$(PRODUCT_OUT),$(call word-colon,2,$(cf)))) \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 21 | $(eval $(call copy-one-file,$(_src),$(_dest))) \ | 
|  | 22 | $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_dest)) \ | 
|  | 23 | ) | 
|  | 24 |  | 
|  | 25 | # ----------------------------------------------------------------- | 
|  | 26 | # docs/index.html | 
|  | 27 | gen := $(OUT_DOCS)/index.html | 
|  | 28 | ALL_DOCS += $(gen) | 
|  | 29 | $(gen): frameworks/base/docs/docs-redirect-index.html | 
|  | 30 | @mkdir -p $(dir $@) | 
|  | 31 | @cp -f $< $@ | 
|  | 32 |  | 
|  | 33 | # ----------------------------------------------------------------- | 
|  | 34 | # default.prop | 
|  | 35 | INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop | 
|  | 36 | ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET) | 
|  | 37 | ADDITIONAL_DEFAULT_PROPERTIES := \ | 
|  | 38 | $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) | 
|  | 39 |  | 
|  | 40 | $(INSTALLED_DEFAULT_PROP_TARGET): | 
|  | 41 | @echo Target buildinfo: $@ | 
|  | 42 | @mkdir -p $(dir $@) | 
|  | 43 | $(hide) echo "#" > $@; \ | 
|  | 44 | echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \ | 
|  | 45 | echo "#" >> $@; | 
|  | 46 | $(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \ | 
|  | 47 | echo "$(line)" >> $@;) | 
|  | 48 |  | 
|  | 49 | # ----------------------------------------------------------------- | 
|  | 50 | # build.prop | 
|  | 51 | INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop | 
|  | 52 | ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET) | 
|  | 53 | ADDITIONAL_BUILD_PROPERTIES := \ | 
|  | 54 | $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES)) | 
|  | 55 |  | 
|  | 56 | # A list of arbitrary tags describing the build configuration. | 
|  | 57 | # Force ":=" so we can use += | 
|  | 58 | BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS) | 
|  | 59 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 60 | BUILD_VERSION_TAGS += debug | 
|  | 61 | endif | 
|  | 62 | # Apps are always signed with test keys, and may be re-signed in a post-build | 
|  | 63 | # step.  If that happens, the "test-keys" tag will be removed by that step. | 
|  | 64 | BUILD_VERSION_TAGS += test-keys | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 65 | BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) | 
|  | 66 |  | 
|  | 67 | # A human-readable string that descibes this build in detail. | 
|  | 68 | build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS) | 
|  | 69 | $(INSTALLED_BUILD_PROP_TARGET): PRIVATE_BUILD_DESC := $(build_desc) | 
|  | 70 |  | 
|  | 71 | # The string used to uniquely identify this build;  used by the OTA server. | 
|  | 72 | ifeq (,$(strip $(BUILD_FINGERPRINT))) | 
|  | 73 | BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE)/$(TARGET_BOOTLOADER_BOARD_NAME):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) | 
|  | 74 | endif | 
|  | 75 | ifneq ($(words $(BUILD_FINGERPRINT)),1) | 
|  | 76 | $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)") | 
|  | 77 | endif | 
|  | 78 |  | 
| Sriram Raman | 7b64124 | 2009-03-24 22:40:59 -0700 | [diff] [blame] | 79 | # Display parameters shown under Settings -> About Phone | 
|  | 80 | ifeq ($(TARGET_BUILD_VARIANT),user) | 
|  | 81 | # User builds should show: | 
|  | 82 | # release build number or branch.buld_number non-release builds | 
|  | 83 |  | 
|  | 84 | # Dev. branches should have DISPLAY_BUILD_NUMBER set | 
|  | 85 | ifeq "true" "$(DISPLAY_BUILD_NUMBER)" | 
|  | 86 | BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER) | 
|  | 87 | else | 
|  | 88 | BUILD_DISPLAY_ID := $(BUILD_ID) | 
|  | 89 | endif | 
|  | 90 | else | 
|  | 91 | # Non-user builds should show detailed build information | 
|  | 92 | BUILD_DISPLAY_ID := $(build_desc) | 
|  | 93 | endif | 
|  | 94 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 95 | # Selects the first locale in the list given as the argument, | 
|  | 96 | # and splits it into language and region, which each may be | 
|  | 97 | # empty. | 
|  | 98 | define default-locale | 
|  | 99 | $(subst _, , $(firstword $(1))) | 
|  | 100 | endef | 
|  | 101 |  | 
|  | 102 | # Selects the first locale in the list given as the argument | 
|  | 103 | # and returns the language (or the region) | 
|  | 104 | define default-locale-language | 
|  | 105 | $(word 2, 2, $(call default-locale, $(1))) | 
|  | 106 | endef | 
|  | 107 | define default-locale-region | 
|  | 108 | $(word 3, 3, $(call default-locale, $(1))) | 
|  | 109 | endef | 
|  | 110 |  | 
|  | 111 | BUILDINFO_SH := build/tools/buildinfo.sh | 
|  | 112 | $(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) | 
|  | 113 | @echo Target buildinfo: $@ | 
|  | 114 | @mkdir -p $(dir $@) | 
|  | 115 | $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \ | 
|  | 116 | TARGET_DEVICE="$(TARGET_DEVICE)" \ | 
|  | 117 | PRODUCT_NAME="$(TARGET_PRODUCT)" \ | 
|  | 118 | PRODUCT_BRAND="$(PRODUCT_BRAND)" \ | 
|  | 119 | PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \ | 
|  | 120 | PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \ | 
|  | 121 | PRODUCT_MODEL="$(PRODUCT_MODEL)" \ | 
|  | 122 | PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \ | 
|  | 123 | PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \ | 
|  | 124 | BUILD_ID="$(BUILD_ID)" \ | 
|  | 125 | BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \ | 
|  | 126 | BUILD_NUMBER="$(BUILD_NUMBER)" \ | 
|  | 127 | PLATFORM_VERSION="$(PLATFORM_VERSION)" \ | 
|  | 128 | PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ | 
| Dianne Hackborn | 9537884 | 2009-05-08 12:06:17 -0700 | [diff] [blame] | 129 | PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 130 | BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ | 
|  | 131 | TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \ | 
|  | 132 | BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \ | 
|  | 133 | TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \ | 
| Dianne Hackborn | ecc70d7 | 2009-05-21 15:45:30 -0700 | [diff] [blame] | 134 | TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 135 | bash $(BUILDINFO_SH) > $@ | 
|  | 136 | $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \ | 
|  | 137 | cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \ | 
|  | 138 | fi | 
|  | 139 | $(if $(ADDITIONAL_BUILD_PROPERTIES), \ | 
|  | 140 | $(hide) echo >> $@; \ | 
|  | 141 | echo "#" >> $@; \ | 
|  | 142 | echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \ | 
|  | 143 | echo "#" >> $@; ) | 
|  | 144 | $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \ | 
|  | 145 | echo "$(line)" >> $@;) | 
|  | 146 |  | 
|  | 147 | build_desc := | 
|  | 148 |  | 
|  | 149 | # ----------------------------------------------------------------- | 
|  | 150 | # sdk-build.prop | 
|  | 151 | # | 
|  | 152 | # There are certain things in build.prop that we don't want to | 
|  | 153 | # ship with the sdk; remove them. | 
|  | 154 |  | 
|  | 155 | # This must be a list of entire property keys followed by | 
|  | 156 | # "=" characters, without any internal spaces. | 
|  | 157 | sdk_build_prop_remove := \ | 
|  | 158 | ro.build.user= \ | 
|  | 159 | ro.build.host= \ | 
|  | 160 | ro.product.brand= \ | 
|  | 161 | ro.product.manufacturer= \ | 
|  | 162 | ro.product.device= | 
|  | 163 | # TODO: Remove this soon-to-be obsolete property | 
|  | 164 | sdk_build_prop_remove += ro.build.product= | 
|  | 165 | INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop | 
|  | 166 | $(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET) | 
|  | 167 | @echo SDK buildinfo: $@ | 
|  | 168 | @mkdir -p $(dir $@) | 
|  | 169 | $(hide) grep -v "$(subst $(space),\|,$(strip \ | 
|  | 170 | $(sdk_build_prop_remove)))" $< > $@.tmp | 
|  | 171 | $(hide) for x in $(sdk_build_prop_remove); do \ | 
|  | 172 | echo "$$x"generic >> $@.tmp; done | 
|  | 173 | $(hide) mv $@.tmp $@ | 
|  | 174 |  | 
|  | 175 | # ----------------------------------------------------------------- | 
|  | 176 | # package stats | 
|  | 177 | PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt | 
|  | 178 | PACKAGES_TO_STAT := \ | 
|  | 179 | $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \ | 
|  | 180 | $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES)))) | 
|  | 181 | $(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT) | 
|  | 182 | @echo Package stats: $@ | 
|  | 183 | @mkdir -p $(dir $@) | 
|  | 184 | $(hide) rm -f $@ | 
|  | 185 | $(hide) build/tools/dump-package-stats $^ > $@ | 
|  | 186 |  | 
|  | 187 | .PHONY: package-stats | 
|  | 188 | package-stats: $(PACKAGE_STATS_FILE) | 
|  | 189 |  | 
|  | 190 | # ----------------------------------------------------------------- | 
|  | 191 | # Cert-to-package mapping.  Used by the post-build signing tools. | 
|  | 192 | name := $(TARGET_PRODUCT) | 
|  | 193 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 194 | name := $(name)_debug | 
|  | 195 | endif | 
|  | 196 | name := $(name)-apkcerts-$(FILE_NAME_TAG) | 
|  | 197 | intermediates := \ | 
|  | 198 | $(call intermediates-dir-for,PACKAGING,apkcerts) | 
|  | 199 | APKCERTS_FILE := $(intermediates)/$(name).txt | 
|  | 200 | # Depending on the built packages isn't exactly right, | 
|  | 201 | # but it should guarantee that the apkcerts file is rebuilt | 
|  | 202 | # if any packages change which certs they're signed with. | 
|  | 203 | all_built_packages := $(foreach p,$(PACKAGES),$(ALL_MODULES.$(p).BUILT)) | 
|  | 204 | $(APKCERTS_FILE): $(all_built_packages) | 
|  | 205 | @echo APK certs list: $@ | 
|  | 206 | @mkdir -p $(dir $@) | 
|  | 207 | @rm -f $@ | 
|  | 208 | $(hide) $(foreach p,$(PACKAGES),\ | 
|  | 209 | echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \ | 
|  | 210 | private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;) | 
|  | 211 |  | 
|  | 212 | .PHONY: apkcerts-list | 
|  | 213 | apkcerts-list: $(APKCERTS_FILE) | 
|  | 214 |  | 
|  | 215 | # ----------------------------------------------------------------- | 
|  | 216 | # module info file | 
|  | 217 | ifdef CREATE_MODULE_INFO_FILE | 
|  | 218 | MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt | 
|  | 219 | $(info Generating $(MODULE_INFO_FILE)...) | 
|  | 220 | $(shell rm -f $(MODULE_INFO_FILE)) | 
|  | 221 | $(foreach m,$(ALL_MODULES), \ | 
|  | 222 | $(shell echo "NAME=\"$(m)\"" \ | 
|  | 223 | "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \ | 
|  | 224 | "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \ | 
|  | 225 | "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \ | 
|  | 226 | "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE))) | 
|  | 227 | endif | 
|  | 228 |  | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 229 | # ----------------------------------------------------------------- | 
|  | 230 |  | 
|  | 231 | # The test key is used to sign this package, and as the key required | 
|  | 232 | # for future OTA packages installed by this system.  Actual product | 
|  | 233 | # deliverables will be re-signed by hand.  We expect this file to | 
|  | 234 | # exist with the suffixes ".x509.pem" and ".pk8". | 
|  | 235 | DEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey | 
|  | 236 |  | 
|  | 237 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 238 | # Rules that need to be present for the simulator, even | 
|  | 239 | # if they don't do anything. | 
|  | 240 | .PHONY: systemimage | 
|  | 241 | systemimage: | 
|  | 242 |  | 
|  | 243 | ifneq ($(TARGET_SIMULATOR),true) | 
|  | 244 |  | 
|  | 245 | # ################################################################# | 
|  | 246 | # Targets for boot/OS images | 
|  | 247 | # ################################################################# | 
|  | 248 |  | 
|  | 249 | # ----------------------------------------------------------------- | 
|  | 250 | # the ramdisk | 
|  | 251 | INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \ | 
|  | 252 | $(ALL_PREBUILT) \ | 
|  | 253 | $(ALL_COPIED_HEADERS) \ | 
|  | 254 | $(ALL_GENERATED_SOURCES) \ | 
|  | 255 | $(ALL_DEFAULT_INSTALLED_MODULES)) | 
|  | 256 |  | 
| Joe Onorato | 64d85d0 | 2009-04-09 19:31:12 -0700 | [diff] [blame] | 257 | BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img | 
|  | 258 |  | 
|  | 259 | # We just build this directly to the install location. | 
|  | 260 | INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET) | 
| Doug Zongker | 8b70e8c | 2009-05-27 09:14:25 -0700 | [diff] [blame] | 261 | $(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 262 | $(call pretty,"Target ram disk: $@") | 
| Doug Zongker | 8b70e8c | 2009-05-27 09:14:25 -0700 | [diff] [blame] | 263 | $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 264 |  | 
|  | 265 |  | 
|  | 266 | ifneq ($(strip $(TARGET_NO_KERNEL)),true) | 
|  | 267 |  | 
|  | 268 | # ----------------------------------------------------------------- | 
|  | 269 | # the boot image, which is a collection of other images. | 
|  | 270 | INTERNAL_BOOTIMAGE_ARGS := \ | 
|  | 271 | $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ | 
|  | 272 | --kernel $(INSTALLED_KERNEL_TARGET) \ | 
|  | 273 | --ramdisk $(INSTALLED_RAMDISK_TARGET) | 
|  | 274 |  | 
|  | 275 | INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS)) | 
|  | 276 |  | 
|  | 277 | BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE)) | 
|  | 278 | ifdef BOARD_KERNEL_CMDLINE | 
|  | 279 | INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)" | 
|  | 280 | endif | 
|  | 281 |  | 
| Dima Zavin | 1e0847c | 2009-05-07 19:43:08 -0700 | [diff] [blame] | 282 | BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE)) | 
|  | 283 | ifdef BOARD_KERNEL_BASE | 
|  | 284 | INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) | 
|  | 285 | endif | 
|  | 286 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 287 | INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img | 
|  | 288 |  | 
|  | 289 | ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true) | 
|  | 290 | tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg | 
|  | 291 | INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image) | 
|  | 292 | INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG) | 
|  | 293 | $(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES) | 
|  | 294 | $(call pretty,"Target boot image: $@") | 
|  | 295 | $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@ | 
|  | 296 |  | 
|  | 297 | else # TARGET_BOOTIMAGE_USE_EXT2 != true | 
|  | 298 |  | 
|  | 299 | $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) | 
|  | 300 | $(call pretty,"Target boot image: $@") | 
|  | 301 | $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@ | 
|  | 302 | $(hide) $(call assert-max-file-size,$@,$(BOARD_BOOTIMAGE_MAX_SIZE)) | 
|  | 303 | endif # TARGET_BOOTIMAGE_USE_EXT2 | 
|  | 304 |  | 
|  | 305 | else	# TARGET_NO_KERNEL | 
|  | 306 | # HACK: The top-level targets depend on the bootimage.  Not all targets | 
|  | 307 | # can produce a bootimage, though, and emulator targets need the ramdisk | 
|  | 308 | # instead.  Fake it out by calling the ramdisk the bootimage. | 
|  | 309 | # TODO: make the emulator use bootimages, and make mkbootimg accept | 
|  | 310 | #       kernel-less inputs. | 
|  | 311 | INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET) | 
|  | 312 | endif | 
|  | 313 |  | 
|  | 314 | # ----------------------------------------------------------------- | 
|  | 315 | # NOTICE files | 
|  | 316 | # | 
|  | 317 | # This needs to be before the systemimage rules, because it adds to | 
|  | 318 | # ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files | 
|  | 319 | # go into the systemimage. | 
|  | 320 |  | 
|  | 321 | .PHONY: notice_files | 
|  | 322 |  | 
|  | 323 | # Create the rule to combine the files into text and html forms | 
|  | 324 | # $(1) - Plain text output file | 
|  | 325 | # $(2) - HTML output file | 
|  | 326 | # $(3) - File title | 
|  | 327 | # $(4) - Directory to use.  Notice files are all $(4)/src.  Other | 
|  | 328 | #		 directories in there will be used for scratch | 
|  | 329 | # $(5) - Dependencies for the output files | 
|  | 330 | # | 
|  | 331 | # The algorithm here is that we go collect a hash for each of the notice | 
|  | 332 | # files and write the names of the files that match that hash.  Then | 
|  | 333 | # to generate the real files, we go print out all of the files and their | 
|  | 334 | # hashes. | 
|  | 335 | # | 
|  | 336 | # These rules are fairly complex, so they depend on this makefile so if | 
|  | 337 | # it changes, they'll run again. | 
|  | 338 | # | 
|  | 339 | # TODO: We could clean this up so that we just record the locations of the | 
|  | 340 | # original notice files instead of making rules to copy them somwehere. | 
|  | 341 | # Then we could traverse that without quite as much bash drama. | 
|  | 342 | define combine-notice-files | 
|  | 343 | $(1) $(2): PRIVATE_MESSAGE := $(3) | 
|  | 344 | $(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4) | 
|  | 345 | $(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile | 
|  | 346 | @echo Finding NOTICE files: $$@ | 
|  | 347 | $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash | 
|  | 348 | $$(hide) mkdir -p $$(PRIVATE_DIR)/hash | 
|  | 349 | $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \ | 
|  | 350 | hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \ | 
|  | 351 | hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \ | 
|  | 352 | echo $$$$file >> $$$$hashfile; \ | 
|  | 353 | done | 
|  | 354 | $$(hide) touch $$@ | 
|  | 355 | $(1): $(4)/hash-timestamp | 
|  | 356 | @echo Combining NOTICE files: $$@ | 
|  | 357 | $$(hide) mkdir -p $$(dir $$@) | 
|  | 358 | $$(hide) echo $$(PRIVATE_MESSAGE) > $$@ | 
|  | 359 | $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \ | 
|  | 360 | sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1:" >> $$@ | 
|  | 361 | $$(hide) echo >> $$@ | 
|  | 362 | $$(hide) echo >> $$@ | 
|  | 363 | $$(hide) echo >> $$@ | 
|  | 364 | $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \ | 
|  | 365 | echo "============================================================"\ | 
|  | 366 | >> $$@; \ | 
|  | 367 | echo "Notices for file(s):" >> $$@; \ | 
|  | 368 | cat $$$$hashfile | sort | \ | 
|  | 369 | sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1:" >> \ | 
|  | 370 | $$@; \ | 
|  | 371 | echo "------------------------------------------------------------"\ | 
|  | 372 | >> $$@; \ | 
|  | 373 | echo >> $$@; \ | 
|  | 374 | orig=$$$$(head -n 1 $$$$hashfile); \ | 
|  | 375 | cat $$$$orig >> $$@; \ | 
|  | 376 | echo >> $$@; \ | 
|  | 377 | echo >> $$@; \ | 
|  | 378 | echo >> $$@; \ | 
|  | 379 | done | 
|  | 380 | $(2): $(4)/hash-timestamp | 
|  | 381 | @echo Combining NOTICE files: $$@ | 
|  | 382 | $$(hide) mkdir -p $$(dir $$@) | 
|  | 383 | $$(hide) echo "<html><head>" > $$@ | 
|  | 384 | $$(hide) echo "<style type=\"text/css\">" >> $$@ | 
|  | 385 | $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@ | 
|  | 386 | $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@ | 
|  | 387 | $$(hide) echo ".label { font-weight: bold; }" >> $$@ | 
|  | 388 | $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@ | 
|  | 389 | $$(hide) echo "</style>" >> $$@ | 
|  | 390 | $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@ | 
|  | 391 | $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \ | 
|  | 392 | >> $$@ | 
|  | 393 | $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \ | 
|  | 394 | cat $$$$hashfile | sort | \ | 
|  | 395 | sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  <a name=\"\1\"></a>:" >> \ | 
|  | 396 | $$@; \ | 
|  | 397 | echo "<tr><td class=\"same-license\">" >> $$@; \ | 
|  | 398 | echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \ | 
|  | 399 | echo "<div class=\"file-list\">" >> $$@; \ | 
|  | 400 | cat $$$$hashfile | sort | \ | 
|  | 401 | sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1<br/>:" >> $$@; \ | 
|  | 402 | echo "</div><!-- file-list -->" >> $$@; \ | 
|  | 403 | echo >> $$@; \ | 
|  | 404 | orig=$$$$(head -n 1 $$$$hashfile); \ | 
|  | 405 | echo "<pre class=\"license-text\">" >> $$@; \ | 
|  | 406 | cat $$$$orig | sed -e "s/\&/\&/g" | sed -e "s/</\</g" \ | 
|  | 407 | | sed -e "s/>/\>/g" >> $$@; \ | 
|  | 408 | echo "</pre><!-- license-text -->" >> $$@; \ | 
|  | 409 | echo "</td></tr><!-- same-license -->" >> $$@; \ | 
|  | 410 | echo >> $$@; \ | 
|  | 411 | echo >> $$@; \ | 
|  | 412 | echo >> $$@; \ | 
|  | 413 | done | 
|  | 414 | $$(hide) echo "</table>" >> $$@ | 
|  | 415 | $$(hide) echo "</body></html>" >> $$@ | 
|  | 416 | notice_files: $(1) $(2) | 
|  | 417 | endef | 
|  | 418 |  | 
|  | 419 | # TODO These intermediate NOTICE.txt/NOTICE.html files should go into | 
|  | 420 | # TARGET_OUT_NOTICE_FILES now that the notice files are gathered from | 
|  | 421 | # the src subdirectory. | 
|  | 422 |  | 
|  | 423 | target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt | 
|  | 424 | target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html | 
|  | 425 | target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz | 
|  | 426 | tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt | 
|  | 427 | tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html | 
|  | 428 |  | 
|  | 429 | kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt | 
|  | 430 |  | 
|  | 431 | $(eval $(call combine-notice-files, \ | 
|  | 432 | $(target_notice_file_txt), \ | 
|  | 433 | $(target_notice_file_html), \ | 
|  | 434 | "Notices for files contained in the filesystem images in this directory:", \ | 
|  | 435 | $(TARGET_OUT_NOTICE_FILES), \ | 
|  | 436 | $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file))) | 
|  | 437 |  | 
|  | 438 | $(eval $(call combine-notice-files, \ | 
|  | 439 | $(tools_notice_file_txt), \ | 
|  | 440 | $(tools_notice_file_html), \ | 
|  | 441 | "Notices for files contained in the tools directory:", \ | 
|  | 442 | $(HOST_OUT_NOTICE_FILES), \ | 
|  | 443 | $(ALL_DEFAULT_INSTALLED_MODULES))) | 
|  | 444 |  | 
|  | 445 | # Install the html file at /system/etc/NOTICE.html.gz. | 
|  | 446 | # This is not ideal, but this is very late in the game, after a lot of | 
|  | 447 | # the module processing has already been done -- in fact, we used the | 
|  | 448 | # fact that all that has been done to get the list of modules that we | 
|  | 449 | # need notice files for. | 
| Doug Zongker | 8b70e8c | 2009-05-27 09:14:25 -0700 | [diff] [blame] | 450 | $(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP) | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 451 | $(hide) $(MINIGZIP) -9 < $< > $@ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 452 | installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz | 
|  | 453 | $(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP) | 
|  | 454 | $(copy-file-to-target) | 
| Joe Onorato | 7b2845a | 2009-04-30 13:52:50 -0700 | [diff] [blame] | 455 |  | 
|  | 456 | # if we've been run my mm, mmm, etc, don't reinstall this every time | 
|  | 457 | ifeq ($(ONE_SHOT_MAKEFILE),) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 458 | ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz) | 
| Joe Onorato | 7b2845a | 2009-04-30 13:52:50 -0700 | [diff] [blame] | 459 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 460 |  | 
|  | 461 | # The kernel isn't really a module, so to get its module file in there, we | 
|  | 462 | # make the target NOTICE files depend on this particular file too, which will | 
|  | 463 | # then be in the right directory for the find in combine-notice-files to work. | 
|  | 464 | $(kernel_notice_file): \ | 
|  | 465 | prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \ | 
|  | 466 | | $(ACP) | 
|  | 467 | @echo Copying: $@ | 
|  | 468 | $(hide) mkdir -p $(dir $@) | 
|  | 469 | $(hide) $(ACP) $< $@ | 
|  | 470 |  | 
|  | 471 |  | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 472 | # ----------------------------------------------------------------- | 
|  | 473 | # Build a keystore with the authorized keys in it, used to verify the | 
|  | 474 | # authenticity of downloaded OTA packages. | 
|  | 475 | # | 
|  | 476 | # This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come | 
|  | 477 | # before the rules that use that variable to build the image. | 
|  | 478 | ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip | 
|  | 479 | $(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^] | 480 | $(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] | 481 | $(hide) rm -f $@ | 
|  | 482 | $(hide) mkdir -p $(dir $@) | 
| Doug Zongker | 37c0e27 | 2009-06-15 15:36:16 -0700 | [diff] [blame^] | 483 | $(hide) zip -qj $@ $< | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 484 |  | 
|  | 485 | .PHONY: otacerts | 
|  | 486 | otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip | 
|  | 487 |  | 
|  | 488 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 489 | # ################################################################# | 
|  | 490 | # Targets for user images | 
|  | 491 | # ################################################################# | 
|  | 492 |  | 
|  | 493 | ifeq ($(TARGET_USERIMAGES_USE_EXT2),true) | 
|  | 494 | include external/genext2fs/Config.mk | 
|  | 495 | INTERNAL_MKUSERFS := $(MKEXT2IMG) | 
|  | 496 | else | 
|  | 497 | INTERNAL_MKUSERFS := $(MKYAFFS2) | 
|  | 498 | endif | 
|  | 499 |  | 
|  | 500 | # ----------------------------------------------------------------- | 
|  | 501 | # system yaffs image | 
|  | 502 | # | 
|  | 503 | # First, the "unoptimized" image, which contains .apk/.jar files | 
|  | 504 | # that contain regular, unoptimized/unverified .dex entries. | 
|  | 505 | # | 
|  | 506 | systemimage_unopt_intermediates := \ | 
|  | 507 | $(call intermediates-dir-for,PACKAGING,systemimage_unopt) | 
|  | 508 | BUILT_SYSTEMIMAGE_UNOPT := $(systemimage_unopt_intermediates)/system.img | 
|  | 509 |  | 
|  | 510 | INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \ | 
|  | 511 | $(ALL_PREBUILT) \ | 
|  | 512 | $(ALL_COPIED_HEADERS) \ | 
|  | 513 | $(ALL_GENERATED_SOURCES) \ | 
|  | 514 | $(ALL_DEFAULT_INSTALLED_MODULES)) | 
|  | 515 |  | 
|  | 516 | ifeq ($(TARGET_USERIMAGES_USE_EXT2),true) | 
|  | 517 | ## generate an ext2 image | 
|  | 518 | # $(1): output file | 
|  | 519 | define build-systemimage-target | 
|  | 520 | @echo "Target system fs image: $(1)" | 
|  | 521 | $(call build-userimage-ext2-target,$(TARGET_OUT),$(1),system,) | 
|  | 522 | endef | 
|  | 523 |  | 
|  | 524 | else # TARGET_USERIMAGES_USE_EXT2 != true | 
|  | 525 |  | 
|  | 526 | ## generate a yaffs2 image | 
|  | 527 | # $(1): output file | 
|  | 528 | define build-systemimage-target | 
|  | 529 | @echo "Target system fs image: $(1)" | 
|  | 530 | @mkdir -p $(dir $(1)) | 
|  | 531 | $(hide) $(MKYAFFS2) -f $(TARGET_OUT) $(1) | 
|  | 532 | endef | 
|  | 533 | endif # TARGET_USERIMAGES_USE_EXT2 | 
|  | 534 |  | 
|  | 535 | $(BUILT_SYSTEMIMAGE_UNOPT): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_MKUSERFS) | 
|  | 536 | $(call build-systemimage-target,$@) | 
|  | 537 |  | 
|  | 538 | # The installed image, which may be optimized or unoptimized. | 
|  | 539 | # | 
|  | 540 | INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img | 
|  | 541 |  | 
|  | 542 | ifdef WITH_DEXPREOPT | 
|  | 543 | ifndef DISABLE_DEXPREOPT | 
|  | 544 | with_dexpreopt := true | 
|  | 545 | endif | 
|  | 546 | endif | 
|  | 547 | ifdef with_dexpreopt | 
|  | 548 | # This file will set BUILT_SYSTEMIMAGE and SYSTEMIMAGE_SOURCE_DIR | 
|  | 549 | include build/tools/dexpreopt/Config.mk | 
|  | 550 | else | 
|  | 551 | BUILT_SYSTEMIMAGE := $(BUILT_SYSTEMIMAGE_UNOPT) | 
|  | 552 | SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) | 
|  | 553 | endif | 
|  | 554 |  | 
|  | 555 | $(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) | $(ACP) | 
|  | 556 | @echo "Install system fs image: $@" | 
|  | 557 | $(copy-file-to-target) | 
|  | 558 | $(hide) $(call assert-max-file-size,$@,$(BOARD_SYSTEMIMAGE_MAX_SIZE)) | 
|  | 559 |  | 
|  | 560 | systemimage: $(INSTALLED_SYSTEMIMAGE) | 
|  | 561 |  | 
|  | 562 | .PHONY: systemimage-nodeps snod | 
|  | 563 | systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \ | 
|  | 564 | | $(INTERNAL_MKUSERFS) | 
|  | 565 | @echo "make $@: ignoring dependencies" | 
|  | 566 | $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE)) | 
|  | 567 | $(hide) $(call assert-max-file-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_MAX_SIZE)) | 
|  | 568 |  | 
|  | 569 | ####### | 
|  | 570 | ## system tarball | 
|  | 571 | define build-systemtarball-target | 
|  | 572 | $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)") | 
|  | 573 | $(MKTARBALL) $(FS_GET_STATS) \ | 
|  | 574 | $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \ | 
|  | 575 | $(INSTALLED_SYSTEMTARBALL_TARGET) | 
|  | 576 | endef | 
|  | 577 |  | 
|  | 578 | system_tar := $(PRODUCT_OUT)/system.tar | 
|  | 579 | INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).bz2 | 
|  | 580 | $(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar) | 
|  | 581 | $(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES) | 
|  | 582 | $(build-systemtarball-target) | 
|  | 583 |  | 
|  | 584 | .PHONY: systemtarball-nodeps | 
|  | 585 | systemtarball-nodeps: $(FS_GET_STATS) \ | 
|  | 586 | $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS)) | 
|  | 587 | $(build-systemtarball-target) | 
|  | 588 |  | 
|  | 589 | .PHONY: stnod | 
|  | 590 | stnod: systemtarball-nodeps | 
|  | 591 |  | 
|  | 592 |  | 
|  | 593 | # ----------------------------------------------------------------- | 
|  | 594 | # data partition image | 
|  | 595 | INTERNAL_USERDATAIMAGE_FILES := \ | 
|  | 596 | $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) | 
|  | 597 |  | 
|  | 598 | ifeq ($(TARGET_USERIMAGES_USE_EXT2),true) | 
|  | 599 | ## Generate an ext2 image | 
|  | 600 | define build-userdataimage-target | 
|  | 601 | $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") | 
|  | 602 | @mkdir -p $(TARGET_OUT_DATA) | 
|  | 603 | $(call build-userimage-ext2-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),userdata,) | 
|  | 604 | $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE)) | 
|  | 605 | endef | 
|  | 606 |  | 
|  | 607 | else # TARGET_USERIMAGES_USE_EXT2 != true | 
|  | 608 |  | 
|  | 609 | ## Generate a yaffs2 image | 
|  | 610 | define build-userdataimage-target | 
|  | 611 | $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") | 
|  | 612 | @mkdir -p $(TARGET_OUT_DATA) | 
|  | 613 | $(hide) $(MKYAFFS2) -f $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET) | 
|  | 614 | $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE)) | 
|  | 615 | endef | 
|  | 616 | endif # TARGET_USERIMAGES_USE_EXT2 | 
|  | 617 |  | 
| Joe Onorato | 64d85d0 | 2009-04-09 19:31:12 -0700 | [diff] [blame] | 618 | BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img | 
|  | 619 |  | 
|  | 620 | # We just build this directly to the install location. | 
|  | 621 | INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 622 | $(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_MKUSERFS) \ | 
|  | 623 | $(INTERNAL_USERDATAIMAGE_FILES) | 
|  | 624 | $(build-userdataimage-target) | 
|  | 625 |  | 
|  | 626 | .PHONY: userdataimage-nodeps | 
|  | 627 | userdataimage-nodeps: $(INTERNAL_MKUSERFS) | 
|  | 628 | $(build-userdataimage-target) | 
|  | 629 |  | 
|  | 630 | ####### | 
|  | 631 | ## data partition tarball | 
|  | 632 | define build-userdatatarball-target | 
|  | 633 | $(call pretty,"Target userdata fs tarball: " \ | 
|  | 634 | "$(INSTALLED_USERDATATARBALL_TARGET)") | 
|  | 635 | $(MKTARBALL) $(FS_GET_STATS) \ | 
|  | 636 | $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \ | 
|  | 637 | $(INSTALLED_USERDATATARBALL_TARGET) | 
|  | 638 | endef | 
|  | 639 |  | 
|  | 640 | userdata_tar := $(PRODUCT_OUT)/userdata.tar | 
|  | 641 | INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2 | 
|  | 642 | $(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar) | 
|  | 643 | $(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES) | 
|  | 644 | $(build-userdatatarball-target) | 
|  | 645 |  | 
|  | 646 | .PHONY: userdatatarball-nodeps | 
|  | 647 | userdatatarball-nodeps: $(FS_GET_STATS) | 
|  | 648 | $(build-userdatatarball-target) | 
|  | 649 |  | 
|  | 650 |  | 
|  | 651 | # If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true | 
|  | 652 | ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) | 
|  | 653 |  | 
|  | 654 | # ----------------------------------------------------------------- | 
|  | 655 | # Recovery image | 
|  | 656 | INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img | 
|  | 657 |  | 
|  | 658 | recovery_initrc := $(call include-path-for, recovery)/etc/init.rc | 
|  | 659 | recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system | 
|  | 660 | recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img | 
|  | 661 | recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET) | 
|  | 662 | recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery | 
|  | 663 | recovery_resources_common := $(call include-path-for, recovery)/res | 
|  | 664 | recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)) | 
|  | 665 | recovery_resource_deps := $(shell find $(recovery_resources_common) \ | 
|  | 666 | $(recovery_resources_private) -type f) | 
|  | 667 |  | 
|  | 668 | ifeq ($(recovery_resources_private),) | 
|  | 669 | $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE)) | 
|  | 670 | endif | 
|  | 671 |  | 
|  | 672 | INTERNAL_RECOVERYIMAGE_ARGS := \ | 
|  | 673 | $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ | 
|  | 674 | --kernel $(recovery_kernel) \ | 
|  | 675 | --ramdisk $(recovery_ramdisk) | 
|  | 676 |  | 
|  | 677 | # Assumes this has already been stripped | 
|  | 678 | ifdef BOARD_KERNEL_CMDLINE | 
|  | 679 | INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)" | 
|  | 680 | endif | 
| Dima Zavin | 6ea3b88 | 2009-05-07 21:10:41 -0700 | [diff] [blame] | 681 | ifdef BOARD_KERNEL_BASE | 
|  | 682 | INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) | 
|  | 683 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 684 |  | 
| Doug Zongker | 17c83cf | 2009-04-01 15:48:46 -0700 | [diff] [blame] | 685 | # Keys authorized to sign OTA packages this build will accept.  The | 
|  | 686 | # build always uses test-keys for this; release packaging tools will | 
|  | 687 | # substitute other keys for this one. | 
|  | 688 | OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem | 
|  | 689 |  | 
|  | 690 | # Generate a file containing the keys that will be read by the | 
|  | 691 | # recovery binary. | 
|  | 692 | RECOVERY_INSTALL_OTA_KEYS := \ | 
|  | 693 | $(call intermediates-dir-for,PACKAGING,ota_keys)/keys | 
|  | 694 | DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar | 
|  | 695 | $(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS) | 
|  | 696 | $(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) | 
|  | 697 | @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)" | 
|  | 698 | @rm -rf $@ | 
|  | 699 | @mkdir -p $(dir $@) | 
|  | 700 | java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@ | 
|  | 701 |  | 
| Doug Zongker | 8b70e8c | 2009-05-27 09:14:25 -0700 | [diff] [blame] | 702 | $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 703 | $(INSTALLED_RAMDISK_TARGET) \ | 
|  | 704 | $(INSTALLED_BOOTIMAGE_TARGET) \ | 
|  | 705 | $(recovery_binary) \ | 
|  | 706 | $(recovery_initrc) $(recovery_kernel) \ | 
|  | 707 | $(INSTALLED_2NDBOOTLOADER_TARGET) \ | 
| Doug Zongker | 17c83cf | 2009-04-01 15:48:46 -0700 | [diff] [blame] | 708 | $(recovery_build_prop) $(recovery_resource_deps) \ | 
|  | 709 | $(RECOVERY_INSTALL_OTA_KEYS) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 710 | @echo ----- Making recovery image ------ | 
|  | 711 | rm -rf $(TARGET_RECOVERY_OUT) | 
|  | 712 | mkdir -p $(TARGET_RECOVERY_OUT) | 
|  | 713 | mkdir -p $(TARGET_RECOVERY_ROOT_OUT) | 
|  | 714 | mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc | 
|  | 715 | mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp | 
|  | 716 | echo Copying baseline ramdisk... | 
|  | 717 | cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) | 
|  | 718 | echo Modifying ramdisk contents... | 
|  | 719 | cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/ | 
|  | 720 | cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/ | 
|  | 721 | cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/ | 
|  | 722 | $(foreach item,$(recovery_resources_private), \ | 
|  | 723 | cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/) | 
| Doug Zongker | 17c83cf | 2009-04-01 15:48:46 -0700 | [diff] [blame] | 724 | cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 725 | cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \ | 
|  | 726 | > $(TARGET_RECOVERY_ROOT_OUT)/default.prop | 
| Doug Zongker | 8b70e8c | 2009-05-27 09:14:25 -0700 | [diff] [blame] | 727 | $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 728 | $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@ | 
|  | 729 | @echo ----- Made recovery image -------- $@ | 
|  | 730 | $(hide) $(call assert-max-file-size,$@,$(BOARD_RECOVERYIMAGE_MAX_SIZE)) | 
|  | 731 |  | 
|  | 732 | else | 
|  | 733 | INSTALLED_RECOVERYIMAGE_TARGET := | 
|  | 734 | endif | 
|  | 735 |  | 
|  | 736 | .PHONY: recoveryimage | 
|  | 737 | recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) | 
|  | 738 |  | 
|  | 739 | # ----------------------------------------------------------------- | 
|  | 740 | # bring in the installer image generation defines if necessary | 
|  | 741 | ifeq ($(TARGET_USE_DISKINSTALLER),true) | 
|  | 742 | include bootable/diskinstaller/config.mk | 
|  | 743 | endif | 
|  | 744 |  | 
|  | 745 | # ----------------------------------------------------------------- | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 746 | # host tools needed to build OTA packages | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 747 |  | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 748 | .PHONY: otatools | 
|  | 749 | otatools: $(HOST_OUT_EXECUTABLES)/minigzip \ | 
|  | 750 | $(HOST_OUT_EXECUTABLES)/mkbootfs \ | 
|  | 751 | $(HOST_OUT_EXECUTABLES)/mkbootimg \ | 
|  | 752 | $(HOST_OUT_EXECUTABLES)/fs_config \ | 
|  | 753 | $(HOST_OUT_EXECUTABLES)/mkyaffs2image \ | 
|  | 754 | $(HOST_OUT_EXECUTABLES)/zipalign \ | 
|  | 755 | $(HOST_OUT_EXECUTABLES)/aapt \ | 
|  | 756 | $(HOST_OUT_EXECUTABLES)/bsdiff \ | 
|  | 757 | $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \ | 
|  | 758 | $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 759 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 760 | # ----------------------------------------------------------------- | 
|  | 761 | # A zip of the directories that map to the target filesystem. | 
|  | 762 | # This zip can be used to create an OTA package or filesystem image | 
|  | 763 | # as a post-build step. | 
|  | 764 | # | 
|  | 765 | name := $(TARGET_PRODUCT) | 
|  | 766 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 767 | name := $(name)_debug | 
|  | 768 | endif | 
|  | 769 | name := $(name)-target_files-$(FILE_NAME_TAG) | 
|  | 770 |  | 
|  | 771 | intermediates := $(call intermediates-dir-for,PACKAGING,target_files) | 
|  | 772 | BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip | 
|  | 773 | $(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates) | 
|  | 774 | $(BUILT_TARGET_FILES_PACKAGE): \ | 
|  | 775 | zip_root := $(intermediates)/$(name) | 
|  | 776 |  | 
|  | 777 | # $(1): Directory to copy | 
|  | 778 | # $(2): Location to copy it to | 
|  | 779 | # The "ls -A" is to prevent "acp s/* d" from failing if s is empty. | 
|  | 780 | define package_files-copy-root | 
|  | 781 | if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \ | 
|  | 782 | mkdir -p $(2) && \ | 
|  | 783 | $(ACP) -rd $(strip $(1))/* $(2); \ | 
|  | 784 | fi | 
|  | 785 | endef | 
|  | 786 |  | 
|  | 787 | built_ota_tools := \ | 
| Doug Zongker | 17c83cf | 2009-04-01 15:48:46 -0700 | [diff] [blame] | 788 | $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \ | 
| Doug Zongker | a406c1e | 2009-06-12 16:57:08 -0700 | [diff] [blame] | 789 | $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \ | 
|  | 790 | $(call intermediates-dir-for,EXECUTABLES,updater)/updater | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 791 | $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools) | 
|  | 792 |  | 
|  | 793 | # Depending on the various images guarantees that the underlying | 
|  | 794 | # directories are up-to-date. | 
|  | 795 | $(BUILT_TARGET_FILES_PACKAGE): \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 796 | $(INSTALLED_BOOTIMAGE_TARGET) \ | 
|  | 797 | $(INSTALLED_RADIOIMAGE_TARGET) \ | 
|  | 798 | $(INSTALLED_RECOVERYIMAGE_TARGET) \ | 
|  | 799 | $(BUILT_SYSTEMIMAGE) \ | 
|  | 800 | $(INSTALLED_USERDATAIMAGE_TARGET) \ | 
|  | 801 | $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 802 | $(built_ota_tools) \ | 
|  | 803 | $(APKCERTS_FILE) \ | 
|  | 804 | | $(ACP) | 
|  | 805 | @echo "Package target files: $@" | 
|  | 806 | $(hide) rm -rf $@ $(zip_root) | 
|  | 807 | $(hide) mkdir -p $(dir $@) $(zip_root) | 
|  | 808 | @# Components of the recovery image | 
|  | 809 | $(hide) mkdir -p $(zip_root)/RECOVERY | 
|  | 810 | $(hide) $(call package_files-copy-root, \ | 
|  | 811 | $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK) | 
|  | 812 | ifdef INSTALLED_KERNEL_TARGET | 
|  | 813 | $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel | 
|  | 814 | endif | 
|  | 815 | ifdef INSTALLED_2NDBOOTLOADER_TARGET | 
|  | 816 | $(hide) $(ACP) \ | 
|  | 817 | $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second | 
|  | 818 | endif | 
|  | 819 | ifdef BOARD_KERNEL_CMDLINE | 
|  | 820 | $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline | 
|  | 821 | endif | 
|  | 822 | @# Components of the boot image | 
|  | 823 | $(hide) mkdir -p $(zip_root)/BOOT | 
|  | 824 | $(hide) $(call package_files-copy-root, \ | 
|  | 825 | $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK) | 
|  | 826 | ifdef INSTALLED_KERNEL_TARGET | 
|  | 827 | $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel | 
|  | 828 | endif | 
|  | 829 | ifdef INSTALLED_2NDBOOTLOADER_TARGET | 
|  | 830 | $(hide) $(ACP) \ | 
|  | 831 | $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second | 
|  | 832 | endif | 
|  | 833 | ifdef BOARD_KERNEL_CMDLINE | 
|  | 834 | $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline | 
|  | 835 | endif | 
|  | 836 | ifdef INSTALLED_RADIOIMAGE_TARGET | 
|  | 837 | @# The radio image | 
|  | 838 | $(hide) mkdir -p $(zip_root)/RADIO | 
|  | 839 | $(hide) $(ACP) $(INSTALLED_RADIOIMAGE_TARGET) $(zip_root)/RADIO/image | 
|  | 840 | endif | 
|  | 841 | @# Contents of the system image | 
|  | 842 | $(hide) $(call package_files-copy-root, \ | 
|  | 843 | $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM) | 
|  | 844 | @# Contents of the data image | 
|  | 845 | $(hide) $(call package_files-copy-root, \ | 
|  | 846 | $(TARGET_OUT_DATA),$(zip_root)/DATA) | 
|  | 847 | @# Extra contents of the OTA package | 
|  | 848 | $(hide) mkdir -p $(zip_root)/OTA/bin | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 849 | $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/ | 
|  | 850 | $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/ | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 851 | @# 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] | 852 | @# build them. | 
|  | 853 | $(hide) mkdir -p $(zip_root)/META | 
|  | 854 | $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt | 
| Doug Zongker | 17c83cf | 2009-04-01 15:48:46 -0700 | [diff] [blame] | 855 | $(hide)	echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 856 | @# Zip everything up, preserving symlinks | 
|  | 857 | $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) | 
|  | 858 |  | 
|  | 859 | target-files-package: $(BUILT_TARGET_FILES_PACKAGE) | 
|  | 860 |  | 
|  | 861 | # ----------------------------------------------------------------- | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 862 | # OTA update package | 
|  | 863 | name := $(TARGET_PRODUCT) | 
|  | 864 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 865 | name := $(name)_debug | 
|  | 866 | endif | 
|  | 867 | name := $(name)-ota-$(FILE_NAME_TAG) | 
|  | 868 |  | 
|  | 869 | INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip | 
|  | 870 |  | 
|  | 871 | $(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) | 
|  | 872 |  | 
|  | 873 | $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools | 
|  | 874 | @echo "Package OTA: $@" | 
|  | 875 | $(hide) ./build/tools/releasetools/ota_from_target_files \ | 
|  | 876 | -b $(TARGET_DEVICE_DIR)/BoardConfig.mk \ | 
|  | 877 | -k $(KEY_CERT_PAIR) \ | 
|  | 878 | $(BUILT_TARGET_FILES_PACKAGE) $@ | 
|  | 879 |  | 
|  | 880 | .PHONY: otapackage | 
|  | 881 | otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) | 
|  | 882 |  | 
|  | 883 |  | 
|  | 884 | # ----------------------------------------------------------------- | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 885 | # installed file list | 
|  | 886 | # Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it | 
|  | 887 | # gets the DexOpt one if we're doing that. | 
|  | 888 | INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt | 
|  | 889 | $(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE) | 
|  | 890 | @echo Installed file list: $@ | 
|  | 891 | @mkdir -p $(dir $@) | 
|  | 892 | @rm -f $@ | 
|  | 893 | $(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@ | 
|  | 894 |  | 
|  | 895 | .PHONY: installed-file-list | 
|  | 896 | installed-file-list: $(INSTALLED_FILES_FILE) | 
|  | 897 | $(call dist-for-goals, sdk, $(INSTALLED_FILES_FILE)) | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 898 | $(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE)) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 899 |  | 
|  | 900 | # ----------------------------------------------------------------- | 
|  | 901 | # A zip of the tests that are built when running "make tests". | 
|  | 902 | # This is very similar to BUILT_TARGET_FILES_PACKAGE, but we | 
|  | 903 | # only grab SYSTEM and DATA, and it's called "*-tests-*.zip". | 
|  | 904 | # | 
|  | 905 | name := $(TARGET_PRODUCT) | 
|  | 906 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 907 | name := $(name)_debug | 
|  | 908 | endif | 
|  | 909 | name := $(name)-tests-$(FILE_NAME_TAG) | 
|  | 910 |  | 
|  | 911 | intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip) | 
|  | 912 | BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip | 
|  | 913 | $(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates) | 
|  | 914 | $(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name) | 
|  | 915 |  | 
|  | 916 | # Depending on the images guarantees that the underlying | 
|  | 917 | # directories are up-to-date. | 
|  | 918 | $(BUILT_TESTS_ZIP_PACKAGE): \ | 
|  | 919 | $(BUILT_SYSTEMIMAGE) \ | 
|  | 920 | $(INSTALLED_USERDATAIMAGE_TARGET) \ | 
|  | 921 | | $(ACP) | 
|  | 922 | @echo "Package test files: $@" | 
|  | 923 | $(hide) rm -rf $@ $(zip_root) | 
|  | 924 | $(hide) mkdir -p $(dir $@) $(zip_root) | 
|  | 925 | @# Some parts of the system image | 
|  | 926 | $(hide) $(call package_files-copy-root, \ | 
|  | 927 | $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin) | 
|  | 928 | $(hide) $(call package_files-copy-root, \ | 
|  | 929 | $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib) | 
|  | 930 | $(hide) $(call package_files-copy-root, \ | 
|  | 931 | $(SYSTEMIMAGE_SOURCE_DIR)/framework, \ | 
|  | 932 | $(zip_root)/SYSTEM/framework) | 
|  | 933 | $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM | 
|  | 934 | @# Contents of the data image | 
|  | 935 | $(hide) $(call package_files-copy-root, \ | 
|  | 936 | $(TARGET_OUT_DATA),$(zip_root)/DATA) | 
|  | 937 | $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) | 
|  | 938 |  | 
|  | 939 | tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE) | 
|  | 940 |  | 
|  | 941 | # ----------------------------------------------------------------- | 
|  | 942 | # A zip of the symbols directory.  Keep the full paths to make it | 
|  | 943 | # more obvious where these files came from. | 
|  | 944 | # | 
|  | 945 | name := $(TARGET_PRODUCT) | 
|  | 946 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 947 | name := $(name)_debug | 
|  | 948 | endif | 
|  | 949 | name := $(name)-symbols-$(FILE_NAME_TAG) | 
|  | 950 |  | 
|  | 951 | SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip | 
|  | 952 | $(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET) | 
|  | 953 | @echo "Package symbols: $@" | 
|  | 954 | $(hide) rm -rf $@ | 
|  | 955 | $(hide) mkdir -p $(dir $@) | 
|  | 956 | $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED) | 
|  | 957 |  | 
|  | 958 | # ----------------------------------------------------------------- | 
|  | 959 | # A zip of the Android Apps. Not keeping full path so that we don't | 
|  | 960 | # include product names when distributing | 
|  | 961 | # | 
|  | 962 | name := $(TARGET_PRODUCT) | 
|  | 963 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 964 | name := $(name)_debug | 
|  | 965 | endif | 
|  | 966 | name := $(name)-apps-$(FILE_NAME_TAG) | 
|  | 967 |  | 
|  | 968 | APPS_ZIP := $(PRODUCT_OUT)/$(name).zip | 
|  | 969 | $(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE) | 
|  | 970 | @echo "Package apps: $@" | 
|  | 971 | $(hide) rm -rf $@ | 
|  | 972 | $(hide) mkdir -p $(dir $@) | 
|  | 973 | $(hide) zip -qj $@ $(TARGET_OUT_APPS)/* | 
|  | 974 |  | 
|  | 975 | endif	# TARGET_SIMULATOR != true | 
|  | 976 |  | 
|  | 977 | # ----------------------------------------------------------------- | 
|  | 978 | # dalvik something | 
|  | 979 | .PHONY: dalvikfiles | 
|  | 980 | dalvikfiles: $(INTERNAL_DALVIK_MODULES) | 
|  | 981 |  | 
|  | 982 | # ----------------------------------------------------------------- | 
|  | 983 | # The update package | 
|  | 984 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 985 | name := $(TARGET_PRODUCT) | 
|  | 986 | ifeq ($(TARGET_BUILD_TYPE),debug) | 
|  | 987 | name := $(name)_debug | 
|  | 988 | endif | 
|  | 989 | name := $(name)-img-$(FILE_NAME_TAG) | 
|  | 990 |  | 
|  | 991 | INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip | 
|  | 992 |  | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 993 | $(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 994 | @echo "Package: $@" | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 995 | $(hide) ./build/tools/releasetools/img_from_target_files \ | 
|  | 996 | -b $(TARGET_DEVICE_DIR)/BoardConfig.mk \ | 
|  | 997 | $(BUILT_TARGET_FILES_PACKAGE) $@ | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 998 |  | 
| Doug Zongker | 8678df4 | 2009-06-15 14:30:14 -0700 | [diff] [blame] | 999 | .PHONY: updatepackage | 
|  | 1000 | updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1001 |  | 
|  | 1002 | # ----------------------------------------------------------------- | 
|  | 1003 | # The emulator package | 
|  | 1004 |  | 
|  | 1005 | ifneq ($(TARGET_SIMULATOR),true) | 
|  | 1006 |  | 
|  | 1007 | INTERNAL_EMULATOR_PACKAGE_FILES += \ | 
|  | 1008 | $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \ | 
|  | 1009 | prebuilt/android-arm/kernel/kernel-qemu \ | 
|  | 1010 | $(INSTALLED_RAMDISK_TARGET) \ | 
|  | 1011 | $(INSTALLED_SYSTEMIMAGE) \ | 
|  | 1012 | $(INSTALLED_USERDATAIMAGE_TARGET) | 
|  | 1013 |  | 
|  | 1014 | name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG) | 
|  | 1015 |  | 
|  | 1016 | INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip | 
|  | 1017 |  | 
|  | 1018 | $(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES) | 
|  | 1019 | @echo "Package: $@" | 
|  | 1020 | $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES) | 
|  | 1021 |  | 
|  | 1022 | endif | 
|  | 1023 |  | 
|  | 1024 | # ----------------------------------------------------------------- | 
|  | 1025 | # The pdk package (Platform Development Kit) | 
|  | 1026 |  | 
|  | 1027 | ifneq (,$(filter pdk,$(MAKECMDGOALS))) | 
|  | 1028 | include development/pdk/Pdk.mk | 
|  | 1029 | endif | 
|  | 1030 |  | 
|  | 1031 | # ----------------------------------------------------------------- | 
|  | 1032 | # The SDK | 
|  | 1033 |  | 
|  | 1034 | ifneq ($(TARGET_SIMULATOR),true) | 
|  | 1035 |  | 
|  | 1036 | # The SDK includes host-specific components, so it belongs under HOST_OUT. | 
|  | 1037 | sdk_dir := $(HOST_OUT)/sdk | 
|  | 1038 |  | 
|  | 1039 | # Build a name that looks like: | 
|  | 1040 | # | 
|  | 1041 | #     linux-x86   --> android-sdk_12345_linux-x86 | 
|  | 1042 | #     darwin-x86  --> android-sdk_12345_mac-x86 | 
|  | 1043 | #     windows-x86 --> android-sdk_12345_windows | 
|  | 1044 | # | 
|  | 1045 | sdk_name := android-sdk_$(FILE_NAME_TAG) | 
|  | 1046 | ifeq ($(HOST_OS),darwin) | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 1047 | INTERNAL_SDK_HOST_OS_NAME := mac | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1048 | else | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 1049 | INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1050 | endif | 
|  | 1051 | ifneq ($(HOST_OS),windows) | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 1052 | 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] | 1053 | endif | 
| Joe Onorato | 03fbe40 | 2009-04-13 08:31:16 -0700 | [diff] [blame] | 1054 | sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1055 |  | 
|  | 1056 | sdk_dep_file := $(sdk_dir)/sdk_deps.mk | 
|  | 1057 |  | 
|  | 1058 | ATREE_FILES := | 
|  | 1059 | -include $(sdk_dep_file) | 
|  | 1060 |  | 
|  | 1061 | # if we don't have a real list, then use "everything" | 
|  | 1062 | ifeq ($(strip $(ATREE_FILES)),) | 
|  | 1063 | ATREE_FILES := \ | 
|  | 1064 | $(ALL_PREBUILT) \ | 
|  | 1065 | $(ALL_COPIED_HEADERS) \ | 
|  | 1066 | $(ALL_GENERATED_SOURCES) \ | 
|  | 1067 | $(ALL_DEFAULT_INSTALLED_MODULES) \ | 
|  | 1068 | $(INSTALLED_RAMDISK_TARGET) \ | 
|  | 1069 | $(ALL_DOCS) \ | 
|  | 1070 | $(ALL_SDK_FILES) | 
|  | 1071 | endif | 
|  | 1072 |  | 
|  | 1073 | atree_dir := development/build | 
|  | 1074 |  | 
|  | 1075 | sdk_atree_files := \ | 
|  | 1076 | $(atree_dir)/sdk.exclude.atree \ | 
|  | 1077 | $(atree_dir)/sdk.atree \ | 
|  | 1078 | $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree | 
|  | 1079 |  | 
|  | 1080 | deps := \ | 
|  | 1081 | $(target_notice_file_txt) \ | 
|  | 1082 | $(tools_notice_file_txt) \ | 
|  | 1083 | $(OUT_DOCS)/offline-sdk-timestamp \ | 
|  | 1084 | $(INTERNAL_UPDATE_PACKAGE_TARGET) \ | 
|  | 1085 | $(INSTALLED_SDK_BUILD_PROP_TARGET) \ | 
|  | 1086 | $(ATREE_FILES) \ | 
|  | 1087 | $(atree_dir)/sdk.atree \ | 
|  | 1088 | $(HOST_OUT_EXECUTABLES)/atree \ | 
|  | 1089 | $(HOST_OUT_EXECUTABLES)/line_endings | 
|  | 1090 |  | 
|  | 1091 | INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip | 
|  | 1092 | $(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name) | 
|  | 1093 | $(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name) | 
|  | 1094 | $(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file) | 
|  | 1095 | $(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files) | 
|  | 1096 |  | 
|  | 1097 | # Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built. | 
|  | 1098 | # | 
|  | 1099 | #SDK_GNU_ERROR := true | 
|  | 1100 |  | 
|  | 1101 | $(INTERNAL_SDK_TARGET): $(deps) | 
|  | 1102 | @echo "Package SDK: $@" | 
|  | 1103 | $(hide) rm -rf $(PRIVATE_DIR) $@ | 
|  | 1104 | $(hide) for f in $(target_gnu_MODULES); do \ | 
|  | 1105 | if [ -f $$f ]; then \ | 
|  | 1106 | echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \ | 
|  | 1107 | including GNU target $$f >&2; \ | 
|  | 1108 | FAIL=$(SDK_GNU_ERROR); \ | 
|  | 1109 | fi; \ | 
|  | 1110 | done; \ | 
|  | 1111 | if [ $$FAIL ]; then exit 1; fi | 
|  | 1112 | $(hide) ( \ | 
|  | 1113 | $(HOST_OUT_EXECUTABLES)/atree \ | 
|  | 1114 | $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \ | 
|  | 1115 | -m $(PRIVATE_DEP_FILE) \ | 
|  | 1116 | -I . \ | 
|  | 1117 | -I $(PRODUCT_OUT) \ | 
|  | 1118 | -I $(HOST_OUT) \ | 
|  | 1119 | -I $(TARGET_COMMON_OUT_ROOT) \ | 
|  | 1120 | -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \ | 
|  | 1121 | -o $(PRIVATE_DIR) && \ | 
|  | 1122 | cp -f $(target_notice_file_txt) \ | 
|  | 1123 | $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \ | 
|  | 1124 | cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \ | 
|  | 1125 | HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \ | 
|  | 1126 | development/tools/scripts/sdk_clean.sh $(PRIVATE_DIR) && \ | 
|  | 1127 | chmod -R ug+rwX $(PRIVATE_DIR) && \ | 
|  | 1128 | cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \ | 
|  | 1129 | ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 ) | 
|  | 1130 |  | 
|  | 1131 | endif # !simulator | 
|  | 1132 |  | 
|  | 1133 | # ----------------------------------------------------------------- | 
|  | 1134 | # Findbugs | 
|  | 1135 | INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml | 
|  | 1136 | INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html | 
|  | 1137 | $(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES) | 
|  | 1138 | @echo UnionBugs: $@ | 
|  | 1139 | $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \ | 
|  | 1140 | > $@ | 
|  | 1141 | $(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET) | 
|  | 1142 | @echo ConvertXmlToText: $@ | 
|  | 1143 | $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \ | 
|  | 1144 | $(INTERNAL_FINDBUGS_XML_TARGET)	> $@ | 
|  | 1145 |  | 
|  | 1146 | # ----------------------------------------------------------------- | 
|  | 1147 | # Findbugs | 
|  | 1148 |  | 
|  | 1149 | # ----------------------------------------------------------------- | 
|  | 1150 | # These are some additional build tasks that need to be run. | 
|  | 1151 | include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk)) |