generalize the definition of a "radio image"
Non-HTC devices may have multiple files constituting their "radio
image". Generalize the INSTALLED_RADIOIMAGE_TARGET variable a bit:
initially define it as empty, then let AndroidBoard.mk files add to
it. Provide a convenience function add-radio-image for them to call
to add files. Put all those files into the target_files zip for use
in OTA and fastboot package construction.
Note that for HTC devices, this changes the name of the radio image in
the target_files zip: instead of "RADIO/image" it will be
"RADIO/radio.img". Tools that use the target_files zip will need to
be changed.
diff --git a/core/Makefile b/core/Makefile
index 84a511a..7745f24 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -843,11 +843,9 @@
ifdef BOARD_KERNEL_BASE
$(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
endif
-ifdef INSTALLED_RADIOIMAGE_TARGET
- @# The radio image
- $(hide) mkdir -p $(zip_root)/RADIO
- $(hide) $(ACP) $(INSTALLED_RADIOIMAGE_TARGET) $(zip_root)/RADIO/image
-endif
+ $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
+ mkdir -p $(zip_root)/RADIO; \
+ $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
@# Contents of the system image
$(hide) $(call package_files-copy-root, \
$(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
diff --git a/core/definitions.mk b/core/definitions.mk
index 1d9dd74..69c7aae 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1569,6 +1569,25 @@
)
endef
+
+###########################################################
+## Define device-specific radio files
+###########################################################
+
+# Copy a radio image file to the output location, and add it to
+# INSTALLED_RADIOIMAGE_TARGET.
+# $(1): filename
+define add-radio-file
+ $(eval $(call add-radio-file-internal,$(1)))
+endef
+define add-radio-file-internal
+INSTALLED_RADIOIMAGE_TARGET += $$(PRODUCT_OUT)/$(1)
+ALL_PREBUILT += $$(PRODUCT_OUT)/$(1)
+$$(PRODUCT_OUT)/$(1) : $$(LOCAL_PATH)/$(1) | $$(ACP)
+ $$(transform-prebuilt-to-target)
+endef
+
+
###########################################################
## Other includes
###########################################################