blob: 351dd15d09f904ab12f6df0c71f574c8c1bbfd82 [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"
Ying Wang7e8d4422011-06-17 17:05:35 -070019unique_product_copy_files_destinations :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080020$(foreach cf,$(PRODUCT_COPY_FILES), \
Ying Wang462d26b2010-11-02 21:31:47 -070021 $(eval _src := $(call word-colon,1,$(cf))) \
22 $(eval _dest := $(call word-colon,2,$(cf))) \
Ying Wang7e8d4422011-06-17 17:05:35 -070023 $(if $(filter $(unique_product_copy_files_destinations),$(_dest)),, \
Ying Wang462d26b2010-11-02 21:31:47 -070024 $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
25 $(eval $(call copy-one-file,$(_src),$(_fulldest))) \
26 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
Ying Wang7e8d4422011-06-17 17:05:35 -070027 $(eval unique_product_copy_files_destinations += $(_dest))))
28unique_product_copy_files_destinations :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080029
30# -----------------------------------------------------------------
31# docs/index.html
32gen := $(OUT_DOCS)/index.html
33ALL_DOCS += $(gen)
34$(gen): frameworks/base/docs/docs-redirect-index.html
35 @mkdir -p $(dir $@)
36 @cp -f $< $@
37
38# -----------------------------------------------------------------
39# default.prop
40INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
41ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
42ADDITIONAL_DEFAULT_PROPERTIES := \
Ying Wang7e8d4422011-06-17 17:05:35 -070043 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
Mike Lockwood0d23fec2011-06-09 14:54:40 -070044ADDITIONAL_DEFAULT_PROPERTIES += \
Ying Wang7e8d4422011-06-17 17:05:35 -070045 $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
46ADDITIONAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
47 $(ADDITIONAL_DEFAULT_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -080048
49$(INSTALLED_DEFAULT_PROP_TARGET):
50 @echo Target buildinfo: $@
51 @mkdir -p $(dir $@)
52 $(hide) echo "#" > $@; \
53 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
54 echo "#" >> $@;
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -070055 $(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \
56 echo "$(line)" >> $@;)
Joe Onorato9197a482011-06-08 16:04:14 -070057 build/tools/post_process_props.py $@
The Android Open Source Project88b60792009-03-03 19:28:42 -080058
59# -----------------------------------------------------------------
60# build.prop
61INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
62ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
63ADDITIONAL_BUILD_PROPERTIES := \
Ying Wang7e8d4422011-06-17 17:05:35 -070064 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
65ADDITIONAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
66 $(ADDITIONAL_BUILD_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -080067
68# A list of arbitrary tags describing the build configuration.
69# Force ":=" so we can use +=
70BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
71ifeq ($(TARGET_BUILD_TYPE),debug)
72 BUILD_VERSION_TAGS += debug
73endif
74# Apps are always signed with test keys, and may be re-signed in a post-build
75# step. If that happens, the "test-keys" tag will be removed by that step.
76BUILD_VERSION_TAGS += test-keys
The Android Open Source Project88b60792009-03-03 19:28:42 -080077BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
78
79# A human-readable string that descibes this build in detail.
80build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS)
81$(INSTALLED_BUILD_PROP_TARGET): PRIVATE_BUILD_DESC := $(build_desc)
82
83# The string used to uniquely identify this build; used by the OTA server.
84ifeq (,$(strip $(BUILD_FINGERPRINT)))
Doug Zongker135a1202010-09-15 13:02:12 -070085 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 -080086endif
87ifneq ($(words $(BUILD_FINGERPRINT)),1)
88 $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)")
89endif
90
Sriram Raman7b641242009-03-24 22:40:59 -070091# Display parameters shown under Settings -> About Phone
92ifeq ($(TARGET_BUILD_VARIANT),user)
93 # User builds should show:
94 # release build number or branch.buld_number non-release builds
95
96 # Dev. branches should have DISPLAY_BUILD_NUMBER set
97 ifeq "true" "$(DISPLAY_BUILD_NUMBER)"
98 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER)
99 else
100 BUILD_DISPLAY_ID := $(BUILD_ID)
101 endif
102else
103 # Non-user builds should show detailed build information
104 BUILD_DISPLAY_ID := $(build_desc)
105endif
106
Ying Wang77c882f2010-04-27 15:45:35 -0700107# Whether there is default locale set in PRODUCT_PROPERTY_OVERRIDES
Ying Wang38d7f022010-07-21 14:58:42 -0700108product_property_override_locale_language := $(strip \
109 $(patsubst ro.product.locale.language=%,%,\
Ying Wang77c882f2010-04-27 15:45:35 -0700110 $(filter ro.product.locale.language=%,$(PRODUCT_PROPERTY_OVERRIDES))))
Ying Wang38d7f022010-07-21 14:58:42 -0700111product_property_overrides_locale_region := $(strip \
112 $(patsubst ro.product.locale.region=%,%,\
Ying Wang77c882f2010-04-27 15:45:35 -0700113 $(filter ro.product.locale.region=%,$(PRODUCT_PROPERTY_OVERRIDES))))
114
The Android Open Source Project88b60792009-03-03 19:28:42 -0800115# Selects the first locale in the list given as the argument,
116# and splits it into language and region, which each may be
117# empty.
118define default-locale
119$(subst _, , $(firstword $(1)))
120endef
121
122# Selects the first locale in the list given as the argument
Ying Wang77c882f2010-04-27 15:45:35 -0700123# and returns the language (or the region), if it's not set in PRODUCT_PROPERTY_OVERRIDES;
124# Return empty string if it's already set in PRODUCT_PROPERTY_OVERRIDES.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800125define default-locale-language
Ying Wang38d7f022010-07-21 14:58:42 -0700126$(if $(product_property_override_locale_language),,$(word 1, $(call default-locale, $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800127endef
128define default-locale-region
Ying Wang38d7f022010-07-21 14:58:42 -0700129$(if $(product_property_overrides_locale_region),,$(word 2, $(call default-locale, $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800130endef
131
132BUILDINFO_SH := build/tools/buildinfo.sh
Chih-Wei Huang75947ef2010-11-03 18:33:46 +0800133$(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 -0800134 @echo Target buildinfo: $@
135 @mkdir -p $(dir $@)
136 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
137 TARGET_DEVICE="$(TARGET_DEVICE)" \
138 PRODUCT_NAME="$(TARGET_PRODUCT)" \
139 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
140 PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \
141 PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \
Robert Greenwaltfbd10d92009-05-20 13:37:35 -0700142 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800143 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
144 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
145 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
146 BUILD_ID="$(BUILD_ID)" \
147 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
148 BUILD_NUMBER="$(BUILD_NUMBER)" \
149 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
150 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
Dianne Hackborn95378842009-05-08 12:06:17 -0700151 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800152 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
153 TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
154 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \
155 TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
Dianne Hackbornecc70d72009-05-21 15:45:30 -0700156 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
David 'Digit' Turner2edfb712009-11-06 15:12:00 -0800157 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Joe Onorato25939e22010-11-09 08:53:01 -0800158 TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800159 bash $(BUILDINFO_SH) > $@
160 $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \
161 cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \
162 fi
163 $(if $(ADDITIONAL_BUILD_PROPERTIES), \
164 $(hide) echo >> $@; \
165 echo "#" >> $@; \
166 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
167 echo "#" >> $@; )
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -0700168 $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \
169 echo "$(line)" >> $@;)
Joe Onorato9197a482011-06-08 16:04:14 -0700170 $(hide) build/tools/post_process_props.py $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800171
172build_desc :=
173
174# -----------------------------------------------------------------
175# sdk-build.prop
176#
177# There are certain things in build.prop that we don't want to
178# ship with the sdk; remove them.
179
180# This must be a list of entire property keys followed by
181# "=" characters, without any internal spaces.
182sdk_build_prop_remove := \
183 ro.build.user= \
184 ro.build.host= \
185 ro.product.brand= \
186 ro.product.manufacturer= \
187 ro.product.device=
188# TODO: Remove this soon-to-be obsolete property
189sdk_build_prop_remove += ro.build.product=
190INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
191$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
192 @echo SDK buildinfo: $@
193 @mkdir -p $(dir $@)
194 $(hide) grep -v "$(subst $(space),\|,$(strip \
195 $(sdk_build_prop_remove)))" $< > $@.tmp
196 $(hide) for x in $(sdk_build_prop_remove); do \
197 echo "$$x"generic >> $@.tmp; done
198 $(hide) mv $@.tmp $@
199
200# -----------------------------------------------------------------
201# package stats
202PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
203PACKAGES_TO_STAT := \
204 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
205 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
206$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
207 @echo Package stats: $@
208 @mkdir -p $(dir $@)
209 $(hide) rm -f $@
210 $(hide) build/tools/dump-package-stats $^ > $@
211
212.PHONY: package-stats
213package-stats: $(PACKAGE_STATS_FILE)
214
215# -----------------------------------------------------------------
216# Cert-to-package mapping. Used by the post-build signing tools.
217name := $(TARGET_PRODUCT)
218ifeq ($(TARGET_BUILD_TYPE),debug)
219 name := $(name)_debug
220endif
221name := $(name)-apkcerts-$(FILE_NAME_TAG)
222intermediates := \
223 $(call intermediates-dir-for,PACKAGING,apkcerts)
224APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800225# We don't need to really build all the modules.
226# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700227$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800228 @echo APK certs list: $@
229 @mkdir -p $(dir $@)
230 @rm -f $@
231 $(hide) $(foreach p,$(PACKAGES),\
Doug Zongkerf6a53aa2009-12-15 15:06:55 -0800232 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
233 echo 'name="$(p).apk" certificate="EXTERNAL" \
234 private_key=""' >> $@;,\
235 echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
236 private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800237
238.PHONY: apkcerts-list
239apkcerts-list: $(APKCERTS_FILE)
240
Ying Wang15e487a2011-02-15 10:56:18 -0800241ifneq (,$(TARGET_BUILD_APPS))
242 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
243endif
Ying Wangefb21682010-07-23 16:42:13 -0700244
The Android Open Source Project88b60792009-03-03 19:28:42 -0800245# -----------------------------------------------------------------
246# module info file
247ifdef CREATE_MODULE_INFO_FILE
248 MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt
249 $(info Generating $(MODULE_INFO_FILE)...)
250 $(shell rm -f $(MODULE_INFO_FILE))
251 $(foreach m,$(ALL_MODULES), \
252 $(shell echo "NAME=\"$(m)\"" \
253 "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \
254 "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \
255 "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \
256 "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE)))
257endif
258
Doug Zongker8678df42009-06-15 14:30:14 -0700259# -----------------------------------------------------------------
260
261# The test key is used to sign this package, and as the key required
262# for future OTA packages installed by this system. Actual product
263# deliverables will be re-signed by hand. We expect this file to
264# exist with the suffixes ".x509.pem" and ".pk8".
265DEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey
266
267
The Android Open Source Project88b60792009-03-03 19:28:42 -0800268# Rules that need to be present for the simulator, even
269# if they don't do anything.
270.PHONY: systemimage
271systemimage:
272
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800273# -----------------------------------------------------------------
274
275.PHONY: event-log-tags
276
Joe Onoratob7510532010-07-14 10:22:54 -0700277# Produce an event logs tag file for everything we know about, in order
278# to properly allocate numbers. Then produce a file that's filtered
279# for what's going to be installed.
280
281all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
282
283# Include tags from all packages that we know about
284all_event_log_tags_src := \
285 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
286
287$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src)
288$(all_event_log_tags_file): $(all_event_log_tags_src)
289 $(hide) mkdir -p $(dir $@)
290 $(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
291
292
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800293event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800294
Doug Zongkera34fa952011-02-23 12:17:29 -0800295# Include tags from all packages included in this product, plus all
296# tags that are part of the system (ie, not in a vendor/ or device/
297# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800298event_log_tags_src := \
299 $(sort $(foreach m,\
300 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
301 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800302 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
303 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800304
305$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
Joe Onoratob7510532010-07-14 10:22:54 -0700306$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
307$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800308 $(hide) mkdir -p $(dir $@)
Joe Onoratob7510532010-07-14 10:22:54 -0700309 $(hide) build/tools/merge-event-log-tags.py -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800310
311event-log-tags: $(event_log_tags_file)
312
313ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
314
Joe Onoratob7510532010-07-14 10:22:54 -0700315
The Android Open Source Project88b60792009-03-03 19:28:42 -0800316ifneq ($(TARGET_SIMULATOR),true)
317
318# #################################################################
319# Targets for boot/OS images
320# #################################################################
321
322# -----------------------------------------------------------------
323# the ramdisk
324INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
325 $(ALL_PREBUILT) \
326 $(ALL_COPIED_HEADERS) \
327 $(ALL_GENERATED_SOURCES) \
328 $(ALL_DEFAULT_INSTALLED_MODULES))
329
Joe Onorato64d85d02009-04-09 19:31:12 -0700330BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
331
332# We just build this directly to the install location.
333INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700334$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800335 $(call pretty,"Target ram disk: $@")
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700336 $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800337
338
339ifneq ($(strip $(TARGET_NO_KERNEL)),true)
340
341# -----------------------------------------------------------------
342# the boot image, which is a collection of other images.
343INTERNAL_BOOTIMAGE_ARGS := \
344 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
345 --kernel $(INSTALLED_KERNEL_TARGET) \
346 --ramdisk $(INSTALLED_RAMDISK_TARGET)
347
348INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
349
350BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
351ifdef BOARD_KERNEL_CMDLINE
352 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
353endif
354
Dima Zavin1e0847c2009-05-07 19:43:08 -0700355BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
356ifdef BOARD_KERNEL_BASE
357 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
358endif
359
Ying Wangffff0022010-08-23 12:56:25 -0700360BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
361ifdef BOARD_KERNEL_PAGESIZE
362 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
363endif
364
The Android Open Source Project88b60792009-03-03 19:28:42 -0800365INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
366
367ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
368tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg
369INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image)
370INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG)
371$(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES)
372 $(call pretty,"Target boot image: $@")
373 $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
374
375else # TARGET_BOOTIMAGE_USE_EXT2 != true
376
377$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
378 $(call pretty,"Target boot image: $@")
379 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
Doug Zongkered96e882009-08-26 09:37:07 -0700380 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800381endif # TARGET_BOOTIMAGE_USE_EXT2
382
383else # TARGET_NO_KERNEL
384# HACK: The top-level targets depend on the bootimage. Not all targets
385# can produce a bootimage, though, and emulator targets need the ramdisk
386# instead. Fake it out by calling the ramdisk the bootimage.
387# TODO: make the emulator use bootimages, and make mkbootimg accept
388# kernel-less inputs.
389INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
390endif
391
392# -----------------------------------------------------------------
393# NOTICE files
394#
395# This needs to be before the systemimage rules, because it adds to
396# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
397# go into the systemimage.
398
399.PHONY: notice_files
400
401# Create the rule to combine the files into text and html forms
402# $(1) - Plain text output file
403# $(2) - HTML output file
404# $(3) - File title
405# $(4) - Directory to use. Notice files are all $(4)/src. Other
406# directories in there will be used for scratch
407# $(5) - Dependencies for the output files
408#
409# The algorithm here is that we go collect a hash for each of the notice
410# files and write the names of the files that match that hash. Then
411# to generate the real files, we go print out all of the files and their
412# hashes.
413#
414# These rules are fairly complex, so they depend on this makefile so if
415# it changes, they'll run again.
416#
417# TODO: We could clean this up so that we just record the locations of the
418# original notice files instead of making rules to copy them somwehere.
419# Then we could traverse that without quite as much bash drama.
420define combine-notice-files
421$(1) $(2): PRIVATE_MESSAGE := $(3)
422$(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4)
423$(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile
424 @echo Finding NOTICE files: $$@
425 $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash
426 $$(hide) mkdir -p $$(PRIVATE_DIR)/hash
427 $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \
428 hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \
429 hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \
430 echo $$$$file >> $$$$hashfile; \
431 done
432 $$(hide) touch $$@
433$(1): $(4)/hash-timestamp
434 @echo Combining NOTICE files: $$@
435 $$(hide) mkdir -p $$(dir $$@)
436 $$(hide) echo $$(PRIVATE_MESSAGE) > $$@
437 $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \
438 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> $$@
439 $$(hide) echo >> $$@
440 $$(hide) echo >> $$@
441 $$(hide) echo >> $$@
442 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
443 echo "============================================================"\
444 >> $$@; \
445 echo "Notices for file(s):" >> $$@; \
446 cat $$$$hashfile | sort | \
447 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> \
448 $$@; \
449 echo "------------------------------------------------------------"\
450 >> $$@; \
451 echo >> $$@; \
452 orig=$$$$(head -n 1 $$$$hashfile); \
453 cat $$$$orig >> $$@; \
454 echo >> $$@; \
455 echo >> $$@; \
456 echo >> $$@; \
457 done
458$(2): $(4)/hash-timestamp
459 @echo Combining NOTICE files: $$@
460 $$(hide) mkdir -p $$(dir $$@)
461 $$(hide) echo "<html><head>" > $$@
462 $$(hide) echo "<style type=\"text/css\">" >> $$@
463 $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@
464 $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@
465 $$(hide) echo ".label { font-weight: bold; }" >> $$@
466 $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@
467 $$(hide) echo "</style>" >> $$@
468 $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@
469 $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \
470 >> $$@
471 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
472 cat $$$$hashfile | sort | \
473 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: <a name=\"\1\"></a>:" >> \
474 $$@; \
475 echo "<tr><td class=\"same-license\">" >> $$@; \
476 echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \
477 echo "<div class=\"file-list\">" >> $$@; \
478 cat $$$$hashfile | sort | \
479 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1<br/>:" >> $$@; \
480 echo "</div><!-- file-list -->" >> $$@; \
481 echo >> $$@; \
482 orig=$$$$(head -n 1 $$$$hashfile); \
483 echo "<pre class=\"license-text\">" >> $$@; \
484 cat $$$$orig | sed -e "s/\&/\&amp;/g" | sed -e "s/</\&lt;/g" \
485 | sed -e "s/>/\&gt;/g" >> $$@; \
486 echo "</pre><!-- license-text -->" >> $$@; \
487 echo "</td></tr><!-- same-license -->" >> $$@; \
488 echo >> $$@; \
489 echo >> $$@; \
490 echo >> $$@; \
491 done
492 $$(hide) echo "</table>" >> $$@
493 $$(hide) echo "</body></html>" >> $$@
494notice_files: $(1) $(2)
495endef
496
497# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
498# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
499# the src subdirectory.
500
501target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
502target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
503target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
504tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
505tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
506
507kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
508
509$(eval $(call combine-notice-files, \
510 $(target_notice_file_txt), \
511 $(target_notice_file_html), \
512 "Notices for files contained in the filesystem images in this directory:", \
513 $(TARGET_OUT_NOTICE_FILES), \
514 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file)))
515
516$(eval $(call combine-notice-files, \
517 $(tools_notice_file_txt), \
518 $(tools_notice_file_html), \
519 "Notices for files contained in the tools directory:", \
520 $(HOST_OUT_NOTICE_FILES), \
521 $(ALL_DEFAULT_INSTALLED_MODULES)))
522
523# Install the html file at /system/etc/NOTICE.html.gz.
524# This is not ideal, but this is very late in the game, after a lot of
525# the module processing has already been done -- in fact, we used the
526# fact that all that has been done to get the list of modules that we
527# need notice files for.
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700528$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
Doug Zongker8678df42009-06-15 14:30:14 -0700529 $(hide) $(MINIGZIP) -9 < $< > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800530installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
531$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
532 $(copy-file-to-target)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700533
534# if we've been run my mm, mmm, etc, don't reinstall this every time
535ifeq ($(ONE_SHOT_MAKEFILE),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800536ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700537endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800538
539# The kernel isn't really a module, so to get its module file in there, we
540# make the target NOTICE files depend on this particular file too, which will
541# then be in the right directory for the find in combine-notice-files to work.
542$(kernel_notice_file): \
543 prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \
544 | $(ACP)
545 @echo Copying: $@
546 $(hide) mkdir -p $(dir $@)
547 $(hide) $(ACP) $< $@
548
549
Doug Zongker8678df42009-06-15 14:30:14 -0700550# -----------------------------------------------------------------
551# Build a keystore with the authorized keys in it, used to verify the
552# authenticity of downloaded OTA packages.
553#
554# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
555# before the rules that use that variable to build the image.
556ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
557$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
Doug Zongker37c0e272009-06-15 15:36:16 -0700558$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
Doug Zongker8678df42009-06-15 14:30:14 -0700559 $(hide) rm -f $@
560 $(hide) mkdir -p $(dir $@)
Doug Zongker37c0e272009-06-15 15:36:16 -0700561 $(hide) zip -qj $@ $<
Doug Zongker8678df42009-06-15 14:30:14 -0700562
563.PHONY: otacerts
564otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
565
566
The Android Open Source Project88b60792009-03-03 19:28:42 -0800567# #################################################################
568# Targets for user images
569# #################################################################
570
Ying Wang933abf12010-06-16 14:31:34 -0700571INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800572ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -0700573INTERNAL_USERIMAGES_USE_EXT := true
574INTERNAL_USERIMAGES_EXT_VARIANT := ext2
575else
576ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
577INTERNAL_USERIMAGES_USE_EXT := true
578INTERNAL_USERIMAGES_EXT_VARIANT := ext3
579else
580ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
581INTERNAL_USERIMAGES_USE_EXT := true
582INTERNAL_USERIMAGES_EXT_VARIANT := ext4
583endif
584endif
585endif
586
Ying Wang542903a2010-11-17 15:40:38 -0800587ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
588 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
589endif
590
Colin Cross0a7b2c52010-05-07 02:23:59 -0700591ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
Ying Wang542903a2010-11-17 15:40:38 -0800592INTERNAL_USERIMAGES_DEPS := $(MKEXTUSERIMG) $(MAKE_EXT4FS)
Ying Wang933abf12010-06-16 14:31:34 -0700593INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
594
Ying Wangc79f4da2010-06-16 14:58:50 -0700595# $(1): src directory
596# $(2): output file
Ying Wang026f1452010-09-27 17:49:03 -0700597# $(3): mount point
Ying Wangc79f4da2010-06-16 14:58:50 -0700598# $(4): ext variant (ext2, ext3, ext4)
Colin Crosse0a40212010-08-03 14:43:34 -0700599# $(5): size of the partition
Ying Wangc79f4da2010-06-16 14:58:50 -0700600define build-userimage-ext-target
601 @mkdir -p $(dir $(2))
Ying Wang1b5f1dc2011-02-17 15:44:45 -0800602 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Ying Wang542903a2010-11-17 15:40:38 -0800603 $(MKEXTUSERIMG) $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG) $(1) $(2) $(4) $(3) $(5)
Ying Wangc79f4da2010-06-16 14:58:50 -0700604endef
The Android Open Source Project88b60792009-03-03 19:28:42 -0800605else
Colin Cross144b0282010-05-10 13:04:47 -0700606INTERNAL_USERIMAGES_DEPS := $(MKYAFFS2)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800607endif
608
609# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -0700610# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700611
612# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
Brian Swetland630b7d32009-08-07 18:09:44 -0700613ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID)))
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700614
Doug Zongker4647f122009-07-02 09:00:54 -0700615INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
616
617recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
618recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
619recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
620recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
621recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
622recovery_resources_common := $(call include-path-for, recovery)/res
623recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))
624recovery_resource_deps := $(shell find $(recovery_resources_common) \
625 $(recovery_resources_private) -type f)
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700626recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Doug Zongker4647f122009-07-02 09:00:54 -0700627
628ifeq ($(recovery_resources_private),)
629 $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE))
630endif
631
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700632ifeq ($(recovery_fstab),)
633 $(info No recovery.fstab for TARGET_DEVICE $(TARGET_DEVICE))
634endif
635
Doug Zongker4647f122009-07-02 09:00:54 -0700636INTERNAL_RECOVERYIMAGE_ARGS := \
637 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
638 --kernel $(recovery_kernel) \
639 --ramdisk $(recovery_ramdisk)
640
641# Assumes this has already been stripped
642ifdef BOARD_KERNEL_CMDLINE
643 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
644endif
645ifdef BOARD_KERNEL_BASE
646 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
647endif
Ying Wang4de6b5b2010-08-25 14:29:34 -0700648BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
649ifdef BOARD_KERNEL_PAGESIZE
650 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
651endif
Doug Zongker4647f122009-07-02 09:00:54 -0700652
653# Keys authorized to sign OTA packages this build will accept. The
654# build always uses test-keys for this; release packaging tools will
655# substitute other keys for this one.
656OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem
657
658# Generate a file containing the keys that will be read by the
659# recovery binary.
660RECOVERY_INSTALL_OTA_KEYS := \
661 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys
662DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
663$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -0700664$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Doug Zongkere121d6a2011-02-01 14:13:52 -0800665$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
666 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"
Doug Zongker4647f122009-07-02 09:00:54 -0700667 @rm -rf $@
668 @mkdir -p $(dir $@)
Doug Zongkere121d6a2011-02-01 14:13:52 -0800669 java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
Doug Zongker4647f122009-07-02 09:00:54 -0700670
671$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
672 $(INSTALLED_RAMDISK_TARGET) \
673 $(INSTALLED_BOOTIMAGE_TARGET) \
674 $(recovery_binary) \
675 $(recovery_initrc) $(recovery_kernel) \
676 $(INSTALLED_2NDBOOTLOADER_TARGET) \
677 $(recovery_build_prop) $(recovery_resource_deps) \
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700678 $(recovery_fstab) \
Doug Zongker4647f122009-07-02 09:00:54 -0700679 $(RECOVERY_INSTALL_OTA_KEYS)
680 @echo ----- Making recovery image ------
681 rm -rf $(TARGET_RECOVERY_OUT)
682 mkdir -p $(TARGET_RECOVERY_OUT)
683 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)
684 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc
685 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp
686 echo Copying baseline ramdisk...
687 cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
Doug Zongkerb4c7d322010-07-01 15:30:11 -0700688 rm $(TARGET_RECOVERY_ROOT_OUT)/init*.rc
Doug Zongker4647f122009-07-02 09:00:54 -0700689 echo Modifying ramdisk contents...
690 cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
691 cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
692 cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/
693 $(foreach item,$(recovery_resources_private), \
694 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)
Doug Zongker9ce0fb62010-09-20 18:04:41 -0700695 $(foreach item,$(recovery_fstab), \
696 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
Doug Zongker4647f122009-07-02 09:00:54 -0700697 cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
698 cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
699 > $(TARGET_RECOVERY_ROOT_OUT)/default.prop
700 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
701 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
702 @echo ----- Made recovery image -------- $@
Doug Zongkered96e882009-08-26 09:37:07 -0700703 $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
Doug Zongker4647f122009-07-02 09:00:54 -0700704
705else
706INSTALLED_RECOVERYIMAGE_TARGET :=
707endif
708
709.PHONY: recoveryimage
710recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET)
711
Dima Zavin11818982010-02-05 13:34:34 -0800712ifneq ($(BOARD_NAND_PAGE_SIZE),)
713mkyaffs2_extra_flags := -c $(BOARD_NAND_PAGE_SIZE)
714else
715mkyaffs2_extra_flags :=
Lars Svensson9cb8c282010-12-06 15:24:58 +0100716BOARD_NAND_PAGE_SIZE := 2048
Dima Zavin11818982010-02-05 13:34:34 -0800717endif
718
Naseer Ahmed53871882010-08-06 12:19:29 -0700719ifneq ($(BOARD_NAND_SPARE_SIZE),)
720mkyaffs2_extra_flags += -s $(BOARD_NAND_SPARE_SIZE)
Lars Svensson9cb8c282010-12-06 15:24:58 +0100721else
722BOARD_NAND_SPARE_SIZE := 64
Naseer Ahmed53871882010-08-06 12:19:29 -0700723endif
724
Doug Zongker4647f122009-07-02 09:00:54 -0700725# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -0700726# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -0800727#
Ying Wang02352372010-09-27 10:37:25 -0700728systemimage_intermediates := \
729 $(call intermediates-dir-for,PACKAGING,systemimage)
730BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
The Android Open Source Project88b60792009-03-03 19:28:42 -0800731
732INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
733 $(ALL_PREBUILT) \
734 $(ALL_COPIED_HEADERS) \
735 $(ALL_GENERATED_SOURCES) \
736 $(ALL_DEFAULT_INSTALLED_MODULES))
737
Colin Cross0a7b2c52010-05-07 02:23:59 -0700738ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
739## generate an ext image
The Android Open Source Project88b60792009-03-03 19:28:42 -0800740# $(1): output file
741define build-systemimage-target
742 @echo "Target system fs image: $(1)"
Colin Crosse0a40212010-08-03 14:43:34 -0700743 $(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 -0800744endef
745
Colin Cross0a7b2c52010-05-07 02:23:59 -0700746else # INTERNAL_USERIMAGES_USE_EXT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800747
748## generate a yaffs2 image
749# $(1): output file
750define build-systemimage-target
751 @echo "Target system fs image: $(1)"
752 @mkdir -p $(dir $(1))
Dima Zavin11818982010-02-05 13:34:34 -0800753 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800754endef
Colin Cross0a7b2c52010-05-07 02:23:59 -0700755endif # INTERNAL_USERIMAGES_USE_EXT
The Android Open Source Project88b60792009-03-03 19:28:42 -0800756
Ying Wang02352372010-09-27 10:37:25 -0700757$(BUILT_SYSTEMIMAGE): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800758 $(call build-systemimage-target,$@)
759
The Android Open Source Project88b60792009-03-03 19:28:42 -0800760INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -0700761SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800762
Doug Zongker73ef8252009-07-23 15:12:53 -0700763# The system partition needs room for the recovery image as well. We
764# now store the recovery image as a binary patch using the boot image
765# as the source (since they are very similar). Generate the patch so
766# we can see how big it's going to be, and include that in the system
767# image size check calculation.
Sriram Raman1e96ac82009-07-24 13:52:32 -0700768ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Doug Zongker73ef8252009-07-23 15:12:53 -0700769intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
770RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
771$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \
772 $(INSTALLED_BOOTIMAGE_TARGET) \
Doug Zongker22bc5172009-07-23 18:27:43 -0700773 $(HOST_OUT_EXECUTABLES)/imgdiff \
774 $(HOST_OUT_EXECUTABLES)/bsdiff
Doug Zongker73ef8252009-07-23 15:12:53 -0700775 @echo "Construct recovery from boot"
776 mkdir -p $(dir $@)
Doug Zongkerb003d892009-07-23 18:48:38 -0700777 PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Sriram Raman1e96ac82009-07-24 13:52:32 -0700778endif
779
Doug Zongker73ef8252009-07-23 15:12:53 -0700780
781$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800782 @echo "Install system fs image: $@"
783 $(copy-file-to-target)
Doug Zongkered96e882009-08-26 09:37:07 -0700784 $(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 -0800785
786systemimage: $(INSTALLED_SYSTEMIMAGE)
787
788.PHONY: systemimage-nodeps snod
789systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -0700790 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800791 @echo "make $@: ignoring dependencies"
792 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
Doug Zongkered96e882009-08-26 09:37:07 -0700793 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800794
795#######
796## system tarball
797define build-systemtarball-target
798 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
799 $(MKTARBALL) $(FS_GET_STATS) \
800 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
801 $(INSTALLED_SYSTEMTARBALL_TARGET)
802endef
803
Bruce Beare69ef5ce2010-06-11 12:05:57 -0700804ifndef SYSTEM_TARBALL_FORMAT
805 SYSTEM_TARBALL_FORMAT := bz2
806endif
807
The Android Open Source Project88b60792009-03-03 19:28:42 -0800808system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -0700809INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800810$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
811$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
812 $(build-systemtarball-target)
813
814.PHONY: systemtarball-nodeps
815systemtarball-nodeps: $(FS_GET_STATS) \
816 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
817 $(build-systemtarball-target)
818
819.PHONY: stnod
820stnod: systemtarball-nodeps
821
822
Bruce Beare52aac202010-06-04 15:24:49 -0700823#######
824## boot tarball
825define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -0700826 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -0700827 $(hide) mkdir -p $(PRODUCT_OUT)/boot
828 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
829 $(hide) echo $(BOARD_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
830 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
831 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
832 $(INSTALLED_BOOTTARBALL_TARGET)
833endef
834
835ifndef BOOT_TARBALL_FORMAT
836 BOOT_TARBALL_FORMAT := bz2
837endif
838
839boot_tar := $(PRODUCT_OUT)/boot.tar
840INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
841$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
842$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
843 $(build-boottarball-target)
844
845.PHONY: boottarball-nodeps btnod
846boottarball-nodeps btnod: $(FS_GET_STATS) \
847 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
848 $(build-boottarball-target)
849
850
The Android Open Source Project88b60792009-03-03 19:28:42 -0800851# -----------------------------------------------------------------
852# data partition image
853INTERNAL_USERDATAIMAGE_FILES := \
854 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
855
Colin Cross0a7b2c52010-05-07 02:23:59 -0700856ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800857## Generate an ext2 image
858define build-userdataimage-target
859 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
860 @mkdir -p $(TARGET_OUT_DATA)
Ying Wang026f1452010-09-27 17:49:03 -0700861 $(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 -0700862 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800863endef
864
Colin Cross0a7b2c52010-05-07 02:23:59 -0700865else # INTERNAL_USERIMAGES_USE_EXT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800866
867## Generate a yaffs2 image
868define build-userdataimage-target
869 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
870 @mkdir -p $(TARGET_OUT_DATA)
Dima Zavin11818982010-02-05 13:34:34 -0800871 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
Doug Zongkered96e882009-08-26 09:37:07 -0700872 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800873endef
Colin Cross0a7b2c52010-05-07 02:23:59 -0700874endif # INTERNAL_USERIMAGES_USE_EXT
The Android Open Source Project88b60792009-03-03 19:28:42 -0800875
Joe Onorato64d85d02009-04-09 19:31:12 -0700876BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
877
878# We just build this directly to the install location.
879INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Colin Cross144b0282010-05-10 13:04:47 -0700880$(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800881 $(INTERNAL_USERDATAIMAGE_FILES)
882 $(build-userdataimage-target)
883
884.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -0700885userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800886 $(build-userdataimage-target)
887
888#######
889## data partition tarball
890define build-userdatatarball-target
891 $(call pretty,"Target userdata fs tarball: " \
892 "$(INSTALLED_USERDATATARBALL_TARGET)")
893 $(MKTARBALL) $(FS_GET_STATS) \
894 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
895 $(INSTALLED_USERDATATARBALL_TARGET)
896endef
897
898userdata_tar := $(PRODUCT_OUT)/userdata.tar
899INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
900$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
901$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
902 $(build-userdatatarball-target)
903
904.PHONY: userdatatarball-nodeps
905userdatatarball-nodeps: $(FS_GET_STATS)
906 $(build-userdatatarball-target)
907
908
The Android Open Source Project88b60792009-03-03 19:28:42 -0800909# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800910# bring in the installer image generation defines if necessary
911ifeq ($(TARGET_USE_DISKINSTALLER),true)
912include bootable/diskinstaller/config.mk
913endif
914
915# -----------------------------------------------------------------
Doug Zongker8678df42009-06-15 14:30:14 -0700916# host tools needed to build OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -0800917
Ying Wang06898662010-06-17 17:52:18 -0700918OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
Doug Zongker8678df42009-06-15 14:30:14 -0700919 $(HOST_OUT_EXECUTABLES)/mkbootfs \
920 $(HOST_OUT_EXECUTABLES)/mkbootimg \
921 $(HOST_OUT_EXECUTABLES)/fs_config \
922 $(HOST_OUT_EXECUTABLES)/mkyaffs2image \
923 $(HOST_OUT_EXECUTABLES)/zipalign \
924 $(HOST_OUT_EXECUTABLES)/aapt \
925 $(HOST_OUT_EXECUTABLES)/bsdiff \
Doug Zongkerc494d7c2009-06-18 08:43:44 -0700926 $(HOST_OUT_EXECUTABLES)/imgdiff \
Doug Zongker8678df42009-06-15 14:30:14 -0700927 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
Ying Wang933abf12010-06-16 14:31:34 -0700928 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
929 $(HOST_OUT_EXECUTABLES)/mkuserimg.sh \
930 $(HOST_OUT_EXECUTABLES)/genext2fs \
931 $(HOST_OUT_EXECUTABLES)/tune2fs \
Sriram Ramanff83c852010-11-30 15:09:19 -0500932 $(HOST_OUT_EXECUTABLES)/e2fsck \
Sriram Ramanc647aec2010-11-29 18:51:20 -0500933 $(HOST_OUT_EXECUTABLES)/make_ext4fs
The Android Open Source Project88b60792009-03-03 19:28:42 -0800934
Ying Wang06898662010-06-17 17:52:18 -0700935.PHONY: otatools
936otatools: $(OTATOOLS)
937
The Android Open Source Project88b60792009-03-03 19:28:42 -0800938# -----------------------------------------------------------------
939# A zip of the directories that map to the target filesystem.
940# This zip can be used to create an OTA package or filesystem image
941# as a post-build step.
942#
943name := $(TARGET_PRODUCT)
944ifeq ($(TARGET_BUILD_TYPE),debug)
945 name := $(name)_debug
946endif
947name := $(name)-target_files-$(FILE_NAME_TAG)
948
949intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
950BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
951$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
952$(BUILT_TARGET_FILES_PACKAGE): \
953 zip_root := $(intermediates)/$(name)
954
955# $(1): Directory to copy
956# $(2): Location to copy it to
957# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
958define package_files-copy-root
959 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
960 mkdir -p $(2) && \
961 $(ACP) -rd $(strip $(1))/* $(2); \
962 fi
963endef
964
965built_ota_tools := \
Doug Zongker17c83cf2009-04-01 15:48:46 -0700966 $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \
Doug Zongker6c770462009-07-22 18:27:31 -0700967 $(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \
Doug Zongkera406c1e2009-06-12 16:57:08 -0700968 $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \
969 $(call intermediates-dir-for,EXECUTABLES,updater)/updater
The Android Open Source Project88b60792009-03-03 19:28:42 -0800970$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
971
Doug Zongkerb1134dd2009-06-17 17:09:40 -0700972$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
973
Doug Zongkerc18736b2009-09-30 09:20:32 -0700974ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
975# default to common dir for device vendor
976$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common
977else
978$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
979endif
980
The Android Open Source Project88b60792009-03-03 19:28:42 -0800981# Depending on the various images guarantees that the underlying
982# directories are up-to-date.
983$(BUILT_TARGET_FILES_PACKAGE): \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800984 $(INSTALLED_BOOTIMAGE_TARGET) \
985 $(INSTALLED_RADIOIMAGE_TARGET) \
986 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Doug Zongker4647f122009-07-02 09:00:54 -0700987 $(INSTALLED_SYSTEMIMAGE) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800988 $(INSTALLED_USERDATAIMAGE_TARGET) \
989 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800990 $(built_ota_tools) \
991 $(APKCERTS_FILE) \
Doug Zongker283e2a12010-03-15 17:52:32 -0700992 $(HOST_OUT_EXECUTABLES)/fs_config \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800993 | $(ACP)
994 @echo "Package target files: $@"
995 $(hide) rm -rf $@ $(zip_root)
996 $(hide) mkdir -p $(dir $@) $(zip_root)
997 @# Components of the recovery image
998 $(hide) mkdir -p $(zip_root)/RECOVERY
999 $(hide) $(call package_files-copy-root, \
1000 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
1001ifdef INSTALLED_KERNEL_TARGET
1002 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
1003endif
1004ifdef INSTALLED_2NDBOOTLOADER_TARGET
1005 $(hide) $(ACP) \
1006 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
1007endif
1008ifdef BOARD_KERNEL_CMDLINE
1009 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
1010endif
Doug Zongker38a649f2009-06-17 09:07:09 -07001011ifdef BOARD_KERNEL_BASE
1012 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
1013endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001014ifdef BOARD_KERNEL_PAGESIZE
1015 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize
1016endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001017 @# Components of the boot image
1018 $(hide) mkdir -p $(zip_root)/BOOT
1019 $(hide) $(call package_files-copy-root, \
1020 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
1021ifdef INSTALLED_KERNEL_TARGET
1022 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
1023endif
1024ifdef INSTALLED_2NDBOOTLOADER_TARGET
1025 $(hide) $(ACP) \
1026 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
1027endif
1028ifdef BOARD_KERNEL_CMDLINE
1029 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
1030endif
Doug Zongker38a649f2009-06-17 09:07:09 -07001031ifdef BOARD_KERNEL_BASE
1032 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
1033endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001034ifdef BOARD_KERNEL_PAGESIZE
1035 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
1036endif
Doug Zongkere01100c2009-06-19 17:12:18 -07001037 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
1038 mkdir -p $(zip_root)/RADIO; \
1039 $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001040 @# Contents of the system image
1041 $(hide) $(call package_files-copy-root, \
1042 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
1043 @# Contents of the data image
1044 $(hide) $(call package_files-copy-root, \
1045 $(TARGET_OUT_DATA),$(zip_root)/DATA)
1046 @# Extra contents of the OTA package
1047 $(hide) mkdir -p $(zip_root)/OTA/bin
The Android Open Source Project88b60792009-03-03 19:28:42 -08001048 $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
1049 $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Doug Zongker8678df42009-06-15 14:30:14 -07001050 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08001051 @# build them.
1052 $(hide) mkdir -p $(zip_root)/META
1053 $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Doug Zongker17c83cf2009-04-01 15:48:46 -07001054 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Doug Zongker37974732010-09-16 17:44:38 -07001055 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001056ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07001057 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001058endif
1059ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001060 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001061endif
1062ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001063 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001064endif
1065ifdef BOARD_SYSTEMIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001066 $(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001067endif
1068ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08001069 $(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07001070endif
Doug Zongker37974732010-09-16 17:44:38 -07001071 $(hide) echo "tool_extensions=$(tool_extensions)" >> $(zip_root)/META/misc_info.txt
Ying Wangd421f572010-08-25 20:39:41 -07001072ifdef mkyaffs2_extra_flags
Doug Zongker37974732010-09-16 17:44:38 -07001073 $(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(zip_root)/META/misc_info.txt
Ying Wangd421f572010-08-25 20:39:41 -07001074endif
Ying Wangc5a07ce2010-11-17 17:45:36 -08001075ifdef INTERNAL_USERIMAGES_SPARSE_EXT_FLAG
1076 $(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(zip_root)/META/misc_info.txt
1077endif
Doug Zongker5d4808d2011-03-16 07:49:13 -07001078ifdef PRODUCT_EXTRA_RECOVERY_KEYS
1079 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08001080endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001081 @# Zip everything up, preserving symlinks
1082 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
Doug Zongker283e2a12010-03-15 17:52:32 -07001083 @# Run fs_config on all the system files in the zip, and save the output
1084 $(hide) zipinfo -1 $@ | awk -F/ 'BEGIN { OFS="/" } /^SYSTEM\// {$$1 = "system"; print}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/filesystem_config.txt
1085 $(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/filesystem_config.txt)
1086
The Android Open Source Project88b60792009-03-03 19:28:42 -08001087
1088target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
1089
Doug Zongker367910f2009-06-15 18:56:51 -07001090
1091ifneq ($(TARGET_SIMULATOR),true)
1092ifneq ($(TARGET_PRODUCT),sdk)
Ying Wang279f3082011-02-09 12:26:42 -08001093ifeq ($(filter generic%,$(TARGET_DEVICE)),)
Ying Wangfb0a3472010-08-25 16:06:06 -07001094ifneq ($(TARGET_NO_KERNEL),true)
Ying Wanga73b6562011-03-03 21:52:08 -08001095ifneq ($(recovery_fstab),)
Doug Zongker367910f2009-06-15 18:56:51 -07001096
Ying Wang09a00a62010-10-20 14:01:09 -07001097# -----------------------------------------------------------------
1098# OTA update package
1099
Doug Zongker8678df42009-06-15 14:30:14 -07001100name := $(TARGET_PRODUCT)
1101ifeq ($(TARGET_BUILD_TYPE),debug)
1102 name := $(name)_debug
1103endif
1104name := $(name)-ota-$(FILE_NAME_TAG)
1105
1106INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1107
1108$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
1109
Ying Wang06898662010-06-17 17:52:18 -07001110$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
Doug Zongker8678df42009-06-15 14:30:14 -07001111 @echo "Package OTA: $@"
Ying Wang68bb6512010-08-25 15:23:21 -07001112 $(hide) ./build/tools/releasetools/ota_from_target_files -v \
Doug Zongker602a84e2009-06-18 08:35:12 -07001113 -p $(HOST_OUT) \
Doug Zongker8678df42009-06-15 14:30:14 -07001114 -k $(KEY_CERT_PAIR) \
1115 $(BUILT_TARGET_FILES_PACKAGE) $@
1116
1117.PHONY: otapackage
1118otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
1119
Ying Wang09a00a62010-10-20 14:01:09 -07001120# -----------------------------------------------------------------
1121# The update package
1122
1123name := $(TARGET_PRODUCT)
1124ifeq ($(TARGET_BUILD_TYPE),debug)
1125 name := $(name)_debug
1126endif
1127name := $(name)-img-$(FILE_NAME_TAG)
1128
1129INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1130
1131ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
1132# default to common dir for device vendor
1133$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common
1134else
1135$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
1136endif
1137
1138$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
1139 @echo "Package: $@"
1140 $(hide) ./build/tools/releasetools/img_from_target_files -v \
1141 -s $(extensions) \
1142 -p $(HOST_OUT) \
1143 $(BUILT_TARGET_FILES_PACKAGE) $@
1144
1145.PHONY: updatepackage
1146updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
1147
Ying Wanga73b6562011-03-03 21:52:08 -08001148endif # recovery_fstab is defined
Ying Wangfb0a3472010-08-25 16:06:06 -07001149endif # TARGET_NO_KERNEL != true
Ying Wang279f3082011-02-09 12:26:42 -08001150endif # TARGET_DEVICE != generic*
Doug Zongker367910f2009-06-15 18:56:51 -07001151endif # TARGET_PRODUCT != sdk
1152endif # TARGET_SIMULATOR != true
Doug Zongker8678df42009-06-15 14:30:14 -07001153
1154# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08001155# installed file list
1156# Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it
1157# gets the DexOpt one if we're doing that.
1158INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
1159$(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE)
1160 @echo Installed file list: $@
1161 @mkdir -p $(dir $@)
1162 @rm -f $@
1163 $(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@
1164
1165.PHONY: installed-file-list
1166installed-file-list: $(INSTALLED_FILES_FILE)
Raphaelc4d47312011-02-15 16:09:36 -08001167ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),)
1168$(call dist-for-goals, sdk win_sdk, $(INSTALLED_FILES_FILE))
Ying Wanga37a2cb2010-04-28 12:59:51 -07001169endif
1170ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
Joe Onorato03fbe402009-04-13 08:31:16 -07001171$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wanga37a2cb2010-04-28 12:59:51 -07001172endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001173
1174# -----------------------------------------------------------------
1175# A zip of the tests that are built when running "make tests".
1176# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
1177# only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
1178#
1179name := $(TARGET_PRODUCT)
1180ifeq ($(TARGET_BUILD_TYPE),debug)
1181 name := $(name)_debug
1182endif
1183name := $(name)-tests-$(FILE_NAME_TAG)
1184
1185intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
1186BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
1187$(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
1188$(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
1189
1190# Depending on the images guarantees that the underlying
1191# directories are up-to-date.
1192$(BUILT_TESTS_ZIP_PACKAGE): \
1193 $(BUILT_SYSTEMIMAGE) \
1194 $(INSTALLED_USERDATAIMAGE_TARGET) \
1195 | $(ACP)
1196 @echo "Package test files: $@"
1197 $(hide) rm -rf $@ $(zip_root)
1198 $(hide) mkdir -p $(dir $@) $(zip_root)
1199 @# Some parts of the system image
1200 $(hide) $(call package_files-copy-root, \
1201 $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin)
1202 $(hide) $(call package_files-copy-root, \
1203 $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib)
1204 $(hide) $(call package_files-copy-root, \
1205 $(SYSTEMIMAGE_SOURCE_DIR)/framework, \
1206 $(zip_root)/SYSTEM/framework)
1207 $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM
1208 @# Contents of the data image
1209 $(hide) $(call package_files-copy-root, \
1210 $(TARGET_OUT_DATA),$(zip_root)/DATA)
1211 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
1212
Ying Wang9c762552010-09-10 14:39:33 -07001213.PHONY: tests-zip-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08001214tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
1215
Ying Wangdb2cb632010-09-14 16:07:56 -07001216# Target needed by tests build
1217.PHONY: tests-build-target
1218tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE) \
1219 $(BUILT_USERDATAIMAGE_TARGET)
1220
1221ifneq (,$(filter $(MAKECMDGOALS),tests-build-target))
1222 $(call dist-for-goals, tests-build-target, \
1223 $(BUILT_TESTS_ZIP_PACKAGE) \
1224 $(BUILT_USERDATAIMAGE_TARGET))
Ying Wang9c762552010-09-10 14:39:33 -07001225endif
1226
The Android Open Source Project88b60792009-03-03 19:28:42 -08001227# -----------------------------------------------------------------
1228# A zip of the symbols directory. Keep the full paths to make it
1229# more obvious where these files came from.
1230#
1231name := $(TARGET_PRODUCT)
1232ifeq ($(TARGET_BUILD_TYPE),debug)
1233 name := $(name)_debug
1234endif
1235name := $(name)-symbols-$(FILE_NAME_TAG)
1236
1237SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
1238$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET)
1239 @echo "Package symbols: $@"
1240 $(hide) rm -rf $@
1241 $(hide) mkdir -p $(dir $@)
1242 $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
1243
1244# -----------------------------------------------------------------
1245# A zip of the Android Apps. Not keeping full path so that we don't
1246# include product names when distributing
1247#
1248name := $(TARGET_PRODUCT)
1249ifeq ($(TARGET_BUILD_TYPE),debug)
1250 name := $(name)_debug
1251endif
1252name := $(name)-apps-$(FILE_NAME_TAG)
1253
1254APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
1255$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
1256 @echo "Package apps: $@"
1257 $(hide) rm -rf $@
1258 $(hide) mkdir -p $(dir $@)
1259 $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
1260
Guang Zhu0198d6e2010-04-23 11:54:37 -07001261
1262#------------------------------------------------------------------
1263# A zip of emma code coverage meta files. Generated for fully emma
1264# instrumented build.
1265#
1266EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip
1267$(EMMA_META_ZIP): $(INSTALLED_SYSTEMIMAGE)
1268 @echo "Collecting Emma coverage meta files."
1269 $(hide) find $(TARGET_COMMON_OUT_ROOT) -name "coverage.em" | \
1270 zip -@ -q $@
1271
The Android Open Source Project88b60792009-03-03 19:28:42 -08001272endif # TARGET_SIMULATOR != true
1273
1274# -----------------------------------------------------------------
1275# dalvik something
1276.PHONY: dalvikfiles
1277dalvikfiles: $(INTERNAL_DALVIK_MODULES)
1278
1279# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08001280# The emulator package
1281
1282ifneq ($(TARGET_SIMULATOR),true)
1283
1284INTERNAL_EMULATOR_PACKAGE_FILES += \
1285 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Bruce Beare18a130e2011-02-18 15:06:20 -08001286 prebuilt/android-$(TARGET_ARCH)/kernel/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001287 $(INSTALLED_RAMDISK_TARGET) \
1288 $(INSTALLED_SYSTEMIMAGE) \
1289 $(INSTALLED_USERDATAIMAGE_TARGET)
1290
1291name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
1292
1293INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1294
1295$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
1296 @echo "Package: $@"
1297 $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
1298
1299endif
1300
1301# -----------------------------------------------------------------
1302# The pdk package (Platform Development Kit)
1303
1304ifneq (,$(filter pdk,$(MAKECMDGOALS)))
1305 include development/pdk/Pdk.mk
1306endif
1307
1308# -----------------------------------------------------------------
1309# The SDK
1310
1311ifneq ($(TARGET_SIMULATOR),true)
1312
1313# The SDK includes host-specific components, so it belongs under HOST_OUT.
1314sdk_dir := $(HOST_OUT)/sdk
1315
1316# Build a name that looks like:
1317#
1318# linux-x86 --> android-sdk_12345_linux-x86
1319# darwin-x86 --> android-sdk_12345_mac-x86
1320# windows-x86 --> android-sdk_12345_windows
1321#
1322sdk_name := android-sdk_$(FILE_NAME_TAG)
1323ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07001324 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08001325else
Joe Onorato03fbe402009-04-13 08:31:16 -07001326 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001327endif
1328ifneq ($(HOST_OS),windows)
Joe Onorato03fbe402009-04-13 08:31:16 -07001329 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001330endif
Joe Onorato03fbe402009-04-13 08:31:16 -07001331sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001332
1333sdk_dep_file := $(sdk_dir)/sdk_deps.mk
1334
1335ATREE_FILES :=
1336-include $(sdk_dep_file)
1337
1338# if we don't have a real list, then use "everything"
1339ifeq ($(strip $(ATREE_FILES)),)
1340ATREE_FILES := \
1341 $(ALL_PREBUILT) \
1342 $(ALL_COPIED_HEADERS) \
1343 $(ALL_GENERATED_SOURCES) \
1344 $(ALL_DEFAULT_INSTALLED_MODULES) \
1345 $(INSTALLED_RAMDISK_TARGET) \
1346 $(ALL_DOCS) \
1347 $(ALL_SDK_FILES)
1348endif
1349
1350atree_dir := development/build
1351
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01001352# sdk/build/tools.atree contains the generic rules, while
1353#
1354# sdk/build/tools.$(TARGET_ARCH).atree contains target-specific rules
1355# the latter is optional.
1356#
1357sdk_tools_atree_files := sdk/build/tools.atree
1358ifneq (,$(strip $(wildcard sdk/build/tools.$(TARGET_ARCH).atree)))
1359 sdk_tools_atree_files += sdk/build/tools.$(TARGET_ARCH).atree
1360endif
1361
The Android Open Source Project88b60792009-03-03 19:28:42 -08001362sdk_atree_files := \
1363 $(atree_dir)/sdk.exclude.atree \
1364 $(atree_dir)/sdk.atree \
Xavier Ducrohetffd50872010-09-27 15:51:32 -07001365 $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree \
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01001366 $(sdk_tools_atree_files)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001367
1368deps := \
1369 $(target_notice_file_txt) \
1370 $(tools_notice_file_txt) \
1371 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07001372 $(SYMBOLS_ZIP) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07001373 $(INSTALLED_SYSTEMIMAGE) \
1374 $(INSTALLED_USERDATAIMAGE_TARGET) \
1375 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001376 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07001377 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001378 $(ATREE_FILES) \
1379 $(atree_dir)/sdk.atree \
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01001380 $(sdk_tools_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001381 $(HOST_OUT_EXECUTABLES)/atree \
1382 $(HOST_OUT_EXECUTABLES)/line_endings
1383
1384INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
1385$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
1386$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
1387$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
1388$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
1389
1390# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
1391#
1392#SDK_GNU_ERROR := true
1393
Raphael7a6a9c32011-02-01 13:30:00 -08001394ifeq ($(HOST_OS),darwin)
1395HOST_STRIP_SDK_LLVM := strip
1396else
1397HOST_STRIP_SDK_LLVM := strip --strip-all
1398endif
1399
The Android Open Source Project88b60792009-03-03 19:28:42 -08001400$(INTERNAL_SDK_TARGET): $(deps)
1401 @echo "Package SDK: $@"
1402 $(hide) rm -rf $(PRIVATE_DIR) $@
1403 $(hide) for f in $(target_gnu_MODULES); do \
1404 if [ -f $$f ]; then \
1405 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
1406 including GNU target $$f >&2; \
1407 FAIL=$(SDK_GNU_ERROR); \
1408 fi; \
1409 done; \
1410 if [ $$FAIL ]; then exit 1; fi
1411 $(hide) ( \
1412 $(HOST_OUT_EXECUTABLES)/atree \
1413 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
1414 -m $(PRIVATE_DEP_FILE) \
1415 -I . \
1416 -I $(PRODUCT_OUT) \
1417 -I $(HOST_OUT) \
1418 -I $(TARGET_COMMON_OUT_ROOT) \
1419 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
Raphael Moll7558ad52011-01-05 14:58:17 -08001420 -v "OUT_DIR=$(OUT_DIR)" \
Bruce Beare18a130e2011-02-18 15:06:20 -08001421 -v "TARGET_ARCH=$(TARGET_ARCH)" \
1422 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001423 -o $(PRIVATE_DIR) && \
1424 cp -f $(target_notice_file_txt) \
Bruce Beare18a130e2011-02-18 15:06:20 -08001425 $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/$(TARGET_CPU_ABI)/NOTICE.txt && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001426 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
Xavier Ducrohet4216a8c2011-03-15 13:28:40 -07001427 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
Raphael7a6a9c32011-02-01 13:30:00 -08001428 if [ -f $(PRIVATE_DIR)/platform-tools/llvm-rs-cc ]; then \
1429 $(HOST_STRIP_SDK_LLVM) $(PRIVATE_DIR)/platform-tools/llvm-rs-cc; \
1430 fi && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001431 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
Raphael7a6a9c32011-02-01 13:30:00 -08001432 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001433 chmod -R ug+rwX $(PRIVATE_DIR) && \
1434 cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
1435 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
1436
Raphael3d224a02010-04-16 17:50:09 -07001437
1438# Is a Windows SDK requested? If so, we need some definitions from here
1439# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08001440MAIN_SDK_NAME := $(sdk_name)
1441MAIN_SDK_DIR := $(sdk_dir)
1442MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Raphael3d224a02010-04-16 17:50:09 -07001443ifneq ($(filter win_sdk,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07001444include $(TOPDIR)development/build/tools/windows_sdk.mk
1445endif
1446
The Android Open Source Project88b60792009-03-03 19:28:42 -08001447endif # !simulator
1448
1449# -----------------------------------------------------------------
1450# Findbugs
1451INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
1452INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
1453$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
1454 @echo UnionBugs: $@
1455 $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \
1456 > $@
1457$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
1458 @echo ConvertXmlToText: $@
1459 $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
1460 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
1461
1462# -----------------------------------------------------------------
1463# Findbugs
1464
1465# -----------------------------------------------------------------
1466# These are some additional build tasks that need to be run.
1467include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01001468-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Raphaelc4d47312011-02-15 16:09:36 -08001469
1470# -----------------------------------------------------------------
1471# Create SDK repository packages. Must be done after tasks/* since
1472# we need the addon rules defined.
1473ifneq ($(sdk_repo_goal),)
1474include $(TOPDIR)development/build/tools/sdk_repo.mk
1475endif