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