Create ODM partition NOTICE file
Logic to create a seperate ODM NOTICE file for modules located at
TARGET_OUT_ODM.
Bug: 137542307
Test: Built an image with both a seperate ODM image and one where it is
built into vendor.img and ensured that a NOTICE.xml.gz was located at
/odm/etc and contained any license generated by ODM modules.
Change-Id: I9e6f46b1b94c5b6584c2a5810713fcf49f637d02
diff --git a/core/Makefile b/core/Makefile
index 575ab36..3ca5929 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1172,7 +1172,7 @@
.PHONY: notice_files
# Create the rule to combine the files into text and html/xml forms
-# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|html
+# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|xml_odm|html
# $(2) - Plain text output file
# $(3) - HTML/XML output file
# $(4) - File title
@@ -1197,11 +1197,12 @@
$(2) : $(3)
$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
build/make/tools/generate-notice-files.py --text-output $(2) \
- $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor -e product -e system_ext --xml-output, \
+ $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor -e product -e system_ext -e odm --xml-output, \
$(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
$(if $(filter $(1),xml_product),-i product --xml-output, \
$(if $(filter $(1),xml_system_ext),-i system_ext --xml-output, \
- --html-output)))) $(3) \
+ $(if $(filter $(1),xml_odm),-i odm --xml-output, \
+ --html-output))))) $(3) \
-t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
notice_files: $(2) $(3)
endef
@@ -1254,6 +1255,11 @@
target_system_ext_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.xml.gz
installed_system_ext_notice_xml_gz := $(TARGET_OUT_SYSTEM_EXT)/etc/NOTICE.xml.gz
+target_odm_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.txt
+target_odm_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.xml
+target_odm_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.xml.gz
+installed_odm_notice_xml_gz := $(TARGET_OUT_ODM)/etc/NOTICE.xml.gz
+
# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
# being built. A notice xml file must depend on all modules that could potentially
# install a license file relevant to it.
@@ -1265,7 +1271,11 @@
license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
license_modules_system_ext := $(filter $(TARGET_OUT_SYSTEM_EXT)/%,$(license_modules))
-license_modules_agg := $(license_modules_vendor) $(license_modules_product) $(license_modules_system_ext)
+license_modules_odm := $(filter $(TARGET_OUT_ODM)/%,$(license_modules))
+license_modules_agg := $(license_modules_vendor) \
+ $(license_modules_product) \
+ $(license_modules_system_ext) \
+ $(license_modules_odm)
license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
$(eval $(call combine-notice-files, xml_excluded_extra_partitions, \
@@ -1292,6 +1302,12 @@
"Notices for files contained in the system_ext filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
$(license_modules_system_ext)))
+$(eval $(call combine-notice-files, xml_odm, \
+ $(target_odm_notice_file_txt), \
+ $(target_odm_notice_file_xml), \
+ "Notices for files contained in the odm filesystem image in this directory:", \
+ $(TARGET_OUT_NOTICE_FILES), \
+ $(license_modules_odm)))
$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
$(hide) $(MINIGZIP) -9 < $< > $@
@@ -1301,6 +1317,8 @@
$(hide) $(MINIGZIP) -9 < $< > $@
$(target_system_ext_notice_file_xml_gz): $(target_system_ext_notice_file_xml) | $(MINIGZIP)
$(hide) $(MINIGZIP) -9 < $< > $@
+$(target_odm_notice_file_xml_gz): $(target_odm_notice_file_xml) | $(MINIGZIP)
+ $(hide) $(MINIGZIP) -9 < $< > $@
$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
$(copy-file-to-target)
$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
@@ -1309,6 +1327,8 @@
$(copy-file-to-target)
$(installed_system_ext_notice_xml_gz): $(target_system_ext_notice_file_xml_gz)
$(copy-file-to-target)
+$(installed_odm_notice_xml_gz): $(target_odm_notice_file_xml_gz)
+ $(copy-file-to-target)
# if we've been run my mm, mmm, etc, don't reinstall this every time
ifeq ($(ONE_SHOT_MAKEFILE),)
@@ -1316,6 +1336,7 @@
ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
ALL_DEFAULT_INSTALLED_MODULES += $(installed_system_ext_notice_xml_gz)
+ ALL_DEFAULT_INSTALLED_MODULES += $(installed_odm_notice_xml_gz)
endif
endif # PRODUCT_NOTICE_SPLIT