Merge "SDK Addon multi-sys-img support, part 2." into lmp-dev
diff --git a/build/tools/mk_sdk_repo_xml.sh b/build/tools/mk_sdk_repo_xml.sh
index 3fad505..6793a11 100755
--- a/build/tools/mk_sdk_repo_xml.sh
+++ b/build/tools/mk_sdk_repo_xml.sh
@@ -122,6 +122,8 @@
   SystemImage.Abi               abi                      r:3,s:1
   SystemImage.TagId             tag-id                   r:9,s:2
   SystemImage.TagDisplay        tag-display              r:9,s:2
+  Addon.VendorId                add-on/vendor-id         s:3
+  Addon.VendorDisplay           add-on/vendor-display    s:3
   # from addon manifest.ini for addon.xml packages
   # (note that vendor/name are mapped to different XML elements based on the XSD version)
   vendor-id                     vendor-id                4
diff --git a/build/tools/sdk_repo.mk b/build/tools/sdk_repo.mk
index 8d13d70..db8808a 100644
--- a/build/tools/sdk_repo.mk
+++ b/build/tools/sdk_repo.mk
@@ -205,6 +205,26 @@
 
 endif
 
+ifneq ($(ADDON_SDK_IMG_ZIP),)
+
+# Copy/rename the ADDON_SDK_IMG_ZIP file as an sdk-repo zip in the dist dir
+
+RENAMED_ADDON_IMG_ZIP := $(ADDON_SDK_IMG_ZIP):$(notdir $(call sdk-repo-pkg-zip,$(HOST_OS),$(ADDON_SDK_IMG_ZIP),system-images))
+
+$(call dist-for-goals, sdk_repo, $(RENAMED_ADDON_IMG_ZIP))
+
+# Generate the system-image XML for the addon sys-img
+
+SDK_ADDON_IMG_XML := $(dir $(ADDON_SDK_ZIP))/addon-sys-img.xml
+
+$(SDK_ADDON_IMG_XML): $(ADDON_SDK_IMG_ZIP)
+	$(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \
+	            $(SDK_ADDON_IMG_XML) $(SDK_SYSIMG_XSD) system-image $(HOST_OS) $(RENAMED_ADDON_IMG_ZIP)
+
+$(call dist-for-goals, sdk_repo, $(SDK_ADDON_IMG_XML))
+
+endif
+
 # -----------------------------------------------------------------
 # Rules for the SDK Repository XML