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