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