add PDK_PLATFORM_ZIP_PRODUCT_BINARIES to allow adding product specific binaries to platform.zip

- This can be used to deliver stuffs like kernel symbol file.
- Files are added in relative path from the top of android source tree.
- PDK_PLATFORM_ZIP_PRODUCT_BINARIES will be defined in BoardConfig.mk.
- files under out dir will be rejected to prevent possible conflicts.

bug: 9963432
Change-Id: Id1da643534cd86939df4941f39e4414d343bba99
diff --git a/core/Makefile b/core/Makefile
index 171936f..d6f4cfd 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -875,6 +875,11 @@
 #######
 ## platform.zip: system, plus other files to be used in PDK fusion build,
 ## in a zip file
+##
+## 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.
+PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
 INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
 $(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES)
 	$(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
@@ -886,7 +891,9 @@
 ifeq (true,$(PLATFORM_ZIP_ADD_JAVA))
 	$(hide) cd $(OUT_DIR) && zip -qry $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
 endif
-
+ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
+	$(hide) zip -qry $@ $(PDK_PLATFORM_ZIP_PRODUCT_BINARIES)
+endif
 
 .PHONY: platform
 platform: $(INSTALLED_PLATFORM_ZIP)