blob: 7ff896ee9c022e1e338e0e02657e76fce1997698 [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))
45
46$(INSTALLED_DEFAULT_PROP_TARGET):
47 @echo Target buildinfo: $@
48 @mkdir -p $(dir $@)
49 $(hide) echo "#" > $@; \
50 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
51 echo "#" >> $@;
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -070052 $(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \
53 echo "$(line)" >> $@;)
The Android Open Source Project88b60792009-03-03 19:28:42 -080054
55# -----------------------------------------------------------------
56# build.prop
57INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
58ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
59ADDITIONAL_BUILD_PROPERTIES := \
60 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
61
62# A list of arbitrary tags describing the build configuration.
63# Force ":=" so we can use +=
64BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
65ifeq ($(TARGET_BUILD_TYPE),debug)
66 BUILD_VERSION_TAGS += debug
67endif
68# Apps are always signed with test keys, and may be re-signed in a post-build
69# step. If that happens, the "test-keys" tag will be removed by that step.
70BUILD_VERSION_TAGS += test-keys
The Android Open Source Project88b60792009-03-03 19:28:42 -080071BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
72
73# A human-readable string that descibes this build in detail.
74build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS)
75$(INSTALLED_BUILD_PROP_TARGET): PRIVATE_BUILD_DESC := $(build_desc)
76
77# The string used to uniquely identify this build; used by the OTA server.
78ifeq (,$(strip $(BUILD_FINGERPRINT)))
Doug Zongker135a1202010-09-15 13:02:12 -070079 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 -080080endif
81ifneq ($(words $(BUILD_FINGERPRINT)),1)
82 $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)")
83endif
84
Sriram Raman7b641242009-03-24 22:40:59 -070085# Display parameters shown under Settings -> About Phone
86ifeq ($(TARGET_BUILD_VARIANT),user)
87 # User builds should show:
88 # release build number or branch.buld_number non-release builds
89
90 # Dev. branches should have DISPLAY_BUILD_NUMBER set
91 ifeq "true" "$(DISPLAY_BUILD_NUMBER)"
92 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER)
93 else
94 BUILD_DISPLAY_ID := $(BUILD_ID)
95 endif
96else
97 # Non-user builds should show detailed build information
98 BUILD_DISPLAY_ID := $(build_desc)
99endif
100
Ying Wang77c882f2010-04-27 15:45:35 -0700101# Whether there is default locale set in PRODUCT_PROPERTY_OVERRIDES
Ying Wang38d7f022010-07-21 14:58:42 -0700102product_property_override_locale_language := $(strip \
103 $(patsubst ro.product.locale.language=%,%,\
Ying Wang77c882f2010-04-27 15:45:35 -0700104 $(filter ro.product.locale.language=%,$(PRODUCT_PROPERTY_OVERRIDES))))
Ying Wang38d7f022010-07-21 14:58:42 -0700105product_property_overrides_locale_region := $(strip \
106 $(patsubst ro.product.locale.region=%,%,\
Ying Wang77c882f2010-04-27 15:45:35 -0700107 $(filter ro.product.locale.region=%,$(PRODUCT_PROPERTY_OVERRIDES))))
108
The Android Open Source Project88b60792009-03-03 19:28:42 -0800109# Selects the first locale in the list given as the argument,
110# and splits it into language and region, which each may be
111# empty.
112define default-locale
113$(subst _, , $(firstword $(1)))
114endef
115
116# Selects the first locale in the list given as the argument
Ying Wang77c882f2010-04-27 15:45:35 -0700117# and returns the language (or the region), if it's not set in PRODUCT_PROPERTY_OVERRIDES;
118# Return empty string if it's already set in PRODUCT_PROPERTY_OVERRIDES.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800119define default-locale-language
Ying Wang38d7f022010-07-21 14:58:42 -0700120$(if $(product_property_override_locale_language),,$(word 1, $(call default-locale, $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800121endef
122define default-locale-region
Ying Wang38d7f022010-07-21 14:58:42 -0700123$(if $(product_property_overrides_locale_region),,$(word 2, $(call default-locale, $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800124endef
125
126BUILDINFO_SH := build/tools/buildinfo.sh
Chih-Wei Huang75947ef2010-11-03 18:33:46 +0800127$(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 -0800128 @echo Target buildinfo: $@
129 @mkdir -p $(dir $@)
130 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
131 TARGET_DEVICE="$(TARGET_DEVICE)" \
132 PRODUCT_NAME="$(TARGET_PRODUCT)" \
133 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
134 PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \
135 PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \
Robert Greenwaltfbd10d92009-05-20 13:37:35 -0700136 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800137 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
138 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
139 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
140 BUILD_ID="$(BUILD_ID)" \
141 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
142 BUILD_NUMBER="$(BUILD_NUMBER)" \
143 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
144 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
Dianne Hackborn95378842009-05-08 12:06:17 -0700145 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800146 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
147 TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
148 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \
149 TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
Dianne Hackbornecc70d72009-05-21 15:45:30 -0700150 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
David 'Digit' Turner2edfb712009-11-06 15:12:00 -0800151 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Joe Onorato25939e22010-11-09 08:53:01 -0800152 TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800153 bash $(BUILDINFO_SH) > $@
154 $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \
155 cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \
156 fi
157 $(if $(ADDITIONAL_BUILD_PROPERTIES), \
158 $(hide) echo >> $@; \
159 echo "#" >> $@; \
160 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
161 echo "#" >> $@; )
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -0700162 $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \
163 echo "$(line)" >> $@;)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800164
165build_desc :=
166
167# -----------------------------------------------------------------
168# sdk-build.prop
169#
170# There are certain things in build.prop that we don't want to
171# ship with the sdk; remove them.
172
173# This must be a list of entire property keys followed by
174# "=" characters, without any internal spaces.
175sdk_build_prop_remove := \
176 ro.build.user= \
177 ro.build.host= \
178 ro.product.brand= \
179 ro.product.manufacturer= \
180 ro.product.device=
181# TODO: Remove this soon-to-be obsolete property
182sdk_build_prop_remove += ro.build.product=
183INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
184$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
185 @echo SDK buildinfo: $@
186 @mkdir -p $(dir $@)
187 $(hide) grep -v "$(subst $(space),\|,$(strip \
188 $(sdk_build_prop_remove)))" $< > $@.tmp
189 $(hide) for x in $(sdk_build_prop_remove); do \
190 echo "$$x"generic >> $@.tmp; done
191 $(hide) mv $@.tmp $@
192
193# -----------------------------------------------------------------
194# package stats
195PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
196PACKAGES_TO_STAT := \
197 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
198 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
199$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
200 @echo Package stats: $@
201 @mkdir -p $(dir $@)
202 $(hide) rm -f $@
203 $(hide) build/tools/dump-package-stats $^ > $@
204
205.PHONY: package-stats
206package-stats: $(PACKAGE_STATS_FILE)
207
208# -----------------------------------------------------------------
209# Cert-to-package mapping. Used by the post-build signing tools.
210name := $(TARGET_PRODUCT)
211ifeq ($(TARGET_BUILD_TYPE),debug)
212 name := $(name)_debug
213endif
214name := $(name)-apkcerts-$(FILE_NAME_TAG)
215intermediates := \
216 $(call intermediates-dir-for,PACKAGING,apkcerts)
217APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800218# We don't need to really build all the modules.
219# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700220$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800221 @echo APK certs list: $@
222 @mkdir -p $(dir $@)
223 @rm -f $@
224 $(hide) $(foreach p,$(PACKAGES),\
Doug Zongkerf6a53aa2009-12-15 15:06:55 -0800225 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
226 echo 'name="$(p).apk" certificate="EXTERNAL" \
227 private_key=""' >> $@;,\
228 echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
229 private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800230
231.PHONY: apkcerts-list
232apkcerts-list: $(APKCERTS_FILE)
233
Ying Wang15e487a2011-02-15 10:56:18 -0800234ifneq (,$(TARGET_BUILD_APPS))
235 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
236endif
Ying Wangefb21682010-07-23 16:42:13 -0700237
The Android Open Source Project88b60792009-03-03 19:28:42 -0800238# -----------------------------------------------------------------
239# module info file
240ifdef CREATE_MODULE_INFO_FILE
241 MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt
242 $(info Generating $(MODULE_INFO_FILE)...)
243 $(shell rm -f $(MODULE_INFO_FILE))
244 $(foreach m,$(ALL_MODULES), \
245 $(shell echo "NAME=\"$(m)\"" \
246 "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \
247 "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \
248 "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \
249 "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE)))
250endif
251
Doug Zongker8678df42009-06-15 14:30:14 -0700252# -----------------------------------------------------------------
253
254# The test key is used to sign this package, and as the key required
255# for future OTA packages installed by this system. Actual product
256# deliverables will be re-signed by hand. We expect this file to
257# exist with the suffixes ".x509.pem" and ".pk8".
258DEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey
259
260
The Android Open Source Project88b60792009-03-03 19:28:42 -0800261# Rules that need to be present for the simulator, even
262# if they don't do anything.
263.PHONY: systemimage
264systemimage:
265
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800266# -----------------------------------------------------------------
267
268.PHONY: event-log-tags
269
Joe Onoratob7510532010-07-14 10:22:54 -0700270# Produce an event logs tag file for everything we know about, in order
271# to properly allocate numbers. Then produce a file that's filtered
272# for what's going to be installed.
273
274all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
275
276# Include tags from all packages that we know about
277all_event_log_tags_src := \
278 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
279
280$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src)
281$(all_event_log_tags_file): $(all_event_log_tags_src)
282 $(hide) mkdir -p $(dir $@)
283 $(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
284
285
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800286event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800287
Doug Zongkera34fa952011-02-23 12:17:29 -0800288# Include tags from all packages included in this product, plus all
289# tags that are part of the system (ie, not in a vendor/ or device/
290# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800291event_log_tags_src := \
292 $(sort $(foreach m,\
293 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
294 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800295 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
296 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800297
298$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
Joe Onoratob7510532010-07-14 10:22:54 -0700299$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
300$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800301 $(hide) mkdir -p $(dir $@)
Joe Onoratob7510532010-07-14 10:22:54 -0700302 $(hide) build/tools/merge-event-log-tags.py -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800303
304event-log-tags: $(event_log_tags_file)
305
306ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
307
Joe Onoratob7510532010-07-14 10:22:54 -0700308
The Android Open Source Project88b60792009-03-03 19:28:42 -0800309ifneq ($(TARGET_SIMULATOR),true)
310
311# #################################################################
312# Targets for boot/OS images
313# #################################################################
314
315# -----------------------------------------------------------------
316# the ramdisk
317INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
318 $(ALL_PREBUILT) \
319 $(ALL_COPIED_HEADERS) \
320 $(ALL_GENERATED_SOURCES) \
321 $(ALL_DEFAULT_INSTALLED_MODULES))
322
Joe Onorato64d85d02009-04-09 19:31:12 -0700323BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
324
325# We just build this directly to the install location.
326INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700327$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800328 $(call pretty,"Target ram disk: $@")
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700329 $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800330
331
332ifneq ($(strip $(TARGET_NO_KERNEL)),true)
333
334# -----------------------------------------------------------------
335# the boot image, which is a collection of other images.
336INTERNAL_BOOTIMAGE_ARGS := \
337 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
338 --kernel $(INSTALLED_KERNEL_TARGET) \
339 --ramdisk $(INSTALLED_RAMDISK_TARGET)
340
341INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
342
343BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
344ifdef BOARD_KERNEL_CMDLINE
345 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
346endif
347
Dima Zavin1e0847c2009-05-07 19:43:08 -0700348BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
349ifdef BOARD_KERNEL_BASE
350 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
351endif
352
Ying Wangffff0022010-08-23 12:56:25 -0700353BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
354ifdef BOARD_KERNEL_PAGESIZE
355 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
356endif
357
The Android Open Source Project88b60792009-03-03 19:28:42 -0800358INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
359
360ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
361tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg
362INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image)
363INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG)
364$(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES)
365 $(call pretty,"Target boot image: $@")
366 $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
367
368else # TARGET_BOOTIMAGE_USE_EXT2 != true
369
370$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
371 $(call pretty,"Target boot image: $@")
372 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
Doug Zongkered96e882009-08-26 09:37:07 -0700373 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800374endif # TARGET_BOOTIMAGE_USE_EXT2
375
376else # TARGET_NO_KERNEL
377# HACK: The top-level targets depend on the bootimage. Not all targets
378# can produce a bootimage, though, and emulator targets need the ramdisk
379# instead. Fake it out by calling the ramdisk the bootimage.
380# TODO: make the emulator use bootimages, and make mkbootimg accept
381# kernel-less inputs.
382INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
383endif
384
385# -----------------------------------------------------------------
386# NOTICE files
387#
388# This needs to be before the systemimage rules, because it adds to
389# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
390# go into the systemimage.
391
392.PHONY: notice_files
393
394# Create the rule to combine the files into text and html forms
395# $(1) - Plain text output file
396# $(2) - HTML output file
397# $(3) - File title
398# $(4) - Directory to use. Notice files are all $(4)/src. Other
399# directories in there will be used for scratch
400# $(5) - Dependencies for the output files
401#
402# The algorithm here is that we go collect a hash for each of the notice
403# files and write the names of the files that match that hash. Then
404# to generate the real files, we go print out all of the files and their
405# hashes.
406#
407# These rules are fairly complex, so they depend on this makefile so if
408# it changes, they'll run again.
409#
410# TODO: We could clean this up so that we just record the locations of the
411# original notice files instead of making rules to copy them somwehere.
412# Then we could traverse that without quite as much bash drama.
413define combine-notice-files
414$(1) $(2): PRIVATE_MESSAGE := $(3)
415$(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4)
416$(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile
417 @echo Finding NOTICE files: $$@
418 $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash
419 $$(hide) mkdir -p $$(PRIVATE_DIR)/hash
420 $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \
421 hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \
422 hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \
423 echo $$$$file >> $$$$hashfile; \
424 done
425 $$(hide) touch $$@
426$(1): $(4)/hash-timestamp
427 @echo Combining NOTICE files: $$@
428 $$(hide) mkdir -p $$(dir $$@)
429 $$(hide) echo $$(PRIVATE_MESSAGE) > $$@
430 $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \
431 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> $$@
432 $$(hide) echo >> $$@
433 $$(hide) echo >> $$@
434 $$(hide) echo >> $$@
435 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
436 echo "============================================================"\
437 >> $$@; \
438 echo "Notices for file(s):" >> $$@; \
439 cat $$$$hashfile | sort | \
440 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> \
441 $$@; \
442 echo "------------------------------------------------------------"\
443 >> $$@; \
444 echo >> $$@; \
445 orig=$$$$(head -n 1 $$$$hashfile); \
446 cat $$$$orig >> $$@; \
447 echo >> $$@; \
448 echo >> $$@; \
449 echo >> $$@; \
450 done
451$(2): $(4)/hash-timestamp
452 @echo Combining NOTICE files: $$@
453 $$(hide) mkdir -p $$(dir $$@)
454 $$(hide) echo "<html><head>" > $$@
455 $$(hide) echo "<style type=\"text/css\">" >> $$@
456 $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@
457 $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@
458 $$(hide) echo ".label { font-weight: bold; }" >> $$@
459 $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@
460 $$(hide) echo "</style>" >> $$@
461 $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@
462 $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \
463 >> $$@
464 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
465 cat $$$$hashfile | sort | \
466 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: <a name=\"\1\"></a>:" >> \
467 $$@; \
468 echo "<tr><td class=\"same-license\">" >> $$@; \
469 echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \
470 echo "<div class=\"file-list\">" >> $$@; \
471 cat $$$$hashfile | sort | \
472 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1<br/>:" >> $$@; \
473 echo "</div><!-- file-list -->" >> $$@; \
474 echo >> $$@; \
475 orig=$$$$(head -n 1 $$$$hashfile); \
476 echo "<pre class=\"license-text\">" >> $$@; \
477 cat $$$$orig | sed -e "s/\&/\&amp;/g" | sed -e "s/</\&lt;/g" \
478 | sed -e "s/>/\&gt;/g" >> $$@; \
479 echo "</pre><!-- license-text -->" >> $$@; \
480 echo "</td></tr><!-- same-license -->" >> $$@; \
481 echo >> $$@; \
482 echo >> $$@; \
483 echo >> $$@; \
484 done
485 $$(hide) echo "</table>" >> $$@
486 $$(hide) echo "</body></html>" >> $$@
487notice_files: $(1) $(2)
488endef
489
490# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
491# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
492# the src subdirectory.
493
494target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
495target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
496target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
497tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
498tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
499
500kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
501
502$(eval $(call combine-notice-files, \
503 $(target_notice_file_txt), \
504 $(target_notice_file_html), \
505 "Notices for files contained in the filesystem images in this directory:", \
506 $(TARGET_OUT_NOTICE_FILES), \
507 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file)))
508
509$(eval $(call combine-notice-files, \
510 $(tools_notice_file_txt), \
511 $(tools_notice_file_html), \
512 "Notices for files contained in the tools directory:", \
513 $(HOST_OUT_NOTICE_FILES), \
514 $(ALL_DEFAULT_INSTALLED_MODULES)))
515
516# Install the html file at /system/etc/NOTICE.html.gz.
517# This is not ideal, but this is very late in the game, after a lot of
518# the module processing has already been done -- in fact, we used the
519# fact that all that has been done to get the list of modules that we
520# need notice files for.
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700521$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
Doug Zongker8678df42009-06-15 14:30:14 -0700522 $(hide) $(MINIGZIP) -9 < $< > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800523installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
524$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
525 $(copy-file-to-target)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700526
527# if we've been run my mm, mmm, etc, don't reinstall this every time
528ifeq ($(ONE_SHOT_MAKEFILE),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800529ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700530endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800531
532# The kernel isn't really a module, so to get its module file in there, we
533# make the target NOTICE files depend on this particular file too, which will
534# then be in the right directory for the find in combine-notice-files to work.
535$(kernel_notice_file): \
536 prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \
537 | $(ACP)
538 @echo Copying: $@
539 $(hide) mkdir -p $(dir $@)
540 $(hide) $(ACP) $< $@
541
542
Doug Zongker8678df42009-06-15 14:30:14 -0700543# -----------------------------------------------------------------
544# Build a keystore with the authorized keys in it, used to verify the
545# authenticity of downloaded OTA packages.
546#
547# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
548# before the rules that use that variable to build the image.
549ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
550$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
Doug Zongker37c0e272009-06-15 15:36:16 -0700551$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
Doug Zongker8678df42009-06-15 14:30:14 -0700552 $(hide) rm -f $@
553 $(hide) mkdir -p $(dir $@)
Doug Zongker37c0e272009-06-15 15:36:16 -0700554 $(hide) zip -qj $@ $<
Doug Zongker8678df42009-06-15 14:30:14 -0700555
556.PHONY: otacerts
557otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
558
559
The Android Open Source Project88b60792009-03-03 19:28:42 -0800560# #################################################################
561# Targets for user images
562# #################################################################
563
Ying Wang933abf12010-06-16 14:31:34 -0700564INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800565ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -0700566INTERNAL_USERIMAGES_USE_EXT := true
567INTERNAL_USERIMAGES_EXT_VARIANT := ext2
568else
569ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
570INTERNAL_USERIMAGES_USE_EXT := true
571INTERNAL_USERIMAGES_EXT_VARIANT := ext3
572else
573ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
574INTERNAL_USERIMAGES_USE_EXT := true
575INTERNAL_USERIMAGES_EXT_VARIANT := ext4
576endif
577endif
578endif
579
Ying Wang542903a2010-11-17 15:40:38 -0800580ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
581 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
582endif
583
Colin Cross0a7b2c52010-05-07 02:23:59 -0700584ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
Ying Wang542903a2010-11-17 15:40:38 -0800585INTERNAL_USERIMAGES_DEPS := $(MKEXTUSERIMG) $(MAKE_EXT4FS)
Ying Wang933abf12010-06-16 14:31:34 -0700586INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
587
Ying Wangc79f4da2010-06-16 14:58:50 -0700588# $(1): src directory
589# $(2): output file
Ying Wang026f1452010-09-27 17:49:03 -0700590# $(3): mount point
Ying Wangc79f4da2010-06-16 14:58:50 -0700591# $(4): ext variant (ext2, ext3, ext4)
Colin Crosse0a40212010-08-03 14:43:34 -0700592# $(5): size of the partition
Ying Wangc79f4da2010-06-16 14:58:50 -0700593define build-userimage-ext-target
594 @mkdir -p $(dir $(2))
Ying Wang1b5f1dc2011-02-17 15:44:45 -0800595 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Ying Wang542903a2010-11-17 15:40:38 -0800596 $(MKEXTUSERIMG) $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG) $(1) $(2) $(4) $(3) $(5)
Ying Wangc79f4da2010-06-16 14:58:50 -0700597endef
The Android Open Source Project88b60792009-03-03 19:28:42 -0800598else
Colin Cross144b0282010-05-10 13:04:47 -0700599INTERNAL_USERIMAGES_DEPS := $(MKYAFFS2)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800600endif
601
602# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -0700603# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700604
605# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
Brian Swetland630b7d32009-08-07 18:09:44 -0700606ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID)))
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700607
Doug Zongker4647f122009-07-02 09:00:54 -0700608INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
609
610recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
611recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
612recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
613recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
614recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
615recovery_resources_common := $(call include-path-for, recovery)/res
616recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))
617recovery_resource_deps := $(shell find $(recovery_resources_common) \
618 $(recovery_resources_private) -type f)
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700619recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Doug Zongker4647f122009-07-02 09:00:54 -0700620
621ifeq ($(recovery_resources_private),)
622 $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE))
623endif
624
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700625ifeq ($(recovery_fstab),)
626 $(info No recovery.fstab for TARGET_DEVICE $(TARGET_DEVICE))
627endif
628
Doug Zongker4647f122009-07-02 09:00:54 -0700629INTERNAL_RECOVERYIMAGE_ARGS := \
630 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
631 --kernel $(recovery_kernel) \
632 --ramdisk $(recovery_ramdisk)
633
634# Assumes this has already been stripped
635ifdef BOARD_KERNEL_CMDLINE
636 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
637endif
638ifdef BOARD_KERNEL_BASE
639 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
640endif
Ying Wang4de6b5b2010-08-25 14:29:34 -0700641BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
642ifdef BOARD_KERNEL_PAGESIZE
643 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
644endif
Doug Zongker4647f122009-07-02 09:00:54 -0700645
646# Keys authorized to sign OTA packages this build will accept. The
647# build always uses test-keys for this; release packaging tools will
648# substitute other keys for this one.
649OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem
650
651# Generate a file containing the keys that will be read by the
652# recovery binary.
653RECOVERY_INSTALL_OTA_KEYS := \
654 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys
655DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
656$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -0700657$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Doug Zongkere121d6a2011-02-01 14:13:52 -0800658$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
659 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"
Doug Zongker4647f122009-07-02 09:00:54 -0700660 @rm -rf $@
661 @mkdir -p $(dir $@)
Doug Zongkere121d6a2011-02-01 14:13:52 -0800662 java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
Doug Zongker4647f122009-07-02 09:00:54 -0700663
664$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
665 $(INSTALLED_RAMDISK_TARGET) \
666 $(INSTALLED_BOOTIMAGE_TARGET) \
667 $(recovery_binary) \
668 $(recovery_initrc) $(recovery_kernel) \
669 $(INSTALLED_2NDBOOTLOADER_TARGET) \
670 $(recovery_build_prop) $(recovery_resource_deps) \
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700671 $(recovery_fstab) \
Doug Zongker4647f122009-07-02 09:00:54 -0700672 $(RECOVERY_INSTALL_OTA_KEYS)
673 @echo ----- Making recovery image ------
674 rm -rf $(TARGET_RECOVERY_OUT)
675 mkdir -p $(TARGET_RECOVERY_OUT)
676 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)
677 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc
678 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp
679 echo Copying baseline ramdisk...
680 cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
Doug Zongkerb4c7d322010-07-01 15:30:11 -0700681 rm $(TARGET_RECOVERY_ROOT_OUT)/init*.rc
Doug Zongker4647f122009-07-02 09:00:54 -0700682 echo Modifying ramdisk contents...
683 cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
684 cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
685 cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/
686 $(foreach item,$(recovery_resources_private), \
687 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700688 $(foreach item,$(recovery_fstab), \
689 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
Doug Zongker4647f122009-07-02 09:00:54 -0700690 cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
691 cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
692 > $(TARGET_RECOVERY_ROOT_OUT)/default.prop
693 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
694 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
695 @echo ----- Made recovery image -------- $@
Doug Zongkered96e882009-08-26 09:37:07 -0700696 $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
Doug Zongker4647f122009-07-02 09:00:54 -0700697
698else
699INSTALLED_RECOVERYIMAGE_TARGET :=
700endif
701
702.PHONY: recoveryimage
703recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET)
704
Dima Zavin11818982010-02-05 13:34:34 -0800705ifneq ($(BOARD_NAND_PAGE_SIZE),)
706mkyaffs2_extra_flags := -c $(BOARD_NAND_PAGE_SIZE)
707else
708mkyaffs2_extra_flags :=
Lars Svensson9cb8c282010-12-06 15:24:58 +0100709BOARD_NAND_PAGE_SIZE := 2048
Dima Zavin11818982010-02-05 13:34:34 -0800710endif
711
Naseer Ahmed53871882010-08-06 12:19:29 -0700712ifneq ($(BOARD_NAND_SPARE_SIZE),)
713mkyaffs2_extra_flags += -s $(BOARD_NAND_SPARE_SIZE)
Lars Svensson9cb8c282010-12-06 15:24:58 +0100714else
715BOARD_NAND_SPARE_SIZE := 64
Naseer Ahmed53871882010-08-06 12:19:29 -0700716endif
717
Doug Zongker4647f122009-07-02 09:00:54 -0700718# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -0700719# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -0800720#
Ying Wang02352372010-09-27 10:37:25 -0700721systemimage_intermediates := \
722 $(call intermediates-dir-for,PACKAGING,systemimage)
723BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
The Android Open Source Project88b60792009-03-03 19:28:42 -0800724
725INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
726 $(ALL_PREBUILT) \
727 $(ALL_COPIED_HEADERS) \
728 $(ALL_GENERATED_SOURCES) \
729 $(ALL_DEFAULT_INSTALLED_MODULES))
730
Colin Cross0a7b2c52010-05-07 02:23:59 -0700731ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
732## generate an ext image
The Android Open Source Project88b60792009-03-03 19:28:42 -0800733# $(1): output file
734define build-systemimage-target
735 @echo "Target system fs image: $(1)"
Colin Crosse0a40212010-08-03 14:43:34 -0700736 $(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 -0800737endef
738
Colin Cross0a7b2c52010-05-07 02:23:59 -0700739else # INTERNAL_USERIMAGES_USE_EXT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800740
741## generate a yaffs2 image
742# $(1): output file
743define build-systemimage-target
744 @echo "Target system fs image: $(1)"
745 @mkdir -p $(dir $(1))
Dima Zavin11818982010-02-05 13:34:34 -0800746 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800747endef
Colin Cross0a7b2c52010-05-07 02:23:59 -0700748endif # INTERNAL_USERIMAGES_USE_EXT
The Android Open Source Project88b60792009-03-03 19:28:42 -0800749
Ying Wang02352372010-09-27 10:37:25 -0700750$(BUILT_SYSTEMIMAGE): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800751 $(call build-systemimage-target,$@)
752
The Android Open Source Project88b60792009-03-03 19:28:42 -0800753INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -0700754SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800755
Doug Zongker73ef8252009-07-23 15:12:53 -0700756# The system partition needs room for the recovery image as well. We
757# now store the recovery image as a binary patch using the boot image
758# as the source (since they are very similar). Generate the patch so
759# we can see how big it's going to be, and include that in the system
760# image size check calculation.
Sriram Raman1e96ac82009-07-24 13:52:32 -0700761ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Doug Zongker73ef8252009-07-23 15:12:53 -0700762intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
763RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
764$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \
765 $(INSTALLED_BOOTIMAGE_TARGET) \
Doug Zongker22bc5172009-07-23 18:27:43 -0700766 $(HOST_OUT_EXECUTABLES)/imgdiff \
767 $(HOST_OUT_EXECUTABLES)/bsdiff
Doug Zongker73ef8252009-07-23 15:12:53 -0700768 @echo "Construct recovery from boot"
769 mkdir -p $(dir $@)
Doug Zongkerb003d892009-07-23 18:48:38 -0700770 PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Sriram Raman1e96ac82009-07-24 13:52:32 -0700771endif
772
Doug Zongker73ef8252009-07-23 15:12:53 -0700773
774$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800775 @echo "Install system fs image: $@"
776 $(copy-file-to-target)
Doug Zongkered96e882009-08-26 09:37:07 -0700777 $(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 -0800778
779systemimage: $(INSTALLED_SYSTEMIMAGE)
780
781.PHONY: systemimage-nodeps snod
782systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -0700783 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800784 @echo "make $@: ignoring dependencies"
785 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
Doug Zongkered96e882009-08-26 09:37:07 -0700786 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800787
788#######
789## system tarball
790define build-systemtarball-target
791 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
792 $(MKTARBALL) $(FS_GET_STATS) \
793 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
794 $(INSTALLED_SYSTEMTARBALL_TARGET)
795endef
796
Bruce Beare69ef5ce2010-06-11 12:05:57 -0700797ifndef SYSTEM_TARBALL_FORMAT
798 SYSTEM_TARBALL_FORMAT := bz2
799endif
800
The Android Open Source Project88b60792009-03-03 19:28:42 -0800801system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -0700802INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800803$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
804$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
805 $(build-systemtarball-target)
806
807.PHONY: systemtarball-nodeps
808systemtarball-nodeps: $(FS_GET_STATS) \
809 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
810 $(build-systemtarball-target)
811
812.PHONY: stnod
813stnod: systemtarball-nodeps
814
815
Bruce Beare52aac202010-06-04 15:24:49 -0700816#######
817## boot tarball
818define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -0700819 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -0700820 $(hide) mkdir -p $(PRODUCT_OUT)/boot
821 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
822 $(hide) echo $(BOARD_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
823 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
824 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
825 $(INSTALLED_BOOTTARBALL_TARGET)
826endef
827
828ifndef BOOT_TARBALL_FORMAT
829 BOOT_TARBALL_FORMAT := bz2
830endif
831
832boot_tar := $(PRODUCT_OUT)/boot.tar
833INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
834$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
835$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
836 $(build-boottarball-target)
837
838.PHONY: boottarball-nodeps btnod
839boottarball-nodeps btnod: $(FS_GET_STATS) \
840 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
841 $(build-boottarball-target)
842
843
The Android Open Source Project88b60792009-03-03 19:28:42 -0800844# -----------------------------------------------------------------
845# data partition image
846INTERNAL_USERDATAIMAGE_FILES := \
847 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
848
Colin Cross0a7b2c52010-05-07 02:23:59 -0700849ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800850## Generate an ext2 image
851define build-userdataimage-target
852 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
853 @mkdir -p $(TARGET_OUT_DATA)
Ying Wang026f1452010-09-27 17:49:03 -0700854 $(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 -0700855 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800856endef
857
Colin Cross0a7b2c52010-05-07 02:23:59 -0700858else # INTERNAL_USERIMAGES_USE_EXT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800859
860## Generate a yaffs2 image
861define build-userdataimage-target
862 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
863 @mkdir -p $(TARGET_OUT_DATA)
Dima Zavin11818982010-02-05 13:34:34 -0800864 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
Doug Zongkered96e882009-08-26 09:37:07 -0700865 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800866endef
Colin Cross0a7b2c52010-05-07 02:23:59 -0700867endif # INTERNAL_USERIMAGES_USE_EXT
The Android Open Source Project88b60792009-03-03 19:28:42 -0800868
Joe Onorato64d85d02009-04-09 19:31:12 -0700869BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
870
871# We just build this directly to the install location.
872INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Colin Cross144b0282010-05-10 13:04:47 -0700873$(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800874 $(INTERNAL_USERDATAIMAGE_FILES)
875 $(build-userdataimage-target)
876
877.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -0700878userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800879 $(build-userdataimage-target)
880
881#######
882## data partition tarball
883define build-userdatatarball-target
884 $(call pretty,"Target userdata fs tarball: " \
885 "$(INSTALLED_USERDATATARBALL_TARGET)")
886 $(MKTARBALL) $(FS_GET_STATS) \
887 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
888 $(INSTALLED_USERDATATARBALL_TARGET)
889endef
890
891userdata_tar := $(PRODUCT_OUT)/userdata.tar
892INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
893$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
894$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
895 $(build-userdatatarball-target)
896
897.PHONY: userdatatarball-nodeps
898userdatatarball-nodeps: $(FS_GET_STATS)
899 $(build-userdatatarball-target)
900
901
The Android Open Source Project88b60792009-03-03 19:28:42 -0800902# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800903# bring in the installer image generation defines if necessary
904ifeq ($(TARGET_USE_DISKINSTALLER),true)
905include bootable/diskinstaller/config.mk
906endif
907
908# -----------------------------------------------------------------
Doug Zongker8678df42009-06-15 14:30:14 -0700909# host tools needed to build OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -0800910
Ying Wang06898662010-06-17 17:52:18 -0700911OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
Doug Zongker8678df42009-06-15 14:30:14 -0700912 $(HOST_OUT_EXECUTABLES)/mkbootfs \
913 $(HOST_OUT_EXECUTABLES)/mkbootimg \
914 $(HOST_OUT_EXECUTABLES)/fs_config \
915 $(HOST_OUT_EXECUTABLES)/mkyaffs2image \
916 $(HOST_OUT_EXECUTABLES)/zipalign \
917 $(HOST_OUT_EXECUTABLES)/aapt \
918 $(HOST_OUT_EXECUTABLES)/bsdiff \
Doug Zongkerc494d7c2009-06-18 08:43:44 -0700919 $(HOST_OUT_EXECUTABLES)/imgdiff \
Doug Zongker8678df42009-06-15 14:30:14 -0700920 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
Ying Wang933abf12010-06-16 14:31:34 -0700921 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
922 $(HOST_OUT_EXECUTABLES)/mkuserimg.sh \
923 $(HOST_OUT_EXECUTABLES)/genext2fs \
924 $(HOST_OUT_EXECUTABLES)/tune2fs \
Sriram Ramanff83c852010-11-30 15:09:19 -0500925 $(HOST_OUT_EXECUTABLES)/e2fsck \
Sriram Ramanc647aec2010-11-29 18:51:20 -0500926 $(HOST_OUT_EXECUTABLES)/make_ext4fs
The Android Open Source Project88b60792009-03-03 19:28:42 -0800927
Ying Wang06898662010-06-17 17:52:18 -0700928.PHONY: otatools
929otatools: $(OTATOOLS)
930
The Android Open Source Project88b60792009-03-03 19:28:42 -0800931# -----------------------------------------------------------------
932# A zip of the directories that map to the target filesystem.
933# This zip can be used to create an OTA package or filesystem image
934# as a post-build step.
935#
936name := $(TARGET_PRODUCT)
937ifeq ($(TARGET_BUILD_TYPE),debug)
938 name := $(name)_debug
939endif
940name := $(name)-target_files-$(FILE_NAME_TAG)
941
942intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
943BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
944$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
945$(BUILT_TARGET_FILES_PACKAGE): \
946 zip_root := $(intermediates)/$(name)
947
948# $(1): Directory to copy
949# $(2): Location to copy it to
950# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
951define package_files-copy-root
952 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
953 mkdir -p $(2) && \
954 $(ACP) -rd $(strip $(1))/* $(2); \
955 fi
956endef
957
958built_ota_tools := \
Doug Zongker17c83cf2009-04-01 15:48:46 -0700959 $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \
Doug Zongker6c770462009-07-22 18:27:31 -0700960 $(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \
Doug Zongkera406c1e2009-06-12 16:57:08 -0700961 $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \
962 $(call intermediates-dir-for,EXECUTABLES,updater)/updater
The Android Open Source Project88b60792009-03-03 19:28:42 -0800963$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
964
Doug Zongkerb1134dd2009-06-17 17:09:40 -0700965$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
966
Doug Zongkerc18736b2009-09-30 09:20:32 -0700967ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
968# default to common dir for device vendor
969$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common
970else
971$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
972endif
973
The Android Open Source Project88b60792009-03-03 19:28:42 -0800974# Depending on the various images guarantees that the underlying
975# directories are up-to-date.
976$(BUILT_TARGET_FILES_PACKAGE): \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800977 $(INSTALLED_BOOTIMAGE_TARGET) \
978 $(INSTALLED_RADIOIMAGE_TARGET) \
979 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Doug Zongker4647f122009-07-02 09:00:54 -0700980 $(INSTALLED_SYSTEMIMAGE) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800981 $(INSTALLED_USERDATAIMAGE_TARGET) \
982 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800983 $(built_ota_tools) \
984 $(APKCERTS_FILE) \
Doug Zongker283e2a12010-03-15 17:52:32 -0700985 $(HOST_OUT_EXECUTABLES)/fs_config \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800986 | $(ACP)
987 @echo "Package target files: $@"
988 $(hide) rm -rf $@ $(zip_root)
989 $(hide) mkdir -p $(dir $@) $(zip_root)
990 @# Components of the recovery image
991 $(hide) mkdir -p $(zip_root)/RECOVERY
992 $(hide) $(call package_files-copy-root, \
993 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
994ifdef INSTALLED_KERNEL_TARGET
995 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
996endif
997ifdef INSTALLED_2NDBOOTLOADER_TARGET
998 $(hide) $(ACP) \
999 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
1000endif
1001ifdef BOARD_KERNEL_CMDLINE
1002 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
1003endif
Doug Zongker38a649f2009-06-17 09:07:09 -07001004ifdef BOARD_KERNEL_BASE
1005 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
1006endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001007ifdef BOARD_KERNEL_PAGESIZE
1008 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize
1009endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001010 @# Components of the boot image
1011 $(hide) mkdir -p $(zip_root)/BOOT
1012 $(hide) $(call package_files-copy-root, \
1013 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
1014ifdef INSTALLED_KERNEL_TARGET
1015 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
1016endif
1017ifdef INSTALLED_2NDBOOTLOADER_TARGET
1018 $(hide) $(ACP) \
1019 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
1020endif
1021ifdef BOARD_KERNEL_CMDLINE
1022 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
1023endif
Doug Zongker38a649f2009-06-17 09:07:09 -07001024ifdef BOARD_KERNEL_BASE
1025 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
1026endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001027ifdef BOARD_KERNEL_PAGESIZE
1028 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
1029endif
Doug Zongkere01100c2009-06-19 17:12:18 -07001030 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
1031 mkdir -p $(zip_root)/RADIO; \
1032 $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001033 @# Contents of the system image
1034 $(hide) $(call package_files-copy-root, \
1035 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
1036 @# Contents of the data image
1037 $(hide) $(call package_files-copy-root, \
1038 $(TARGET_OUT_DATA),$(zip_root)/DATA)
1039 @# Extra contents of the OTA package
1040 $(hide) mkdir -p $(zip_root)/OTA/bin
The Android Open Source Project88b60792009-03-03 19:28:42 -08001041 $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
1042 $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Doug Zongker8678df42009-06-15 14:30:14 -07001043 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08001044 @# build them.
1045 $(hide) mkdir -p $(zip_root)/META
1046 $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Doug Zongker17c83cf2009-04-01 15:48:46 -07001047 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Doug Zongker37974732010-09-16 17:44:38 -07001048 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001049ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07001050 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001051endif
1052ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001053 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001054endif
1055ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001056 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001057endif
1058ifdef BOARD_SYSTEMIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001059 $(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001060endif
1061ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001062 $(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001063endif
Doug Zongker37974732010-09-16 17:44:38 -07001064 $(hide) echo "tool_extensions=$(tool_extensions)" >> $(zip_root)/META/misc_info.txt
Ying Wangd421f572010-08-25 20:39:41 -07001065ifdef mkyaffs2_extra_flags
Doug Zongker37974732010-09-16 17:44:38 -07001066 $(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(zip_root)/META/misc_info.txt
Ying Wangd421f572010-08-25 20:39:41 -07001067endif
Ying Wangc5a07ce2010-11-17 17:45:36 -08001068ifdef INTERNAL_USERIMAGES_SPARSE_EXT_FLAG
1069 $(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(zip_root)/META/misc_info.txt
1070endif
Doug Zongker5d4808d2011-03-16 07:49:13 -07001071ifdef PRODUCT_EXTRA_RECOVERY_KEYS
1072 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08001073endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001074 @# Zip everything up, preserving symlinks
1075 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
Doug Zongker283e2a12010-03-15 17:52:32 -07001076 @# Run fs_config on all the system files in the zip, and save the output
1077 $(hide) zipinfo -1 $@ | awk -F/ 'BEGIN { OFS="/" } /^SYSTEM\// {$$1 = "system"; print}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/filesystem_config.txt
1078 $(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/filesystem_config.txt)
1079
The Android Open Source Project88b60792009-03-03 19:28:42 -08001080
1081target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
1082
Doug Zongker367910f2009-06-15 18:56:51 -07001083
1084ifneq ($(TARGET_SIMULATOR),true)
1085ifneq ($(TARGET_PRODUCT),sdk)
Ying Wang279f3082011-02-09 12:26:42 -08001086ifeq ($(filter generic%,$(TARGET_DEVICE)),)
Ying Wangfb0a3472010-08-25 16:06:06 -07001087ifneq ($(TARGET_NO_KERNEL),true)
Doug Zongker367910f2009-06-15 18:56:51 -07001088
Ying Wang09a00a62010-10-20 14:01:09 -07001089# -----------------------------------------------------------------
1090# OTA update package
1091
Doug Zongker8678df42009-06-15 14:30:14 -07001092name := $(TARGET_PRODUCT)
1093ifeq ($(TARGET_BUILD_TYPE),debug)
1094 name := $(name)_debug
1095endif
1096name := $(name)-ota-$(FILE_NAME_TAG)
1097
1098INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1099
1100$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
1101
Ying Wang06898662010-06-17 17:52:18 -07001102$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
Doug Zongker8678df42009-06-15 14:30:14 -07001103 @echo "Package OTA: $@"
Ying Wang68bb6512010-08-25 15:23:21 -07001104 $(hide) ./build/tools/releasetools/ota_from_target_files -v \
Doug Zongker602a84e2009-06-18 08:35:12 -07001105 -p $(HOST_OUT) \
Doug Zongker8678df42009-06-15 14:30:14 -07001106 -k $(KEY_CERT_PAIR) \
1107 $(BUILT_TARGET_FILES_PACKAGE) $@
1108
1109.PHONY: otapackage
1110otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
1111
Ying Wang09a00a62010-10-20 14:01:09 -07001112# -----------------------------------------------------------------
1113# The update package
1114
1115name := $(TARGET_PRODUCT)
1116ifeq ($(TARGET_BUILD_TYPE),debug)
1117 name := $(name)_debug
1118endif
1119name := $(name)-img-$(FILE_NAME_TAG)
1120
1121INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1122
1123ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
1124# default to common dir for device vendor
1125$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common
1126else
1127$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
1128endif
1129
1130$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
1131 @echo "Package: $@"
1132 $(hide) ./build/tools/releasetools/img_from_target_files -v \
1133 -s $(extensions) \
1134 -p $(HOST_OUT) \
1135 $(BUILT_TARGET_FILES_PACKAGE) $@
1136
1137.PHONY: updatepackage
1138updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
1139
Ying Wangfb0a3472010-08-25 16:06:06 -07001140endif # TARGET_NO_KERNEL != true
Ying Wang279f3082011-02-09 12:26:42 -08001141endif # TARGET_DEVICE != generic*
Doug Zongker367910f2009-06-15 18:56:51 -07001142endif # TARGET_PRODUCT != sdk
1143endif # TARGET_SIMULATOR != true
Doug Zongker8678df42009-06-15 14:30:14 -07001144
1145# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08001146# installed file list
1147# Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it
1148# gets the DexOpt one if we're doing that.
1149INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
1150$(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE)
1151 @echo Installed file list: $@
1152 @mkdir -p $(dir $@)
1153 @rm -f $@
1154 $(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@
1155
1156.PHONY: installed-file-list
1157installed-file-list: $(INSTALLED_FILES_FILE)
Raphaelc4d47312011-02-15 16:09:36 -08001158ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),)
1159$(call dist-for-goals, sdk win_sdk, $(INSTALLED_FILES_FILE))
Ying Wanga37a2cb2010-04-28 12:59:51 -07001160endif
1161ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
Joe Onorato03fbe402009-04-13 08:31:16 -07001162$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wanga37a2cb2010-04-28 12:59:51 -07001163endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001164
1165# -----------------------------------------------------------------
1166# A zip of the tests that are built when running "make tests".
1167# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
1168# only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
1169#
1170name := $(TARGET_PRODUCT)
1171ifeq ($(TARGET_BUILD_TYPE),debug)
1172 name := $(name)_debug
1173endif
1174name := $(name)-tests-$(FILE_NAME_TAG)
1175
1176intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
1177BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
1178$(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
1179$(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
1180
1181# Depending on the images guarantees that the underlying
1182# directories are up-to-date.
1183$(BUILT_TESTS_ZIP_PACKAGE): \
1184 $(BUILT_SYSTEMIMAGE) \
1185 $(INSTALLED_USERDATAIMAGE_TARGET) \
1186 | $(ACP)
1187 @echo "Package test files: $@"
1188 $(hide) rm -rf $@ $(zip_root)
1189 $(hide) mkdir -p $(dir $@) $(zip_root)
1190 @# Some parts of the system image
1191 $(hide) $(call package_files-copy-root, \
1192 $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin)
1193 $(hide) $(call package_files-copy-root, \
1194 $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib)
1195 $(hide) $(call package_files-copy-root, \
1196 $(SYSTEMIMAGE_SOURCE_DIR)/framework, \
1197 $(zip_root)/SYSTEM/framework)
1198 $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM
1199 @# Contents of the data image
1200 $(hide) $(call package_files-copy-root, \
1201 $(TARGET_OUT_DATA),$(zip_root)/DATA)
1202 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
1203
Ying Wang9c762552010-09-10 14:39:33 -07001204.PHONY: tests-zip-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08001205tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
1206
Ying Wangdb2cb632010-09-14 16:07:56 -07001207# Target needed by tests build
1208.PHONY: tests-build-target
1209tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE) \
1210 $(BUILT_USERDATAIMAGE_TARGET)
1211
1212ifneq (,$(filter $(MAKECMDGOALS),tests-build-target))
1213 $(call dist-for-goals, tests-build-target, \
1214 $(BUILT_TESTS_ZIP_PACKAGE) \
1215 $(BUILT_USERDATAIMAGE_TARGET))
Ying Wang9c762552010-09-10 14:39:33 -07001216endif
1217
The Android Open Source Project88b60792009-03-03 19:28:42 -08001218# -----------------------------------------------------------------
1219# A zip of the symbols directory. Keep the full paths to make it
1220# more obvious where these files came from.
1221#
1222name := $(TARGET_PRODUCT)
1223ifeq ($(TARGET_BUILD_TYPE),debug)
1224 name := $(name)_debug
1225endif
1226name := $(name)-symbols-$(FILE_NAME_TAG)
1227
1228SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
1229$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET)
1230 @echo "Package symbols: $@"
1231 $(hide) rm -rf $@
1232 $(hide) mkdir -p $(dir $@)
1233 $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
1234
1235# -----------------------------------------------------------------
1236# A zip of the Android Apps. Not keeping full path so that we don't
1237# include product names when distributing
1238#
1239name := $(TARGET_PRODUCT)
1240ifeq ($(TARGET_BUILD_TYPE),debug)
1241 name := $(name)_debug
1242endif
1243name := $(name)-apps-$(FILE_NAME_TAG)
1244
1245APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
1246$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
1247 @echo "Package apps: $@"
1248 $(hide) rm -rf $@
1249 $(hide) mkdir -p $(dir $@)
1250 $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
1251
Guang Zhu0198d6e2010-04-23 11:54:37 -07001252
1253#------------------------------------------------------------------
1254# A zip of emma code coverage meta files. Generated for fully emma
1255# instrumented build.
1256#
1257EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip
1258$(EMMA_META_ZIP): $(INSTALLED_SYSTEMIMAGE)
1259 @echo "Collecting Emma coverage meta files."
1260 $(hide) find $(TARGET_COMMON_OUT_ROOT) -name "coverage.em" | \
1261 zip -@ -q $@
1262
The Android Open Source Project88b60792009-03-03 19:28:42 -08001263endif # TARGET_SIMULATOR != true
1264
1265# -----------------------------------------------------------------
1266# dalvik something
1267.PHONY: dalvikfiles
1268dalvikfiles: $(INTERNAL_DALVIK_MODULES)
1269
1270# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08001271# The emulator package
1272
1273ifneq ($(TARGET_SIMULATOR),true)
1274
1275INTERNAL_EMULATOR_PACKAGE_FILES += \
1276 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
1277 prebuilt/android-arm/kernel/kernel-qemu \
1278 $(INSTALLED_RAMDISK_TARGET) \
1279 $(INSTALLED_SYSTEMIMAGE) \
1280 $(INSTALLED_USERDATAIMAGE_TARGET)
1281
1282name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
1283
1284INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1285
1286$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
1287 @echo "Package: $@"
1288 $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
1289
1290endif
1291
1292# -----------------------------------------------------------------
1293# The pdk package (Platform Development Kit)
1294
1295ifneq (,$(filter pdk,$(MAKECMDGOALS)))
1296 include development/pdk/Pdk.mk
1297endif
1298
1299# -----------------------------------------------------------------
1300# The SDK
1301
1302ifneq ($(TARGET_SIMULATOR),true)
1303
1304# The SDK includes host-specific components, so it belongs under HOST_OUT.
1305sdk_dir := $(HOST_OUT)/sdk
1306
1307# Build a name that looks like:
1308#
1309# linux-x86 --> android-sdk_12345_linux-x86
1310# darwin-x86 --> android-sdk_12345_mac-x86
1311# windows-x86 --> android-sdk_12345_windows
1312#
1313sdk_name := android-sdk_$(FILE_NAME_TAG)
1314ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07001315 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08001316else
Joe Onorato03fbe402009-04-13 08:31:16 -07001317 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001318endif
1319ifneq ($(HOST_OS),windows)
Joe Onorato03fbe402009-04-13 08:31:16 -07001320 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001321endif
Joe Onorato03fbe402009-04-13 08:31:16 -07001322sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001323
1324sdk_dep_file := $(sdk_dir)/sdk_deps.mk
1325
1326ATREE_FILES :=
1327-include $(sdk_dep_file)
1328
1329# if we don't have a real list, then use "everything"
1330ifeq ($(strip $(ATREE_FILES)),)
1331ATREE_FILES := \
1332 $(ALL_PREBUILT) \
1333 $(ALL_COPIED_HEADERS) \
1334 $(ALL_GENERATED_SOURCES) \
1335 $(ALL_DEFAULT_INSTALLED_MODULES) \
1336 $(INSTALLED_RAMDISK_TARGET) \
1337 $(ALL_DOCS) \
1338 $(ALL_SDK_FILES)
1339endif
1340
1341atree_dir := development/build
1342
1343sdk_atree_files := \
1344 $(atree_dir)/sdk.exclude.atree \
1345 $(atree_dir)/sdk.atree \
Xavier Ducrohetffd50872010-09-27 15:51:32 -07001346 $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree \
1347 sdk/build/tools.atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08001348
1349deps := \
1350 $(target_notice_file_txt) \
1351 $(tools_notice_file_txt) \
1352 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07001353 $(SYMBOLS_ZIP) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07001354 $(INSTALLED_SYSTEMIMAGE) \
1355 $(INSTALLED_USERDATAIMAGE_TARGET) \
1356 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001357 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07001358 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001359 $(ATREE_FILES) \
1360 $(atree_dir)/sdk.atree \
Xavier Ducrohetffd50872010-09-27 15:51:32 -07001361 sdk/build/tools.atree \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001362 $(HOST_OUT_EXECUTABLES)/atree \
1363 $(HOST_OUT_EXECUTABLES)/line_endings
1364
1365INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
1366$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
1367$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
1368$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
1369$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
1370
1371# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
1372#
1373#SDK_GNU_ERROR := true
1374
Raphael7a6a9c32011-02-01 13:30:00 -08001375ifeq ($(HOST_OS),darwin)
1376HOST_STRIP_SDK_LLVM := strip
1377else
1378HOST_STRIP_SDK_LLVM := strip --strip-all
1379endif
1380
The Android Open Source Project88b60792009-03-03 19:28:42 -08001381$(INTERNAL_SDK_TARGET): $(deps)
1382 @echo "Package SDK: $@"
1383 $(hide) rm -rf $(PRIVATE_DIR) $@
1384 $(hide) for f in $(target_gnu_MODULES); do \
1385 if [ -f $$f ]; then \
1386 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
1387 including GNU target $$f >&2; \
1388 FAIL=$(SDK_GNU_ERROR); \
1389 fi; \
1390 done; \
1391 if [ $$FAIL ]; then exit 1; fi
1392 $(hide) ( \
1393 $(HOST_OUT_EXECUTABLES)/atree \
1394 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
1395 -m $(PRIVATE_DEP_FILE) \
1396 -I . \
1397 -I $(PRODUCT_OUT) \
1398 -I $(HOST_OUT) \
1399 -I $(TARGET_COMMON_OUT_ROOT) \
1400 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
Raphael Moll7558ad52011-01-05 14:58:17 -08001401 -v "OUT_DIR=$(OUT_DIR)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001402 -o $(PRIVATE_DIR) && \
1403 cp -f $(target_notice_file_txt) \
1404 $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \
1405 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
Xavier Ducrohet4216a8c2011-03-15 13:28:40 -07001406 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
Raphael7a6a9c32011-02-01 13:30:00 -08001407 if [ -f $(PRIVATE_DIR)/platform-tools/llvm-rs-cc ]; then \
1408 $(HOST_STRIP_SDK_LLVM) $(PRIVATE_DIR)/platform-tools/llvm-rs-cc; \
1409 fi && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001410 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
Raphael7a6a9c32011-02-01 13:30:00 -08001411 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001412 chmod -R ug+rwX $(PRIVATE_DIR) && \
1413 cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
1414 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
1415
Raphael3d224a02010-04-16 17:50:09 -07001416
1417# Is a Windows SDK requested? If so, we need some definitions from here
1418# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08001419MAIN_SDK_NAME := $(sdk_name)
1420MAIN_SDK_DIR := $(sdk_dir)
1421MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Raphael3d224a02010-04-16 17:50:09 -07001422ifneq ($(filter win_sdk,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07001423include $(TOPDIR)development/build/tools/windows_sdk.mk
1424endif
1425
The Android Open Source Project88b60792009-03-03 19:28:42 -08001426endif # !simulator
1427
1428# -----------------------------------------------------------------
1429# Findbugs
1430INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
1431INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
1432$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
1433 @echo UnionBugs: $@
1434 $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \
1435 > $@
1436$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
1437 @echo ConvertXmlToText: $@
1438 $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
1439 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
1440
1441# -----------------------------------------------------------------
1442# Findbugs
1443
1444# -----------------------------------------------------------------
1445# These are some additional build tasks that need to be run.
1446include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01001447-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Raphaelc4d47312011-02-15 16:09:36 -08001448
1449# -----------------------------------------------------------------
1450# Create SDK repository packages. Must be done after tasks/* since
1451# we need the addon rules defined.
1452ifneq ($(sdk_repo_goal),)
1453include $(TOPDIR)development/build/tools/sdk_repo.mk
1454endif