2009-03-04 11:28:42 +08:00
# Put some miscellaneous rules here
2014-03-02 07:32:04 +08:00
# HACK: clear LOCAL_PATH from including last build target before calling
# intermedites-dir-for
LOCAL_PATH := $( BUILD_SYSTEM)
2009-03-04 11:28:42 +08:00
# Pick a reasonable string to use to identify files.
i f n e q "" "$(filter eng.%,$(BUILD_NUMBER))"
# BUILD_NUMBER has a timestamp in it, which means that
# it will change every time. Pick a stable value.
FILE_NAME_TAG := eng.$( USER)
e l s e
FILE_NAME_TAG := $( BUILD_NUMBER)
e n d i f
# -----------------------------------------------------------------
# Define rules to copy PRODUCT_COPY_FILES defined by the product.
2012-09-21 07:35:36 +08:00
# PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>].
2009-03-04 11:28:42 +08:00
# <dest file> is relative to $(PRODUCT_OUT), so it should look like,
# e.g., "system/etc/file.xml".
2010-03-02 08:18:59 +08:00
# The filter part means "only eval the copy-one-file rule if this
2010-11-03 12:31:47 +08:00
# src:dest pair is the first one to match the same dest"
2011-09-30 04:23:25 +08:00
#$(1): the src:dest pair
d e f i n e c h e c k - p r o d u c t - c o p y - f i l e s
2014-01-22 12:25:46 +08:00
$( if $ ( filter %.apk , $ ( call word -colon , 2, $ ( 1) ) ) ,$ ( error \
2011-09-30 04:23:25 +08:00
Prebuilt apk found in PRODUCT_COPY_FILES: $( 1) , use BUILD_PREBUILT instead!) )
e n d e f
2012-09-06 09:08:29 +08:00
# filter out the duplicate <source file>:<dest file> pairs.
unique_product_copy_files_pairs :=
2009-03-04 11:28:42 +08:00
$( foreach cf ,$ ( PRODUCT_COPY_FILES ) , \
2012-09-06 09:08:29 +08:00
$( if $( filter $( unique_product_copy_files_pairs) ,$( cf) ) ,,\
$( eval unique_product_copy_files_pairs += $( cf) ) ) )
unique_product_copy_files_destinations :=
$( foreach cf ,$ ( unique_product_copy_files_pairs ) , \
2010-11-03 12:31:47 +08:00
$( eval _src := $( call word-colon,1,$( cf) ) ) \
$( eval _dest := $( call word-colon,2,$( cf) ) ) \
2011-09-30 04:23:25 +08:00
$( call check-product-copy-files,$( cf) ) \
2011-12-17 03:54:25 +08:00
$( if $( filter $( unique_product_copy_files_destinations) ,$( _dest) ) , \
$( info PRODUCT_COPY_FILES $( cf) ignored.) , \
2010-11-03 12:31:47 +08:00
$( eval _fulldest := $( call append-path,$( PRODUCT_OUT) ,$( _dest) ) ) \
2012-05-15 05:39:00 +08:00
$( if $( filter %.xml,$( _dest) ) ,\
$( eval $( call copy-xml-file-checked,$( _src) ,$( _fulldest) ) ) ,\
$( eval $( call copy-one-file,$( _src) ,$( _fulldest) ) ) ) \
2010-11-03 12:31:47 +08:00
$( eval ALL_DEFAULT_INSTALLED_MODULES += $( _fulldest) ) \
2011-06-18 08:05:35 +08:00
$( eval unique_product_copy_files_destinations += $( _dest) ) ) )
2012-09-06 09:08:29 +08:00
unique_product_copy_files_pairs :=
2011-06-18 08:05:35 +08:00
unique_product_copy_files_destinations :=
2009-03-04 11:28:42 +08:00
2016-02-24 05:40:07 +08:00
# -----------------------------------------------------------------
# Define rules to copy headers defined in copy_headers.mk
# If more than one makefile declared a header, print a warning,
# then copy the last one defined. This matches the previous make
# behavior.
$( foreach dest ,$ ( ALL_COPIED_HEADERS ) , \
$( eval _srcs := $( ALL_COPIED_HEADERS.$( dest) .SRC) ) \
$( eval _src := $( word $( words $( _srcs) ) ,$( _srcs) ) ) \
$( if $( call streq,$( _src) ,$( _srcs) ) ,, \
$( warning Duplicate header copy: $( dest) ) \
$( warning Defined in: $( ALL_COPIED_HEADERS.$( dest) .MAKEFILE) ) ) \
$( eval $( call copy-one-header,$( _src) ,$( dest) ) ) )
all_copied_headers : $( ALL_COPIED_HEADERS )
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# docs/index.html
2012-04-03 09:21:36 +08:00
i f e q ( , $( TARGET_BUILD_APPS ) )
2009-03-04 11:28:42 +08:00
gen := $( OUT_DOCS) /index.html
ALL_DOCS += $( gen)
$(gen) : frameworks /base /docs /docs -redirect -index .html
@mkdir -p $( dir $@ )
@cp -f $< $@
2012-04-03 09:21:36 +08:00
e n d i f
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# default.prop
INSTALLED_DEFAULT_PROP_TARGET := $( TARGET_ROOT_OUT) /default.prop
ALL_DEFAULT_INSTALLED_MODULES += $( INSTALLED_DEFAULT_PROP_TARGET)
ADDITIONAL_DEFAULT_PROPERTIES := \
2011-06-18 08:05:35 +08:00
$( call collapse-pairs, $( ADDITIONAL_DEFAULT_PROPERTIES) )
2011-06-10 05:54:40 +08:00
ADDITIONAL_DEFAULT_PROPERTIES += \
2011-06-18 08:05:35 +08:00
$( call collapse-pairs, $( PRODUCT_DEFAULT_PROPERTY_OVERRIDES) )
ADDITIONAL_DEFAULT_PROPERTIES := $( call uniq-pairs-by-first-component, \
$( ADDITIONAL_DEFAULT_PROPERTIES) ,= )
2009-03-04 11:28:42 +08:00
2015-05-07 11:44:22 +08:00
intermediate_system_build_prop := $( call intermediates-dir-for,ETC,system_build_prop) /build.prop
$(INSTALLED_DEFAULT_PROP_TARGET) : $( intermediate_system_build_prop )
2009-03-04 11:28:42 +08:00
@echo Target buildinfo: $@
@mkdir -p $( dir $@ )
$( hide) echo "#" > $@ ; \
echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@ ; \
echo "#" >> $@ ;
2010-09-08 01:51:12 +08:00
$( hide) $( foreach line,$( ADDITIONAL_DEFAULT_PROPERTIES) , \
echo " $( line) " >> $@ ; )
2015-05-07 11:44:22 +08:00
$( hide) echo "#" >> $@ ; \
echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@ ; \
echo "#" >> $@ ;
2015-08-18 11:44:29 +08:00
$( hide) echo ro.bootimage.build.date= ` $( DATE_FROM_FILE) ` >>$@
$( hide) echo ro.bootimage.build.date.utc= ` $( DATE_FROM_FILE) +%s` >>$@
2015-07-22 03:54:17 +08:00
$( hide) echo ro.bootimage.build.fingerprint= " $( BUILD_FINGERPRINT_FROM_FILE) " >>$@
2015-05-07 11:44:22 +08:00
$( hide) build/tools/post_process_props.py $@
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# build.prop
INSTALLED_BUILD_PROP_TARGET := $( TARGET_OUT) /build.prop
ALL_DEFAULT_INSTALLED_MODULES += $( INSTALLED_BUILD_PROP_TARGET)
ADDITIONAL_BUILD_PROPERTIES := \
2011-06-18 08:05:35 +08:00
$( call collapse-pairs, $( ADDITIONAL_BUILD_PROPERTIES) )
ADDITIONAL_BUILD_PROPERTIES := $( call uniq-pairs-by-first-component, \
$( ADDITIONAL_BUILD_PROPERTIES) ,= )
2009-03-04 11:28:42 +08:00
# A list of arbitrary tags describing the build configuration.
# Force ":=" so we can use +=
BUILD_VERSION_TAGS := $( BUILD_VERSION_TAGS)
i f e q ( $( TARGET_BUILD_TYPE ) , d e b u g )
BUILD_VERSION_TAGS += debug
e n d i f
2011-10-06 03:41:56 +08:00
# The "test-keys" tag marks builds signed with the old test keys,
# which are available in the SDK. "dev-keys" marks builds signed with
# non-default dev keys (usually private keys from a vendor directory).
# Both of these tags will be removed and replaced with "release-keys"
# when the target-files is signed in a post-build step.
i f e q ( $( DEFAULT_SYSTEM_DEV_CERTIFICATE ) , b u i l d / t a r g e t / p r o d u c t / s e c u r i t y / t e s t k e y )
2013-07-24 02:51:04 +08:00
BUILD_KEYS := test-keys
2011-10-06 03:41:56 +08:00
e l s e
2013-07-24 02:51:04 +08:00
BUILD_KEYS := dev-keys
2011-10-06 03:41:56 +08:00
e n d i f
2013-07-24 02:51:04 +08:00
BUILD_VERSION_TAGS += $( BUILD_KEYS)
2009-03-04 11:28:42 +08:00
BUILD_VERSION_TAGS := $( subst $( space) ,$( comma) ,$( sort $( BUILD_VERSION_TAGS) ) )
# A human-readable string that descibes this build in detail.
2015-07-17 08:15:19 +08:00
build_desc := $( TARGET_PRODUCT) -$( TARGET_BUILD_VARIANT) $( PLATFORM_VERSION) $( BUILD_ID) $( BUILD_NUMBER_FROM_FILE) $( BUILD_VERSION_TAGS)
2015-05-07 11:44:22 +08:00
$(intermediate_system_build_prop) : PRIVATE_BUILD_DESC := $( build_desc )
2009-03-04 11:28:42 +08:00
2014-03-22 07:20:05 +08:00
# The string used to uniquely identify the combined build and product; used by the OTA server.
2009-03-04 11:28:42 +08:00
i f e q ( , $( strip $ ( BUILD_FINGERPRINT ) ) )
2014-06-13 09:42:53 +08:00
ifneq ( $( filter eng.%,$( BUILD_NUMBER) ) ,)
# Trim down BUILD_FINGERPRINT: the default BUILD_NUMBER makes it easily exceed
# the Android system property length limit (PROPERTY_VALUE_MAX=92).
2015-12-01 14:20:55 +08:00
BF_BUILD_NUMBER := $( shell echo $$ { USER:0:6} ) $( shell $( DATE) +%m%d%H%M)
2014-06-13 09:42:53 +08:00
else
BF_BUILD_NUMBER := $( BUILD_NUMBER)
endif
BUILD_FINGERPRINT := $( PRODUCT_BRAND) /$( TARGET_PRODUCT) /$( TARGET_DEVICE) :$( PLATFORM_VERSION) /$( BUILD_ID) /$( BF_BUILD_NUMBER) :$( TARGET_BUILD_VARIANT) /$( BUILD_VERSION_TAGS)
2009-03-04 11:28:42 +08:00
e n d i f
i f n e q ( $( words $ ( BUILD_FINGERPRINT ) ) , 1 )
$( error BUILD_FINGERPRINT cannot contain spaces: " $( BUILD_FINGERPRINT) " )
e n d i f
2015-07-22 07:22:51 +08:00
$( shell mkdir -p $ ( PRODUCT_OUT ) && echo $ ( BUILD_FINGERPRINT ) > $ ( PRODUCT_OUT ) /build_fingerprint .txt )
2015-07-17 08:15:19 +08:00
BUILD_FINGERPRINT_FROM_FILE := $$ ( cat $( PRODUCT_OUT) /build_fingerprint.txt)
2014-03-22 07:20:05 +08:00
# The string used to uniquely identify the system build; used by the OTA server.
# This purposefully excludes any product-specific variables.
i f e q ( , $( strip $ ( BUILD_THUMBPRINT ) ) )
BUILD_THUMBPRINT := $( PLATFORM_VERSION) /$( BUILD_ID) /$( BUILD_NUMBER) :$( TARGET_BUILD_VARIANT) /$( BUILD_VERSION_TAGS)
e n d i f
i f n e q ( $( words $ ( BUILD_THUMBPRINT ) ) , 1 )
$( error BUILD_THUMBPRINT cannot contain spaces: " $( BUILD_THUMBPRINT) " )
e n d i f
2014-10-08 09:42:11 +08:00
KNOWN_OEM_THUMBPRINT_PROPERTIES := \
ro.product.brand \
ro.product.name \
ro.product.device
OEM_THUMBPRINT_PROPERTIES := $( filter $( KNOWN_OEM_THUMBPRINT_PROPERTIES) ,\
$( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_OEM_PROPERTIES) )
2009-03-25 13:40:59 +08:00
# Display parameters shown under Settings -> About Phone
i f e q ( $( TARGET_BUILD_VARIANT ) , u s e r )
# User builds should show:
# release build number or branch.buld_number non-release builds
# Dev. branches should have DISPLAY_BUILD_NUMBER set
ifeq "true" " $( DISPLAY_BUILD_NUMBER) "
2015-07-17 08:15:19 +08:00
BUILD_DISPLAY_ID := $( BUILD_ID) .$( BUILD_NUMBER_FROM_FILE) $( BUILD_KEYS)
2009-03-25 13:40:59 +08:00
else
2013-07-24 02:51:04 +08:00
BUILD_DISPLAY_ID := $( BUILD_ID) $( BUILD_KEYS)
2009-03-25 13:40:59 +08:00
endif
e l s e
# Non-user builds should show detailed build information
BUILD_DISPLAY_ID := $( build_desc)
e n d i f
2015-01-16 02:16:24 +08:00
# Accepts a whitespace separated list of product locales such as
# (en_US en_AU en_GB...) and returns the first locale in the list with
# underscores replaced with hyphens. In the example above, this will
# return "en-US".
d e f i n e g e t - d e f a u l t - p r o d u c t - l o c a l e
$( strip $ ( subst _ ,-, $ ( firstword $ ( 1) ) ) )
2009-03-04 11:28:42 +08:00
e n d e f
BUILDINFO_SH := build/tools/buildinfo.sh
2012-09-29 00:33:45 +08:00
2015-10-29 09:45:03 +08:00
# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test harness to distinguish builds.
TARGET_BUILD_FLAVOR := $( TARGET_PRODUCT) -$( TARGET_BUILD_VARIANT)
i f d e f S A N I T I Z E _ T A R G E T
TARGET_BUILD_FLAVOR := $( TARGET_BUILD_FLAVOR) _asan
e n d i f
2012-09-29 00:33:45 +08:00
i f d e f T A R G E T _ S Y S T E M _ P R O P
system_prop_file := $( TARGET_SYSTEM_PROP)
e l s e
system_prop_file := $( wildcard $( TARGET_DEVICE_DIR) /system.prop)
e n d i f
2015-05-07 11:44:22 +08:00
$(intermediate_system_build_prop) : $( BUILDINFO_SH ) $( INTERNAL_BUILD_ID_MAKEFILE ) $( BUILD_SYSTEM ) /version_defaults .mk $( system_prop_file ) $( INSTALLED_ANDROID_INFO_TXT_TARGET )
2009-03-04 11:28:42 +08:00
@echo Target buildinfo: $@
@mkdir -p $( dir $@ )
2014-03-19 08:20:10 +08:00
$( hide) echo > $@
i f n e q ( $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_OEM_PROPERTIES ) , )
$( hide) echo "#" >> $@ ; \
echo "# PRODUCT_OEM_PROPERTIES" >> $@ ; \
2014-03-22 07:20:05 +08:00
echo "#" >> $@ ;
2014-03-19 08:20:10 +08:00
$( hide) $( foreach prop,$( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_OEM_PROPERTIES) , \
echo " import /oem/oem.prop $( prop) " >> $@ ; )
e n d i f
2009-03-04 11:28:42 +08:00
$( hide) TARGET_BUILD_TYPE = " $( TARGET_BUILD_VARIANT) " \
2015-10-29 09:45:03 +08:00
TARGET_BUILD_FLAVOR = " $( TARGET_BUILD_FLAVOR) " \
2009-03-04 11:28:42 +08:00
TARGET_DEVICE = " $( TARGET_DEVICE) " \
PRODUCT_NAME = " $( TARGET_PRODUCT) " \
PRODUCT_BRAND = " $( PRODUCT_BRAND) " \
2015-01-16 02:16:24 +08:00
PRODUCT_DEFAULT_LOCALE = " $( call get-default-product-locale,$( PRODUCT_LOCALES) ) " \
2009-05-21 04:37:35 +08:00
PRODUCT_DEFAULT_WIFI_CHANNELS = " $( PRODUCT_DEFAULT_WIFI_CHANNELS) " \
2009-03-04 11:28:42 +08:00
PRODUCT_MODEL = " $( PRODUCT_MODEL) " \
PRODUCT_MANUFACTURER = " $( PRODUCT_MANUFACTURER) " \
PRIVATE_BUILD_DESC = " $( PRIVATE_BUILD_DESC) " \
BUILD_ID = " $( BUILD_ID) " \
BUILD_DISPLAY_ID = " $( BUILD_DISPLAY_ID) " \
2015-08-12 06:25:12 +08:00
DATE = " $( DATE_FROM_FILE) " \
2015-07-17 08:15:19 +08:00
BUILD_NUMBER = " $( BUILD_NUMBER_FROM_FILE) " \
2015-06-30 08:20:43 +08:00
BOARD_BUILD_SYSTEM_ROOT_IMAGE = " $( BOARD_BUILD_SYSTEM_ROOT_IMAGE) " \
2015-11-12 02:22:48 +08:00
AB_OTA_UPDATER = " $( AB_OTA_UPDATER) " \
2009-03-04 11:28:42 +08:00
PLATFORM_VERSION = " $( PLATFORM_VERSION) " \
2015-08-13 07:11:20 +08:00
PLATFORM_SECURITY_PATCH = " $( PLATFORM_SECURITY_PATCH) " \
PLATFORM_BASE_OS = " $( PLATFORM_BASE_OS) " \
2009-03-04 11:28:42 +08:00
PLATFORM_SDK_VERSION = " $( PLATFORM_SDK_VERSION) " \
2015-05-22 04:49:05 +08:00
PLATFORM_PREVIEW_SDK_VERSION = " $( PLATFORM_PREVIEW_SDK_VERSION) " \
2009-05-09 03:06:17 +08:00
PLATFORM_VERSION_CODENAME = " $( PLATFORM_VERSION_CODENAME) " \
2014-04-25 07:19:14 +08:00
PLATFORM_VERSION_ALL_CODENAMES = " $( PLATFORM_VERSION_ALL_CODENAMES) " \
2009-03-04 11:28:42 +08:00
BUILD_VERSION_TAGS = " $( BUILD_VERSION_TAGS) " \
TARGET_BOOTLOADER_BOARD_NAME = " $( TARGET_BOOTLOADER_BOARD_NAME) " \
2015-07-17 08:15:19 +08:00
BUILD_FINGERPRINT = " $( BUILD_FINGERPRINT_FROM_FILE) " \
2014-10-08 09:42:11 +08:00
$( if $( OEM_THUMBPRINT_PROPERTIES) ,BUILD_THUMBPRINT= " $( BUILD_THUMBPRINT) " ) \
2009-03-04 11:28:42 +08:00
TARGET_BOARD_PLATFORM = " $( TARGET_BOARD_PLATFORM) " \
2014-03-27 01:33:55 +08:00
TARGET_CPU_ABI_LIST = " $( TARGET_CPU_ABI_LIST) " \
2014-04-07 18:01:54 +08:00
TARGET_CPU_ABI_LIST_32_BIT = " $( TARGET_CPU_ABI_LIST_32_BIT) " \
TARGET_CPU_ABI_LIST_64_BIT = " $( TARGET_CPU_ABI_LIST_64_BIT) " \
2009-05-22 06:45:30 +08:00
TARGET_CPU_ABI = " $( TARGET_CPU_ABI) " \
2009-11-07 07:12:00 +08:00
TARGET_CPU_ABI2 = " $( TARGET_CPU_ABI2) " \
2010-11-10 00:53:01 +08:00
TARGET_AAPT_CHARACTERISTICS = " $( TARGET_AAPT_CHARACTERISTICS) " \
2014-03-19 08:20:10 +08:00
bash $( BUILDINFO_SH) >> $@
2012-04-12 23:00:58 +08:00
$( hide) $( foreach file,$( system_prop_file) , \
if [ -f " $( file) " ] ; then \
echo "#" >> $@ ; \
echo Target buildinfo from: " $( file) " ; \
echo " # from $( file) " >> $@ ; \
echo "#" >> $@ ; \
cat $( file) >> $@ ; \
fi ; )
2009-03-04 11:28:42 +08:00
$( if $( ADDITIONAL_BUILD_PROPERTIES) , \
$( hide) echo >> $@ ; \
echo "#" >> $@ ; \
echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@ ; \
echo "#" >> $@ ; )
2010-09-08 01:51:12 +08:00
$( hide) $( foreach line,$( ADDITIONAL_BUILD_PROPERTIES) , \
echo " $( line) " >> $@ ; )
2015-02-07 02:12:55 +08:00
$( hide) cat $( INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@
2014-03-19 08:20:10 +08:00
$( hide) build/tools/post_process_props.py $@ $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
2009-03-04 11:28:42 +08:00
build_desc :=
2015-05-07 11:44:22 +08:00
i f e q ( , $( filter true , $ ( TARGET_NO_KERNEL ) $ ( TARGET_NO_RECOVERY ) ) )
INSTALLED_RECOVERYIMAGE_TARGET := $( PRODUCT_OUT) /recovery.img
e l s e
INSTALLED_RECOVERYIMAGE_TARGET :=
e n d i f
$(INSTALLED_BUILD_PROP_TARGET) : $( intermediate_system_build_prop ) $( INSTALLED_RECOVERYIMAGE_TARGET )
@echo " Target build info: $@ "
$( hide) cat $( intermediate_system_build_prop) > $@
i f d e f I N S T A L L E D _ R E C O V E R Y I M A G E _ T A R G E T
$( hide) echo ro.expect.recovery_id= ` cat $( RECOVERYIMAGE_ID_FILE) ` >> $@
e n d i f
2014-07-22 08:21:20 +08:00
# -----------------------------------------------------------------
# vendor build.prop
#
# For verifying that the vendor build is what we thing it is
i f d e f B O A R D _ V E N D O R I M A G E _ F I L E _ S Y S T E M _ T Y P E
INSTALLED_VENDOR_BUILD_PROP_TARGET := $( TARGET_OUT_VENDOR) /build.prop
ALL_DEFAULT_INSTALLED_MODULES += $( INSTALLED_VENDOR_BUILD_PROP_TARGET)
$(INSTALLED_VENDOR_BUILD_PROP_TARGET) : $( INSTALLED_BUILD_PROP_TARGET )
@echo Target vendor buildinfo: $@
@mkdir -p $( dir $@ )
$( hide) echo > $@
2015-08-12 06:25:12 +08:00
$( hide) echo ro.vendor.build.date= ` $( DATE_FROM_FILE) ` >>$@
$( hide) echo ro.vendor.build.date.utc= ` $( DATE_FROM_FILE) +%s` >>$@
2015-07-17 08:15:19 +08:00
$( hide) echo ro.vendor.build.fingerprint= " $( BUILD_FINGERPRINT_FROM_FILE) " >>$@
2014-07-22 08:21:20 +08:00
e n d i f
2015-01-14 07:30:34 +08:00
# ----------------------------------------------------------------
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# sdk-build.prop
#
# There are certain things in build.prop that we don't want to
# ship with the sdk; remove them.
# This must be a list of entire property keys followed by
# "=" characters, without any internal spaces.
sdk_build_prop_remove := \
ro.build.user= \
ro.build.host= \
ro.product.brand= \
ro.product.manufacturer= \
ro.product.device=
# TODO: Remove this soon-to-be obsolete property
sdk_build_prop_remove += ro.build.product=
INSTALLED_SDK_BUILD_PROP_TARGET := $( PRODUCT_OUT) /sdk/sdk-build.prop
$(INSTALLED_SDK_BUILD_PROP_TARGET) : $( INSTALLED_BUILD_PROP_TARGET )
@echo SDK buildinfo: $@
@mkdir -p $( dir $@ )
$( hide) grep -v " $( subst $( space) ,\| ,$( strip \
$( sdk_build_prop_remove) ) ) " $< > $@ .tmp
$( hide) for x in $( sdk_build_prop_remove) ; do \
echo " $$ x " generic >> $@ .tmp; done
$( hide) mv $@ .tmp $@
# -----------------------------------------------------------------
# package stats
PACKAGE_STATS_FILE := $( PRODUCT_OUT) /package-stats.txt
PACKAGES_TO_STAT := \
$( sort $( filter $( TARGET_OUT) /% $( TARGET_OUT_DATA) /%, \
$( filter %.jar %.apk, $( ALL_DEFAULT_INSTALLED_MODULES) ) ) )
$(PACKAGE_STATS_FILE) : $( PACKAGES_TO_STAT )
@echo Package stats: $@
@mkdir -p $( dir $@ )
$( hide) rm -f $@
2015-08-24 00:40:05 +08:00
i f e q ( $( PACKAGES_TO_STAT ) , )
# Create empty package stats file if target builds no jar(s) or apk(s).
$( hide) touch $@
e l s e
2009-03-04 11:28:42 +08:00
$( hide) build/tools/dump-package-stats $^ > $@
2015-08-24 00:40:05 +08:00
e n d i f
2009-03-04 11:28:42 +08:00
.PHONY : package -stats
package-stats : $( PACKAGE_STATS_FILE )
# -----------------------------------------------------------------
# Cert-to-package mapping. Used by the post-build signing tools.
2012-10-27 00:21:28 +08:00
# Use a macro to add newline to each echo command
d e f i n e _ a p k c e r t s _ e c h o _ w i t h _ n e w l i n e
$( hide ) e c h o $( 1)
e n d e f
2009-03-04 11:28:42 +08:00
name := $( TARGET_PRODUCT)
i f e q ( $( TARGET_BUILD_TYPE ) , d e b u g )
name := $( name) _debug
e n d i f
name := $( name) -apkcerts-$( FILE_NAME_TAG)
intermediates := \
$( call intermediates-dir-for,PACKAGING,apkcerts)
APKCERTS_FILE := $( intermediates) /$( name) .txt
2011-02-16 02:56:18 +08:00
# We don't need to really build all the modules.
# TODO: rebuild APKCERTS_FILE if any app change its cert.
2010-07-24 07:42:13 +08:00
$(APKCERTS_FILE) :
2009-03-04 11:28:42 +08:00
@echo APK certs list: $@
@mkdir -p $( dir $@ )
@rm -f $@
2012-10-27 00:21:28 +08:00
$( foreach p,$( PACKAGES) ,\
$( if $( PACKAGES.$( p) .EXTERNAL_KEY) ,\
$( call _apkcerts_echo_with_newline,\
' name = " $( p) .apk " certificate = "EXTERNAL" \
private_key = "" ' >> $@ ) ,\
$( call _apkcerts_echo_with_newline,\
' name = " $( p) .apk " certificate = " $( PACKAGES.$( p) .CERTIFICATE) " \
private_key = " $( PACKAGES.$( p) .PRIVATE_KEY) " ' >> $@ ) ) )
# In case value of PACKAGES is empty.
2011-09-27 03:05:06 +08:00
$( hide) touch $@
2009-03-04 11:28:42 +08:00
.PHONY : apkcerts -list
apkcerts-list : $( APKCERTS_FILE )
2011-02-16 02:56:18 +08:00
i f n e q ( , $( TARGET_BUILD_APPS ) )
$( call dist-for-goals, apps_only, $( APKCERTS_FILE) :apkcerts.txt)
e n d i f
2010-07-24 07:42:13 +08:00
2009-06-16 05:30:14 +08:00
# -----------------------------------------------------------------
2011-10-05 01:50:08 +08:00
# The dev key is used to sign this package, and as the key required
2009-06-16 05:30:14 +08:00
# for future OTA packages installed by this system. Actual product
# deliverables will be re-signed by hand. We expect this file to
# exist with the suffixes ".x509.pem" and ".pk8".
2011-10-05 01:50:08 +08:00
DEFAULT_KEY_CERT_PAIR := $( DEFAULT_SYSTEM_DEV_CERTIFICATE)
2009-06-16 05:30:14 +08:00
2011-07-12 13:11:46 +08:00
# Rules that need to be present for the all targets, even
2009-03-04 11:28:42 +08:00
# if they don't do anything.
.PHONY : systemimage
systemimage :
2010-02-17 08:01:43 +08:00
# -----------------------------------------------------------------
.PHONY : event -log -tags
2010-07-15 01:22:54 +08:00
# Produce an event logs tag file for everything we know about, in order
# to properly allocate numbers. Then produce a file that's filtered
# for what's going to be installed.
all_event_log_tags_file := $( TARGET_OUT_COMMON_INTERMEDIATES) /all-event-log-tags.txt
2012-04-13 04:25:54 +08:00
event_log_tags_file := $( TARGET_OUT) /etc/event-log-tags
2010-07-15 01:22:54 +08:00
# Include tags from all packages that we know about
all_event_log_tags_src := \
$( sort $( foreach m, $( ALL_MODULES) , $( ALL_MODULES.$( m) .EVENT_LOG_TAGS) ) )
2012-04-13 04:25:54 +08:00
# PDK builds will already have a full list of tags that needs to get merged
# in with the ones from source
pdk_fusion_log_tags_file := $( patsubst $( PRODUCT_OUT) /%,$( _pdk_fusion_intermediates) /%,$( filter $( event_log_tags_file) ,$( ALL_PDK_FUSION_FILES) ) )
$(all_event_log_tags_file) : PRIVATE_SRC_FILES := $( all_event_log_tags_src ) $( pdk_fusion_log_tags_file )
$(all_event_log_tags_file) : $( all_event_log_tags_src ) $( pdk_fusion_log_tags_file )
2010-07-15 01:22:54 +08:00
$( hide) mkdir -p $( dir $@ )
$( hide) build/tools/merge-event-log-tags.py -o $@ $( PRIVATE_SRC_FILES)
2011-02-24 04:17:29 +08:00
# Include tags from all packages included in this product, plus all
# tags that are part of the system (ie, not in a vendor/ or device/
# directory).
2010-02-17 08:01:43 +08:00
event_log_tags_src := \
$( sort $( foreach m,\
$( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_PACKAGES) \
$( call module-names-for-tag-list,user) , \
2011-02-24 04:17:29 +08:00
$( ALL_MODULES.$( m) .EVENT_LOG_TAGS) ) \
$( filter-out vendor/% device/% out/%,$( all_event_log_tags_src) ) )
2010-02-17 08:01:43 +08:00
2012-04-13 04:25:54 +08:00
$(event_log_tags_file) : PRIVATE_SRC_FILES := $( event_log_tags_src ) $( pdk_fusion_log_tags_file )
2010-07-15 01:22:54 +08:00
$(event_log_tags_file) : PRIVATE_MERGED_FILE := $( all_event_log_tags_file )
2012-04-13 04:25:54 +08:00
$(event_log_tags_file) : $( event_log_tags_src ) $( all_event_log_tags_file ) $( pdk_fusion_log_tags_file )
2010-02-17 08:01:43 +08:00
$( hide) mkdir -p $( dir $@ )
2010-07-15 01:22:54 +08:00
$( hide) build/tools/merge-event-log-tags.py -o $@ -m $( PRIVATE_MERGED_FILE) $( PRIVATE_SRC_FILES)
2010-02-17 08:01:43 +08:00
event-log-tags : $( event_log_tags_file )
ALL_DEFAULT_INSTALLED_MODULES += $( event_log_tags_file)
2010-07-15 01:22:54 +08:00
2009-03-04 11:28:42 +08:00
# #################################################################
# Targets for boot/OS images
# #################################################################
2014-01-14 08:14:20 +08:00
i f n e q ( $( strip $ ( TARGET_NO_BOOTLOADER ) ) , t r u e )
INSTALLED_BOOTLOADER_MODULE := $( PRODUCT_OUT) /bootloader
ifeq ( $( strip $( TARGET_BOOTLOADER_IS_2ND) ) ,true)
INSTALLED_2NDBOOTLOADER_TARGET := $( PRODUCT_OUT) /2ndbootloader
else
INSTALLED_2NDBOOTLOADER_TARGET :=
endif
e l s e
INSTALLED_BOOTLOADER_MODULE :=
INSTALLED_2NDBOOTLOADER_TARGET :=
e n d i f # TARGET_NO_BOOTLOADER
i f n e q ( $( strip $ ( TARGET_NO_KERNEL ) ) , t r u e )
INSTALLED_KERNEL_TARGET := $( PRODUCT_OUT) /kernel
e l s e
INSTALLED_KERNEL_TARGET :=
e n d i f
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# the ramdisk
INTERNAL_RAMDISK_FILES := $( filter $( TARGET_ROOT_OUT) /%, \
$( ALL_PREBUILT) \
$( ALL_GENERATED_SOURCES) \
$( ALL_DEFAULT_INSTALLED_MODULES) )
2009-04-10 10:31:12 +08:00
BUILT_RAMDISK_TARGET := $( PRODUCT_OUT) /ramdisk.img
# We just build this directly to the install location.
INSTALLED_RAMDISK_TARGET := $( BUILT_RAMDISK_TARGET)
2012-08-14 06:03:00 +08:00
$(INSTALLED_RAMDISK_TARGET) : $( MKBOOTFS ) $( INTERNAL_RAMDISK_FILES ) | $( MINIGZIP )
2009-03-04 11:28:42 +08:00
$( call pretty," Target ram disk: $@ " )
2015-07-10 00:54:55 +08:00
$( hide) $( MKBOOTFS) -d $( TARGET_OUT) $( TARGET_ROOT_OUT) | $( MINIGZIP) > $@
2009-03-04 11:28:42 +08:00
2013-08-09 07:34:29 +08:00
.PHONY : ramdisk -nodeps
ramdisk-nodeps : $( MKBOOTFS ) | $( MINIGZIP )
@echo " make $@ : ignoring dependencies "
2015-07-10 00:54:55 +08:00
$( hide) $( MKBOOTFS) -d $( TARGET_OUT) $( TARGET_ROOT_OUT) | $( MINIGZIP) > $( INSTALLED_RAMDISK_TARGET)
2009-03-04 11:28:42 +08:00
i f n e q ( $( strip $ ( TARGET_NO_KERNEL ) ) , t r u e )
# -----------------------------------------------------------------
# the boot image, which is a collection of other images.
INTERNAL_BOOTIMAGE_ARGS := \
$( addprefix --second ,$( INSTALLED_2NDBOOTLOADER_TARGET) ) \
2015-04-09 06:11:47 +08:00
--kernel $( INSTALLED_KERNEL_TARGET)
i f n e q ( $( BOARD_BUILD_SYSTEM_ROOT_IMAGE ) , t r u e )
INTERNAL_BOOTIMAGE_ARGS += --ramdisk $( INSTALLED_RAMDISK_TARGET)
e n d i f
2009-03-04 11:28:42 +08:00
INTERNAL_BOOTIMAGE_FILES := $( filter-out --%,$( INTERNAL_BOOTIMAGE_ARGS) )
2009-05-08 10:43:08 +08:00
BOARD_KERNEL_BASE := $( strip $( BOARD_KERNEL_BASE) )
i f d e f B O A R D _ K E R N E L _ B A S E
INTERNAL_BOOTIMAGE_ARGS += --base $( BOARD_KERNEL_BASE)
e n d i f
2010-08-24 03:56:25 +08:00
BOARD_KERNEL_PAGESIZE := $( strip $( BOARD_KERNEL_PAGESIZE) )
i f d e f B O A R D _ K E R N E L _ P A G E S I Z E
INTERNAL_BOOTIMAGE_ARGS += --pagesize $( BOARD_KERNEL_PAGESIZE)
e n d i f
2016-04-30 09:20:13 +08:00
i f e q ( $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VERITY ) , t r u e )
i f e q ( $( BOARD_BUILD_SYSTEM_ROOT_IMAGE ) , t r u e )
VERITY_KEYID := veritykeyid = id:` openssl x509 -in $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VERITY_SIGNING_KEY) .x509.pem -text \
| grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g' `
e n d i f
e n d i f
2016-06-18 09:42:39 +08:00
BOARD_KERNEL_CMDLINE := $( strip $( BOARD_KERNEL_CMDLINE) buildvariant = $( TARGET_BUILD_VARIANT) $( VERITY_KEYID) )
2016-04-30 09:20:13 +08:00
i f d e f B O A R D _ K E R N E L _ C M D L I N E
INTERNAL_BOOTIMAGE_ARGS += --cmdline " $( BOARD_KERNEL_CMDLINE) "
e n d i f
2016-03-16 00:49:30 +08:00
INTERNAL_MKBOOTIMG_VERSION_ARGS := \
--os_version $( PLATFORM_VERSION) \
--os_patch_level $( PLATFORM_SECURITY_PATCH)
2009-03-04 11:28:42 +08:00
INSTALLED_BOOTIMAGE_TARGET := $( PRODUCT_OUT) /boot.img
2015-11-11 11:21:34 +08:00
# BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true.
i f e q ( $( BOARD_USES_RECOVERY_AS_BOOT ) , t r u e )
i f n e q ( $( BOARD_BUILD_SYSTEM_ROOT_IMAGE ) , t r u e )
$( error BOARD_BUILD_SYSTEM_ROOT_IMAGE must be enabled for BOARD_USES_RECOVERY_AS_BOOT.)
e n d i f
e n d i f
# We build recovery as boot image if BOARD_USES_RECOVERY_AS_BOOT is true.
i f n e q ( $( BOARD_USES_RECOVERY_AS_BOOT ) , t r u e )
2009-03-04 11:28:42 +08:00
i f e q ( $( TARGET_BOOTIMAGE_USE_EXT 2) , t r u e )
2015-02-12 07:04:59 +08:00
$( error TARGET_BOOTIMAGE_USE_EXT 2 is not supported anymore )
2015-04-07 22:08:59 +08:00
e l s e i f e q ( t r u e , $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_BOOT_SIGNER ) ) # TARGET_BOOTIMAGE_USE_EXT2 != true
2014-07-09 11:07:41 +08:00
$(INSTALLED_BOOTIMAGE_TARGET) : $( MKBOOTIMG ) $( INTERNAL_BOOTIMAGE_FILES ) $( BOOT_SIGNER )
$( call pretty," Target boot image: $@ " )
2016-03-16 00:49:30 +08:00
$( hide) $( MKBOOTIMG) $( INTERNAL_BOOTIMAGE_ARGS) $( INTERNAL_MKBOOTIMG_VERSION_ARGS) $( BOARD_MKBOOTIMG_ARGS) --output $@
2014-11-07 12:38:00 +08:00
$( BOOT_SIGNER) /boot $@ $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VERITY_SIGNING_KEY) .pk8 $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VERITY_SIGNING_KEY) .x509.pem $@
2014-07-09 11:07:41 +08:00
$( hide) $( call assert-max-image-size,$@ ,$( BOARD_BOOTIMAGE_PARTITION_SIZE) )
.PHONY : bootimage -nodeps
bootimage-nodeps : $( MKBOOTIMG ) $( BOOT_SIGNER )
@echo " make $@ : ignoring dependencies "
2016-03-16 00:49:30 +08:00
$( hide) $( MKBOOTIMG) $( INTERNAL_BOOTIMAGE_ARGS) $( INTERNAL_MKBOOTIMG_VERSION_ARGS) $( BOARD_MKBOOTIMG_ARGS) --output $( INSTALLED_BOOTIMAGE_TARGET)
2014-11-07 12:38:00 +08:00
$( BOOT_SIGNER) /boot $( INSTALLED_BOOTIMAGE_TARGET) $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VERITY_SIGNING_KEY) .pk8 $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VERITY_SIGNING_KEY) .x509.pem $( INSTALLED_BOOTIMAGE_TARGET)
2014-07-09 11:07:41 +08:00
$( hide) $( call assert-max-image-size,$( INSTALLED_BOOTIMAGE_TARGET) ,$( BOARD_BOOTIMAGE_PARTITION_SIZE) )
2015-04-07 22:08:59 +08:00
e l s e i f e q ( t r u e , $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VBOOT ) ) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
2015-03-04 00:54:11 +08:00
$(INSTALLED_BOOTIMAGE_TARGET) : $( MKBOOTIMG ) $( INTERNAL_BOOTIMAGE_FILES ) $( VBOOT_SIGNER )
$( call pretty," Target boot image: $@ " )
2016-03-16 00:49:30 +08:00
$( hide) $( MKBOOTIMG) $( INTERNAL_BOOTIMAGE_ARGS) $( INTERNAL_MKBOOTIMG_VERSION_ARGS) $( BOARD_MKBOOTIMG_ARGS) --output $@ .unsigned
2015-08-08 02:58:05 +08:00
$( VBOOT_SIGNER) $( FUTILITY) $@ .unsigned $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VBOOT_SIGNING_KEY) .vbpubk $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VBOOT_SIGNING_KEY) .vbprivk $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VBOOT_SIGNING_SUBKEY) .vbprivk $@ .keyblock $@
2015-03-04 00:54:11 +08:00
$( hide) $( call assert-max-image-size,$@ ,$( BOARD_BOOTIMAGE_PARTITION_SIZE) )
.PHONY : bootimage -nodeps
bootimage-nodeps : $( MKBOOTIMG ) $( VBOOT_SIGNER )
@echo " make $@ : ignoring dependencies "
2016-03-16 00:49:30 +08:00
$( hide) $( MKBOOTIMG) $( INTERNAL_BOOTIMAGE_ARGS) $( INTERNAL_MKBOOTIMG_VERSION_ARGS) $( BOARD_MKBOOTIMG_ARGS) --output $( INSTALLED_BOOTIMAGE_TARGET) .unsigned
2015-08-08 02:58:05 +08:00
$( VBOOT_SIGNER) $( FUTILITY) $( INSTALLED_BOOTIMAGE_TARGET) .unsigned $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VBOOT_SIGNING_KEY) .vbpubk $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VBOOT_SIGNING_KEY) .vbprivk $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VBOOT_SIGNING_SUBKEY) .vbprivk $( INSTALLED_BOOTIMAGE_TARGET) .keyblock $( INSTALLED_BOOTIMAGE_TARGET)
2015-03-04 00:54:11 +08:00
$( hide) $( call assert-max-image-size,$( INSTALLED_BOOTIMAGE_TARGET) ,$( BOARD_BOOTIMAGE_PARTITION_SIZE) )
e l s e # PRODUCT_SUPPORTS_VBOOT != true
2009-03-04 11:28:42 +08:00
$(INSTALLED_BOOTIMAGE_TARGET) : $( MKBOOTIMG ) $( INTERNAL_BOOTIMAGE_FILES )
$( call pretty," Target boot image: $@ " )
2016-03-16 00:49:30 +08:00
$( hide) $( MKBOOTIMG) $( INTERNAL_BOOTIMAGE_ARGS) $( INTERNAL_MKBOOTIMG_VERSION_ARGS) $( BOARD_MKBOOTIMG_ARGS) --output $@
2014-06-17 05:19:36 +08:00
$( hide) $( call assert-max-image-size,$@ ,$( BOARD_BOOTIMAGE_PARTITION_SIZE) )
2013-08-09 07:34:29 +08:00
.PHONY : bootimage -nodeps
bootimage-nodeps : $( MKBOOTIMG )
@echo " make $@ : ignoring dependencies "
2016-03-16 00:49:30 +08:00
$( hide) $( MKBOOTIMG) $( INTERNAL_BOOTIMAGE_ARGS) $( INTERNAL_MKBOOTIMG_VERSION_ARGS) $( BOARD_MKBOOTIMG_ARGS) --output $( INSTALLED_BOOTIMAGE_TARGET)
2014-06-17 05:19:36 +08:00
$( hide) $( call assert-max-image-size,$( INSTALLED_BOOTIMAGE_TARGET) ,$( BOARD_BOOTIMAGE_PARTITION_SIZE) )
2013-08-09 07:34:29 +08:00
2009-03-04 11:28:42 +08:00
e n d i f # TARGET_BOOTIMAGE_USE_EXT2
2015-11-11 11:21:34 +08:00
e n d i f # BOARD_USES_RECOVERY_AS_BOOT
2009-03-04 11:28:42 +08:00
e l s e # TARGET_NO_KERNEL
# HACK: The top-level targets depend on the bootimage. Not all targets
# can produce a bootimage, though, and emulator targets need the ramdisk
# instead. Fake it out by calling the ramdisk the bootimage.
# TODO: make the emulator use bootimages, and make mkbootimg accept
# kernel-less inputs.
INSTALLED_BOOTIMAGE_TARGET := $( INSTALLED_RAMDISK_TARGET)
e n d i f
# -----------------------------------------------------------------
# NOTICE files
#
2012-03-01 19:34:41 +08:00
# We are required to publish the licenses for all code under BSD, GPL and
# Apache licenses (and possibly other more exotic ones as well). We err on the
# side of caution, so the licenses for other third-party code are included here
# too.
#
2009-03-04 11:28:42 +08:00
# This needs to be before the systemimage rules, because it adds to
# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
# go into the systemimage.
2012-03-01 03:18:08 +08:00
.PHONY : notice_files
2009-03-04 11:28:42 +08:00
# Create the rule to combine the files into text and html forms
2012-03-01 03:18:08 +08:00
# $(1) - Plain text output file
# $(2) - HTML output file
# $(3) - File title
# $(4) - Directory to use. Notice files are all $(4)/src. Other
2009-03-04 11:28:42 +08:00
# directories in there will be used for scratch
2012-03-01 03:18:08 +08:00
# $(5) - Dependencies for the output files
2009-03-04 11:28:42 +08:00
#
# The algorithm here is that we go collect a hash for each of the notice
# files and write the names of the files that match that hash. Then
# to generate the real files, we go print out all of the files and their
# hashes.
#
# These rules are fairly complex, so they depend on this makefile so if
# it changes, they'll run again.
#
# TODO: We could clean this up so that we just record the locations of the
# original notice files instead of making rules to copy them somwehere.
# Then we could traverse that without quite as much bash drama.
d e f i n e c o m b i n e - n o t i c e - f i l e s
2012-03-01 03:18:08 +08:00
$(1) $(2) : PRIVATE_MESSAGE := $( 3)
2012-03-29 22:33:19 +08:00
$(1) $(2) : PRIVATE_DIR := $( 4)
2012-04-10 03:16:23 +08:00
$(1) : $( 2)
$(2) : $( 5) $( BUILD_SYSTEM ) /Makefile build /tools /generate -notice -files .py
2012-03-29 22:33:19 +08:00
build/tools/generate-notice-files.py $( 1) $( 2) $$ ( PRIVATE_MESSAGE) $$ ( PRIVATE_DIR) /src
2012-03-01 03:18:08 +08:00
notice_files : $( 1) $( 2)
2009-03-04 11:28:42 +08:00
e n d e f
# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
# the src subdirectory.
2012-03-01 03:18:08 +08:00
target_notice_file_txt := $( TARGET_OUT_INTERMEDIATES) /NOTICE.txt
2009-03-04 11:28:42 +08:00
target_notice_file_html := $( TARGET_OUT_INTERMEDIATES) /NOTICE.html
target_notice_file_html_gz := $( TARGET_OUT_INTERMEDIATES) /NOTICE.html.gz
2012-03-01 03:18:08 +08:00
tools_notice_file_txt := $( HOST_OUT_INTERMEDIATES) /NOTICE.txt
2009-03-04 11:28:42 +08:00
tools_notice_file_html := $( HOST_OUT_INTERMEDIATES) /NOTICE.html
2013-08-23 11:02:03 +08:00
i f n d e f T A R G E T _ B U I L D _ A P P S
2009-03-04 11:28:42 +08:00
kernel_notice_file := $( TARGET_OUT_NOTICE_FILES) /src/kernel.txt
2012-04-10 08:04:12 +08:00
pdk_fusion_notice_files := $( filter $( TARGET_OUT_NOTICE_FILES) /%, $( ALL_PDK_FUSION_FILES) )
2009-03-04 11:28:42 +08:00
$( eval $ ( call combine -notice -files , \
2012-03-01 03:18:08 +08:00
$( target_notice_file_txt) , \
2009-03-04 11:28:42 +08:00
$( target_notice_file_html) , \
"Notices for files contained in the filesystem images in this directory:" , \
$( TARGET_OUT_NOTICE_FILES) , \
2012-04-10 08:04:12 +08:00
$( ALL_DEFAULT_INSTALLED_MODULES) $( kernel_notice_file) $( pdk_fusion_notice_files) ) )
2009-03-04 11:28:42 +08:00
$( eval $ ( call combine -notice -files , \
2012-03-01 03:18:08 +08:00
$( tools_notice_file_txt) , \
2009-03-04 11:28:42 +08:00
$( tools_notice_file_html) , \
"Notices for files contained in the tools directory:" , \
$( HOST_OUT_NOTICE_FILES) , \
$( ALL_DEFAULT_INSTALLED_MODULES) ) )
# Install the html file at /system/etc/NOTICE.html.gz.
# This is not ideal, but this is very late in the game, after a lot of
# the module processing has already been done -- in fact, we used the
# fact that all that has been done to get the list of modules that we
# need notice files for.
2009-05-28 00:14:25 +08:00
$(target_notice_file_html_gz) : $( target_notice_file_html ) | $( MINIGZIP )
2009-06-16 05:30:14 +08:00
$( hide) $( MINIGZIP) -9 < $< > $@
2009-03-04 11:28:42 +08:00
installed_notice_html_gz := $( TARGET_OUT) /etc/NOTICE.html.gz
$(installed_notice_html_gz) : $( target_notice_file_html_gz ) | $( ACP )
$( copy-file-to-target)
2009-05-01 04:52:50 +08:00
# if we've been run my mm, mmm, etc, don't reinstall this every time
i f e q ( $( ONE_SHOT_MAKEFILE ) , )
2009-03-04 11:28:42 +08:00
ALL_DEFAULT_INSTALLED_MODULES += $( installed_notice_html_gz)
2009-05-01 04:52:50 +08:00
e n d i f
2013-08-23 11:02:03 +08:00
e n d i f # TARGET_BUILD_APPS
2009-03-04 11:28:42 +08:00
# The kernel isn't really a module, so to get its module file in there, we
# make the target NOTICE files depend on this particular file too, which will
# then be in the right directory for the find in combine-notice-files to work.
$(kernel_notice_file) : \
2015-11-09 08:28:15 +08:00
$( BUILD_SYSTEM) /LINUX_KERNEL_COPYING \
2009-03-04 11:28:42 +08:00
| $( ACP)
@echo Copying: $@
$( hide) mkdir -p $( dir $@ )
$( hide) $( ACP) $< $@
2009-06-16 05:30:14 +08:00
# -----------------------------------------------------------------
# Build a keystore with the authorized keys in it, used to verify the
# authenticity of downloaded OTA packages.
#
# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
# before the rules that use that variable to build the image.
2015-10-30 05:26:18 +08:00
ALL_DEFAULT_INSTALLED_MODULES += $( TARGET_OUT_ETC) /security/otacerts.zip
$(TARGET_OUT_ETC)/security/otacerts.zip : KEY_CERT_PAIR := $( DEFAULT_KEY_CERT_PAIR )
2015-10-30 07:33:05 +08:00
$(TARGET_OUT_ETC)/security/otacerts.zip : $( addsuffix .x 509.pem ,$ ( DEFAULT_KEY_CERT_PAIR ) ) | $( ZIPTIME )
2009-06-16 05:30:14 +08:00
$( hide) rm -f $@
$( hide) mkdir -p $( dir $@ )
2015-10-30 07:33:05 +08:00
$( hide) zip -qjX $@ $<
$( remove-timestamps-from-package)
2009-06-16 05:30:14 +08:00
2016-01-21 12:58:20 +08:00
# Carry the public key for update_engine if it's a non-Brillo target that
# uses the AB updater. We use the same key as otacerts but in RSA public key
# format.
i f e q ( $( AB_OTA_UPDATER ) , t r u e )
i f e q ( $( BRILLO ) , )
2016-01-22 06:28:50 +08:00
ALL_DEFAULT_INSTALLED_MODULES += $( TARGET_OUT_ETC) /update_engine/update-payload-key.pub.pem
$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem : $( addsuffix .x 509.pem ,$ ( DEFAULT_KEY_CERT_PAIR ) )
2016-01-21 12:58:20 +08:00
$( hide) rm -f $@
$( hide) mkdir -p $( dir $@ )
$( hide) openssl x509 -pubkey -noout -in $< > $@
2016-08-04 11:52:54 +08:00
ALL_DEFAULT_INSTALLED_MODULES += $( TARGET_RECOVERY_ROOT_OUT) /etc/update_engine/update-payload-key.pub.pem
$(TARGET_RECOVERY_ROOT_OUT)/etc/update_engine/update-payload-key.pub.pem : $( TARGET_OUT_ETC ) /update_engine /update -payload -key .pub .pem
$( hide) cp -f $< $@
2016-01-21 12:58:20 +08:00
e n d i f
e n d i f
2009-06-16 05:30:14 +08:00
.PHONY : otacerts
otacerts : $( TARGET_OUT_ETC ) /security /otacerts .zip
2009-03-04 11:28:42 +08:00
# #################################################################
# Targets for user images
# #################################################################
2010-06-17 05:31:34 +08:00
INTERNAL_USERIMAGES_EXT_VARIANT :=
2009-03-04 11:28:42 +08:00
i f e q ( $( TARGET_USERIMAGES_USE_EXT 2) , t r u e )
2010-05-07 17:23:59 +08:00
INTERNAL_USERIMAGES_USE_EXT := true
INTERNAL_USERIMAGES_EXT_VARIANT := ext2
e l s e
i f e q ( $( TARGET_USERIMAGES_USE_EXT 3) , t r u e )
INTERNAL_USERIMAGES_USE_EXT := true
INTERNAL_USERIMAGES_EXT_VARIANT := ext3
e l s e
i f e q ( $( TARGET_USERIMAGES_USE_EXT 4) , t r u e )
INTERNAL_USERIMAGES_USE_EXT := true
INTERNAL_USERIMAGES_EXT_VARIANT := ext4
e n d i f
e n d i f
e n d i f
2014-10-23 11:01:22 +08:00
# These options tell the recovery updater/installer how to mount the partitions writebale.
# <fstype>=<fstype_opts>[|<fstype_opts>]...
# fstype_opts := <opt>[,<opt>]...
# opt := <name>[=<value>]
2014-10-24 07:27:03 +08:00
# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS := ext4 = max_batch_time = 0,commit= 1,data= ordered,barrier= 1,errors= panic,nodelalloc
2014-10-23 11:01:22 +08:00
2010-11-18 07:40:38 +08:00
i f n e q ( t r u e , $( TARGET_USERIMAGES_SPARSE_EXT_DISABLED ) )
INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
e n d i f
2010-05-07 17:23:59 +08:00
i f e q ( $( INTERNAL_USERIMAGES_USE_EXT ) , t r u e )
2014-06-17 05:17:40 +08:00
INTERNAL_USERIMAGES_DEPS := $( SIMG2IMG)
INTERNAL_USERIMAGES_DEPS += $( MKEXTUSERIMG) $( MAKE_EXT4FS) $( E2FSCK)
i f e q ( $( TARGET_USERIMAGES_USE_F 2FS ) , t r u e )
INTERNAL_USERIMAGES_DEPS += $( MKF2FSUSERIMG) $( MAKE_F2FS)
e n d i f
2009-03-04 11:28:42 +08:00
e n d i f
2014-06-17 05:17:40 +08:00
2015-12-16 10:00:14 +08:00
i f n e q ( t r u e , $( TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED ) )
INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
e n d i f
2016-02-10 06:12:47 +08:00
i f n e q ( $( filter $ ( BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE ) $ ( BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE ) ,squashfs ) , )
2015-06-25 06:42:19 +08:00
INTERNAL_USERIMAGES_DEPS += $( MAKE_SQUASHFS) $( MKSQUASHFSUSERIMG) $( IMG2SIMG)
2015-03-04 04:30:37 +08:00
e n d i f
2011-11-01 09:13:30 +08:00
INTERNAL_USERIMAGES_BINARY_PATHS := $( sort $( dir $( INTERNAL_USERIMAGES_DEPS) ) )
2009-03-04 11:28:42 +08:00
2014-04-29 07:27:32 +08:00
i f e q ( t r u e , $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VERITY ) )
2014-04-17 09:49:56 +08:00
INTERNAL_USERIMAGES_DEPS += $( BUILD_VERITY_TREE) $( APPEND2SIMG) $( VERITY_SIGNER)
2015-05-20 14:30:57 +08:00
i f e q ( t r u e , $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VERITY_FEC ) )
INTERNAL_USERIMAGES_DEPS += $( FEC)
e n d i f
2013-06-17 08:26:08 +08:00
e n d i f
2015-08-05 02:59:06 +08:00
SELINUX_FC := $( TARGET_ROOT_OUT) /file_contexts.bin
2012-11-22 02:47:00 +08:00
INTERNAL_USERIMAGES_DEPS += $( SELINUX_FC)
2016-03-03 13:07:23 +08:00
INTERNAL_USERIMAGES_DEPS += $( BLK_ALLOC_TO_BASE_FS)
2011-10-29 08:02:30 +08:00
# $(1): the path of the output dictionary file
2013-02-28 05:54:02 +08:00
# $(2): additional "key=value" pairs to append to the dictionary file.
2011-10-29 08:02:30 +08:00
d e f i n e g e n e r a t e - u s e r i m a g e - p r o p - d i c t i o n a r y
$( if $ ( INTERNAL_USERIMAGES_EXT_VARIANT ) ,$ ( hide ) echo "fs_type =$ ( INTERNAL_USERIMAGES_EXT_VARIANT ) " >> $ ( 1) )
$( if $ ( BOARD_SYSTEMIMAGE_PARTITION_SIZE ) ,$ ( hide ) echo "system_size =$ ( BOARD_SYSTEMIMAGE_PARTITION_SIZE ) " >> $ ( 1) )
2015-03-04 04:30:37 +08:00
$( if $ ( BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE ) ,$ ( hide ) echo "system_fs_type =$ ( BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE ) " >> $ ( 1) )
2014-11-19 10:03:13 +08:00
$( if $ ( BOARD_SYSTEMIMAGE_JOURNAL_SIZE ) ,$ ( hide ) echo "system_journal_size =$ ( BOARD_SYSTEMIMAGE_JOURNAL_SIZE ) " >> $ ( 1) )
2015-06-24 02:16:05 +08:00
$( if $ ( BOARD_HAS_EXT 4_RESERVED_BLOCKS ) ,$ ( hide ) echo "has_ext 4_reserved_blocks =$ ( BOARD_HAS_EXT 4_RESERVED_BLOCKS ) " >> $ ( 1) )
2015-06-18 03:35:15 +08:00
$( if $ ( BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR ) ,$ ( hide ) echo "system_squashfs_compressor =$ ( BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR ) " >> $ ( 1) )
$( if $ ( BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT ) ,$ ( hide ) echo "system_squashfs_compressor_opt =$ ( BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT ) " >> $ ( 1) )
2016-05-25 03:59:30 +08:00
$( if $ ( BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE ) ,$ ( hide ) echo "system_squashfs_block_size =$ ( BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE ) " >> $ ( 1) )
2016-06-16 06:53:07 +08:00
$( if $ ( BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_ 4K_ALIGN ) ,$ ( hide ) echo "system_squashfs_disable_ 4k_align =$ ( BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_ 4K_ALIGN ) " >> $ ( 1) )
2016-04-23 08:22:07 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SYSTEM_BASE_FS_PATH ) ,$ ( hide ) echo "system_base_fs_file =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SYSTEM_BASE_FS_PATH ) " >> $ ( 1) )
2014-06-17 05:17:40 +08:00
$( if $ ( BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE ) ,$ ( hide ) echo "userdata_fs_type =$ ( BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE ) " >> $ ( 1) )
2011-10-29 08:02:30 +08:00
$( if $ ( BOARD_USERDATAIMAGE_PARTITION_SIZE ) ,$ ( hide ) echo "userdata_size =$ ( BOARD_USERDATAIMAGE_PARTITION_SIZE ) " >> $ ( 1) )
2011-11-05 02:37:01 +08:00
$( if $ ( BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE ) ,$ ( hide ) echo "cache_fs_type =$ ( BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE ) " >> $ ( 1) )
$( if $ ( BOARD_CACHEIMAGE_PARTITION_SIZE ) ,$ ( hide ) echo "cache_size =$ ( BOARD_CACHEIMAGE_PARTITION_SIZE ) " >> $ ( 1) )
2013-03-21 02:02:05 +08:00
$( if $ ( BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE ) ,$ ( hide ) echo "vendor_fs_type =$ ( BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE ) " >> $ ( 1) )
$( if $ ( BOARD_VENDORIMAGE_PARTITION_SIZE ) ,$ ( hide ) echo "vendor_size =$ ( BOARD_VENDORIMAGE_PARTITION_SIZE ) " >> $ ( 1) )
2014-11-19 10:03:13 +08:00
$( if $ ( BOARD_VENDORIMAGE_JOURNAL_SIZE ) ,$ ( hide ) echo "vendor_journal_size =$ ( BOARD_VENDORIMAGE_JOURNAL_SIZE ) " >> $ ( 1) )
2016-02-10 07:40:38 +08:00
$( if $ ( BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR ) ,$ ( hide ) echo "vendor_squashfs_compressor =$ ( BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR ) " >> $ ( 1) )
$( if $ ( BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT ) ,$ ( hide ) echo "vendor_squashfs_compressor_opt =$ ( BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT ) " >> $ ( 1) )
2016-05-25 03:59:30 +08:00
$( if $ ( BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE ) ,$ ( hide ) echo "vendor_squashfs_block_size =$ ( BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE ) " >> $ ( 1) )
2016-06-16 06:53:07 +08:00
$( if $ ( BOARD_VENDORIMAGE_SQUASHFS_DISABLE_ 4K_ALIGN ) ,$ ( hide ) echo "vendor_squashfs_disable_ 4k_align =$ ( BOARD_VENDORIMAGE_SQUASHFS_DISABLE_ 4K_ALIGN ) " >> $ ( 1) )
2016-04-23 08:22:07 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_VENDOR_BASE_FS_PATH ) ,$ ( hide ) echo "vendor_base_fs_file =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_VENDOR_BASE_FS_PATH ) " >> $ ( 1) )
2014-03-12 08:13:27 +08:00
$( if $ ( BOARD_OEMIMAGE_PARTITION_SIZE ) ,$ ( hide ) echo "oem_size =$ ( BOARD_OEMIMAGE_PARTITION_SIZE ) " >> $ ( 1) )
2014-11-19 10:03:13 +08:00
$( if $ ( BOARD_OEMIMAGE_JOURNAL_SIZE ) ,$ ( hide ) echo "oem_journal_size =$ ( BOARD_OEMIMAGE_JOURNAL_SIZE ) " >> $ ( 1) )
2011-10-29 08:02:30 +08:00
$( if $ ( INTERNAL_USERIMAGES_SPARSE_EXT_FLAG ) ,$ ( hide ) echo "extfs_sparse_flag =$ ( INTERNAL_USERIMAGES_SPARSE_EXT_FLAG ) " >> $ ( 1) )
2015-12-16 10:00:14 +08:00
$( if $ ( INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG ) ,$ ( hide ) echo "squashfs_sparse_flag =$ ( INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG ) " >> $ ( 1) )
2012-11-22 02:47:00 +08:00
$( hide ) e c h o "selinux_fc=$(SELINUX_FC)" > > $( 1)
2015-04-07 22:08:59 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_BOOT_SIGNER ) ,$ ( hide ) echo "boot_signer =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_BOOT_SIGNER ) " >> $ ( 1) )
2014-07-11 06:42:38 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VERITY ) ,$ ( hide ) echo "verity =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VERITY ) " >> $ ( 1) )
2014-11-14 09:54:30 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VERITY ) ,$ ( hide ) echo "verity_key =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_VERITY_SIGNING_KEY ) " >> $ ( 1) )
2015-06-02 17:03:27 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VERITY ) ,$ ( hide ) echo "verity_signer_cmd =$ ( notdir $ ( VERITY_SIGNER ) ) " >> $ ( 1) )
2015-05-20 14:30:57 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VERITY_FEC ) ,$ ( hide ) echo "verity_fec =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VERITY_FEC ) " >> $ ( 1) )
2014-07-11 06:42:38 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SYSTEM_VERITY_PARTITION ) ,$ ( hide ) echo "system_verity_block_device =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SYSTEM_VERITY_PARTITION ) " >> $ ( 1) )
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_VENDOR_VERITY_PARTITION ) ,$ ( hide ) echo "vendor_verity_block_device =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_VENDOR_VERITY_PARTITION ) " >> $ ( 1) )
2015-03-30 14:07:41 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VBOOT ) ,$ ( hide ) echo "vboot =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VBOOT ) " >> $ ( 1) )
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VBOOT ) ,$ ( hide ) echo "vboot_key =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_VBOOT_SIGNING_KEY ) " >> $ ( 1) )
2015-08-08 02:58:05 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VBOOT ) ,$ ( hide ) echo "vboot_subkey =$ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_VBOOT_SIGNING_SUBKEY ) " >> $ ( 1) )
2015-03-30 14:07:41 +08:00
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VBOOT ) ,$ ( hide ) echo "futility =$ ( FUTILITY ) " >> $ ( 1) )
$( if $ ( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VBOOT ) ,$ ( hide ) echo "vboot_signer_cmd =$ ( VBOOT_SIGNER ) " >> $ ( 1) )
2015-11-11 11:21:34 +08:00
$( if $ ( filter true ,$ ( BOARD_USES_RECOVERY_AS_BOOT ) ) ,\
$( hide) echo "recovery_as_boot=true" >> $( 1) )
2015-03-25 10:07:40 +08:00
$( if $ ( filter true ,$ ( BOARD_BUILD_SYSTEM_ROOT_IMAGE ) ) ,\
$( hide) echo "system_root_image=true" >> $( 1) ; \
echo " ramdisk_dir= $( TARGET_ROOT_OUT) " >> $( 1) )
2013-02-28 05:54:02 +08:00
$( if $ ( 2) ,$ ( hide ) $ ( foreach kv ,$ ( 2) ,echo "$ ( kv ) " >> $ ( 1) ;) )
2011-10-29 08:02:30 +08:00
e n d e f
2009-07-03 00:00:54 +08:00
# -----------------------------------------------------------------
# Recovery image
2009-07-08 08:14:25 +08:00
2015-11-11 11:21:34 +08:00
# Recovery image exists if we are building recovery, or building recovery as boot.
i f n e q ( , $( INSTALLED_RECOVERYIMAGE_TARGET ) $( filter true ,$ ( BOARD_USES_RECOVERY_AS_BOOT ) ) )
2009-07-03 00:00:54 +08:00
2015-03-11 03:02:57 +08:00
INTERNAL_RECOVERYIMAGE_FILES := $( filter $( TARGET_RECOVERY_OUT) /%, \
$( ALL_DEFAULT_INSTALLED_MODULES) )
2009-07-03 00:00:54 +08:00
recovery_initrc := $( call include-path-for, recovery) /etc/init.rc
2014-05-30 04:41:03 +08:00
recovery_sepolicy := $( call intermediates-dir-for,ETC,sepolicy.recovery) /sepolicy.recovery
2009-07-03 00:00:54 +08:00
recovery_kernel := $( INSTALLED_KERNEL_TARGET) # same as a non-recovery system
recovery_ramdisk := $( PRODUCT_OUT) /ramdisk-recovery.img
2015-05-07 11:44:22 +08:00
recovery_build_prop := $( intermediate_system_build_prop)
2009-07-03 00:00:54 +08:00
recovery_resources_common := $( call include-path-for, recovery) /res
2013-03-07 07:04:31 +08:00
2014-05-13 06:32:20 +08:00
# Set recovery_density to the density bucket of the device.
recovery_density := unknown
i f n e q ( , $( PRODUCT_AAPT_PREF_CONFIG ) )
# If PRODUCT_AAPT_PREF_CONFIG includes a dpi bucket, then use that value.
recovery_density := $( filter %dpi,$( PRODUCT_AAPT_PREF_CONFIG) )
e l s e
2014-12-03 08:13:09 +08:00
# Otherwise, use the default medium density.
recovery_densities := mdpi
2014-05-13 06:32:20 +08:00
e n d i f
i f n e q ( , $( wildcard $ ( recovery_resources_common ) -$ ( recovery_density ) ) )
recovery_resources_common := $( recovery_resources_common) -$( recovery_density)
2014-04-05 04:51:15 +08:00
e l s e
recovery_resources_common := $( recovery_resources_common) -xhdpi
e n d i f
2014-05-13 06:32:20 +08:00
# Select the 18x32 font on high-density devices (xhdpi and up); and
# the 12x22 font on other devices. Note that the font selected here
# can be overridden for a particular device by putting a font.png in
# its private recovery resources.
2015-04-09 05:14:43 +08:00
i f n e q ( , $( filter xxxhdpi 560dpi xxhdpi 400dpi xhdpi ,$ ( recovery_density ) ) )
2013-03-07 07:04:31 +08:00
recovery_font := $( call include-path-for, recovery) /fonts/18x32.png
e l s e
recovery_font := $( call include-path-for, recovery) /fonts/12x22.png
e n d i f
2015-08-07 02:47:47 +08:00
i f n d e f T A R G E T _ P R I V A T E _ R E S _ D I R S
TARGET_PRIVATE_RES_DIRS := $( wildcard $( TARGET_DEVICE_DIR) /recovery/res)
e n d i f
2009-07-03 00:00:54 +08:00
recovery_resource_deps := $( shell find $( recovery_resources_common) \
2015-08-07 02:47:47 +08:00
$( TARGET_PRIVATE_RES_DIRS) -type f)
2012-09-29 00:33:45 +08:00
i f d e f T A R G E T _ R E C O V E R Y _ F S T A B
recovery_fstab := $( TARGET_RECOVERY_FSTAB)
e l s e
2010-09-21 09:04:41 +08:00
recovery_fstab := $( strip $( wildcard $( TARGET_DEVICE_DIR) /recovery.fstab) )
2012-09-29 00:33:45 +08:00
e n d i f
2016-06-11 01:11:54 +08:00
i f d e f T A R G E T _ R E C O V E R Y _ W I P E
recovery_wipe := $( TARGET_RECOVERY_WIPE)
2016-06-01 14:56:23 +08:00
e l s e
2016-06-11 01:11:54 +08:00
recovery_wipe :=
2016-06-01 14:56:23 +08:00
e n d i f
2015-07-23 03:33:18 +08:00
2015-11-11 11:21:34 +08:00
# Prior to A/B update, we used to have:
# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
# recovery-resource.dat is needed only if we carry a patch of the boot and
# recovery images and invoke install-recovery.sh on the first boot post an
# OTA update.
#
# We no longer need that if one of the following conditions holds:
# a) We carry a full copy of the recovery image
# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
# b) We build a single image that contains boot and recovery both
# (BOARD_USES_RECOVERY_AS_BOOT = true).
i f e q ( , $( filter true , $ ( BOARD_USES_FULL_RECOVERY_IMAGE ) $ ( BOARD_USES_RECOVERY_AS_BOOT ) ) )
2012-08-21 06:38:58 +08:00
# Named '.dat' so we don't attempt to use imgdiff for patching it.
RECOVERY_RESOURCE_ZIP := $( TARGET_OUT) /etc/recovery-resource.dat
2015-07-23 03:33:18 +08:00
e l s e
RECOVERY_RESOURCE_ZIP :=
e n d i f
2009-07-03 00:00:54 +08:00
2015-08-07 02:47:47 +08:00
i f e q ( $( TARGET_PRIVATE_RES_DIRS ) , )
2009-07-03 00:00:54 +08:00
$( info No private recovery resources for TARGET_DEVICE $( TARGET_DEVICE) )
e n d i f
2010-09-21 09:04:41 +08:00
i f e q ( $( recovery_fstab ) , )
$( info No recovery.fstab for TARGET_DEVICE $( TARGET_DEVICE) )
e n d i f
2009-07-03 00:00:54 +08:00
INTERNAL_RECOVERYIMAGE_ARGS := \
$( addprefix --second ,$( INSTALLED_2NDBOOTLOADER_TARGET) ) \
--kernel $( recovery_kernel) \
--ramdisk $( recovery_ramdisk)
# Assumes this has already been stripped
i f d e f B O A R D _ K E R N E L _ C M D L I N E
INTERNAL_RECOVERYIMAGE_ARGS += --cmdline " $( BOARD_KERNEL_CMDLINE) "
e n d i f
i f d e f B O A R D _ K E R N E L _ B A S E
INTERNAL_RECOVERYIMAGE_ARGS += --base $( BOARD_KERNEL_BASE)
e n d i f
2010-08-26 05:29:34 +08:00
BOARD_KERNEL_PAGESIZE := $( strip $( BOARD_KERNEL_PAGESIZE) )
i f d e f B O A R D _ K E R N E L _ P A G E S I Z E
INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $( BOARD_KERNEL_PAGESIZE)
e n d i f
2009-07-03 00:00:54 +08:00
# Keys authorized to sign OTA packages this build will accept. The
2011-10-05 01:50:08 +08:00
# build always uses dev-keys for this; release packaging tools will
2009-07-03 00:00:54 +08:00
# substitute other keys for this one.
2011-10-05 01:50:08 +08:00
OTA_PUBLIC_KEYS := $( DEFAULT_SYSTEM_DEV_CERTIFICATE) .x509.pem
2009-07-03 00:00:54 +08:00
# Generate a file containing the keys that will be read by the
# recovery binary.
RECOVERY_INSTALL_OTA_KEYS := \
$( call intermediates-dir-for,PACKAGING,ota_keys) /keys
DUMPKEY_JAR := $( HOST_OUT_JAVA_LIBRARIES) /dumpkey.jar
$(RECOVERY_INSTALL_OTA_KEYS) : PRIVATE_OTA_PUBLIC_KEYS := $( OTA_PUBLIC_KEYS )
2011-03-16 22:49:13 +08:00
$(RECOVERY_INSTALL_OTA_KEYS) : extra_keys := $( patsubst %,%.x 509.pem ,$ ( PRODUCT_EXTRA_RECOVERY_KEYS ) )
2011-02-02 06:13:52 +08:00
$(RECOVERY_INSTALL_OTA_KEYS) : $( OTA_PUBLIC_KEYS ) $( DUMPKEY_JAR ) $( extra_keys )
@echo " DumpPublicKey: $@ <= $( PRIVATE_OTA_PUBLIC_KEYS) $( extra_keys) "
2009-07-03 00:00:54 +08:00
@rm -rf $@
@mkdir -p $( dir $@ )
2011-02-02 06:13:52 +08:00
java -jar $( DUMPKEY_JAR) $( PRIVATE_OTA_PUBLIC_KEYS) $( extra_keys) > $@
2009-07-03 00:00:54 +08:00
2015-05-07 11:44:22 +08:00
RECOVERYIMAGE_ID_FILE := $( PRODUCT_OUT) /recovery.id
2015-01-31 06:05:22 +08:00
# $(1): output file
d e f i n e b u i l d - r e c o v e r y i m a g e - t a r g e t
@echo ----- Making recovery image ------
$( hide) mkdir -p $( TARGET_RECOVERY_OUT)
2016-01-13 03:34:58 +08:00
$( hide) mkdir -p $( TARGET_RECOVERY_ROOT_OUT) /etc $( TARGET_RECOVERY_ROOT_OUT) /sdcard $( TARGET_RECOVERY_ROOT_OUT) /tmp
2015-01-31 06:05:22 +08:00
@echo Copying baseline ramdisk...
2016-05-14 06:26:09 +08:00
$( hide) rsync -a --exclude= etc --exclude= sdcard $( IGNORE_CACHE_LINK) $( TARGET_ROOT_OUT) $( TARGET_RECOVERY_OUT) # "cp -Rf" fails to overwrite broken symlinks on Mac.
2015-01-31 06:05:22 +08:00
@echo Modifying ramdisk contents...
$( hide) rm -f $( TARGET_RECOVERY_ROOT_OUT) /init*.rc
$( hide) cp -f $( recovery_initrc) $( TARGET_RECOVERY_ROOT_OUT) /
$( hide) rm -f $( TARGET_RECOVERY_ROOT_OUT) /sepolicy
$( hide) cp -f $( recovery_sepolicy) $( TARGET_RECOVERY_ROOT_OUT) /sepolicy
2015-04-03 03:48:32 +08:00
$( hide) cp $( TARGET_ROOT_OUT) /init.recovery.*.rc $( TARGET_RECOVERY_ROOT_OUT) / || true # Ignore error when the src file doesn't exist.
2015-01-31 06:05:22 +08:00
$( hide) mkdir -p $( TARGET_RECOVERY_ROOT_OUT) /res
$( hide) rm -rf $( TARGET_RECOVERY_ROOT_OUT) /res/*
$( hide) cp -rf $( recovery_resources_common) /* $( TARGET_RECOVERY_ROOT_OUT) /res
$( hide) cp -f $( recovery_font) $( TARGET_RECOVERY_ROOT_OUT) /res/images/font.png
2015-08-07 02:47:47 +08:00
$( hide) $( foreach item,$( TARGET_PRIVATE_RES_DIRS) , \
cp -rf $( item) $( TARGET_RECOVERY_ROOT_OUT) /$( newline) )
2015-01-31 06:05:22 +08:00
$( hide) $( foreach item,$( recovery_fstab) , \
cp -f $( item) $( TARGET_RECOVERY_ROOT_OUT) /etc/recovery.fstab)
2016-06-11 01:11:54 +08:00
$( if $( strip $( recovery_wipe) ) , \
$( hide) cp -f $( recovery_wipe) $( TARGET_RECOVERY_ROOT_OUT) /etc/recovery.wipe)
2015-01-31 06:05:22 +08:00
$( hide) cp $( RECOVERY_INSTALL_OTA_KEYS) $( TARGET_RECOVERY_ROOT_OUT) /res/keys
$( hide) cat $( INSTALLED_DEFAULT_PROP_TARGET) $( recovery_build_prop) \
> $( TARGET_RECOVERY_ROOT_OUT) /default.prop
2016-07-23 02:03:31 +08:00
$( BOARD_RECOVERY_IMAGE_PREPARE)
2015-07-31 05:34:01 +08:00
$( if $( filter true,$( BOARD_BUILD_SYSTEM_ROOT_IMAGE) ) , \
$( hide) mkdir -p $( TARGET_RECOVERY_ROOT_OUT) /system_root; \
rm -rf $( TARGET_RECOVERY_ROOT_OUT) /system; \
ln -sf /system_root/system $( TARGET_RECOVERY_ROOT_OUT) /system) # Mount the system_root_image to /system_root and symlink /system.
2015-07-10 00:54:55 +08:00
$( hide) $( MKBOOTFS) -d $( TARGET_OUT) $( TARGET_RECOVERY_ROOT_OUT) | $( MINIGZIP) > $( recovery_ramdisk)
2015-03-30 14:07:41 +08:00
$( if $( filter true,$( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_SUPPORTS_VBOOT) ) , \
2016-03-16 00:49:30 +08:00
$( hide) $( MKBOOTIMG) $( INTERNAL_RECOVERYIMAGE_ARGS) $( INTERNAL_MKBOOTIMG_VERSION_ARGS) $( BOARD_MKBOOTIMG_ARGS) --output $( 1) .unsigned, \
$( hide) $( MKBOOTIMG) $( INTERNAL_RECOVERYIMAGE_ARGS) $( INTERNAL_MKBOOTIMG_VERSION_ARGS) $( BOARD_MKBOOTIMG_ARGS) --output $( 1) --id > $( RECOVERYIMAGE_ID_FILE) )
2015-04-07 22:08:59 +08:00
$( if $( filter true,$( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_SUPPORTS_BOOT_SIGNER) ) ,\
2016-08-09 01:51:10 +08:00
$( if $( filter true,$( BOARD_USES_RECOVERY_AS_BOOT) ) ,\
$( BOOT_SIGNER) /boot $( 1) $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VERITY_SIGNING_KEY) .pk8 $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VERITY_SIGNING_KEY) .x509.pem $( 1) ,\
$( BOOT_SIGNER) /recovery $( 1) $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VERITY_SIGNING_KEY) .pk8 $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VERITY_SIGNING_KEY) .x509.pem $( 1) \
) \
)
2015-03-30 14:07:41 +08:00
$( if $( filter true,$( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_SUPPORTS_VBOOT) ) , \
2015-08-08 02:58:05 +08:00
$( VBOOT_SIGNER) $( FUTILITY) $( 1) .unsigned $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VBOOT_SIGNING_KEY) .vbpubk $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VBOOT_SIGNING_KEY) .vbprivk $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VBOOT_SIGNING_SUBKEY) .vbprivk $( 1) .keyblock $( 1) )
2016-08-09 01:51:10 +08:00
$( if $( filter true,$( BOARD_USES_RECOVERY_AS_BOOT) ) , \
2015-11-11 11:21:34 +08:00
$( hide) $( call assert-max-image-size,$( 1) ,$( BOARD_BOOTIMAGE_PARTITION_SIZE) ) , \
$( hide) $( call assert-max-image-size,$( 1) ,$( BOARD_RECOVERYIMAGE_PARTITION_SIZE) ) )
2015-01-31 06:05:22 +08:00
@echo ----- Made recovery image: $( 1) --------
e n d e f
2015-11-11 11:21:34 +08:00
i f e q ( $( BOARD_USES_RECOVERY_AS_BOOT ) , t r u e )
2016-03-11 04:57:33 +08:00
i f e q ( t r u e , $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_BOOT_SIGNER ) )
$(INSTALLED_BOOTIMAGE_TARGET) : $( BOOT_SIGNER )
e n d i f
i f e q ( t r u e , $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SUPPORTS_VBOOT ) )
$(INSTALLED_BOOTIMAGE_TARGET) : $( VBOOT_SIGNER )
e n d i f
2015-11-11 11:21:34 +08:00
$(INSTALLED_BOOTIMAGE_TARGET) : $( MKBOOTFS ) $( MKBOOTIMG ) $( MINIGZIP ) \
$( INSTALLED_RAMDISK_TARGET) \
$( INTERNAL_RECOVERYIMAGE_FILES) \
$( recovery_initrc) $( recovery_sepolicy) $( recovery_kernel) \
$( INSTALLED_2NDBOOTLOADER_TARGET) \
$( recovery_build_prop) $( recovery_resource_deps) \
$( recovery_fstab) \
$( RECOVERY_INSTALL_OTA_KEYS)
$( call pretty," Target boot image from recovery: $@ " )
$( call build-recoveryimage-target, $@ )
e n d i f
2009-07-03 00:00:54 +08:00
$(INSTALLED_RECOVERYIMAGE_TARGET) : $( MKBOOTFS ) $( MKBOOTIMG ) $( MINIGZIP ) \
$( INSTALLED_RAMDISK_TARGET) \
$( INSTALLED_BOOTIMAGE_TARGET) \
2015-03-11 03:02:57 +08:00
$( INTERNAL_RECOVERYIMAGE_FILES) \
2014-05-30 04:41:03 +08:00
$( recovery_initrc) $( recovery_sepolicy) $( recovery_kernel) \
2009-07-03 00:00:54 +08:00
$( INSTALLED_2NDBOOTLOADER_TARGET) \
$( recovery_build_prop) $( recovery_resource_deps) \
2010-09-21 09:04:41 +08:00
$( recovery_fstab) \
2009-07-03 00:00:54 +08:00
$( RECOVERY_INSTALL_OTA_KEYS)
2015-01-31 06:05:22 +08:00
$( call build-recoveryimage-target, $@ )
2009-07-03 00:00:54 +08:00
2015-12-23 01:47:46 +08:00
i f d e f R E C O V E R Y _ R E S O U R C E _ Z I P
2015-10-30 07:33:05 +08:00
$(RECOVERY_RESOURCE_ZIP) : $( INSTALLED_RECOVERYIMAGE_TARGET ) | $( ZIPTIME )
2012-09-05 05:45:11 +08:00
$( hide) mkdir -p $( dir $@ )
2015-10-30 07:33:05 +08:00
$( hide) find $( TARGET_RECOVERY_ROOT_OUT) /res -type f | sort | zip -0qrjX $@ -@
$( remove-timestamps-from-package)
2015-07-23 03:33:18 +08:00
e n d i f
2012-08-21 06:38:58 +08:00
2015-01-31 06:05:22 +08:00
.PHONY : recoveryimage -nodeps
recoveryimage-nodeps :
@echo " make $@ : ignoring dependencies "
$( call build-recoveryimage-target, $( INSTALLED_RECOVERYIMAGE_TARGET) )
2015-07-23 03:33:18 +08:00
e l s e # INSTALLED_RECOVERYIMAGE_TARGET not defined
2012-08-21 06:38:58 +08:00
RECOVERY_RESOURCE_ZIP :=
2009-07-03 00:00:54 +08:00
e n d i f
.PHONY : recoveryimage
2012-08-21 06:38:58 +08:00
recoveryimage : $( INSTALLED_RECOVERYIMAGE_TARGET ) $( RECOVERY_RESOURCE_ZIP )
2009-07-03 00:00:54 +08:00
2015-02-05 11:58:09 +08:00
i f e q ( $( BOARD_NAND_PAGE_SIZE ) , )
2010-12-06 22:24:58 +08:00
BOARD_NAND_PAGE_SIZE := 2048
2010-02-06 05:34:34 +08:00
e n d i f
2015-02-05 11:58:09 +08:00
i f e q ( $( BOARD_NAND_SPARE_SIZE ) , )
2010-12-06 22:24:58 +08:00
BOARD_NAND_SPARE_SIZE := 64
2010-08-07 03:19:29 +08:00
e n d i f
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
2010-09-28 01:37:25 +08:00
# system image
2009-03-04 11:28:42 +08:00
#
2012-08-09 06:27:00 +08:00
# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
PDK_FUSION_SYSIMG_FILES := \
$( filter-out $( foreach p,$( overridden_packages) ,$( p) %/$( p) .apk) , \
$( ALL_PDK_FUSION_FILES) )
2009-03-04 11:28:42 +08:00
INTERNAL_SYSTEMIMAGE_FILES := $( filter $( TARGET_OUT) /%, \
2012-03-14 09:58:27 +08:00
$( ALL_PREBUILT) \
$( ALL_GENERATED_SOURCES) \
2012-08-21 06:38:58 +08:00
$( ALL_DEFAULT_INSTALLED_MODULES) \
$( PDK_FUSION_SYSIMG_FILES) \
$( RECOVERY_RESOURCE_ZIP) )
2012-03-14 09:58:27 +08:00
2015-03-04 04:30:37 +08:00
2012-08-14 06:03:00 +08:00
FULL_SYSTEMIMAGE_DEPS := $( INTERNAL_SYSTEMIMAGE_FILES) $( INTERNAL_USERIMAGES_DEPS)
2011-09-10 07:35:53 +08:00
# -----------------------------------------------------------------
# installed file list
# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
# We put installed-files.txt ahead of image itself in the dependency graph
# so that we can get the size stat even if the build fails due to too large
# system image.
INSTALLED_FILES_FILE := $( PRODUCT_OUT) /installed-files.txt
$(INSTALLED_FILES_FILE) : $( FULL_SYSTEMIMAGE_DEPS )
@echo Installed file list: $@
@mkdir -p $( dir $@ )
@rm -f $@
$( hide) build/tools/fileslist.py $( TARGET_OUT) > $@
.PHONY : installed -file -list
installed-file-list : $( INSTALLED_FILES_FILE )
2013-03-02 08:45:35 +08:00
$( call dist -for -goals , sdk win_sdk sdk_addon , $ ( INSTALLED_FILES_FILE ) )
2011-09-10 07:35:53 +08:00
systemimage_intermediates := \
2011-11-05 02:37:01 +08:00
$( call intermediates-dir-for,PACKAGING,systemimage)
2011-09-10 07:35:53 +08:00
BUILT_SYSTEMIMAGE := $( systemimage_intermediates) /system.img
2014-06-19 11:26:24 +08:00
# Create symlink /system/vendor to /vendor if necessary.
2016-06-18 05:07:37 +08:00
i f d e f B O A R D _ U S E S _ V E N D O R I M A G E
2014-06-19 11:26:24 +08:00
d e f i n e c r e a t e - s y s t e m - v e n d o r - s y m l i n k
2014-07-18 03:56:49 +08:00
$( hide ) i f [ - d $( TARGET_OUT ) / v e n d o r ] & & [ ! - h $( TARGET_OUT ) / v e n d o r ] ; t h e n \
echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>& 2; \
echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>& 2; \
exit 1; \
f i
2014-06-19 11:26:24 +08:00
$( hide ) l n - s f / v e n d o r $( TARGET_OUT ) / v e n d o r
e n d e f
e l s e
d e f i n e c r e a t e - s y s t e m - v e n d o r - s y m l i n k
e n d e f
e n d i f
2009-03-04 11:28:42 +08:00
# $(1): output file
d e f i n e b u i l d - s y s t e m i m a g e - t a r g e t
2011-10-29 08:02:30 +08:00
@echo " Target system fs image: $( 1) "
2014-06-19 11:26:24 +08:00
$( call create-system-vendor-symlink)
2011-10-29 08:02:30 +08:00
@mkdir -p $( dir $( 1) ) $( systemimage_intermediates) && rm -rf $( systemimage_intermediates) /system_image_info.txt
2013-06-17 08:26:08 +08:00
$( call generate-userimage-prop-dictionary, $( systemimage_intermediates) /system_image_info.txt, \
2014-05-06 13:19:37 +08:00
skip_fsck = true )
2011-10-29 08:02:30 +08:00
$( hide) PATH = $( foreach p,$( INTERNAL_USERIMAGES_BINARY_PATHS) ,$( p) :) $$ PATH \
./build/tools/releasetools/build_image.py \
2015-07-10 00:54:55 +08:00
$( TARGET_OUT) $( systemimage_intermediates) /system_image_info.txt $( 1) $( TARGET_OUT) \
2014-08-14 03:36:05 +08:00
|| ( echo " Out of space? the tree size of $( TARGET_OUT) is (MB): " 1>& 2 ; \
du -sm $( TARGET_OUT) 1>& 2; \
2015-06-24 02:16:05 +08:00
if [ " $( INTERNAL_USERIMAGES_EXT_VARIANT) " = = "ext4" ] ; then \
maxsize = $( BOARD_SYSTEMIMAGE_PARTITION_SIZE) ; \
if [ " $( BOARD_HAS_EXT4_RESERVED_BLOCKS) " = = "true" ] ; then \
maxsize = $$ ( ( maxsize - 4096 * 4096) ) ; \
fi ; \
echo " The max is $$ (( maxsize / 1048576 )) MB. " 1>& 2 ; \
else \
echo " The max is $$ (( $( BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB. " 1>& 2 ; \
fi ; \
2014-08-20 03:21:35 +08:00
mkdir -p $( DIST_DIR) ; cp $( INSTALLED_FILES_FILE) $( DIST_DIR) /installed-files-rescued.txt; \
2014-08-14 03:36:05 +08:00
exit 1 )
2009-03-04 11:28:42 +08:00
e n d e f
2011-09-10 07:35:53 +08:00
$(BUILT_SYSTEMIMAGE) : $( FULL_SYSTEMIMAGE_DEPS ) $( INSTALLED_FILES_FILE )
2009-03-04 11:28:42 +08:00
$( call build-systemimage-target,$@ )
INSTALLED_SYSTEMIMAGE := $( PRODUCT_OUT) /system.img
2010-09-28 01:37:25 +08:00
SYSTEMIMAGE_SOURCE_DIR := $( TARGET_OUT)
2009-03-04 11:28:42 +08:00
2009-07-24 06:12:53 +08:00
# The system partition needs room for the recovery image as well. We
# now store the recovery image as a binary patch using the boot image
# as the source (since they are very similar). Generate the patch so
# we can see how big it's going to be, and include that in the system
# image size check calculation.
2009-07-25 04:52:32 +08:00
i f n e q ( $( INSTALLED_RECOVERYIMAGE_TARGET ) , )
2015-07-23 03:33:18 +08:00
i f n e q ( $( BOARD_USES_FULL_RECOVERY_IMAGE ) , t r u e )
2009-07-24 06:12:53 +08:00
intermediates := $( call intermediates-dir-for,PACKAGING,recovery_patch)
RECOVERY_FROM_BOOT_PATCH := $( intermediates) /recovery_from_boot.p
$(RECOVERY_FROM_BOOT_PATCH) : $( INSTALLED_RECOVERYIMAGE_TARGET ) \
$( INSTALLED_BOOTIMAGE_TARGET) \
2009-07-24 09:27:43 +08:00
$( HOST_OUT_EXECUTABLES) /imgdiff \
$( HOST_OUT_EXECUTABLES) /bsdiff
2009-07-24 06:12:53 +08:00
@echo "Construct recovery from boot"
mkdir -p $( dir $@ )
2009-07-24 09:48:38 +08:00
PATH = $( HOST_OUT_EXECUTABLES) :$$ PATH $( HOST_OUT_EXECUTABLES) /imgdiff $( INSTALLED_BOOTIMAGE_TARGET) $( INSTALLED_RECOVERYIMAGE_TARGET) $@
2015-07-23 03:33:18 +08:00
e l s e # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
RECOVERY_FROM_BOOT_PATCH := $( INSTALLED_RECOVERYIMAGE_TARGET)
e n d i f
2009-07-25 04:52:32 +08:00
e n d i f
2009-07-24 06:12:53 +08:00
$(INSTALLED_SYSTEMIMAGE) : $( BUILT_SYSTEMIMAGE ) $( RECOVERY_FROM_BOOT_PATCH ) | $( ACP )
2009-03-04 11:28:42 +08:00
@echo " Install system fs image: $@ "
$( copy-file-to-target)
2014-06-17 05:19:36 +08:00
$( hide) $( call assert-max-image-size,$@ $( RECOVERY_FROM_BOOT_PATCH) ,$( BOARD_SYSTEMIMAGE_PARTITION_SIZE) )
2009-03-04 11:28:42 +08:00
systemimage : $( INSTALLED_SYSTEMIMAGE )
.PHONY : systemimage -nodeps snod
systemimage-nodeps snod : $( filter -out systemimage -nodeps snod ,$ ( MAKECMDGOALS ) ) \
2010-05-11 04:04:47 +08:00
| $( INTERNAL_USERIMAGES_DEPS)
2009-03-04 11:28:42 +08:00
@echo " make $@ : ignoring dependencies "
$( call build-systemimage-target,$( INSTALLED_SYSTEMIMAGE) )
2014-06-17 05:19:36 +08:00
$( hide) $( call assert-max-image-size,$( INSTALLED_SYSTEMIMAGE) ,$( BOARD_SYSTEMIMAGE_PARTITION_SIZE) )
2009-03-04 11:28:42 +08:00
2012-02-25 03:05:48 +08:00
i f n e q ( , $( filter systemimage -nodeps snod , $ ( MAKECMDGOALS ) ) )
i f e q ( t r u e , $( WITH_DEXPREOPT ) )
$(warning Warning : with dexpreopt enabled , you may need a full rebuild .)
e n d i f
e n d i f
2009-03-04 11:28:42 +08:00
#######
## system tarball
d e f i n e b u i l d - s y s t e m t a r b a l l - t a r g e t
2014-06-19 11:26:24 +08:00
$( call pretty," Target system fs tarball: $( INSTALLED_SYSTEMTARBALL_TARGET) " )
$( call create-system-vendor-symlink)
$( MKTARBALL) $( FS_GET_STATS) \
$( PRODUCT_OUT) system $( PRIVATE_SYSTEM_TAR) \
2015-07-10 00:54:55 +08:00
$( INSTALLED_SYSTEMTARBALL_TARGET) $( TARGET_OUT)
2009-03-04 11:28:42 +08:00
e n d e f
2010-06-12 03:05:57 +08:00
i f n d e f S Y S T E M _ T A R B A L L _ F O R M A T
SYSTEM_TARBALL_FORMAT := bz2
e n d i f
2009-03-04 11:28:42 +08:00
system_tar := $( PRODUCT_OUT) /system.tar
2010-06-12 03:05:57 +08:00
INSTALLED_SYSTEMTARBALL_TARGET := $( system_tar) .$( SYSTEM_TARBALL_FORMAT)
2009-03-04 11:28:42 +08:00
$(INSTALLED_SYSTEMTARBALL_TARGET) : PRIVATE_SYSTEM_TAR := $( system_tar )
$(INSTALLED_SYSTEMTARBALL_TARGET) : $( FS_GET_STATS ) $( INTERNAL_SYSTEMIMAGE_FILES )
$( build-systemtarball-target)
.PHONY : systemtarball -nodeps
systemtarball-nodeps : $( FS_GET_STATS ) \
$( filter-out systemtarball-nodeps stnod,$( MAKECMDGOALS) )
$( build-systemtarball-target)
.PHONY : stnod
stnod : systemtarball -nodeps
2016-03-12 02:32:01 +08:00
# -----------------------------------------------------------------
2012-04-10 08:04:12 +08:00
## platform.zip: system, plus other files to be used in PDK fusion build,
## in a zip file
2013-07-23 05:54:58 +08:00
##
## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
## The variable will be typically set from BoardConfig.mk.
## Files under out dir will be rejected to prevent possible conflicts with other rules.
2016-03-12 02:32:01 +08:00
pdk_odex_javalibs := $( strip $( foreach m,$( DEXPREOPT.MODULES.JAVA_LIBRARIES) ,\
$( if $( filter $( DEXPREOPT.$( m) .INSTALLED) ,$( ALL_DEFAULT_INSTALLED_MODULES) ) ,$( m) ) ) )
pdk_odex_apps := $( strip $( foreach m,$( DEXPREOPT.MODULES.APPS) ,\
$( if $( filter $( DEXPREOPT.$( m) .INSTALLED) ,$( ALL_DEFAULT_INSTALLED_MODULES) ) ,$( m) ) ) )
pdk_classes_dex := $( strip \
$( foreach m,$( pdk_odex_javalibs) ,$( call intermediates-dir-for,JAVA_LIBRARIES,$( m) ,,COMMON) /javalib.jar) \
$( foreach m,$( pdk_odex_apps) ,$( call intermediates-dir-for,APPS,$( m) ) /package.dex.apk) )
pdk_odex_config_mk := $( PRODUCT_OUT) /pdk_dexpreopt_config.mk
$(pdk_odex_config_mk) : PRIVATE_JAVA_LIBRARIES := $( pdk_odex_javalibs )
$(pdk_odex_config_mk) : PRIVATE_APPS := $( pdk_odex_apps )
$(pdk_odex_config_mk) :
@echo " PDK odex config makefile: $@ "
$( hide) mkdir -p $( dir $@ )
$( hide) echo "# Auto-generated. Do not modify." > $@
$( hide) echo " PDK.DEXPREOPT.JAVA_LIBRARIES:= $( PRIVATE_JAVA_LIBRARIES) " >> $@
$( hide) echo " PDK.DEXPREOPT.APPS:= $( PRIVATE_APPS) " >> $@
$( foreach m,$( PRIVATE_JAVA_LIBRARIES) ,\
$( hide) echo " PDK.DEXPREOPT. $( m) .SRC:= $( patsubst $( OUT_DIR) /%,%,$( call intermediates-dir-for,JAVA_LIBRARIES,$( m) ,,COMMON) /javalib.jar) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .DEX_PREOPT:= $( DEXPREOPT.$( m) .DEX_PREOPT) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .MULTILIB:= $( DEXPREOPT.$( m) .MULTILIB) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .DEX_PREOPT_FLAGS:= $( DEXPREOPT.$( m) .DEX_PREOPT_FLAGS) " >> $@ $( newline) \
)
$( foreach m,$( PRIVATE_APPS) ,\
$( hide) echo " PDK.DEXPREOPT. $( m) .SRC:= $( patsubst $( OUT_DIR) /%,%,$( call intermediates-dir-for,APPS,$( m) ) /package.dex.apk) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .DEX_PREOPT:= $( DEXPREOPT.$( m) .DEX_PREOPT) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .MULTILIB:= $( DEXPREOPT.$( m) .MULTILIB) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .DEX_PREOPT_FLAGS:= $( DEXPREOPT.$( m) .DEX_PREOPT_FLAGS) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .PRIVILEGED_MODULE:= $( DEXPREOPT.$( m) .PRIVILEGED_MODULE) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .PROPRIETARY_MODULE:= $( DEXPREOPT.$( m) .PROPRIETARY_MODULE) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .TARGET_ARCH:= $( DEXPREOPT.$( m) .TARGET_ARCH) " >> $@ $( newline) \
$( hide) echo " PDK.DEXPREOPT. $( m) .STRIPPED_SRC:= $( patsubst $( PRODUCT_OUT) /%,%,$( DEXPREOPT.$( m) .INSTALLED_STRIPPED) ) " >> $@ $( newline) \
)
2013-07-23 05:54:58 +08:00
PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $( filter-out $( OUT_DIR) /%,$( PDK_PLATFORM_ZIP_PRODUCT_BINARIES) )
2012-05-17 01:32:41 +08:00
INSTALLED_PLATFORM_ZIP := $( PRODUCT_OUT) /platform.zip
2016-03-12 02:32:01 +08:00
$(INSTALLED_PLATFORM_ZIP) : PRIVATE_DEX_FILES := $( pdk_classes_dex )
$(INSTALLED_PLATFORM_ZIP) : PRIVATE_ODEX_CONFIG := $( pdk_odex_config_mk )
$(INSTALLED_PLATFORM_ZIP) : $( INTERNAL_SYSTEMIMAGE_FILES ) $( pdk_odex_config_mk )
2012-05-17 01:32:41 +08:00
$( call pretty," Platform zip package: $( INSTALLED_PLATFORM_ZIP) " )
2012-03-31 04:52:54 +08:00
$( hide) rm -f $@
2015-10-30 07:33:05 +08:00
$( hide) cd $( dir $@ ) && zip -qryX $( notdir $@ ) \
2012-04-10 08:04:12 +08:00
$( TARGET_COPY_OUT_SYSTEM) \
2012-08-01 08:13:20 +08:00
$( patsubst $( PRODUCT_OUT) /%, %, $( TARGET_OUT_NOTICE_FILES) ) \
$( addprefix symbols/,$( PDK_SYMBOL_FILES_LIST) )
2014-07-17 08:46:35 +08:00
i f d e f B O A R D _ V E N D O R I M A G E _ F I L E _ S Y S T E M _ T Y P E
2015-10-30 07:33:05 +08:00
$( hide) cd $( dir $@ ) && zip -qryX $( notdir $@ ) \
2014-07-17 08:46:35 +08:00
$( TARGET_COPY_OUT_VENDOR)
e n d i f
2013-12-19 11:36:44 +08:00
i f n e q ( $( PDK_PLATFORM_JAVA_ZIP_CONTENTS ) , )
2015-10-30 07:33:05 +08:00
$( hide) cd $( OUT_DIR) && zip -qryX $( patsubst $( OUT_DIR) /%,%,$@ ) $( PDK_PLATFORM_JAVA_ZIP_CONTENTS)
2012-05-17 01:32:41 +08:00
e n d i f
2013-07-23 05:54:58 +08:00
i f n e q ( $( PDK_PLATFORM_ZIP_PRODUCT_BINARIES ) , )
2015-10-30 07:33:05 +08:00
$( hide) zip -qryX $@ $( PDK_PLATFORM_ZIP_PRODUCT_BINARIES)
2013-07-23 05:54:58 +08:00
e n d i f
2016-03-12 02:32:01 +08:00
@# Add dex-preopt files and config.
$( if $( PRIVATE_DEX_FILES) ,$( hide) cd $( OUT_DIR) && zip -qryX $( patsubst $( OUT_DIR) /%,%,$@ $( PRIVATE_DEX_FILES) ) )
$( hide) zip -qryXj $@ $( PRIVATE_ODEX_CONFIG)
2012-03-31 04:52:54 +08:00
.PHONY : platform
2012-05-17 01:32:41 +08:00
platform : $( INSTALLED_PLATFORM_ZIP )
.PHONY : platform -java
platform-java : platform
2012-03-31 04:52:54 +08:00
# Dist the platform.zip
2012-05-30 08:55:46 +08:00
i f n e q ( , $( filter platform platform -java , $ ( MAKECMDGOALS ) ) )
$( call dist -for -goals , platform platform -java , $ ( INSTALLED_PLATFORM_ZIP ) )
2012-03-31 04:52:54 +08:00
e n d i f
2009-03-04 11:28:42 +08:00
2016-03-12 02:32:01 +08:00
# -----------------------------------------------------------------
2010-06-05 06:24:49 +08:00
## boot tarball
d e f i n e b u i l d - b o o t t a r b a l l - t a r g e t
2010-06-25 05:02:00 +08:00
$( hide) echo " Target boot fs tarball: $( INSTALLED_BOOTTARBALL_TARGET) "
2010-06-05 06:24:49 +08:00
$( hide) mkdir -p $( PRODUCT_OUT) /boot
$( hide) cp -f $( INTERNAL_BOOTIMAGE_FILES) $( PRODUCT_OUT) /boot/.
$( hide) echo $( BOARD_KERNEL_CMDLINE) > $( PRODUCT_OUT) /boot/cmdline
$( hide) $( MKTARBALL) $( FS_GET_STATS) \
$( PRODUCT_OUT) boot $( PRIVATE_BOOT_TAR) \
2015-07-10 00:54:55 +08:00
$( INSTALLED_BOOTTARBALL_TARGET) $( TARGET_OUT)
2010-06-05 06:24:49 +08:00
e n d e f
i f n d e f B O O T _ T A R B A L L _ F O R M A T
BOOT_TARBALL_FORMAT := bz2
e n d i f
boot_tar := $( PRODUCT_OUT) /boot.tar
INSTALLED_BOOTTARBALL_TARGET := $( boot_tar) .$( BOOT_TARBALL_FORMAT)
$(INSTALLED_BOOTTARBALL_TARGET) : PRIVATE_BOOT_TAR := $( boot_tar )
$(INSTALLED_BOOTTARBALL_TARGET) : $( FS_GET_STATS ) $( INTERNAL_BOOTIMAGE_FILES )
$( build-boottarball-target)
.PHONY : boottarball -nodeps btnod
boottarball-nodeps btnod : $( FS_GET_STATS ) \
$( filter-out boottarball-nodeps btnod,$( MAKECMDGOALS) )
$( build-boottarball-target)
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# data partition image
INTERNAL_USERDATAIMAGE_FILES := \
2011-11-05 02:37:01 +08:00
$( filter $( TARGET_OUT_DATA) /%,$( ALL_DEFAULT_INSTALLED_MODULES) )
2009-03-04 11:28:42 +08:00
2013-03-16 01:32:29 +08:00
# Don't build userdata.img if it's extfs but no partition size
skip_userdata.img :=
i f d e f I N T E R N A L _ U S E R I M A G E S _ E X T _ V A R I A N T
i f n d e f B O A R D _ U S E R D A T A I M A G E _ P A R T I T I O N _ S I Z E
skip_userdata.img := true
e n d i f
e n d i f
i f n e q ( $( skip_userdata .img ) , t r u e )
2011-10-29 08:02:30 +08:00
userdataimage_intermediates := \
2011-11-05 02:37:01 +08:00
$( call intermediates-dir-for,PACKAGING,userdata)
2011-10-29 08:02:30 +08:00
BUILT_USERDATAIMAGE_TARGET := $( PRODUCT_OUT) /userdata.img
2009-03-04 11:28:42 +08:00
d e f i n e b u i l d - u s e r d a t a i m a g e - t a r g e t
2011-10-29 08:02:30 +08:00
$( call pretty," Target userdata fs image: $( INSTALLED_USERDATAIMAGE_TARGET) " )
@mkdir -p $( TARGET_OUT_DATA)
@mkdir -p $( userdataimage_intermediates) && rm -rf $( userdataimage_intermediates) /userdata_image_info.txt
2013-02-28 05:54:02 +08:00
$( call generate-userimage-prop-dictionary, $( userdataimage_intermediates) /userdata_image_info.txt, skip_fsck = true )
2011-10-29 08:02:30 +08:00
$( hide) PATH = $( foreach p,$( INTERNAL_USERIMAGES_BINARY_PATHS) ,$( p) :) $$ PATH \
./build/tools/releasetools/build_image.py \
2015-07-10 00:54:55 +08:00
$( TARGET_OUT_DATA) $( userdataimage_intermediates) /userdata_image_info.txt $( INSTALLED_USERDATAIMAGE_TARGET) $( TARGET_OUT)
2014-06-17 05:19:36 +08:00
$( hide) $( call assert-max-image-size,$( INSTALLED_USERDATAIMAGE_TARGET) ,$( BOARD_USERDATAIMAGE_PARTITION_SIZE) )
2009-03-04 11:28:42 +08:00
e n d e f
2009-04-10 10:31:12 +08:00
# We just build this directly to the install location.
INSTALLED_USERDATAIMAGE_TARGET := $( BUILT_USERDATAIMAGE_TARGET)
2010-05-11 04:04:47 +08:00
$(INSTALLED_USERDATAIMAGE_TARGET) : $( INTERNAL_USERIMAGES_DEPS ) \
2009-03-04 11:28:42 +08:00
$( INTERNAL_USERDATAIMAGE_FILES)
$( build-userdataimage-target)
.PHONY : userdataimage -nodeps
2010-05-11 04:04:47 +08:00
userdataimage-nodeps : | $( INTERNAL_USERIMAGES_DEPS )
2009-03-04 11:28:42 +08:00
$( build-userdataimage-target)
2013-03-16 01:32:29 +08:00
e n d i f # not skip_userdata.img
skip_userdata.img :=
2012-10-16 05:36:22 +08:00
2009-03-04 11:28:42 +08:00
#######
## data partition tarball
d e f i n e b u i l d - u s e r d a t a t a r b a l l - t a r g e t
$( call pretty,"Target userdata fs tarball: " \
" $( INSTALLED_USERDATATARBALL_TARGET) " )
$( MKTARBALL) $( FS_GET_STATS) \
$( PRODUCT_OUT) data $( PRIVATE_USERDATA_TAR) \
2015-07-10 00:54:55 +08:00
$( INSTALLED_USERDATATARBALL_TARGET) $( TARGET_OUT)
2009-03-04 11:28:42 +08:00
e n d e f
userdata_tar := $( PRODUCT_OUT) /userdata.tar
INSTALLED_USERDATATARBALL_TARGET := $( userdata_tar) .bz2
$(INSTALLED_USERDATATARBALL_TARGET) : PRIVATE_USERDATA_TAR := $( userdata_tar )
$(INSTALLED_USERDATATARBALL_TARGET) : $( FS_GET_STATS ) $( INTERNAL_USERDATAIMAGE_FILES )
$( build-userdatatarball-target)
2016-08-17 07:36:05 +08:00
$( call dist -for -goals ,userdatatarball ,$ ( INSTALLED_USERDATATARBALL_TARGET ) )
2009-03-04 11:28:42 +08:00
.PHONY : userdatatarball -nodeps
userdatatarball-nodeps : $( FS_GET_STATS )
$( build-userdatatarball-target)
2011-11-05 02:37:01 +08:00
# -----------------------------------------------------------------
# cache partition image
i f d e f B O A R D _ C A C H E I M A G E _ F I L E _ S Y S T E M _ T Y P E
INTERNAL_CACHEIMAGE_FILES := \
$( filter $( TARGET_OUT_CACHE) /%,$( ALL_DEFAULT_INSTALLED_MODULES) )
cacheimage_intermediates := \
$( call intermediates-dir-for,PACKAGING,cache)
BUILT_CACHEIMAGE_TARGET := $( PRODUCT_OUT) /cache.img
d e f i n e b u i l d - c a c h e i m a g e - t a r g e t
$( call pretty," Target cache fs image: $( INSTALLED_CACHEIMAGE_TARGET) " )
@mkdir -p $( TARGET_OUT_CACHE)
@mkdir -p $( cacheimage_intermediates) && rm -rf $( cacheimage_intermediates) /cache_image_info.txt
2013-02-28 05:54:02 +08:00
$( call generate-userimage-prop-dictionary, $( cacheimage_intermediates) /cache_image_info.txt, skip_fsck = true )
2011-11-05 02:37:01 +08:00
$( hide) PATH = $( foreach p,$( INTERNAL_USERIMAGES_BINARY_PATHS) ,$( p) :) $$ PATH \
./build/tools/releasetools/build_image.py \
2015-07-10 00:54:55 +08:00
$( TARGET_OUT_CACHE) $( cacheimage_intermediates) /cache_image_info.txt $( INSTALLED_CACHEIMAGE_TARGET) $( TARGET_OUT)
2014-06-17 05:19:36 +08:00
$( hide) $( call assert-max-image-size,$( INSTALLED_CACHEIMAGE_TARGET) ,$( BOARD_CACHEIMAGE_PARTITION_SIZE) )
2011-11-05 02:37:01 +08:00
e n d e f
# We just build this directly to the install location.
INSTALLED_CACHEIMAGE_TARGET := $( BUILT_CACHEIMAGE_TARGET)
$(INSTALLED_CACHEIMAGE_TARGET) : $( INTERNAL_USERIMAGES_DEPS ) $( INTERNAL_CACHEIMAGE_FILES )
$( build-cacheimage-target)
.PHONY : cacheimage -nodeps
cacheimage-nodeps : | $( INTERNAL_USERIMAGES_DEPS )
$( build-cacheimage-target)
2016-05-14 06:26:09 +08:00
e l s e # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
# we need to ignore the broken cache link when doing the rsync
IGNORE_CACHE_LINK := --exclude= cache
2011-11-05 02:37:01 +08:00
e n d i f # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
2013-03-21 02:02:05 +08:00
2016-06-17 05:47:10 +08:00
# -----------------------------------------------------------------
# system_other partition image
i f e q ( $( BOARD_USES_SYSTEM_OTHER_ODEX ) , t r u e )
BOARD_USES_SYSTEM_OTHER := true
# Marker file to identify that odex files are installed
INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $( TARGET_OUT_SYSTEM_OTHER) /system-other-odex-marker
ALL_DEFAULT_INSTALLED_MODULES += $( INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER) :
$( hide) touch $@
e n d i f
i f d e f B O A R D _ U S E S _ S Y S T E M _ O T H E R
INTERNAL_SYSTEMOTHERIMAGE_FILES := \
$( filter $( TARGET_OUT_SYSTEM_OTHER) /%,\
$( ALL_DEFAULT_INSTALLED_MODULES) \
$( ALL_PDK_FUSION_FILES) )
INSTALLED_FILES_FILE_SYSTEMOTHER := $( PRODUCT_OUT) /installed-files-system-other.txt
$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $( INTERNAL_SYSTEMOTHERIMAGE_FILES )
@echo Installed file list: $@
@mkdir -p $( dir $@ )
@rm -f $@
$( hide) build/tools/fileslist.py $( TARGET_OUT_SYSTEM_OTHER) > $@
systemotherimage_intermediates := \
$( call intermediates-dir-for,PACKAGING,system_other)
BUILT_SYSTEMOTHERIMAGE_TARGET := $( PRODUCT_OUT) /system_other.img
# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
d e f i n e b u i l d - s y s t e m o t h e r i m a g e - t a r g e t
$( call pretty," Target system_other fs image: $( INSTALLED_SYSTEMOTHERIMAGE_TARGET) " )
@mkdir -p $( TARGET_OUT_SYSTEM_OTHER)
@mkdir -p $( systemotherimage_intermediates) && rm -rf $( systemotherimage_intermediates) /system_other_image_info.txt
$( call generate-userimage-prop-dictionary, $( systemotherimage_intermediates) /system_other_image_info.txt, skip_fsck = true )
$( hide) PATH = $( foreach p,$( INTERNAL_USERIMAGES_BINARY_PATHS) ,$( p) :) $$ PATH \
./build/tools/releasetools/build_image.py \
$( TARGET_OUT_SYSTEM_OTHER) $( systemotherimage_intermediates) /system_other_image_info.txt $( INSTALLED_SYSTEMOTHERIMAGE_TARGET) $( TARGET_OUT)
$( hide) $( call assert-max-image-size,$( INSTALLED_SYSTEMOTHERIMAGE_TARGET) ,$( BOARD_SYSTEMIMAGE_PARTITION_SIZE) )
e n d e f
# We just build this directly to the install location.
INSTALLED_SYSTEMOTHERIMAGE_TARGET := $( BUILT_SYSTEMOTHERIMAGE_TARGET)
$(INSTALLED_SYSTEMOTHERIMAGE_TARGET) : $( INTERNAL_USERIMAGES_DEPS ) $( INTERNAL_SYSTEMOTHERIMAGE_FILES ) $( INSTALLED_FILES_FILE_SYSTEMOTHER )
$( build-systemotherimage-target)
.PHONY : systemotherimage -nodeps
systemotherimage-nodeps : | $( INTERNAL_USERIMAGES_DEPS )
$( build-systemotherimage-target)
e n d i f # BOARD_USES_SYSTEM_OTHER
2013-03-21 02:02:05 +08:00
# -----------------------------------------------------------------
# vendor partition image
i f d e f B O A R D _ V E N D O R I M A G E _ F I L E _ S Y S T E M _ T Y P E
INTERNAL_VENDORIMAGE_FILES := \
2014-07-17 08:46:35 +08:00
$( filter $( TARGET_OUT_VENDOR) /%,\
$( ALL_DEFAULT_INSTALLED_MODULES) \
$( ALL_PDK_FUSION_FILES) )
# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
$(INSTALLED_PLATFORM_ZIP) : $( INTERNAL_VENDORIMAGE_FILES )
2013-03-21 02:02:05 +08:00
2015-09-16 05:22:12 +08:00
INSTALLED_FILES_FILE_VENDOR := $( PRODUCT_OUT) /installed-files-vendor.txt
$(INSTALLED_FILES_FILE_VENDOR) : $( INTERNAL_VENDORIMAGE_FILES )
@echo Installed file list: $@
@mkdir -p $( dir $@ )
@rm -f $@
$( hide) build/tools/fileslist.py $( TARGET_OUT_VENDOR) > $@
2013-03-21 02:02:05 +08:00
vendorimage_intermediates := \
$( call intermediates-dir-for,PACKAGING,vendor)
BUILT_VENDORIMAGE_TARGET := $( PRODUCT_OUT) /vendor.img
d e f i n e b u i l d - v e n d o r i m a g e - t a r g e t
$( call pretty," Target vendor fs image: $( INSTALLED_VENDORIMAGE_TARGET) " )
@mkdir -p $( TARGET_OUT_VENDOR)
@mkdir -p $( vendorimage_intermediates) && rm -rf $( vendorimage_intermediates) /vendor_image_info.txt
$( call generate-userimage-prop-dictionary, $( vendorimage_intermediates) /vendor_image_info.txt, skip_fsck = true )
$( hide) PATH = $( foreach p,$( INTERNAL_USERIMAGES_BINARY_PATHS) ,$( p) :) $$ PATH \
./build/tools/releasetools/build_image.py \
2015-07-10 00:54:55 +08:00
$( TARGET_OUT_VENDOR) $( vendorimage_intermediates) /vendor_image_info.txt $( INSTALLED_VENDORIMAGE_TARGET) $( TARGET_OUT)
2014-06-17 05:19:36 +08:00
$( hide) $( call assert-max-image-size,$( INSTALLED_VENDORIMAGE_TARGET) ,$( BOARD_VENDORIMAGE_PARTITION_SIZE) )
2013-03-21 02:02:05 +08:00
e n d e f
# We just build this directly to the install location.
INSTALLED_VENDORIMAGE_TARGET := $( BUILT_VENDORIMAGE_TARGET)
2015-09-16 05:22:12 +08:00
$(INSTALLED_VENDORIMAGE_TARGET) : $( INTERNAL_USERIMAGES_DEPS ) $( INTERNAL_VENDORIMAGE_FILES ) $( INSTALLED_FILES_FILE_VENDOR )
2013-03-21 02:02:05 +08:00
$( build-vendorimage-target)
.PHONY : vendorimage -nodeps
vendorimage-nodeps : | $( INTERNAL_USERIMAGES_DEPS )
$( build-vendorimage-target)
2016-06-18 05:07:37 +08:00
e l s e i f d e f B O A R D _ P R E B U I L T _ V E N D O R I M A G E
INSTALLED_VENDORIMAGE_TARGET := $( PRODUCT_OUT) /vendor.img
$( eval $ ( call copy -one -file ,$ ( BOARD_PREBUILT_VENDORIMAGE ) ,$ ( INSTALLED_VENDORIMAGE_TARGET ) ) )
e n d i f
2013-03-21 02:02:05 +08:00
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
2014-11-05 13:17:06 +08:00
# bring in the installer image generation defines if necessary
i f e q ( $( TARGET_USE_DISKINSTALLER ) , t r u e )
i n c l u d e b o o t a b l e / d i s k i n s t a l l e r / c o n f i g . m k
e n d i f
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
2012-04-20 04:54:39 +08:00
# host tools needed to build dist and OTA packages
2009-06-16 05:30:14 +08:00
2015-09-23 02:17:52 +08:00
build_ota_package := true
i f e q ( $( TARGET_SKIP_OTA_PACKAGE ) , t r u e )
build_ota_package := false
e n d i f
i f e q ( $( BUILD_OS ) , d a r w i n )
build_ota_package := false
e n d i f
i f n e q ( $( strip $ ( SANITIZE_TARGET ) ) , )
build_ota_package := false
e n d i f
i f e q ( $( TARGET_PRODUCT ) , s d k )
build_ota_package := false
e n d i f
i f n e q ( $( filter generic %,$ ( TARGET_DEVICE ) ) , )
build_ota_package := false
e n d i f
i f e q ( $( TARGET_NO_KERNEL ) , t r u e )
build_ota_package := false
e n d i f
i f e q ( $( recovery_fstab ) , )
build_ota_package := false
e n d i f
2016-02-05 07:09:23 +08:00
i f e q ( $( TARGET_BUILD_PDK ) , t r u e )
build_ota_package := false
e n d i f
2015-09-23 02:17:52 +08:00
i f e q ( $( build_ota_package ) , t r u e )
2015-08-12 02:24:19 +08:00
OTATOOLS := $( HOST_OUT_EXECUTABLES) /minigzip \
$( HOST_OUT_EXECUTABLES) /aapt \
2015-04-09 03:24:37 +08:00
$( HOST_OUT_EXECUTABLES) /mkbootfs \
$( HOST_OUT_EXECUTABLES) /mkbootimg \
$( HOST_OUT_EXECUTABLES) /fs_config \
$( HOST_OUT_EXECUTABLES) /zipalign \
$( HOST_OUT_EXECUTABLES) /bsdiff \
$( HOST_OUT_EXECUTABLES) /imgdiff \
$( HOST_OUT_JAVA_LIBRARIES) /dumpkey.jar \
$( HOST_OUT_JAVA_LIBRARIES) /signapk.jar \
$( HOST_OUT_JAVA_LIBRARIES) /BootSignature.jar \
$( HOST_OUT_EXECUTABLES) /mkuserimg.sh \
$( HOST_OUT_EXECUTABLES) /make_ext4fs \
2016-04-15 03:11:36 +08:00
$( HOST_OUT_EXECUTABLES) /mksquashfsimage.sh \
$( HOST_OUT_EXECUTABLES) /mksquashfs \
$( HOST_OUT_EXECUTABLES) /mkf2fsuserimg.sh \
$( HOST_OUT_EXECUTABLES) /make_f2fs \
2015-04-09 03:24:37 +08:00
$( HOST_OUT_EXECUTABLES) /simg2img \
$( HOST_OUT_EXECUTABLES) /e2fsck \
$( HOST_OUT_EXECUTABLES) /build_verity_tree \
$( HOST_OUT_EXECUTABLES) /verity_signer \
2016-11-19 09:04:24 +08:00
$( HOST_OUT_EXECUTABLES) /verity_verifier \
2015-04-09 03:24:37 +08:00
$( HOST_OUT_EXECUTABLES) /append2simg \
2015-06-25 06:42:19 +08:00
$( HOST_OUT_EXECUTABLES) /img2simg \
2015-05-20 14:30:57 +08:00
$( HOST_OUT_EXECUTABLES) /boot_signer \
2016-01-05 01:57:32 +08:00
$( HOST_OUT_EXECUTABLES) /fec \
2016-01-20 06:47:17 +08:00
$( HOST_OUT_EXECUTABLES) /brillo_update_payload \
$( HOST_OUT_EXECUTABLES) /lib/shflags/shflags \
2016-03-30 06:12:37 +08:00
$( HOST_OUT_EXECUTABLES) /delta_generator \
$( BLK_ALLOC_TO_BASE_FS)
2016-01-05 01:57:32 +08:00
2015-04-09 03:24:37 +08:00
# Shared libraries.
2015-08-12 02:24:19 +08:00
OTATOOLS += \
2015-04-14 00:01:24 +08:00
$( HOST_LIBRARY_PATH) /libc++$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /liblog$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libcutils$( HOST_SHLIB_SUFFIX) \
2015-06-03 14:35:52 +08:00
$( HOST_LIBRARY_PATH) /libselinux$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libcrypto-host$( HOST_SHLIB_SUFFIX) \
2015-09-29 07:37:27 +08:00
$( HOST_LIBRARY_PATH) /libdivsufsort$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libdivsufsort64$( HOST_SHLIB_SUFFIX) \
2015-12-10 10:02:56 +08:00
$( HOST_LIBRARY_PATH) /libext2fs-host$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libext2_blkid-host$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libext2_com_err-host$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libext2_e2p-host$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libext2_profile-host$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libext2_quota-host$( HOST_SHLIB_SUFFIX) \
2015-12-11 05:38:50 +08:00
$( HOST_LIBRARY_PATH) /libext2_uuid-host$( HOST_SHLIB_SUFFIX) \
2016-01-05 01:57:32 +08:00
$( HOST_LIBRARY_PATH) /libconscrypt_openjdk_jni$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libbrillo$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libbrillo-stream$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libbrillo-http$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libchrome$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libcurl-host$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libevent-host$( HOST_SHLIB_SUFFIX) \
2016-02-12 01:50:41 +08:00
$( HOST_LIBRARY_PATH) /libprotobuf-cpp-lite$( HOST_SHLIB_SUFFIX) \
2016-01-05 01:57:32 +08:00
$( HOST_LIBRARY_PATH) /libssl-host$( HOST_SHLIB_SUFFIX) \
2016-03-24 20:57:03 +08:00
$( HOST_LIBRARY_PATH) /libz-host$( HOST_SHLIB_SUFFIX) \
$( HOST_LIBRARY_PATH) /libbase$( HOST_SHLIB_SUFFIX)
2009-03-04 11:28:42 +08:00
2010-06-18 08:52:18 +08:00
.PHONY : otatools
otatools : $( OTATOOLS )
2014-08-22 23:04:58 +08:00
BUILT_OTATOOLS_PACKAGE := $( PRODUCT_OUT) /otatools.zip
2015-04-09 07:37:34 +08:00
$(BUILT_OTATOOLS_PACKAGE) : zip_root := $( call intermediates -dir -for ,PACKAGING ,otatools ) /otatools
2014-08-22 23:04:58 +08:00
2015-11-05 02:06:25 +08:00
$(BUILT_OTATOOLS_PACKAGE) : $( OTATOOLS ) | $( ACP )
2014-08-22 23:04:58 +08:00
@echo " Package OTA tools: $@ "
$( hide) rm -rf $@ $( zip_root)
2015-06-04 16:07:44 +08:00
$( hide) mkdir -p $( dir $@ ) $( zip_root) /bin $( zip_root) /framework $( zip_root) /releasetools $( zip_root) /system/extras/verity
2015-04-09 03:24:37 +08:00
$( call copy-files-with-structure,$( OTATOOLS) ,$( HOST_OUT) /,$( zip_root) )
2015-06-02 17:59:32 +08:00
$( hide) $( ACP) $( HOST_OUT_JAVA_LIBRARIES) /VeritySigner.jar $( zip_root) /framework/
2015-06-04 16:07:44 +08:00
$( hide) $( ACP) -p system/extras/verity/build_verity_metadata.py $( zip_root) /system/extras/verity/
2014-08-22 23:04:58 +08:00
$( hide) $( ACP) -r -d -p build/tools/releasetools/* $( zip_root) /releasetools
$( hide) rm -rf $@ $( zip_root) /releasetools/*.pyc
2015-10-30 07:33:05 +08:00
$( hide) ( cd $( zip_root) && zip -qryX $( abspath $@ ) *)
$( hide) zip -qryX $( abspath $@ ) build/target/product/security/
2016-05-21 08:27:18 +08:00
$( hide) find device vendor -name \* .pk8 -o -name verifiedboot\* -o -name \* .x509.pem -o -name oem\* .prop | xargs zip -qryX $( abspath $@ ) >/dev/null || true
2014-08-22 23:04:58 +08:00
.PHONY : otatools -package
otatools-package : $( BUILT_OTATOOLS_PACKAGE )
2015-09-23 02:17:52 +08:00
e n d i f # build_ota_package
2014-08-22 23:04:58 +08:00
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# A zip of the directories that map to the target filesystem.
# This zip can be used to create an OTA package or filesystem image
# as a post-build step.
#
name := $( TARGET_PRODUCT)
i f e q ( $( TARGET_BUILD_TYPE ) , d e b u g )
name := $( name) _debug
e n d i f
name := $( name) -target_files-$( FILE_NAME_TAG)
intermediates := $( call intermediates-dir-for,PACKAGING,target_files)
BUILT_TARGET_FILES_PACKAGE := $( intermediates) /$( name) .zip
$(BUILT_TARGET_FILES_PACKAGE) : intermediates := $( intermediates )
$(BUILT_TARGET_FILES_PACKAGE) : \
zip_root := $( intermediates) /$( name)
# $(1): Directory to copy
# $(2): Location to copy it to
# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
d e f i n e p a c k a g e _ f i l e s - c o p y - r o o t
if [ -d " $( strip $( 1) ) " -a " $$ (ls -A $( 1) ) " ] ; then \
mkdir -p $( 2) && \
$( ACP) -rd $( strip $( 1) ) /* $( 2) ; \
fi
e n d e f
2015-12-01 04:22:24 +08:00
built_ota_tools :=
2015-06-23 09:35:35 +08:00
# We can't build static executables when SANITIZE_TARGET=address
2015-09-19 02:54:43 +08:00
i f e q ( $( strip $ ( SANITIZE_TARGET ) ) , )
2015-06-23 09:35:35 +08:00
built_ota_tools += \
$( call intermediates-dir-for,EXECUTABLES,updater,,,$( TARGET_PREFER_32_BIT) ) /updater
e n d i f
2009-03-04 11:28:42 +08:00
$(BUILT_TARGET_FILES_PACKAGE) : PRIVATE_OTA_TOOLS := $( built_ota_tools )
2009-06-18 08:09:40 +08:00
$(BUILT_TARGET_FILES_PACKAGE) : PRIVATE_RECOVERY_API_VERSION := $( RECOVERY_API_VERSION )
2013-02-22 08:27:25 +08:00
$(BUILT_TARGET_FILES_PACKAGE) : PRIVATE_RECOVERY_FSTAB_VERSION := $( RECOVERY_FSTAB_VERSION )
2009-06-18 08:09:40 +08:00
2009-10-01 00:20:32 +08:00
i f e q ( $( TARGET_RELEASETOOLS_EXTENSIONS ) , )
# default to common dir for device vendor
$(BUILT_TARGET_FILES_PACKAGE) : tool_extensions := $( TARGET_DEVICE_DIR ) /../common
e l s e
$(BUILT_TARGET_FILES_PACKAGE) : tool_extensions := $( TARGET_RELEASETOOLS_EXTENSIONS )
e n d i f
2015-10-02 14:53:31 +08:00
# Build OTA tools if not using the AB Updater.
i f n e q ( $( AB_OTA_UPDATER ) , t r u e )
$(BUILT_TARGET_FILES_PACKAGE) : $( built_ota_tools )
e n d i f
2015-11-11 11:21:34 +08:00
# If we are using recovery as boot, output recovery files to BOOT/.
i f e q ( $( BOARD_USES_RECOVERY_AS_BOOT ) , t r u e )
$(BUILT_TARGET_FILES_PACKAGE) : PRIVATE_RECOVERY_OUT := BOOT
e l s e
$(BUILT_TARGET_FILES_PACKAGE) : PRIVATE_RECOVERY_OUT := RECOVERY
e n d i f
2009-03-04 11:28:42 +08:00
# Depending on the various images guarantees that the underlying
# directories are up-to-date.
$(BUILT_TARGET_FILES_PACKAGE) : \
$( INSTALLED_BOOTIMAGE_TARGET) \
$( INSTALLED_RADIOIMAGE_TARGET) \
$( INSTALLED_RECOVERYIMAGE_TARGET) \
2009-07-03 00:00:54 +08:00
$( INSTALLED_SYSTEMIMAGE) \
2009-03-04 11:28:42 +08:00
$( INSTALLED_USERDATAIMAGE_TARGET) \
2011-11-05 02:37:01 +08:00
$( INSTALLED_CACHEIMAGE_TARGET) \
2013-03-21 02:02:05 +08:00
$( INSTALLED_VENDORIMAGE_TARGET) \
2016-06-17 05:47:10 +08:00
$( INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
2009-03-04 11:28:42 +08:00
$( INSTALLED_ANDROID_INFO_TXT_TARGET) \
2013-09-08 08:10:29 +08:00
$( SELINUX_FC) \
2009-03-04 11:28:42 +08:00
$( APKCERTS_FILE) \
2010-03-16 08:52:32 +08:00
$( HOST_OUT_EXECUTABLES) /fs_config \
2015-11-05 02:06:25 +08:00
| $( ACP)
2009-03-04 11:28:42 +08:00
@echo " Package target files: $@ "
$( hide) rm -rf $@ $( zip_root)
$( hide) mkdir -p $( dir $@ ) $( zip_root)
2015-11-11 11:21:34 +08:00
i f n e q ( , $( INSTALLED_RECOVERYIMAGE_TARGET ) $( filter true ,$ ( BOARD_USES_RECOVERY_AS_BOOT ) ) )
2009-03-04 11:28:42 +08:00
@# Components of the recovery image
2015-11-11 11:21:34 +08:00
$( hide) mkdir -p $( zip_root) /$( PRIVATE_RECOVERY_OUT)
2009-03-04 11:28:42 +08:00
$( hide) $( call package_files-copy-root, \
2015-11-11 11:21:34 +08:00
$( TARGET_RECOVERY_ROOT_OUT) ,$( zip_root) /$( PRIVATE_RECOVERY_OUT) /RAMDISK)
2009-03-04 11:28:42 +08:00
i f d e f I N S T A L L E D _ K E R N E L _ T A R G E T
2015-11-11 11:21:34 +08:00
$( hide) $( ACP) $( INSTALLED_KERNEL_TARGET) $( zip_root) /$( PRIVATE_RECOVERY_OUT) /kernel
2009-03-04 11:28:42 +08:00
e n d i f
i f d e f I N S T A L L E D _ 2 N D B O O T L O A D E R _ T A R G E T
$( hide) $( ACP) \
2015-11-11 11:21:34 +08:00
$( INSTALLED_2NDBOOTLOADER_TARGET) $( zip_root) /$( PRIVATE_RECOVERY_OUT) /second
2009-03-04 11:28:42 +08:00
e n d i f
i f d e f B O A R D _ K E R N E L _ C M D L I N E
2015-11-11 11:21:34 +08:00
$( hide) echo " $( BOARD_KERNEL_CMDLINE) " > $( zip_root) /$( PRIVATE_RECOVERY_OUT) /cmdline
2009-06-18 00:07:09 +08:00
e n d i f
i f d e f B O A R D _ K E R N E L _ B A S E
2015-11-11 11:21:34 +08:00
$( hide) echo " $( BOARD_KERNEL_BASE) " > $( zip_root) /$( PRIVATE_RECOVERY_OUT) /base
2010-08-26 05:29:34 +08:00
e n d i f
i f d e f B O A R D _ K E R N E L _ P A G E S I Z E
2015-11-11 11:21:34 +08:00
$( hide) echo " $( BOARD_KERNEL_PAGESIZE) " > $( zip_root) /$( PRIVATE_RECOVERY_OUT) /pagesize
2009-03-04 11:28:42 +08:00
e n d i f
2015-11-11 11:21:34 +08:00
e n d i f # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
2009-03-04 11:28:42 +08:00
@# Components of the boot image
$( hide) mkdir -p $( zip_root) /BOOT
2015-07-22 09:01:20 +08:00
i f e q ( $( BOARD_BUILD_SYSTEM_ROOT_IMAGE ) , t r u e )
$( hide) mkdir -p $( zip_root) /ROOT
$( hide) $( call package_files-copy-root, \
$( TARGET_ROOT_OUT) ,$( zip_root) /ROOT)
e l s e
2009-03-04 11:28:42 +08:00
$( hide) $( call package_files-copy-root, \
$( TARGET_ROOT_OUT) ,$( zip_root) /BOOT/RAMDISK)
2015-07-22 09:01:20 +08:00
e n d i f
2015-11-11 11:21:34 +08:00
@# If we are using recovery as boot, this is already done when processing recovery.
i f n e q ( $( BOARD_USES_RECOVERY_AS_BOOT ) , t r u e )
2009-03-04 11:28:42 +08:00
i f d e f I N S T A L L E D _ K E R N E L _ T A R G E T
$( hide) $( ACP) $( INSTALLED_KERNEL_TARGET) $( zip_root) /BOOT/kernel
e n d i f
i f d e f I N S T A L L E D _ 2 N D B O O T L O A D E R _ T A R G E T
$( hide) $( ACP) \
$( INSTALLED_2NDBOOTLOADER_TARGET) $( zip_root) /BOOT/second
e n d i f
i f d e f B O A R D _ K E R N E L _ C M D L I N E
$( hide) echo " $( BOARD_KERNEL_CMDLINE) " > $( zip_root) /BOOT/cmdline
e n d i f
2009-06-18 00:07:09 +08:00
i f d e f B O A R D _ K E R N E L _ B A S E
$( hide) echo " $( BOARD_KERNEL_BASE) " > $( zip_root) /BOOT/base
2010-08-26 05:29:34 +08:00
e n d i f
i f d e f B O A R D _ K E R N E L _ P A G E S I Z E
$( hide) echo " $( BOARD_KERNEL_PAGESIZE) " > $( zip_root) /BOOT/pagesize
2009-06-18 00:07:09 +08:00
e n d i f
2015-11-11 11:21:34 +08:00
e n d i f # BOARD_USES_RECOVERY_AS_BOOT
2009-06-20 08:12:18 +08:00
$( hide) $( foreach t,$( INSTALLED_RADIOIMAGE_TARGET) ,\
mkdir -p $( zip_root) /RADIO; \
$( ACP) $( t) $( zip_root) /RADIO/$( notdir $( t) ) ; )
2009-03-04 11:28:42 +08:00
@# Contents of the system image
$( hide) $( call package_files-copy-root, \
$( SYSTEMIMAGE_SOURCE_DIR) ,$( zip_root) /SYSTEM)
@# Contents of the data image
$( hide) $( call package_files-copy-root, \
$( TARGET_OUT_DATA) ,$( zip_root) /DATA)
2013-03-21 02:02:05 +08:00
i f d e f B O A R D _ V E N D O R I M A G E _ F I L E _ S Y S T E M _ T Y P E
@# Contents of the vendor image
$( hide) $( call package_files-copy-root, \
$( TARGET_OUT_VENDOR) ,$( zip_root) /VENDOR)
2016-06-17 05:47:10 +08:00
e n d i f
i f d e f I N S T A L L E D _ S Y S T E M O T H E R I M A G E _ T A R G E T
@# Contents of the system_other image
$( hide) $( call package_files-copy-root, \
$( TARGET_OUT_SYSTEM_OTHER) ,$( zip_root) /SYSTEM_OTHER)
2013-03-21 02:02:05 +08:00
e n d i f
2009-03-04 11:28:42 +08:00
@# Extra contents of the OTA package
2015-10-02 14:53:31 +08:00
$( hide) mkdir -p $( zip_root) /OTA
2009-03-04 11:28:42 +08:00
$( hide) $( ACP) $( INSTALLED_ANDROID_INFO_TXT_TARGET) $( zip_root) /OTA/
2015-10-02 14:53:31 +08:00
i f n e q ( $( AB_OTA_UPDATER ) , t r u e )
2015-12-08 02:45:19 +08:00
i f n e q ( $( built_ota_tools ) , )
2015-10-02 14:53:31 +08:00
$( hide) mkdir -p $( zip_root) /OTA/bin
2009-03-04 11:28:42 +08:00
$( hide) $( ACP) $( PRIVATE_OTA_TOOLS) $( zip_root) /OTA/bin/
2015-12-08 02:45:19 +08:00
e n d i f
2015-10-02 14:53:31 +08:00
e n d i f
2009-06-16 05:30:14 +08:00
@# Files that do not end up in any images, but are necessary to
2009-03-04 11:28:42 +08:00
@# build them.
$( hide) mkdir -p $( zip_root) /META
$( hide) $( ACP) $( APKCERTS_FILE) $( zip_root) /META/apkcerts.txt
2013-11-23 05:29:55 +08:00
$( hide) if test -e $( tool_extensions) /releasetools.py; then $( ACP) $( tool_extensions) /releasetools.py $( zip_root) /META/; fi
2015-03-25 10:07:40 +08:00
$( hide) echo " $( PRODUCT_OTA_PUBLIC_KEYS) " > $( zip_root) /META/otakeys.txt
2015-08-05 02:59:06 +08:00
$( hide) $( ACP) $( SELINUX_FC) $( zip_root) /META/file_contexts.bin
2010-09-17 08:44:38 +08:00
$( hide) echo " recovery_api_version= $( PRIVATE_RECOVERY_API_VERSION) " > $( zip_root) /META/misc_info.txt
2013-02-22 08:27:25 +08:00
$( hide) echo " fstab_version= $( PRIVATE_RECOVERY_FSTAB_VERSION) " >> $( zip_root) /META/misc_info.txt
2010-07-02 06:30:11 +08:00
i f d e f B O A R D _ F L A S H _ B L O C K _ S I Z E
2010-09-17 08:44:38 +08:00
$( hide) echo " blocksize= $( BOARD_FLASH_BLOCK_SIZE) " >> $( zip_root) /META/misc_info.txt
2010-07-02 06:30:11 +08:00
e n d i f
i f d e f B O A R D _ B O O T I M A G E _ P A R T I T I O N _ S I Z E
2011-01-15 03:30:56 +08:00
$( hide) echo " boot_size= $( BOARD_BOOTIMAGE_PARTITION_SIZE) " >> $( zip_root) /META/misc_info.txt
2010-07-02 06:30:11 +08:00
e n d i f
2015-11-11 11:21:34 +08:00
i f e q ( $( BOARD_USES_RECOVERY_AS_BOOT ) , )
$( hide) echo " recovery_as_boot= $( BOARD_USES_RECOVERY_AS_BOOT) " >> $( zip_root) /META/misc_info.txt
e n d i f
2015-10-28 10:25:18 +08:00
i f e q ( $( INSTALLED_RECOVERYIMAGE_TARGET ) , )
$( hide) echo "no_recovery=true" >> $( zip_root) /META/misc_info.txt
e n d i f
2010-07-02 06:30:11 +08:00
i f d e f B O A R D _ R E C O V E R Y I M A G E _ P A R T I T I O N _ S I Z E
2011-01-15 03:30:56 +08:00
$( hide) echo " recovery_size= $( BOARD_RECOVERYIMAGE_PARTITION_SIZE) " >> $( zip_root) /META/misc_info.txt
2014-10-23 11:01:22 +08:00
e n d i f
2015-06-24 02:16:05 +08:00
i f d e f B O A R D _ H A S _ E X T 4 _ R E S E R V E D _ B L O C K S
$( hide) echo " has_ext4_reserved_blocks= $( BOARD_HAS_EXT4_RESERVED_BLOCKS) " >> $( zip_root) /META/misc_info.txt
e n d i f
2014-10-23 11:01:22 +08:00
i f d e f T A R G E T _ R E C O V E R Y _ F S T Y P E _ M O U N T _ O P T I O N S
@# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
$( hide) echo " recovery_mount_options= $( TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS) " >> $( zip_root) /META/misc_info.txt
e l s e
$( hide) echo " recovery_mount_options= $( DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS) " >> $( zip_root) /META/misc_info.txt
2010-07-02 06:30:11 +08:00
e n d i f
2010-09-17 08:44:38 +08:00
$( hide) echo " tool_extensions= $( tool_extensions) " >> $( zip_root) /META/misc_info.txt
2011-10-05 01:50:08 +08:00
$( hide) echo " default_system_dev_certificate= $( DEFAULT_SYSTEM_DEV_CERTIFICATE) " >> $( zip_root) /META/misc_info.txt
2011-03-16 22:49:13 +08:00
i f d e f P R O D U C T _ E X T R A _ R E C O V E R Y _ K E Y S
$( hide) echo " extra_recovery_keys= $( PRODUCT_EXTRA_RECOVERY_KEYS) " >> $( zip_root) /META/misc_info.txt
2010-08-26 11:39:41 +08:00
e n d i f
2013-04-18 06:19:19 +08:00
$( hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $( zip_root) /META/misc_info.txt
2016-03-16 00:49:30 +08:00
$( hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $( zip_root) /META/misc_info.txt
2013-09-08 08:10:29 +08:00
$( hide) echo "use_set_metadata=1" >> $( zip_root) /META/misc_info.txt
2013-11-26 06:44:12 +08:00
$( hide) echo "multistage_support=1" >> $( zip_root) /META/misc_info.txt
2013-12-21 03:50:16 +08:00
$( hide) echo "update_rename_support=1" >> $( zip_root) /META/misc_info.txt
2015-10-22 04:30:43 +08:00
$( hide) echo "blockimgdiff_versions=1,2,3,4" >> $( zip_root) /META/misc_info.txt
2014-10-08 09:42:11 +08:00
i f n e q ( $( OEM_THUMBPRINT_PROPERTIES ) , )
2014-03-22 07:20:05 +08:00
# OTA scripts are only interested in fingerprint related properties
2014-10-08 09:42:11 +08:00
$( hide) echo " oem_fingerprint_properties= $( OEM_THUMBPRINT_PROPERTIES) " >> $( zip_root) /META/misc_info.txt
2015-06-26 04:56:53 +08:00
e n d i f
2016-03-30 06:12:37 +08:00
i f n e q ( $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SYSTEM_BASE_FS_PATH ) , )
$( hide) $( ACP) $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_SYSTEM_BASE_FS_PATH) \
$( zip_root) /META/$( notdir $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_SYSTEM_BASE_FS_PATH) )
e n d i f
i f n e q ( $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_VENDOR_BASE_FS_PATH ) , )
$( hide) $( ACP) $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VENDOR_BASE_FS_PATH) \
$( zip_root) /META/$( notdir $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_VENDOR_BASE_FS_PATH) )
e n d i f
2015-09-19 02:54:43 +08:00
i f n e q ( $( strip $ ( SANITIZE_TARGET ) ) , )
2015-06-26 04:56:53 +08:00
# We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
$( hide) echo "userdata_img_with_data=true" >> $( zip_root) /META/misc_info.txt
2015-07-23 03:33:18 +08:00
e n d i f
i f e q ( $( BOARD_USES_FULL_RECOVERY_IMAGE ) , t r u e )
$( hide) echo "full_recovery_image=true" >> $( zip_root) /META/misc_info.txt
2014-03-22 07:20:05 +08:00
e n d i f
2011-10-29 08:02:30 +08:00
$( call generate-userimage-prop-dictionary, $( zip_root) /META/misc_info.txt)
2015-08-19 09:03:56 +08:00
i f n e q ( $( INSTALLED_RECOVERYIMAGE_TARGET ) , )
2015-03-25 21:06:30 +08:00
$( hide) PATH = $( foreach p,$( INTERNAL_USERIMAGES_BINARY_PATHS) ,$( p) :) $$ PATH MKBOOTIMG = $( MKBOOTIMG) \
2015-02-10 09:20:06 +08:00
./build/tools/releasetools/make_recovery_patch $( zip_root) $( zip_root)
2015-09-25 09:12:33 +08:00
e n d i f
2015-09-30 10:05:37 +08:00
i f e q ( $( AB_OTA_UPDATER ) , t r u e )
@# When using the A/B updater, include the updater config files in the zip.
$( hide) $( ACP) $( TOPDIR) system/update_engine/update_engine.conf $( zip_root) /META/update_engine_config.txt
2015-10-23 09:15:27 +08:00
$( hide) for part in $( AB_OTA_PARTITIONS) ; do \
2015-10-02 08:38:09 +08:00
echo " $$ {part} " >> $( zip_root) /META/ab_partitions.txt; \
done
2015-11-13 05:53:25 +08:00
$( hide) for conf in $( AB_OTA_POSTINSTALL_CONFIG) ; do \
echo " $$ {conf} " >> $( zip_root) /META/postinstall_config.txt; \
done
2015-11-05 18:04:04 +08:00
@# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
$( hide) echo " build_type= $( TARGET_BUILD_VARIANT) " >> $( zip_root) /META/misc_info.txt
2015-11-11 11:21:34 +08:00
$( hide) echo "ab_update=true" >> $( zip_root) /META/misc_info.txt
2015-10-09 06:32:40 +08:00
i f d e f O S R E L E A S E D _ D I R E C T O R Y
2015-10-15 06:54:51 +08:00
$( hide) $( ACP) $( TARGET_OUT_ETC) /$( OSRELEASED_DIRECTORY) /product_id $( zip_root) /META/product_id.txt
2015-10-09 06:32:40 +08:00
$( hide) $( ACP) $( TARGET_OUT_ETC) /$( OSRELEASED_DIRECTORY) /product_version $( zip_root) /META/product_version.txt
e n d i f
2015-09-30 10:05:37 +08:00
e n d i f
2015-09-25 09:12:33 +08:00
i f e q ( $( BREAKPAD_GENERATE_SYMBOLS ) , t r u e )
2015-09-30 10:05:37 +08:00
@# If breakpad symbols have been generated, add them to the zip.
2015-09-25 09:12:33 +08:00
$( hide) $( ACP) -r $( TARGET_OUT_BREAKPAD) $( zip_root) /BREAKPAD
2016-06-18 05:07:37 +08:00
e n d i f
i f d e f B O A R D _ P R E B U I L T _ V E N D O R I M A G E
$( hide) mkdir -p $( zip_root) /IMAGES
$( hide) cp $( INSTALLED_VENDORIMAGE_TARGET) $( zip_root) /IMAGES/
2015-08-19 09:03:56 +08:00
e n d i f
2016-01-27 10:47:44 +08:00
@# Zip everything up, preserving symlinks and placing META/ files first to
@# help early validation of the .zip file while uploading it.
$( hide) ( cd $( zip_root) && \
zip -qryX ../$( notdir $@ ) ./META && \
zip -qryXu ../$( notdir $@ ) .)
2014-06-17 06:16:31 +08:00
@# Run fs_config on all the system, vendor, boot ramdisk,
@# and recovery ramdisk files in the zip, and save the output
2015-07-10 00:54:55 +08:00
$( hide) zipinfo -1 $@ | awk 'BEGIN { FS="SYSTEM/" } /^SYSTEM\// {print "system/" $$2}' | $( HOST_OUT_EXECUTABLES) /fs_config -C -D $( TARGET_OUT) -S $( SELINUX_FC) > $( zip_root) /META/filesystem_config.txt
$( hide) zipinfo -1 $@ | awk 'BEGIN { FS="VENDOR/" } /^VENDOR\// {print "vendor/" $$2}' | $( HOST_OUT_EXECUTABLES) /fs_config -C -D $( TARGET_OUT) -S $( SELINUX_FC) > $( zip_root) /META/vendor_filesystem_config.txt
2015-07-22 09:01:20 +08:00
i f e q ( $( BOARD_BUILD_SYSTEM_ROOT_IMAGE ) , t r u e )
2015-08-07 02:01:31 +08:00
$( hide) zipinfo -1 $@ | awk 'BEGIN { FS="ROOT/" } /^ROOT\// {print $$2}' | $( HOST_OUT_EXECUTABLES) /fs_config -C -D $( TARGET_OUT) -S $( SELINUX_FC) > $( zip_root) /META/root_filesystem_config.txt
2015-07-22 09:01:20 +08:00
e n d i f
2015-11-11 11:21:34 +08:00
$( hide) zipinfo -1 $@ | awk 'BEGIN { FS="BOOT/RAMDISK/" } /^BOOT\/RAMDISK\// {print $$2}' | $( HOST_OUT_EXECUTABLES) /fs_config -C -D $( TARGET_OUT) -S $( SELINUX_FC) > $( zip_root) /META/boot_filesystem_config.txt
2015-10-28 10:25:18 +08:00
i f n e q ( $( INSTALLED_RECOVERYIMAGE_TARGET ) , )
2015-07-10 00:54:55 +08:00
$( hide) zipinfo -1 $@ | awk 'BEGIN { FS="RECOVERY/RAMDISK/" } /^RECOVERY\/RAMDISK\// {print $$2}' | $( HOST_OUT_EXECUTABLES) /fs_config -C -D $( TARGET_OUT) -S $( SELINUX_FC) > $( zip_root) /META/recovery_filesystem_config.txt
2016-06-17 05:47:10 +08:00
e n d i f
i f d e f I N S T A L L E D _ S Y S T E M O T H E R I M A G E _ T A R G E T
$( hide) zipinfo -1 $@ | awk 'BEGIN { FS="SYSTEM_OTHER/" } /^SYSTEM_OTHER\// { print "system/" $$2}' | $( HOST_OUT_EXECUTABLES) /fs_config -C -D $( TARGET_OUT) -S $( SELINUX_FC) > $( zip_root) /META/system_other_filesystem_config.txt
2015-10-28 10:25:18 +08:00
e n d i f
2015-10-30 07:33:05 +08:00
$( hide) ( cd $( zip_root) && zip -qX ../$( notdir $@ ) META/*filesystem_config.txt)
2015-03-25 21:06:30 +08:00
$( hide) PATH = $( foreach p,$( INTERNAL_USERIMAGES_BINARY_PATHS) ,$( p) :) $$ PATH MKBOOTIMG = $( MKBOOTIMG) \
2016-06-18 05:07:37 +08:00
./build/tools/releasetools/add_img_to_target_files -a -v -p $( HOST_OUT) $@
2010-03-16 08:52:32 +08:00
2013-03-21 02:02:05 +08:00
.PHONY : target -files -package
2009-03-04 11:28:42 +08:00
target-files-package : $( BUILT_TARGET_FILES_PACKAGE )
2014-04-15 08:25:43 +08:00
i f n e q ( $( filter $ ( MAKECMDGOALS ) ,target -files -package ) , )
$( call dist -for -goals , target -files -package , $ ( BUILT_TARGET_FILES_PACKAGE ) )
e n d i f
2009-06-16 09:56:51 +08:00
2015-08-12 02:24:19 +08:00
i f e q ( $( build_ota_package ) , t r u e )
2010-10-21 05:01:09 +08:00
# -----------------------------------------------------------------
# OTA update package
2009-06-16 05:30:14 +08:00
name := $( TARGET_PRODUCT)
i f e q ( $( TARGET_BUILD_TYPE ) , d e b u g )
name := $( name) _debug
e n d i f
name := $( name) -ota-$( FILE_NAME_TAG)
INTERNAL_OTA_PACKAGE_TARGET := $( PRODUCT_OUT) /$( name) .zip
$(INTERNAL_OTA_PACKAGE_TARGET) : KEY_CERT_PAIR := $( DEFAULT_KEY_CERT_PAIR )
2015-08-12 02:24:19 +08:00
$(INTERNAL_OTA_PACKAGE_TARGET) : $( BUILT_TARGET_FILES_PACKAGE )
2009-06-16 05:30:14 +08:00
@echo " Package OTA: $@ "
2015-02-10 09:20:06 +08:00
$( hide) PATH = $( foreach p,$( INTERNAL_USERIMAGES_BINARY_PATHS) ,$( p) :) $$ PATH MKBOOTIMG = $( MKBOOTIMG) \
2012-11-26 08:53:44 +08:00
./build/tools/releasetools/ota_from_target_files -v \
2014-02-21 05:22:07 +08:00
--block \
2009-06-18 23:35:12 +08:00
-p $( HOST_OUT) \
2012-02-10 02:36:21 +08:00
-k $( KEY_CERT_PAIR) \
2014-04-16 08:40:21 +08:00
$( if $( OEM_OTA_CONFIG) , -o $( OEM_OTA_CONFIG) ) \
2012-02-10 02:36:21 +08:00
$( BUILT_TARGET_FILES_PACKAGE) $@
2009-06-16 05:30:14 +08:00
.PHONY : otapackage
otapackage : $( INTERNAL_OTA_PACKAGE_TARGET )
2015-08-12 02:24:19 +08:00
e n d i f # build_ota_package
2014-06-04 05:07:27 +08:00
2010-10-21 05:01:09 +08:00
# -----------------------------------------------------------------
# The update package
name := $( TARGET_PRODUCT)
i f e q ( $( TARGET_BUILD_TYPE ) , d e b u g )
name := $( name) _debug
e n d i f
name := $( name) -img-$( FILE_NAME_TAG)
INTERNAL_UPDATE_PACKAGE_TARGET := $( PRODUCT_OUT) /$( name) .zip
2015-08-12 02:24:19 +08:00
$(INTERNAL_UPDATE_PACKAGE_TARGET) : $( BUILT_TARGET_FILES_PACKAGE )
2010-10-21 05:01:09 +08:00
@echo " Package: $@ "
2015-02-10 09:20:06 +08:00
$( hide) PATH = $( foreach p,$( INTERNAL_USERIMAGES_BINARY_PATHS) ,$( p) :) $$ PATH MKBOOTIMG = $( MKBOOTIMG) \
2012-11-26 08:53:44 +08:00
./build/tools/releasetools/img_from_target_files -v \
2010-10-21 05:01:09 +08:00
-p $( HOST_OUT) \
$( BUILT_TARGET_FILES_PACKAGE) $@
.PHONY : updatepackage
updatepackage : $( INTERNAL_UPDATE_PACKAGE_TARGET )
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# A zip of the symbols directory. Keep the full paths to make it
# more obvious where these files came from.
#
name := $( TARGET_PRODUCT)
i f e q ( $( TARGET_BUILD_TYPE ) , d e b u g )
name := $( name) _debug
e n d i f
name := $( name) -symbols-$( FILE_NAME_TAG)
SYMBOLS_ZIP := $( PRODUCT_OUT) /$( name) .zip
2014-10-25 02:36:59 +08:00
# For apps_only build we'll establish the dependency later in build/core/main.mk.
i f n d e f T A R G E T _ B U I L D _ A P P S
2009-03-04 11:28:42 +08:00
$(SYMBOLS_ZIP) : $( INSTALLED_SYSTEMIMAGE ) $( INSTALLED_BOOTIMAGE_TARGET )
2014-10-25 02:36:59 +08:00
e n d i f
2015-11-05 02:06:25 +08:00
$(SYMBOLS_ZIP) :
2009-03-04 11:28:42 +08:00
@echo " Package symbols: $@ "
$( hide) rm -rf $@
2014-10-25 02:36:59 +08:00
$( hide) mkdir -p $( dir $@ ) $( TARGET_OUT_UNSTRIPPED)
2015-10-30 07:33:05 +08:00
$( hide) zip -qrX $@ $( TARGET_OUT_UNSTRIPPED)
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# A zip of the Android Apps. Not keeping full path so that we don't
# include product names when distributing
#
name := $( TARGET_PRODUCT)
i f e q ( $( TARGET_BUILD_TYPE ) , d e b u g )
name := $( name) _debug
e n d i f
name := $( name) -apps-$( FILE_NAME_TAG)
APPS_ZIP := $( PRODUCT_OUT) /$( name) .zip
2015-11-05 02:06:25 +08:00
$(APPS_ZIP) : $( INSTALLED_SYSTEMIMAGE )
2009-03-04 11:28:42 +08:00
@echo " Package apps: $@ "
$( hide) rm -rf $@
$( hide) mkdir -p $( dir $@ )
2015-08-24 00:40:05 +08:00
$( hide) apps_to_zip = ` find $( TARGET_OUT_APPS) $( TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk" ` ; \
if [ -z " $$ apps_to_zip " ] ; then \
echo "No apps to zip up. Generating empty apps archive." ; \
a = $$ ( mktemp /tmp/XXXXXXX) && touch $$ a && zip $@ $$ a && zip -d $@ $$ a; \
else \
2015-10-30 07:33:05 +08:00
zip -qjX $@ $$ apps_to_zip; \
2015-08-24 00:40:05 +08:00
fi
2010-04-24 02:54:37 +08:00
#------------------------------------------------------------------
# A zip of emma code coverage meta files. Generated for fully emma
# instrumented build.
#
2012-08-16 03:22:44 +08:00
i f e q ( t r u e , $( EMMA_INSTRUMENT ) )
2010-04-24 02:54:37 +08:00
EMMA_META_ZIP := $( PRODUCT_OUT) /emma_meta.zip
2012-08-16 03:22:44 +08:00
# the dependency will be set up later in build/core/main.mk.
$(EMMA_META_ZIP) :
2010-04-24 02:54:37 +08:00
@echo "Collecting Emma coverage meta files."
2013-12-28 07:55:08 +08:00
$( hide) find $( TARGET_COMMON_OUT_ROOT) $( HOST_COMMON_OUT_ROOT) -name "coverage.em" | \
2015-10-30 07:33:05 +08:00
zip -@ -qX $@
2010-04-24 02:54:37 +08:00
2012-08-16 03:22:44 +08:00
e n d i f # EMMA_INSTRUMENT=true
2013-08-23 11:52:47 +08:00
#------------------------------------------------------------------
# A zip of Proguard obfuscation dictionary files.
# Only for apps_only build.
#
i f d e f T A R G E T _ B U I L D _ A P P S
2013-08-29 09:38:25 +08:00
PROGUARD_DICT_ZIP := $( PRODUCT_OUT) /$( TARGET_PRODUCT) -proguard-dict-$( FILE_NAME_TAG) .zip
2013-08-23 11:52:47 +08:00
# the dependency will be set up later in build/core/main.mk.
$(PROGUARD_DICT_ZIP) :
@echo "Packaging Proguard obfuscation dictionary files."
2016-09-02 02:02:43 +08:00
$( hide) dict_files = ` find $( TARGET_OUT_COMMON_INTERMEDIATES) /APPS -name proguard_dictionary -o -name jack_dictionary` ; \
2013-08-23 11:52:47 +08:00
if [ -n " $$ dict_files " ] ; then \
2013-11-26 09:39:50 +08:00
unobfuscated_jars = $$ { dict_files//proguard_dictionary/classes.jar} ; \
2015-10-30 07:33:05 +08:00
zip -qX $@ $$ dict_files $$ unobfuscated_jars; \
2013-08-23 11:52:47 +08:00
else \
2015-02-27 01:36:27 +08:00
touch $( dir $@ ) /zipdummy; \
( cd $( dir $@ ) && zip -q $( notdir $@ ) zipdummy) ; \
zip -qd $@ zipdummy; \
rm $( dir $@ ) /zipdummy; \
2013-08-23 11:52:47 +08:00
fi
e n d i f # TARGET_BUILD_APPS
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# dalvik something
.PHONY : dalvikfiles
dalvikfiles : $( INTERNAL_DALVIK_MODULES )
# -----------------------------------------------------------------
# The emulator package
2012-07-27 01:15:21 +08:00
i f e q ( $( BUILD_EMULATOR ) , t r u e )
2009-03-04 11:28:42 +08:00
INTERNAL_EMULATOR_PACKAGE_FILES += \
$( HOST_OUT_EXECUTABLES) /emulator$( HOST_EXECUTABLE_SUFFIX) \
2012-01-07 08:44:06 +08:00
prebuilts/qemu-kernel/$( TARGET_ARCH) /kernel-qemu \
2009-03-04 11:28:42 +08:00
$( INSTALLED_RAMDISK_TARGET) \
$( INSTALLED_SYSTEMIMAGE) \
$( INSTALLED_USERDATAIMAGE_TARGET)
name := $( TARGET_PRODUCT) -emulator-$( FILE_NAME_TAG)
INTERNAL_EMULATOR_PACKAGE_TARGET := $( PRODUCT_OUT) /$( name) .zip
2015-11-05 02:06:25 +08:00
$(INTERNAL_EMULATOR_PACKAGE_TARGET) : $( INTERNAL_EMULATOR_PACKAGE_FILES )
2009-03-04 11:28:42 +08:00
@echo " Package: $@ "
2015-10-30 07:33:05 +08:00
$( hide) zip -qjX $@ $( INTERNAL_EMULATOR_PACKAGE_FILES)
2009-03-04 11:28:42 +08:00
2012-07-27 01:15:21 +08:00
e n d i f
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
2012-02-28 07:49:23 +08:00
# Old PDK stuffs, retired
2009-03-04 11:28:42 +08:00
# The pdk package (Platform Development Kit)
2012-02-28 07:49:23 +08:00
#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
# include development/pdk/Pdk.mk
#endif
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# The SDK
# The SDK includes host-specific components, so it belongs under HOST_OUT.
2014-06-03 07:16:53 +08:00
sdk_dir := $( HOST_OUT) /sdk/$( TARGET_PRODUCT)
2009-03-04 11:28:42 +08:00
# Build a name that looks like:
#
# linux-x86 --> android-sdk_12345_linux-x86
# darwin-x86 --> android-sdk_12345_mac-x86
# windows-x86 --> android-sdk_12345_windows
#
sdk_name := android-sdk_$( FILE_NAME_TAG)
i f e q ( $( HOST_OS ) , d a r w i n )
2009-04-13 23:31:16 +08:00
INTERNAL_SDK_HOST_OS_NAME := mac
2009-03-04 11:28:42 +08:00
e l s e
2009-04-13 23:31:16 +08:00
INTERNAL_SDK_HOST_OS_NAME := $( HOST_OS)
2009-03-04 11:28:42 +08:00
e n d i f
i f n e q ( $( HOST_OS ) , w i n d o w s )
2014-06-10 03:31:12 +08:00
INTERNAL_SDK_HOST_OS_NAME := $( INTERNAL_SDK_HOST_OS_NAME) -$( SDK_HOST_ARCH)
2009-03-04 11:28:42 +08:00
e n d i f
2009-04-13 23:31:16 +08:00
sdk_name := $( sdk_name) _$( INTERNAL_SDK_HOST_OS_NAME)
2009-03-04 11:28:42 +08:00
sdk_dep_file := $( sdk_dir) /sdk_deps.mk
ATREE_FILES :=
- i n c l u d e $( sdk_dep_file )
# if we don't have a real list, then use "everything"
i f e q ( $( strip $ ( ATREE_FILES ) ) , )
ATREE_FILES := \
$( ALL_PREBUILT) \
$( ALL_DEFAULT_INSTALLED_MODULES) \
$( INSTALLED_RAMDISK_TARGET) \
$( ALL_DOCS) \
$( ALL_SDK_FILES)
e n d i f
atree_dir := development/build
2011-03-23 18:20:14 +08:00
2009-03-04 11:28:42 +08:00
sdk_atree_files := \
$( atree_dir) /sdk.exclude.atree \
2014-06-10 03:31:12 +08:00
$( atree_dir) /sdk-$( HOST_OS) -$( SDK_HOST_ARCH) .atree
2009-03-04 11:28:42 +08:00
2011-06-23 18:49:02 +08:00
# development/build/sdk-android-<abi>.atree is used to differentiate
# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
# files like the kernel image. We use TARGET_CPU_ABI because we don't
# have a better way to distinguish between CPU models.
i f n e q ( , $( strip $ ( wildcard $ ( atree_dir ) /sdk -android -$ ( TARGET_CPU_ABI ) .atree ) ) )
sdk_atree_files += $( atree_dir) /sdk-android-$( TARGET_CPU_ABI) .atree
e n d i f
2014-03-01 00:45:59 +08:00
i f n e q ( $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_SDK_ATREE_FILES ) , )
sdk_atree_files += $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_SDK_ATREE_FILES)
e l s e
sdk_atree_files += $( atree_dir) /sdk.atree
e n d i f
2014-08-12 06:20:02 +08:00
i n c l u d e $( BUILD_SYSTEM ) / s d k _ f o n t . m k
2014-08-02 01:14:15 +08:00
2009-03-04 11:28:42 +08:00
deps := \
$( target_notice_file_txt) \
$( tools_notice_file_txt) \
$( OUT_DOCS) /offline-sdk-timestamp \
2010-04-01 08:29:04 +08:00
$( SYMBOLS_ZIP) \
2009-06-16 12:25:32 +08:00
$( INSTALLED_SYSTEMIMAGE) \
$( INSTALLED_USERDATAIMAGE_TARGET) \
$( INSTALLED_RAMDISK_TARGET) \
2009-03-04 11:28:42 +08:00
$( INSTALLED_SDK_BUILD_PROP_TARGET) \
2010-04-01 08:29:04 +08:00
$( INSTALLED_BUILD_PROP_TARGET) \
2009-03-04 11:28:42 +08:00
$( ATREE_FILES) \
2014-02-19 06:29:59 +08:00
$( sdk_atree_files) \
2009-03-04 11:28:42 +08:00
$( HOST_OUT_EXECUTABLES) /atree \
2014-08-02 01:14:15 +08:00
$( HOST_OUT_EXECUTABLES) /line_endings \
2014-08-12 06:20:02 +08:00
$( SDK_FONT_DEPS)
2009-03-04 11:28:42 +08:00
INTERNAL_SDK_TARGET := $( sdk_dir) /$( sdk_name) .zip
$(INTERNAL_SDK_TARGET) : PRIVATE_NAME := $( sdk_name )
$(INTERNAL_SDK_TARGET) : PRIVATE_DIR := $( sdk_dir ) /$( sdk_name )
$(INTERNAL_SDK_TARGET) : PRIVATE_DEP_FILE := $( sdk_dep_file )
$(INTERNAL_SDK_TARGET) : PRIVATE_INPUT_FILES := $( sdk_atree_files )
# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
#
#SDK_GNU_ERROR := true
2015-11-05 02:06:25 +08:00
$(INTERNAL_SDK_TARGET) : $( deps )
2009-03-04 11:28:42 +08:00
@echo " Package SDK: $@ "
$( hide) rm -rf $( PRIVATE_DIR) $@
$( hide) for f in $( target_gnu_MODULES) ; do \
if [ -f $$ f ] ; then \
echo SDK: $( if $( SDK_GNU_ERROR) ,ERROR:,warning:) \
including GNU target $$ f >& 2; \
FAIL = $( SDK_GNU_ERROR) ; \
fi ; \
done ; \
if [ $$ FAIL ] ; then exit 1; fi
2014-08-13 01:23:58 +08:00
$( hide) echo $( notdir $( SDK_FONT_DEPS) ) | tr " " "\n" > $( SDK_FONT_TEMP) /fontsInSdk.txt
2009-03-04 11:28:42 +08:00
$( hide) ( \
2012-06-07 10:33:31 +08:00
ATREE_STRIP = "strip -x" \
2009-03-04 11:28:42 +08:00
$( HOST_OUT_EXECUTABLES) /atree \
$( addprefix -f ,$( PRIVATE_INPUT_FILES) ) \
-m $( PRIVATE_DEP_FILE) \
-I . \
-I $( PRODUCT_OUT) \
-I $( HOST_OUT) \
-I $( TARGET_COMMON_OUT_ROOT) \
-v " PLATFORM_NAME=android- $( PLATFORM_VERSION) " \
2011-01-06 06:58:17 +08:00
-v " OUT_DIR= $( OUT_DIR) " \
2011-11-16 08:29:16 +08:00
-v " HOST_OUT= $( HOST_OUT) " \
2011-02-19 07:06:20 +08:00
-v " TARGET_ARCH= $( TARGET_ARCH) " \
-v " TARGET_CPU_ABI= $( TARGET_CPU_ABI) " \
2011-08-25 20:28:03 +08:00
-v " DLL_EXTENSION= $( HOST_SHLIB_SUFFIX) " \
2014-08-12 06:20:02 +08:00
-v " FONT_OUT= $( SDK_FONT_TEMP) " \
2016-03-17 19:02:27 +08:00
-v " JACK_SDKTOOL_VERSION= $( JACK_SDKTOOL_VERSION) " \
2009-03-04 11:28:42 +08:00
-o $( PRIVATE_DIR) && \
cp -f $( target_notice_file_txt) \
2011-09-22 01:22:19 +08:00
$( PRIVATE_DIR) /system-images/android-$( PLATFORM_VERSION) /$( TARGET_CPU_ABI) /NOTICE.txt && \
2011-03-16 04:28:40 +08:00
cp -f $( tools_notice_file_txt) $( PRIVATE_DIR) /platform-tools/NOTICE.txt && \
2009-03-04 11:28:42 +08:00
HOST_OUT_EXECUTABLES = $( HOST_OUT_EXECUTABLES) HOST_OS = $( HOST_OS) \
2011-02-02 05:30:00 +08:00
development/build/tools/sdk_clean.sh $( PRIVATE_DIR) && \
2009-03-04 11:28:42 +08:00
chmod -R ug+rwX $( PRIVATE_DIR) && \
2015-10-30 07:33:05 +08:00
cd $( dir $@ ) && zip -rqX $( notdir $@ ) $( PRIVATE_NAME) \
2009-03-04 11:28:42 +08:00
) || ( rm -rf $( PRIVATE_DIR) $@ && exit 44 )
2010-04-17 08:50:09 +08:00
# Is a Windows SDK requested? If so, we need some definitions from here
# in order to find the Linux SDK used to create the Windows one.
2011-02-16 08:09:36 +08:00
MAIN_SDK_NAME := $( sdk_name)
MAIN_SDK_DIR := $( sdk_dir)
MAIN_SDK_ZIP := $( INTERNAL_SDK_TARGET)
2015-01-28 04:47:10 +08:00
i f n e q ( $( filter win_sdk winsdk -tools ,$ ( MAKECMDGOALS ) ) , )
2010-04-17 08:50:09 +08:00
i n c l u d e $( TOPDIR ) d e v e l o p m e n t / b u i l d / t o o l s / w i n d o w s _ s d k . m k
e n d i f
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# Findbugs
INTERNAL_FINDBUGS_XML_TARGET := $( PRODUCT_OUT) /findbugs.xml
INTERNAL_FINDBUGS_HTML_TARGET := $( PRODUCT_OUT) /findbugs.html
$(INTERNAL_FINDBUGS_XML_TARGET) : $( ALL_FINDBUGS_FILES )
@echo UnionBugs: $@
2014-05-20 16:04:16 +08:00
$( hide) $( FINDBUGS_DIR) /unionBugs $( ALL_FINDBUGS_FILES) \
2009-03-04 11:28:42 +08:00
> $@
$(INTERNAL_FINDBUGS_HTML_TARGET) : $( INTERNAL_FINDBUGS_XML_TARGET )
@echo ConvertXmlToText: $@
2014-05-20 16:04:16 +08:00
$( hide) $( FINDBUGS_DIR) /convertXmlToText -html:fancy.xsl \
2013-08-09 07:34:29 +08:00
$( INTERNAL_FINDBUGS_XML_TARGET) > $@
2009-03-04 11:28:42 +08:00
# -----------------------------------------------------------------
# Findbugs
# -----------------------------------------------------------------
# These are some additional build tasks that need to be run.
2013-08-09 07:34:29 +08:00
i f n e q ( $( dont_bother ) , t r u e )
2009-03-04 11:28:42 +08:00
i n c l u d e $( sort $ ( wildcard $ ( BUILD_SYSTEM ) /tasks /*.mk ) )
2010-11-12 22:46:00 +08:00
- i n c l u d e $( sort $ ( wildcard vendor /*/build /tasks /*.mk ) )
2012-04-17 01:03:16 +08:00
- i n c l u d e $( sort $ ( wildcard device /*/build /tasks /*.mk ) )
2015-08-21 06:39:56 +08:00
- i n c l u d e $( sort $ ( wildcard product /*/build /tasks /*.mk ) )
2014-09-06 08:47:34 +08:00
# Also the project-specific tasks
- i n c l u d e $( sort $ ( wildcard vendor /*/*/build /tasks /*.mk ) )
- i n c l u d e $( sort $ ( wildcard device /*/*/build /tasks /*.mk ) )
2015-08-21 06:39:56 +08:00
- i n c l u d e $( sort $ ( wildcard product /*/*/build /tasks /*.mk ) )
2013-08-09 07:34:29 +08:00
e n d i f
2011-02-16 08:09:36 +08:00
2015-10-29 07:42:39 +08:00
i n c l u d e $( BUILD_SYSTEM ) / p r o d u c t - g r a p h . m k
2011-02-16 08:09:36 +08:00
# -----------------------------------------------------------------
# Create SDK repository packages. Must be done after tasks/* since
# we need the addon rules defined.
i f n e q ( $( sdk_repo_goal ) , )
i n c l u d e $( TOPDIR ) d e v e l o p m e n t / b u i l d / t o o l s / s d k _ r e p o . m k
e n d i f