blob: 237245b610284f50ee85080aa593142360e101c5 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# Put some miscellaneous rules here
2
3# Pick a reasonable string to use to identify files.
4ifneq "" "$(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)
8else
9 FILE_NAME_TAG := $(BUILD_NUMBER)
10endif
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 Queru518ce572010-03-01 16:18:59 -080017# The filter part means "only eval the copy-one-file rule if this
Ying Wang462d26b2010-11-02 21:31:47 -070018# src:dest pair is the first one to match the same dest"
19unique_product_copy_files_destinations := $(sort \
20 $(foreach cf,$(PRODUCT_COPY_FILES), $(call word-colon,2,$(cf))))
The Android Open Source Project88b60792009-03-03 19:28:42 -080021$(foreach cf,$(PRODUCT_COPY_FILES), \
Ying Wang462d26b2010-11-02 21:31:47 -070022 $(eval _src := $(call word-colon,1,$(cf))) \
23 $(eval _dest := $(call word-colon,2,$(cf))) \
24 $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
25 $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
26 $(eval $(call copy-one-file,$(_src),$(_fulldest))) \
27 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
28 $(eval unique_product_copy_files_destinations := $(filter-out $(_dest), \
29 $(unique_product_copy_files_destinations)))))
The Android Open Source Project88b60792009-03-03 19:28:42 -080030
31# -----------------------------------------------------------------
32# docs/index.html
33gen := $(OUT_DOCS)/index.html
34ALL_DOCS += $(gen)
35$(gen): frameworks/base/docs/docs-redirect-index.html
36 @mkdir -p $(dir $@)
37 @cp -f $< $@
38
39# -----------------------------------------------------------------
40# default.prop
41INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
42ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
43ADDITIONAL_DEFAULT_PROPERTIES := \
44 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
Mike Lockwood0d23fec2011-06-09 14:54:40 -070045ADDITIONAL_DEFAULT_PROPERTIES += \
46 $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
The Android Open Source Project88b60792009-03-03 19:28:42 -080047
48$(INSTALLED_DEFAULT_PROP_TARGET):
49 @echo Target buildinfo: $@
50 @mkdir -p $(dir $@)
51 $(hide) echo "#" > $@; \
52 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
53 echo "#" >> $@;
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -070054 $(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \
55 echo "$(line)" >> $@;)
Joe Onorato9197a482011-06-08 16:04:14 -070056 build/tools/post_process_props.py $@
The Android Open Source Project88b60792009-03-03 19:28:42 -080057
58# -----------------------------------------------------------------
59# build.prop
60INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
61ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
62ADDITIONAL_BUILD_PROPERTIES := \
63 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
64
65# A list of arbitrary tags describing the build configuration.
66# Force ":=" so we can use +=
67BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
68ifeq ($(TARGET_BUILD_TYPE),debug)
69 BUILD_VERSION_TAGS += debug
70endif
71# Apps are always signed with test keys, and may be re-signed in a post-build
72# step. If that happens, the "test-keys" tag will be removed by that step.
73BUILD_VERSION_TAGS += test-keys
The Android Open Source Project88b60792009-03-03 19:28:42 -080074BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
75
76# A human-readable string that descibes this build in detail.
77build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS)
78$(INSTALLED_BUILD_PROP_TARGET): PRIVATE_BUILD_DESC := $(build_desc)
79
80# The string used to uniquely identify this build; used by the OTA server.
81ifeq (,$(strip $(BUILD_FINGERPRINT)))
Doug Zongker135a1202010-09-15 13:02:12 -070082 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -080083endif
84ifneq ($(words $(BUILD_FINGERPRINT)),1)
85 $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)")
86endif
87
Sriram Raman7b641242009-03-24 22:40:59 -070088# Display parameters shown under Settings -> About Phone
89ifeq ($(TARGET_BUILD_VARIANT),user)
90 # User builds should show:
91 # release build number or branch.buld_number non-release builds
92
93 # Dev. branches should have DISPLAY_BUILD_NUMBER set
94 ifeq "true" "$(DISPLAY_BUILD_NUMBER)"
95 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER)
96 else
97 BUILD_DISPLAY_ID := $(BUILD_ID)
98 endif
99else
100 # Non-user builds should show detailed build information
101 BUILD_DISPLAY_ID := $(build_desc)
102endif
103
Ying Wang77c882f2010-04-27 15:45:35 -0700104# Whether there is default locale set in PRODUCT_PROPERTY_OVERRIDES
Ying Wang38d7f022010-07-21 14:58:42 -0700105product_property_override_locale_language := $(strip \
106 $(patsubst ro.product.locale.language=%,%,\
Ying Wang77c882f2010-04-27 15:45:35 -0700107 $(filter ro.product.locale.language=%,$(PRODUCT_PROPERTY_OVERRIDES))))
Ying Wang38d7f022010-07-21 14:58:42 -0700108product_property_overrides_locale_region := $(strip \
109 $(patsubst ro.product.locale.region=%,%,\
Ying Wang77c882f2010-04-27 15:45:35 -0700110 $(filter ro.product.locale.region=%,$(PRODUCT_PROPERTY_OVERRIDES))))
111
The Android Open Source Project88b60792009-03-03 19:28:42 -0800112# Selects the first locale in the list given as the argument,
113# and splits it into language and region, which each may be
114# empty.
115define default-locale
116$(subst _, , $(firstword $(1)))
117endef
118
119# Selects the first locale in the list given as the argument
Ying Wang77c882f2010-04-27 15:45:35 -0700120# and returns the language (or the region), if it's not set in PRODUCT_PROPERTY_OVERRIDES;
121# Return empty string if it's already set in PRODUCT_PROPERTY_OVERRIDES.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800122define default-locale-language
Ying Wang38d7f022010-07-21 14:58:42 -0700123$(if $(product_property_override_locale_language),,$(word 1, $(call default-locale, $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800124endef
125define default-locale-region
Ying Wang38d7f022010-07-21 14:58:42 -0700126$(if $(product_property_overrides_locale_region),,$(word 2, $(call default-locale, $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800127endef
128
129BUILDINFO_SH := build/tools/buildinfo.sh
Chih-Wei Huang75947ef2010-11-03 18:33:46 +0800130$(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 Project88b60792009-03-03 19:28:42 -0800131 @echo Target buildinfo: $@
132 @mkdir -p $(dir $@)
133 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
134 TARGET_DEVICE="$(TARGET_DEVICE)" \
135 PRODUCT_NAME="$(TARGET_PRODUCT)" \
136 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
137 PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \
138 PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \
Robert Greenwaltfbd10d92009-05-20 13:37:35 -0700139 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800140 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
141 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
142 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
143 BUILD_ID="$(BUILD_ID)" \
144 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
145 BUILD_NUMBER="$(BUILD_NUMBER)" \
146 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
147 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
Dianne Hackborn95378842009-05-08 12:06:17 -0700148 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800149 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
150 TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
151 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \
152 TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
Dianne Hackbornecc70d72009-05-21 15:45:30 -0700153 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
David 'Digit' Turner2edfb712009-11-06 15:12:00 -0800154 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Joe Onorato25939e22010-11-09 08:53:01 -0800155 TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800156 bash $(BUILDINFO_SH) > $@
157 $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \
158 cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \
159 fi
160 $(if $(ADDITIONAL_BUILD_PROPERTIES), \
161 $(hide) echo >> $@; \
162 echo "#" >> $@; \
163 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
164 echo "#" >> $@; )
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -0700165 $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \
166 echo "$(line)" >> $@;)
Joe Onorato9197a482011-06-08 16:04:14 -0700167 $(hide) build/tools/post_process_props.py $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800168
169build_desc :=
170
171# -----------------------------------------------------------------
172# sdk-build.prop
173#
174# There are certain things in build.prop that we don't want to
175# ship with the sdk; remove them.
176
177# This must be a list of entire property keys followed by
178# "=" characters, without any internal spaces.
179sdk_build_prop_remove := \
180 ro.build.user= \
181 ro.build.host= \
182 ro.product.brand= \
183 ro.product.manufacturer= \
184 ro.product.device=
185# TODO: Remove this soon-to-be obsolete property
186sdk_build_prop_remove += ro.build.product=
187INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
188$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
189 @echo SDK buildinfo: $@
190 @mkdir -p $(dir $@)
191 $(hide) grep -v "$(subst $(space),\|,$(strip \
192 $(sdk_build_prop_remove)))" $< > $@.tmp
193 $(hide) for x in $(sdk_build_prop_remove); do \
194 echo "$$x"generic >> $@.tmp; done
195 $(hide) mv $@.tmp $@
196
197# -----------------------------------------------------------------
198# package stats
199PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
200PACKAGES_TO_STAT := \
201 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
202 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
203$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
204 @echo Package stats: $@
205 @mkdir -p $(dir $@)
206 $(hide) rm -f $@
207 $(hide) build/tools/dump-package-stats $^ > $@
208
209.PHONY: package-stats
210package-stats: $(PACKAGE_STATS_FILE)
211
212# -----------------------------------------------------------------
213# Cert-to-package mapping. Used by the post-build signing tools.
214name := $(TARGET_PRODUCT)
215ifeq ($(TARGET_BUILD_TYPE),debug)
216 name := $(name)_debug
217endif
218name := $(name)-apkcerts-$(FILE_NAME_TAG)
219intermediates := \
220 $(call intermediates-dir-for,PACKAGING,apkcerts)
221APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800222# We don't need to really build all the modules.
223# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700224$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800225 @echo APK certs list: $@
226 @mkdir -p $(dir $@)
227 @rm -f $@
228 $(hide) $(foreach p,$(PACKAGES),\
Doug Zongkerf6a53aa2009-12-15 15:06:55 -0800229 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
230 echo 'name="$(p).apk" certificate="EXTERNAL" \
231 private_key=""' >> $@;,\
232 echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
233 private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800234
235.PHONY: apkcerts-list
236apkcerts-list: $(APKCERTS_FILE)
237
Ying Wang15e487a2011-02-15 10:56:18 -0800238ifneq (,$(TARGET_BUILD_APPS))
239 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
240endif
Ying Wangefb21682010-07-23 16:42:13 -0700241
The Android Open Source Project88b60792009-03-03 19:28:42 -0800242# -----------------------------------------------------------------
243# module info file
244ifdef CREATE_MODULE_INFO_FILE
245 MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt
246 $(info Generating $(MODULE_INFO_FILE)...)
247 $(shell rm -f $(MODULE_INFO_FILE))
248 $(foreach m,$(ALL_MODULES), \
249 $(shell echo "NAME=\"$(m)\"" \
250 "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \
251 "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \
252 "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \
253 "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE)))
254endif
255
Doug Zongker8678df42009-06-15 14:30:14 -0700256# -----------------------------------------------------------------
257
258# The test key is used to sign this package, and as the key required
259# for future OTA packages installed by this system. Actual product
260# deliverables will be re-signed by hand. We expect this file to
261# exist with the suffixes ".x509.pem" and ".pk8".
262DEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey
263
264
The Android Open Source Project88b60792009-03-03 19:28:42 -0800265# Rules that need to be present for the simulator, even
266# if they don't do anything.
267.PHONY: systemimage
268systemimage:
269
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800270# -----------------------------------------------------------------
271
272.PHONY: event-log-tags
273
Joe Onoratob7510532010-07-14 10:22:54 -0700274# Produce an event logs tag file for everything we know about, in order
275# to properly allocate numbers. Then produce a file that's filtered
276# for what's going to be installed.
277
278all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
279
280# Include tags from all packages that we know about
281all_event_log_tags_src := \
282 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
283
284$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src)
285$(all_event_log_tags_file): $(all_event_log_tags_src)
286 $(hide) mkdir -p $(dir $@)
287 $(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
288
289
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800290event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800291
Doug Zongkera34fa952011-02-23 12:17:29 -0800292# Include tags from all packages included in this product, plus all
293# tags that are part of the system (ie, not in a vendor/ or device/
294# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800295event_log_tags_src := \
296 $(sort $(foreach m,\
297 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
298 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800299 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
300 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800301
302$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
Joe Onoratob7510532010-07-14 10:22:54 -0700303$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
304$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800305 $(hide) mkdir -p $(dir $@)
Joe Onoratob7510532010-07-14 10:22:54 -0700306 $(hide) build/tools/merge-event-log-tags.py -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800307
308event-log-tags: $(event_log_tags_file)
309
310ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
311
Joe Onoratob7510532010-07-14 10:22:54 -0700312
The Android Open Source Project88b60792009-03-03 19:28:42 -0800313ifneq ($(TARGET_SIMULATOR),true)
314
315# #################################################################
316# Targets for boot/OS images
317# #################################################################
318
319# -----------------------------------------------------------------
320# the ramdisk
321INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
322 $(ALL_PREBUILT) \
323 $(ALL_COPIED_HEADERS) \
324 $(ALL_GENERATED_SOURCES) \
325 $(ALL_DEFAULT_INSTALLED_MODULES))
326
Joe Onorato64d85d02009-04-09 19:31:12 -0700327BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
328
329# We just build this directly to the install location.
330INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700331$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800332 $(call pretty,"Target ram disk: $@")
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700333 $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800334
335
336ifneq ($(strip $(TARGET_NO_KERNEL)),true)
337
338# -----------------------------------------------------------------
339# the boot image, which is a collection of other images.
340INTERNAL_BOOTIMAGE_ARGS := \
341 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
342 --kernel $(INSTALLED_KERNEL_TARGET) \
343 --ramdisk $(INSTALLED_RAMDISK_TARGET)
344
345INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
346
347BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
348ifdef BOARD_KERNEL_CMDLINE
349 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
350endif
351
Dima Zavin1e0847c2009-05-07 19:43:08 -0700352BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
353ifdef BOARD_KERNEL_BASE
354 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
355endif
356
Ying Wangffff0022010-08-23 12:56:25 -0700357BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
358ifdef BOARD_KERNEL_PAGESIZE
359 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
360endif
361
The Android Open Source Project88b60792009-03-03 19:28:42 -0800362INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
363
364ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
365tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg
366INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image)
367INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG)
368$(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES)
369 $(call pretty,"Target boot image: $@")
370 $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
371
372else # TARGET_BOOTIMAGE_USE_EXT2 != true
373
374$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
375 $(call pretty,"Target boot image: $@")
376 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
Doug Zongkered96e882009-08-26 09:37:07 -0700377 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800378endif # TARGET_BOOTIMAGE_USE_EXT2
379
380else # TARGET_NO_KERNEL
381# HACK: The top-level targets depend on the bootimage. Not all targets
382# can produce a bootimage, though, and emulator targets need the ramdisk
383# instead. Fake it out by calling the ramdisk the bootimage.
384# TODO: make the emulator use bootimages, and make mkbootimg accept
385# kernel-less inputs.
386INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
387endif
388
389# -----------------------------------------------------------------
390# NOTICE files
391#
392# This needs to be before the systemimage rules, because it adds to
393# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
394# go into the systemimage.
395
396.PHONY: notice_files
397
398# Create the rule to combine the files into text and html forms
399# $(1) - Plain text output file
400# $(2) - HTML output file
401# $(3) - File title
402# $(4) - Directory to use. Notice files are all $(4)/src. Other
403# directories in there will be used for scratch
404# $(5) - Dependencies for the output files
405#
406# The algorithm here is that we go collect a hash for each of the notice
407# files and write the names of the files that match that hash. Then
408# to generate the real files, we go print out all of the files and their
409# hashes.
410#
411# These rules are fairly complex, so they depend on this makefile so if
412# it changes, they'll run again.
413#
414# TODO: We could clean this up so that we just record the locations of the
415# original notice files instead of making rules to copy them somwehere.
416# Then we could traverse that without quite as much bash drama.
417define combine-notice-files
418$(1) $(2): PRIVATE_MESSAGE := $(3)
419$(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4)
420$(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile
421 @echo Finding NOTICE files: $$@
422 $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash
423 $$(hide) mkdir -p $$(PRIVATE_DIR)/hash
424 $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \
425 hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \
426 hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \
427 echo $$$$file >> $$$$hashfile; \
428 done
429 $$(hide) touch $$@
430$(1): $(4)/hash-timestamp
431 @echo Combining NOTICE files: $$@
432 $$(hide) mkdir -p $$(dir $$@)
433 $$(hide) echo $$(PRIVATE_MESSAGE) > $$@
434 $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \
435 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> $$@
436 $$(hide) echo >> $$@
437 $$(hide) echo >> $$@
438 $$(hide) echo >> $$@
439 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
440 echo "============================================================"\
441 >> $$@; \
442 echo "Notices for file(s):" >> $$@; \
443 cat $$$$hashfile | sort | \
444 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> \
445 $$@; \
446 echo "------------------------------------------------------------"\
447 >> $$@; \
448 echo >> $$@; \
449 orig=$$$$(head -n 1 $$$$hashfile); \
450 cat $$$$orig >> $$@; \
451 echo >> $$@; \
452 echo >> $$@; \
453 echo >> $$@; \
454 done
455$(2): $(4)/hash-timestamp
456 @echo Combining NOTICE files: $$@
457 $$(hide) mkdir -p $$(dir $$@)
458 $$(hide) echo "<html><head>" > $$@
459 $$(hide) echo "<style type=\"text/css\">" >> $$@
460 $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@
461 $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@
462 $$(hide) echo ".label { font-weight: bold; }" >> $$@
463 $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@
464 $$(hide) echo "</style>" >> $$@
465 $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@
466 $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \
467 >> $$@
468 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
469 cat $$$$hashfile | sort | \
470 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: <a name=\"\1\"></a>:" >> \
471 $$@; \
472 echo "<tr><td class=\"same-license\">" >> $$@; \
473 echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \
474 echo "<div class=\"file-list\">" >> $$@; \
475 cat $$$$hashfile | sort | \
476 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1<br/>:" >> $$@; \
477 echo "</div><!-- file-list -->" >> $$@; \
478 echo >> $$@; \
479 orig=$$$$(head -n 1 $$$$hashfile); \
480 echo "<pre class=\"license-text\">" >> $$@; \
481 cat $$$$orig | sed -e "s/\&/\&amp;/g" | sed -e "s/</\&lt;/g" \
482 | sed -e "s/>/\&gt;/g" >> $$@; \
483 echo "</pre><!-- license-text -->" >> $$@; \
484 echo "</td></tr><!-- same-license -->" >> $$@; \
485 echo >> $$@; \
486 echo >> $$@; \
487 echo >> $$@; \
488 done
489 $$(hide) echo "</table>" >> $$@
490 $$(hide) echo "</body></html>" >> $$@
491notice_files: $(1) $(2)
492endef
493
494# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
495# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
496# the src subdirectory.
497
498target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
499target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
500target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
501tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
502tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
503
504kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
505
506$(eval $(call combine-notice-files, \
507 $(target_notice_file_txt), \
508 $(target_notice_file_html), \
509 "Notices for files contained in the filesystem images in this directory:", \
510 $(TARGET_OUT_NOTICE_FILES), \
511 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file)))
512
513$(eval $(call combine-notice-files, \
514 $(tools_notice_file_txt), \
515 $(tools_notice_file_html), \
516 "Notices for files contained in the tools directory:", \
517 $(HOST_OUT_NOTICE_FILES), \
518 $(ALL_DEFAULT_INSTALLED_MODULES)))
519
520# Install the html file at /system/etc/NOTICE.html.gz.
521# This is not ideal, but this is very late in the game, after a lot of
522# the module processing has already been done -- in fact, we used the
523# fact that all that has been done to get the list of modules that we
524# need notice files for.
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700525$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
Doug Zongker8678df42009-06-15 14:30:14 -0700526 $(hide) $(MINIGZIP) -9 < $< > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800527installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
528$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
529 $(copy-file-to-target)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700530
531# if we've been run my mm, mmm, etc, don't reinstall this every time
532ifeq ($(ONE_SHOT_MAKEFILE),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800533ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700534endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800535
536# The kernel isn't really a module, so to get its module file in there, we
537# make the target NOTICE files depend on this particular file too, which will
538# then be in the right directory for the find in combine-notice-files to work.
539$(kernel_notice_file): \
540 prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \
541 | $(ACP)
542 @echo Copying: $@
543 $(hide) mkdir -p $(dir $@)
544 $(hide) $(ACP) $< $@
545
546
Doug Zongker8678df42009-06-15 14:30:14 -0700547# -----------------------------------------------------------------
548# Build a keystore with the authorized keys in it, used to verify the
549# authenticity of downloaded OTA packages.
550#
551# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
552# before the rules that use that variable to build the image.
553ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
554$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
Doug Zongker37c0e272009-06-15 15:36:16 -0700555$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
Doug Zongker8678df42009-06-15 14:30:14 -0700556 $(hide) rm -f $@
557 $(hide) mkdir -p $(dir $@)
Doug Zongker37c0e272009-06-15 15:36:16 -0700558 $(hide) zip -qj $@ $<
Doug Zongker8678df42009-06-15 14:30:14 -0700559
560.PHONY: otacerts
561otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
562
563
The Android Open Source Project88b60792009-03-03 19:28:42 -0800564# #################################################################
565# Targets for user images
566# #################################################################
567
Ying Wang933abf12010-06-16 14:31:34 -0700568INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800569ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -0700570INTERNAL_USERIMAGES_USE_EXT := true
571INTERNAL_USERIMAGES_EXT_VARIANT := ext2
572else
573ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
574INTERNAL_USERIMAGES_USE_EXT := true
575INTERNAL_USERIMAGES_EXT_VARIANT := ext3
576else
577ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
578INTERNAL_USERIMAGES_USE_EXT := true
579INTERNAL_USERIMAGES_EXT_VARIANT := ext4
580endif
581endif
582endif
583
Ying Wang542903a2010-11-17 15:40:38 -0800584ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
585 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
586endif
587
Colin Cross0a7b2c52010-05-07 02:23:59 -0700588ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
Ying Wang542903a2010-11-17 15:40:38 -0800589INTERNAL_USERIMAGES_DEPS := $(MKEXTUSERIMG) $(MAKE_EXT4FS)
Ying Wang933abf12010-06-16 14:31:34 -0700590INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
591
Ying Wangc79f4da2010-06-16 14:58:50 -0700592# $(1): src directory
593# $(2): output file
Ying Wang026f1452010-09-27 17:49:03 -0700594# $(3): mount point
Ying Wangc79f4da2010-06-16 14:58:50 -0700595# $(4): ext variant (ext2, ext3, ext4)
Colin Crosse0a40212010-08-03 14:43:34 -0700596# $(5): size of the partition
Ying Wangc79f4da2010-06-16 14:58:50 -0700597define build-userimage-ext-target
598 @mkdir -p $(dir $(2))
Ying Wang1b5f1dc2011-02-17 15:44:45 -0800599 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Ying Wang542903a2010-11-17 15:40:38 -0800600 $(MKEXTUSERIMG) $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG) $(1) $(2) $(4) $(3) $(5)
Ying Wangc79f4da2010-06-16 14:58:50 -0700601endef
The Android Open Source Project88b60792009-03-03 19:28:42 -0800602else
Colin Cross144b0282010-05-10 13:04:47 -0700603INTERNAL_USERIMAGES_DEPS := $(MKYAFFS2)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800604endif
605
606# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -0700607# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700608
609# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
Brian Swetland630b7d32009-08-07 18:09:44 -0700610ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID)))
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700611
Doug Zongker4647f122009-07-02 09:00:54 -0700612INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
613
614recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
615recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
616recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
617recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
618recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
619recovery_resources_common := $(call include-path-for, recovery)/res
620recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))
621recovery_resource_deps := $(shell find $(recovery_resources_common) \
622 $(recovery_resources_private) -type f)
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700623recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Doug Zongker4647f122009-07-02 09:00:54 -0700624
625ifeq ($(recovery_resources_private),)
626 $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE))
627endif
628
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700629ifeq ($(recovery_fstab),)
630 $(info No recovery.fstab for TARGET_DEVICE $(TARGET_DEVICE))
631endif
632
Doug Zongker4647f122009-07-02 09:00:54 -0700633INTERNAL_RECOVERYIMAGE_ARGS := \
634 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
635 --kernel $(recovery_kernel) \
636 --ramdisk $(recovery_ramdisk)
637
638# Assumes this has already been stripped
639ifdef BOARD_KERNEL_CMDLINE
640 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
641endif
642ifdef BOARD_KERNEL_BASE
643 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
644endif
Ying Wang4de6b5b2010-08-25 14:29:34 -0700645BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
646ifdef BOARD_KERNEL_PAGESIZE
647 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
648endif
Doug Zongker4647f122009-07-02 09:00:54 -0700649
650# Keys authorized to sign OTA packages this build will accept. The
651# build always uses test-keys for this; release packaging tools will
652# substitute other keys for this one.
653OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem
654
655# Generate a file containing the keys that will be read by the
656# recovery binary.
657RECOVERY_INSTALL_OTA_KEYS := \
658 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys
659DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
660$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -0700661$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Doug Zongkere121d6a2011-02-01 14:13:52 -0800662$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
663 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"
Doug Zongker4647f122009-07-02 09:00:54 -0700664 @rm -rf $@
665 @mkdir -p $(dir $@)
Doug Zongkere121d6a2011-02-01 14:13:52 -0800666 java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
Doug Zongker4647f122009-07-02 09:00:54 -0700667
668$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
669 $(INSTALLED_RAMDISK_TARGET) \
670 $(INSTALLED_BOOTIMAGE_TARGET) \
671 $(recovery_binary) \
672 $(recovery_initrc) $(recovery_kernel) \
673 $(INSTALLED_2NDBOOTLOADER_TARGET) \
674 $(recovery_build_prop) $(recovery_resource_deps) \
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700675 $(recovery_fstab) \
Doug Zongker4647f122009-07-02 09:00:54 -0700676 $(RECOVERY_INSTALL_OTA_KEYS)
677 @echo ----- Making recovery image ------
678 rm -rf $(TARGET_RECOVERY_OUT)
679 mkdir -p $(TARGET_RECOVERY_OUT)
680 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)
681 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc
682 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp
683 echo Copying baseline ramdisk...
684 cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
Doug Zongkerb4c7d322010-07-01 15:30:11 -0700685 rm $(TARGET_RECOVERY_ROOT_OUT)/init*.rc
Doug Zongker4647f122009-07-02 09:00:54 -0700686 echo Modifying ramdisk contents...
687 cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
688 cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
689 cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/
690 $(foreach item,$(recovery_resources_private), \
691 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700692 $(foreach item,$(recovery_fstab), \
693 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
Doug Zongker4647f122009-07-02 09:00:54 -0700694 cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
695 cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
696 > $(TARGET_RECOVERY_ROOT_OUT)/default.prop
697 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
698 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
699 @echo ----- Made recovery image -------- $@
Doug Zongkered96e882009-08-26 09:37:07 -0700700 $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
Doug Zongker4647f122009-07-02 09:00:54 -0700701
702else
703INSTALLED_RECOVERYIMAGE_TARGET :=
704endif
705
706.PHONY: recoveryimage
707recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET)
708
Dima Zavin11818982010-02-05 13:34:34 -0800709ifneq ($(BOARD_NAND_PAGE_SIZE),)
710mkyaffs2_extra_flags := -c $(BOARD_NAND_PAGE_SIZE)
711else
712mkyaffs2_extra_flags :=
Lars Svensson9cb8c282010-12-06 15:24:58 +0100713BOARD_NAND_PAGE_SIZE := 2048
Dima Zavin11818982010-02-05 13:34:34 -0800714endif
715
Naseer Ahmed53871882010-08-06 12:19:29 -0700716ifneq ($(BOARD_NAND_SPARE_SIZE),)
717mkyaffs2_extra_flags += -s $(BOARD_NAND_SPARE_SIZE)
Lars Svensson9cb8c282010-12-06 15:24:58 +0100718else
719BOARD_NAND_SPARE_SIZE := 64
Naseer Ahmed53871882010-08-06 12:19:29 -0700720endif
721
Doug Zongker4647f122009-07-02 09:00:54 -0700722# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -0700723# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -0800724#
Ying Wang02352372010-09-27 10:37:25 -0700725systemimage_intermediates := \
726 $(call intermediates-dir-for,PACKAGING,systemimage)
727BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
The Android Open Source Project88b60792009-03-03 19:28:42 -0800728
729INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
730 $(ALL_PREBUILT) \
731 $(ALL_COPIED_HEADERS) \
732 $(ALL_GENERATED_SOURCES) \
733 $(ALL_DEFAULT_INSTALLED_MODULES))
734
Colin Cross0a7b2c52010-05-07 02:23:59 -0700735ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
736## generate an ext image
The Android Open Source Project88b60792009-03-03 19:28:42 -0800737# $(1): output file
738define build-systemimage-target
739 @echo "Target system fs image: $(1)"
Colin Crosse0a40212010-08-03 14:43:34 -0700740 $(call build-userimage-ext-target,$(TARGET_OUT),$(1),system,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800741endef
742
Colin Cross0a7b2c52010-05-07 02:23:59 -0700743else # INTERNAL_USERIMAGES_USE_EXT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800744
745## generate a yaffs2 image
746# $(1): output file
747define build-systemimage-target
748 @echo "Target system fs image: $(1)"
749 @mkdir -p $(dir $(1))
Dima Zavin11818982010-02-05 13:34:34 -0800750 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800751endef
Colin Cross0a7b2c52010-05-07 02:23:59 -0700752endif # INTERNAL_USERIMAGES_USE_EXT
The Android Open Source Project88b60792009-03-03 19:28:42 -0800753
Ying Wang02352372010-09-27 10:37:25 -0700754$(BUILT_SYSTEMIMAGE): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800755 $(call build-systemimage-target,$@)
756
The Android Open Source Project88b60792009-03-03 19:28:42 -0800757INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -0700758SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800759
Doug Zongker73ef8252009-07-23 15:12:53 -0700760# The system partition needs room for the recovery image as well. We
761# now store the recovery image as a binary patch using the boot image
762# as the source (since they are very similar). Generate the patch so
763# we can see how big it's going to be, and include that in the system
764# image size check calculation.
Sriram Raman1e96ac82009-07-24 13:52:32 -0700765ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Doug Zongker73ef8252009-07-23 15:12:53 -0700766intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
767RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
768$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \
769 $(INSTALLED_BOOTIMAGE_TARGET) \
Doug Zongker22bc5172009-07-23 18:27:43 -0700770 $(HOST_OUT_EXECUTABLES)/imgdiff \
771 $(HOST_OUT_EXECUTABLES)/bsdiff
Doug Zongker73ef8252009-07-23 15:12:53 -0700772 @echo "Construct recovery from boot"
773 mkdir -p $(dir $@)
Doug Zongkerb003d892009-07-23 18:48:38 -0700774 PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Sriram Raman1e96ac82009-07-24 13:52:32 -0700775endif
776
Doug Zongker73ef8252009-07-23 15:12:53 -0700777
778$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800779 @echo "Install system fs image: $@"
780 $(copy-file-to-target)
Doug Zongkered96e882009-08-26 09:37:07 -0700781 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800782
783systemimage: $(INSTALLED_SYSTEMIMAGE)
784
785.PHONY: systemimage-nodeps snod
786systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -0700787 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800788 @echo "make $@: ignoring dependencies"
789 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
Doug Zongkered96e882009-08-26 09:37:07 -0700790 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800791
792#######
793## system tarball
794define build-systemtarball-target
795 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
796 $(MKTARBALL) $(FS_GET_STATS) \
797 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
798 $(INSTALLED_SYSTEMTARBALL_TARGET)
799endef
800
Bruce Beare69ef5ce2010-06-11 12:05:57 -0700801ifndef SYSTEM_TARBALL_FORMAT
802 SYSTEM_TARBALL_FORMAT := bz2
803endif
804
The Android Open Source Project88b60792009-03-03 19:28:42 -0800805system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -0700806INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800807$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
808$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
809 $(build-systemtarball-target)
810
811.PHONY: systemtarball-nodeps
812systemtarball-nodeps: $(FS_GET_STATS) \
813 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
814 $(build-systemtarball-target)
815
816.PHONY: stnod
817stnod: systemtarball-nodeps
818
819
Bruce Beare52aac202010-06-04 15:24:49 -0700820#######
821## boot tarball
822define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -0700823 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -0700824 $(hide) mkdir -p $(PRODUCT_OUT)/boot
825 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
826 $(hide) echo $(BOARD_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
827 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
828 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
829 $(INSTALLED_BOOTTARBALL_TARGET)
830endef
831
832ifndef BOOT_TARBALL_FORMAT
833 BOOT_TARBALL_FORMAT := bz2
834endif
835
836boot_tar := $(PRODUCT_OUT)/boot.tar
837INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
838$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
839$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
840 $(build-boottarball-target)
841
842.PHONY: boottarball-nodeps btnod
843boottarball-nodeps btnod: $(FS_GET_STATS) \
844 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
845 $(build-boottarball-target)
846
847
The Android Open Source Project88b60792009-03-03 19:28:42 -0800848# -----------------------------------------------------------------
849# data partition image
850INTERNAL_USERDATAIMAGE_FILES := \
851 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
852
Colin Cross0a7b2c52010-05-07 02:23:59 -0700853ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800854## Generate an ext2 image
855define build-userdataimage-target
856 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
857 @mkdir -p $(TARGET_OUT_DATA)
Ying Wang026f1452010-09-27 17:49:03 -0700858 $(call build-userimage-ext-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),data,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Doug Zongkered96e882009-08-26 09:37:07 -0700859 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800860endef
861
Colin Cross0a7b2c52010-05-07 02:23:59 -0700862else # INTERNAL_USERIMAGES_USE_EXT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800863
864## Generate a yaffs2 image
865define build-userdataimage-target
866 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
867 @mkdir -p $(TARGET_OUT_DATA)
Dima Zavin11818982010-02-05 13:34:34 -0800868 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
Doug Zongkered96e882009-08-26 09:37:07 -0700869 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800870endef
Colin Cross0a7b2c52010-05-07 02:23:59 -0700871endif # INTERNAL_USERIMAGES_USE_EXT
The Android Open Source Project88b60792009-03-03 19:28:42 -0800872
Joe Onorato64d85d02009-04-09 19:31:12 -0700873BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
874
875# We just build this directly to the install location.
876INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Colin Cross144b0282010-05-10 13:04:47 -0700877$(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800878 $(INTERNAL_USERDATAIMAGE_FILES)
879 $(build-userdataimage-target)
880
881.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -0700882userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800883 $(build-userdataimage-target)
884
885#######
886## data partition tarball
887define build-userdatatarball-target
888 $(call pretty,"Target userdata fs tarball: " \
889 "$(INSTALLED_USERDATATARBALL_TARGET)")
890 $(MKTARBALL) $(FS_GET_STATS) \
891 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
892 $(INSTALLED_USERDATATARBALL_TARGET)
893endef
894
895userdata_tar := $(PRODUCT_OUT)/userdata.tar
896INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
897$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
898$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
899 $(build-userdatatarball-target)
900
901.PHONY: userdatatarball-nodeps
902userdatatarball-nodeps: $(FS_GET_STATS)
903 $(build-userdatatarball-target)
904
905
The Android Open Source Project88b60792009-03-03 19:28:42 -0800906# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800907# bring in the installer image generation defines if necessary
908ifeq ($(TARGET_USE_DISKINSTALLER),true)
909include bootable/diskinstaller/config.mk
910endif
911
912# -----------------------------------------------------------------
Doug Zongker8678df42009-06-15 14:30:14 -0700913# host tools needed to build OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -0800914
Ying Wang06898662010-06-17 17:52:18 -0700915OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
Doug Zongker8678df42009-06-15 14:30:14 -0700916 $(HOST_OUT_EXECUTABLES)/mkbootfs \
917 $(HOST_OUT_EXECUTABLES)/mkbootimg \
918 $(HOST_OUT_EXECUTABLES)/fs_config \
919 $(HOST_OUT_EXECUTABLES)/mkyaffs2image \
920 $(HOST_OUT_EXECUTABLES)/zipalign \
921 $(HOST_OUT_EXECUTABLES)/aapt \
922 $(HOST_OUT_EXECUTABLES)/bsdiff \
Doug Zongkerc494d7c2009-06-18 08:43:44 -0700923 $(HOST_OUT_EXECUTABLES)/imgdiff \
Doug Zongker8678df42009-06-15 14:30:14 -0700924 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
Ying Wang933abf12010-06-16 14:31:34 -0700925 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
926 $(HOST_OUT_EXECUTABLES)/mkuserimg.sh \
927 $(HOST_OUT_EXECUTABLES)/genext2fs \
928 $(HOST_OUT_EXECUTABLES)/tune2fs \
Sriram Ramanff83c852010-11-30 15:09:19 -0500929 $(HOST_OUT_EXECUTABLES)/e2fsck \
Sriram Ramanc647aec2010-11-29 18:51:20 -0500930 $(HOST_OUT_EXECUTABLES)/make_ext4fs
The Android Open Source Project88b60792009-03-03 19:28:42 -0800931
Ying Wang06898662010-06-17 17:52:18 -0700932.PHONY: otatools
933otatools: $(OTATOOLS)
934
The Android Open Source Project88b60792009-03-03 19:28:42 -0800935# -----------------------------------------------------------------
936# A zip of the directories that map to the target filesystem.
937# This zip can be used to create an OTA package or filesystem image
938# as a post-build step.
939#
940name := $(TARGET_PRODUCT)
941ifeq ($(TARGET_BUILD_TYPE),debug)
942 name := $(name)_debug
943endif
944name := $(name)-target_files-$(FILE_NAME_TAG)
945
946intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
947BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
948$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
949$(BUILT_TARGET_FILES_PACKAGE): \
950 zip_root := $(intermediates)/$(name)
951
952# $(1): Directory to copy
953# $(2): Location to copy it to
954# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
955define package_files-copy-root
956 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
957 mkdir -p $(2) && \
958 $(ACP) -rd $(strip $(1))/* $(2); \
959 fi
960endef
961
962built_ota_tools := \
Doug Zongker17c83cf2009-04-01 15:48:46 -0700963 $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \
Doug Zongker6c770462009-07-22 18:27:31 -0700964 $(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \
Doug Zongkera406c1e2009-06-12 16:57:08 -0700965 $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \
966 $(call intermediates-dir-for,EXECUTABLES,updater)/updater
The Android Open Source Project88b60792009-03-03 19:28:42 -0800967$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
968
Doug Zongkerb1134dd2009-06-17 17:09:40 -0700969$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
970
Doug Zongkerc18736b2009-09-30 09:20:32 -0700971ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
972# default to common dir for device vendor
973$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common
974else
975$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
976endif
977
The Android Open Source Project88b60792009-03-03 19:28:42 -0800978# Depending on the various images guarantees that the underlying
979# directories are up-to-date.
980$(BUILT_TARGET_FILES_PACKAGE): \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800981 $(INSTALLED_BOOTIMAGE_TARGET) \
982 $(INSTALLED_RADIOIMAGE_TARGET) \
983 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Doug Zongker4647f122009-07-02 09:00:54 -0700984 $(INSTALLED_SYSTEMIMAGE) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800985 $(INSTALLED_USERDATAIMAGE_TARGET) \
986 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800987 $(built_ota_tools) \
988 $(APKCERTS_FILE) \
Doug Zongker283e2a12010-03-15 17:52:32 -0700989 $(HOST_OUT_EXECUTABLES)/fs_config \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800990 | $(ACP)
991 @echo "Package target files: $@"
992 $(hide) rm -rf $@ $(zip_root)
993 $(hide) mkdir -p $(dir $@) $(zip_root)
994 @# Components of the recovery image
995 $(hide) mkdir -p $(zip_root)/RECOVERY
996 $(hide) $(call package_files-copy-root, \
997 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
998ifdef INSTALLED_KERNEL_TARGET
999 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
1000endif
1001ifdef INSTALLED_2NDBOOTLOADER_TARGET
1002 $(hide) $(ACP) \
1003 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
1004endif
1005ifdef BOARD_KERNEL_CMDLINE
1006 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
1007endif
Doug Zongker38a649f2009-06-17 09:07:09 -07001008ifdef BOARD_KERNEL_BASE
1009 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
1010endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001011ifdef BOARD_KERNEL_PAGESIZE
1012 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize
1013endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001014 @# Components of the boot image
1015 $(hide) mkdir -p $(zip_root)/BOOT
1016 $(hide) $(call package_files-copy-root, \
1017 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
1018ifdef INSTALLED_KERNEL_TARGET
1019 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
1020endif
1021ifdef INSTALLED_2NDBOOTLOADER_TARGET
1022 $(hide) $(ACP) \
1023 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
1024endif
1025ifdef BOARD_KERNEL_CMDLINE
1026 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
1027endif
Doug Zongker38a649f2009-06-17 09:07:09 -07001028ifdef BOARD_KERNEL_BASE
1029 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
1030endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001031ifdef BOARD_KERNEL_PAGESIZE
1032 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
1033endif
Doug Zongkere01100c2009-06-19 17:12:18 -07001034 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
1035 mkdir -p $(zip_root)/RADIO; \
1036 $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001037 @# Contents of the system image
1038 $(hide) $(call package_files-copy-root, \
1039 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
1040 @# Contents of the data image
1041 $(hide) $(call package_files-copy-root, \
1042 $(TARGET_OUT_DATA),$(zip_root)/DATA)
1043 @# Extra contents of the OTA package
1044 $(hide) mkdir -p $(zip_root)/OTA/bin
The Android Open Source Project88b60792009-03-03 19:28:42 -08001045 $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
1046 $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Doug Zongker8678df42009-06-15 14:30:14 -07001047 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08001048 @# build them.
1049 $(hide) mkdir -p $(zip_root)/META
1050 $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Doug Zongker17c83cf2009-04-01 15:48:46 -07001051 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Doug Zongker37974732010-09-16 17:44:38 -07001052 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001053ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07001054 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001055endif
1056ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001057 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001058endif
1059ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001060 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001061endif
1062ifdef BOARD_SYSTEMIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001063 $(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001064endif
1065ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001066 $(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001067endif
Doug Zongker37974732010-09-16 17:44:38 -07001068 $(hide) echo "tool_extensions=$(tool_extensions)" >> $(zip_root)/META/misc_info.txt
Ying Wangd421f572010-08-25 20:39:41 -07001069ifdef mkyaffs2_extra_flags
Doug Zongker37974732010-09-16 17:44:38 -07001070 $(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(zip_root)/META/misc_info.txt
Ying Wangd421f572010-08-25 20:39:41 -07001071endif
Ying Wangc5a07ce2010-11-17 17:45:36 -08001072ifdef INTERNAL_USERIMAGES_SPARSE_EXT_FLAG
1073 $(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(zip_root)/META/misc_info.txt
1074endif
Doug Zongker5d4808d2011-03-16 07:49:13 -07001075ifdef PRODUCT_EXTRA_RECOVERY_KEYS
1076 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08001077endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001078 @# Zip everything up, preserving symlinks
1079 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
Doug Zongker283e2a12010-03-15 17:52:32 -07001080 @# Run fs_config on all the system files in the zip, and save the output
1081 $(hide) zipinfo -1 $@ | awk -F/ 'BEGIN { OFS="/" } /^SYSTEM\// {$$1 = "system"; print}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/filesystem_config.txt
1082 $(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/filesystem_config.txt)
1083
The Android Open Source Project88b60792009-03-03 19:28:42 -08001084
1085target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
1086
Doug Zongker367910f2009-06-15 18:56:51 -07001087
1088ifneq ($(TARGET_SIMULATOR),true)
1089ifneq ($(TARGET_PRODUCT),sdk)
Ying Wang279f3082011-02-09 12:26:42 -08001090ifeq ($(filter generic%,$(TARGET_DEVICE)),)
Ying Wangfb0a3472010-08-25 16:06:06 -07001091ifneq ($(TARGET_NO_KERNEL),true)
Ying Wanga73b6562011-03-03 21:52:08 -08001092ifneq ($(recovery_fstab),)
Doug Zongker367910f2009-06-15 18:56:51 -07001093
Ying Wang09a00a62010-10-20 14:01:09 -07001094# -----------------------------------------------------------------
1095# OTA update package
1096
Doug Zongker8678df42009-06-15 14:30:14 -07001097name := $(TARGET_PRODUCT)
1098ifeq ($(TARGET_BUILD_TYPE),debug)
1099 name := $(name)_debug
1100endif
1101name := $(name)-ota-$(FILE_NAME_TAG)
1102
1103INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1104
1105$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
1106
Ying Wang06898662010-06-17 17:52:18 -07001107$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
Doug Zongker8678df42009-06-15 14:30:14 -07001108 @echo "Package OTA: $@"
Ying Wang68bb6512010-08-25 15:23:21 -07001109 $(hide) ./build/tools/releasetools/ota_from_target_files -v \
Doug Zongker602a84e2009-06-18 08:35:12 -07001110 -p $(HOST_OUT) \
Doug Zongker8678df42009-06-15 14:30:14 -07001111 -k $(KEY_CERT_PAIR) \
1112 $(BUILT_TARGET_FILES_PACKAGE) $@
1113
1114.PHONY: otapackage
1115otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
1116
Ying Wang09a00a62010-10-20 14:01:09 -07001117# -----------------------------------------------------------------
1118# The update package
1119
1120name := $(TARGET_PRODUCT)
1121ifeq ($(TARGET_BUILD_TYPE),debug)
1122 name := $(name)_debug
1123endif
1124name := $(name)-img-$(FILE_NAME_TAG)
1125
1126INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1127
1128ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
1129# default to common dir for device vendor
1130$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common
1131else
1132$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
1133endif
1134
1135$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
1136 @echo "Package: $@"
1137 $(hide) ./build/tools/releasetools/img_from_target_files -v \
1138 -s $(extensions) \
1139 -p $(HOST_OUT) \
1140 $(BUILT_TARGET_FILES_PACKAGE) $@
1141
1142.PHONY: updatepackage
1143updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
1144
Ying Wanga73b6562011-03-03 21:52:08 -08001145endif # recovery_fstab is defined
Ying Wangfb0a3472010-08-25 16:06:06 -07001146endif # TARGET_NO_KERNEL != true
Ying Wang279f3082011-02-09 12:26:42 -08001147endif # TARGET_DEVICE != generic*
Doug Zongker367910f2009-06-15 18:56:51 -07001148endif # TARGET_PRODUCT != sdk
1149endif # TARGET_SIMULATOR != true
Doug Zongker8678df42009-06-15 14:30:14 -07001150
1151# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08001152# installed file list
1153# Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it
1154# gets the DexOpt one if we're doing that.
1155INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
1156$(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE)
1157 @echo Installed file list: $@
1158 @mkdir -p $(dir $@)
1159 @rm -f $@
1160 $(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@
1161
1162.PHONY: installed-file-list
1163installed-file-list: $(INSTALLED_FILES_FILE)
Raphaelc4d47312011-02-15 16:09:36 -08001164ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),)
1165$(call dist-for-goals, sdk win_sdk, $(INSTALLED_FILES_FILE))
Ying Wanga37a2cb2010-04-28 12:59:51 -07001166endif
1167ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
Joe Onorato03fbe402009-04-13 08:31:16 -07001168$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wanga37a2cb2010-04-28 12:59:51 -07001169endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001170
1171# -----------------------------------------------------------------
1172# A zip of the tests that are built when running "make tests".
1173# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
1174# only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
1175#
1176name := $(TARGET_PRODUCT)
1177ifeq ($(TARGET_BUILD_TYPE),debug)
1178 name := $(name)_debug
1179endif
1180name := $(name)-tests-$(FILE_NAME_TAG)
1181
1182intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
1183BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
1184$(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
1185$(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
1186
1187# Depending on the images guarantees that the underlying
1188# directories are up-to-date.
1189$(BUILT_TESTS_ZIP_PACKAGE): \
1190 $(BUILT_SYSTEMIMAGE) \
1191 $(INSTALLED_USERDATAIMAGE_TARGET) \
1192 | $(ACP)
1193 @echo "Package test files: $@"
1194 $(hide) rm -rf $@ $(zip_root)
1195 $(hide) mkdir -p $(dir $@) $(zip_root)
1196 @# Some parts of the system image
1197 $(hide) $(call package_files-copy-root, \
1198 $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin)
1199 $(hide) $(call package_files-copy-root, \
1200 $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib)
1201 $(hide) $(call package_files-copy-root, \
1202 $(SYSTEMIMAGE_SOURCE_DIR)/framework, \
1203 $(zip_root)/SYSTEM/framework)
1204 $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM
1205 @# Contents of the data image
1206 $(hide) $(call package_files-copy-root, \
1207 $(TARGET_OUT_DATA),$(zip_root)/DATA)
1208 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
1209
Ying Wang9c762552010-09-10 14:39:33 -07001210.PHONY: tests-zip-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08001211tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
1212
Ying Wangdb2cb632010-09-14 16:07:56 -07001213# Target needed by tests build
1214.PHONY: tests-build-target
1215tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE) \
1216 $(BUILT_USERDATAIMAGE_TARGET)
1217
1218ifneq (,$(filter $(MAKECMDGOALS),tests-build-target))
1219 $(call dist-for-goals, tests-build-target, \
1220 $(BUILT_TESTS_ZIP_PACKAGE) \
1221 $(BUILT_USERDATAIMAGE_TARGET))
Ying Wang9c762552010-09-10 14:39:33 -07001222endif
1223
The Android Open Source Project88b60792009-03-03 19:28:42 -08001224# -----------------------------------------------------------------
1225# A zip of the symbols directory. Keep the full paths to make it
1226# more obvious where these files came from.
1227#
1228name := $(TARGET_PRODUCT)
1229ifeq ($(TARGET_BUILD_TYPE),debug)
1230 name := $(name)_debug
1231endif
1232name := $(name)-symbols-$(FILE_NAME_TAG)
1233
1234SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
1235$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET)
1236 @echo "Package symbols: $@"
1237 $(hide) rm -rf $@
1238 $(hide) mkdir -p $(dir $@)
1239 $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
1240
1241# -----------------------------------------------------------------
1242# A zip of the Android Apps. Not keeping full path so that we don't
1243# include product names when distributing
1244#
1245name := $(TARGET_PRODUCT)
1246ifeq ($(TARGET_BUILD_TYPE),debug)
1247 name := $(name)_debug
1248endif
1249name := $(name)-apps-$(FILE_NAME_TAG)
1250
1251APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
1252$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
1253 @echo "Package apps: $@"
1254 $(hide) rm -rf $@
1255 $(hide) mkdir -p $(dir $@)
1256 $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
1257
Guang Zhu0198d6e2010-04-23 11:54:37 -07001258
1259#------------------------------------------------------------------
1260# A zip of emma code coverage meta files. Generated for fully emma
1261# instrumented build.
1262#
1263EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip
1264$(EMMA_META_ZIP): $(INSTALLED_SYSTEMIMAGE)
1265 @echo "Collecting Emma coverage meta files."
1266 $(hide) find $(TARGET_COMMON_OUT_ROOT) -name "coverage.em" | \
1267 zip -@ -q $@
1268
The Android Open Source Project88b60792009-03-03 19:28:42 -08001269endif # TARGET_SIMULATOR != true
1270
1271# -----------------------------------------------------------------
1272# dalvik something
1273.PHONY: dalvikfiles
1274dalvikfiles: $(INTERNAL_DALVIK_MODULES)
1275
1276# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08001277# The emulator package
1278
1279ifneq ($(TARGET_SIMULATOR),true)
1280
1281INTERNAL_EMULATOR_PACKAGE_FILES += \
1282 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Bruce Beare18a130e2011-02-18 15:06:20 -08001283 prebuilt/android-$(TARGET_ARCH)/kernel/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001284 $(INSTALLED_RAMDISK_TARGET) \
1285 $(INSTALLED_SYSTEMIMAGE) \
1286 $(INSTALLED_USERDATAIMAGE_TARGET)
1287
1288name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
1289
1290INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1291
1292$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
1293 @echo "Package: $@"
1294 $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
1295
1296endif
1297
1298# -----------------------------------------------------------------
1299# The pdk package (Platform Development Kit)
1300
1301ifneq (,$(filter pdk,$(MAKECMDGOALS)))
1302 include development/pdk/Pdk.mk
1303endif
1304
1305# -----------------------------------------------------------------
1306# The SDK
1307
1308ifneq ($(TARGET_SIMULATOR),true)
1309
1310# The SDK includes host-specific components, so it belongs under HOST_OUT.
1311sdk_dir := $(HOST_OUT)/sdk
1312
1313# Build a name that looks like:
1314#
1315# linux-x86 --> android-sdk_12345_linux-x86
1316# darwin-x86 --> android-sdk_12345_mac-x86
1317# windows-x86 --> android-sdk_12345_windows
1318#
1319sdk_name := android-sdk_$(FILE_NAME_TAG)
1320ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07001321 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08001322else
Joe Onorato03fbe402009-04-13 08:31:16 -07001323 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001324endif
1325ifneq ($(HOST_OS),windows)
Joe Onorato03fbe402009-04-13 08:31:16 -07001326 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001327endif
Joe Onorato03fbe402009-04-13 08:31:16 -07001328sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001329
1330sdk_dep_file := $(sdk_dir)/sdk_deps.mk
1331
1332ATREE_FILES :=
1333-include $(sdk_dep_file)
1334
1335# if we don't have a real list, then use "everything"
1336ifeq ($(strip $(ATREE_FILES)),)
1337ATREE_FILES := \
1338 $(ALL_PREBUILT) \
1339 $(ALL_COPIED_HEADERS) \
1340 $(ALL_GENERATED_SOURCES) \
1341 $(ALL_DEFAULT_INSTALLED_MODULES) \
1342 $(INSTALLED_RAMDISK_TARGET) \
1343 $(ALL_DOCS) \
1344 $(ALL_SDK_FILES)
1345endif
1346
1347atree_dir := development/build
1348
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01001349# sdk/build/tools.atree contains the generic rules, while
1350#
1351# sdk/build/tools.$(TARGET_ARCH).atree contains target-specific rules
1352# the latter is optional.
1353#
1354sdk_tools_atree_files := sdk/build/tools.atree
1355ifneq (,$(strip $(wildcard sdk/build/tools.$(TARGET_ARCH).atree)))
1356 sdk_tools_atree_files += sdk/build/tools.$(TARGET_ARCH).atree
1357endif
1358
The Android Open Source Project88b60792009-03-03 19:28:42 -08001359sdk_atree_files := \
1360 $(atree_dir)/sdk.exclude.atree \
1361 $(atree_dir)/sdk.atree \
Xavier Ducrohetffd50872010-09-27 15:51:32 -07001362 $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree \
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01001363 $(sdk_tools_atree_files)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001364
1365deps := \
1366 $(target_notice_file_txt) \
1367 $(tools_notice_file_txt) \
1368 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07001369 $(SYMBOLS_ZIP) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07001370 $(INSTALLED_SYSTEMIMAGE) \
1371 $(INSTALLED_USERDATAIMAGE_TARGET) \
1372 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001373 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07001374 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001375 $(ATREE_FILES) \
1376 $(atree_dir)/sdk.atree \
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01001377 $(sdk_tools_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001378 $(HOST_OUT_EXECUTABLES)/atree \
1379 $(HOST_OUT_EXECUTABLES)/line_endings
1380
1381INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
1382$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
1383$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
1384$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
1385$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
1386
1387# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
1388#
1389#SDK_GNU_ERROR := true
1390
Raphael7a6a9c32011-02-01 13:30:00 -08001391ifeq ($(HOST_OS),darwin)
1392HOST_STRIP_SDK_LLVM := strip
1393else
1394HOST_STRIP_SDK_LLVM := strip --strip-all
1395endif
1396
The Android Open Source Project88b60792009-03-03 19:28:42 -08001397$(INTERNAL_SDK_TARGET): $(deps)
1398 @echo "Package SDK: $@"
1399 $(hide) rm -rf $(PRIVATE_DIR) $@
1400 $(hide) for f in $(target_gnu_MODULES); do \
1401 if [ -f $$f ]; then \
1402 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
1403 including GNU target $$f >&2; \
1404 FAIL=$(SDK_GNU_ERROR); \
1405 fi; \
1406 done; \
1407 if [ $$FAIL ]; then exit 1; fi
1408 $(hide) ( \
1409 $(HOST_OUT_EXECUTABLES)/atree \
1410 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
1411 -m $(PRIVATE_DEP_FILE) \
1412 -I . \
1413 -I $(PRODUCT_OUT) \
1414 -I $(HOST_OUT) \
1415 -I $(TARGET_COMMON_OUT_ROOT) \
1416 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
Raphael Moll7558ad52011-01-05 14:58:17 -08001417 -v "OUT_DIR=$(OUT_DIR)" \
Bruce Beare18a130e2011-02-18 15:06:20 -08001418 -v "TARGET_ARCH=$(TARGET_ARCH)" \
1419 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001420 -o $(PRIVATE_DIR) && \
1421 cp -f $(target_notice_file_txt) \
Bruce Beare18a130e2011-02-18 15:06:20 -08001422 $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/$(TARGET_CPU_ABI)/NOTICE.txt && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001423 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
Xavier Ducrohet4216a8c2011-03-15 13:28:40 -07001424 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
Raphael7a6a9c32011-02-01 13:30:00 -08001425 if [ -f $(PRIVATE_DIR)/platform-tools/llvm-rs-cc ]; then \
1426 $(HOST_STRIP_SDK_LLVM) $(PRIVATE_DIR)/platform-tools/llvm-rs-cc; \
1427 fi && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001428 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
Raphael7a6a9c32011-02-01 13:30:00 -08001429 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001430 chmod -R ug+rwX $(PRIVATE_DIR) && \
1431 cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
1432 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
1433
Raphael3d224a02010-04-16 17:50:09 -07001434
1435# Is a Windows SDK requested? If so, we need some definitions from here
1436# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08001437MAIN_SDK_NAME := $(sdk_name)
1438MAIN_SDK_DIR := $(sdk_dir)
1439MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Raphael3d224a02010-04-16 17:50:09 -07001440ifneq ($(filter win_sdk,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07001441include $(TOPDIR)development/build/tools/windows_sdk.mk
1442endif
1443
The Android Open Source Project88b60792009-03-03 19:28:42 -08001444endif # !simulator
1445
1446# -----------------------------------------------------------------
1447# Findbugs
1448INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
1449INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
1450$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
1451 @echo UnionBugs: $@
1452 $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \
1453 > $@
1454$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
1455 @echo ConvertXmlToText: $@
1456 $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
1457 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
1458
1459# -----------------------------------------------------------------
1460# Findbugs
1461
1462# -----------------------------------------------------------------
1463# These are some additional build tasks that need to be run.
1464include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01001465-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Raphaelc4d47312011-02-15 16:09:36 -08001466
1467# -----------------------------------------------------------------
1468# Create SDK repository packages. Must be done after tasks/* since
1469# we need the addon rules defined.
1470ifneq ($(sdk_repo_goal),)
1471include $(TOPDIR)development/build/tools/sdk_repo.mk
1472endif