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