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