Merge "Fix generate-userimage-prop-dictionary getting called unnecessarily."
diff --git a/core/Makefile b/core/Makefile
index 26f1698..f2d7585 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -487,6 +487,12 @@
endif
endif
+ifneq ($(BOARD_DO_NOT_STRIP_RECOVERY_MODULES),true)
+ RECOVERY_STRIPPED_MODULE_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_recovery_stripped)
+else
+ RECOVERY_STRIPPED_MODULE_STAGING_DIR :=
+endif
+
ifneq ($(BOARD_DO_NOT_STRIP_VENDOR_MODULES),true)
VENDOR_STRIPPED_MODULE_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_vendor_stripped)
else
@@ -501,7 +507,7 @@
BOARD_KERNEL_MODULE_DIRS += top
$(foreach kmd,$(BOARD_KERNEL_MODULE_DIRS), \
- $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,RECOVERY,$(TARGET_RECOVERY_ROOT_OUT),,modules.load.recovery,,$(kmd))) \
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,RECOVERY,$(TARGET_RECOVERY_ROOT_OUT),,modules.load.recovery,$(RECOVERY_STRIPPED_MODULE_STAGING_DIR),$(kmd))) \
$(eval vendor_ramdisk_fragment := $(KERNEL_MODULE_DIR_VENDOR_RAMDISK_FRAGMENT_$(kmd))) \
$(if $(vendor_ramdisk_fragment), \
$(eval output_dir := $(VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).STAGING_DIR)) \
diff --git a/core/config.mk b/core/config.mk
index acdf15e..0b317fb 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -259,7 +259,7 @@
define add_soong_config_namespace
$(eval SOONG_CONFIG_NAMESPACES += $1) \
-$(eval SOONG_CONFIG_$1 :=)
+$(eval SOONG_CONFIG_$(strip $1) :=)
endef
# The add_soong_config_var function adds a a list of soong config variables to
@@ -268,8 +268,8 @@
# $1 is the namespace. $2 is the list of variables.
# Ex: $(call add_soong_config_var,acme,COOL_FEATURE_A COOL_FEATURE_B)
define add_soong_config_var
-$(eval SOONG_CONFIG_$1 += $2) \
-$(foreach v,$2,$(eval SOONG_CONFIG_$1_$v := $($v)))
+$(eval SOONG_CONFIG_$(strip $1) += $2) \
+$(foreach v,$(strip $2),$(eval SOONG_CONFIG_$(strip $1)_$v := $($v)))
endef
# The add_soong_config_var_value function defines a make variable and also adds
@@ -1004,6 +1004,14 @@
BOARD_PREBUILT_HIDDENAPI_DIR ?=
.KATI_READONLY := BOARD_PREBUILT_HIDDENAPI_DIR
+ifdef USE_HOST_MUSL
+ ifneq (,$(or $(BUILD_BROKEN_USES_BUILD_HOST_EXECUTABLE),\
+ $(BUILD_BROKEN_USES_BUILD_HOST_SHARED_LIBRARY),\
+ $(BUILD_BROKEN_USES_BUILD_HOST_STATIC_LIBRARY)))
+ $(error USE_HOST_MUSL can't be set when native host builds are enabled in Make with BUILD_BROKEN_USES_BUILD_HOST_*)
+ endif
+endif
+
# ###############################################################
# Set up final options.
# ###############################################################
diff --git a/core/main.mk b/core/main.mk
index 7b41ba2..e1cfead 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1886,6 +1886,8 @@
ifdef CLANG_COVERAGE
$(foreach f,$(SOONG_NDK_API_XML), \
$(call dist-for-goals,droidcore,$(f):ndk_apis/$(notdir $(f))))
+ $(foreach f,$(SOONG_CC_API_XML), \
+ $(call dist-for-goals,droidcore,$(f):cc_apis/$(notdir $(f))))
endif
# For full system build (whether unbundled or not), we configure
diff --git a/core/product_config.mk b/core/product_config.mk
index 7bed376..54fbb7d 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -87,6 +87,19 @@
$(foreach f,$(1),$(f):$(2)/$(notdir $(f)))
endef
+#
+# Convert the list of file names to the list of PRODUCT_COPY_FILES items
+# $(1): from pattern
+# $(2): to pattern
+# $(3): file names
+# E.g., calling product-copy-files-by-pattern with
+# (from/%, to/%, a b)
+# returns
+# from/a:to/a from/b:to/b
+define product-copy-files-by-pattern
+$(join $(patsubst %,$(1),$(3)),$(patsubst %,:$(2),$(3)))
+endef
+
# ---------------------------------------------------------------
# Check for obsolete PRODUCT- and APP- goals
ifeq ($(CALLED_FROM_SETUP),true)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index d3f983c..6ed2f20 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -73,6 +73,7 @@
$(call add_json_str, HostArch, $(HOST_ARCH))
$(call add_json_str, HostSecondaryArch, $(HOST_2ND_ARCH))
$(call add_json_bool, HostStaticBinaries, $(BUILD_HOST_static))
+$(call add_json_bool, HostMusl, $(USE_HOST_MUSL))
$(call add_json_str, CrossHost, $(HOST_CROSS_OS))
$(call add_json_str, CrossHostArch, $(HOST_CROSS_ARCH))
diff --git a/core/tasks/tools/build_custom_image.mk b/core/tasks/tools/build_custom_image.mk
index 8b766ae..f9ae2c1 100644
--- a/core/tasks/tools/build_custom_image.mk
+++ b/core/tasks/tools/build_custom_image.mk
@@ -57,13 +57,15 @@
my_kernel_module_copy_files :=
my_custom_image_modules_var := BOARD_$(strip $(call to-upper,$(my_custom_image_name)))_KERNEL_MODULES
ifdef $(my_custom_image_modules_var)
- my_kernel_module_copy_files += $(call build-image-kernel-modules,$($(my_custom_image_modules_var)),$(my_staging_dir),$(CUSTOM_IMAGE_MOUNT_POINT),$(call intermediates-dir-for,PACKAGING,depmod_$(my_custom_image_name)),$($(my_custom_image_modules_var)),modules.load,,$(call intermediates-dir-for,PACKAGING,depmod_$(my_custom_image_name)_stripped))
- my_copy_pairs += $(my_kernel_module_copy_files)
+$(foreach kmod,\
+ $(call build-image-kernel-modules,$($(my_custom_image_modules_var)),$(my_staging_dir),$(CUSTOM_IMAGE_MOUNT_POINT),$(call intermediates-dir-for,PACKAGING,depmod_$(my_custom_image_name)),$($(my_custom_image_modules_var)),modules.load,,$(call intermediates-dir-for,PACKAGING,depmod_$(my_custom_image_name)_stripped)),\
+ $(eval pair := $(subst :,$(space),$(kmod)))\
+ $(eval my_kernel_module_copy_files += $(word 1,$(pair)):$(subst $(my_staging_dir)/,,$(word 2,$(pair)))))
endif
# Collect CUSTOM_IMAGE_COPY_FILES.
my_image_copy_files :=
-$(foreach f,$(CUSTOM_IMAGE_COPY_FILES),\
+$(foreach f,$(CUSTOM_IMAGE_COPY_FILES) $(my_kernel_module_copy_files),\
$(eval pair := $(subst :,$(space),$(f)))\
$(eval src := $(word 1,$(pair)))\
$(eval my_image_copy_files += $(src))\