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