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