core/Makefile: system_dlkm: Copy image for dist
Add support to copy built system_dlkm to IMAGES;
or prebuilt image to PREBUILD_IMAGES for release
tools to pick up for the dist zip.
Bug: 200082547
Test: Manual builds:
1. Set BOARD_USES_SYSTEM_DLKM_PARTITION
2. Set BOARD_PREBUILT_SYSTEM_DLKM_IMAGE to external image
- Check "m" builds the system_dlkm.img in both cases;
and drops image at out/target/product/vsoc_x86_64/
- Check that "m dist" can find the image in
$(zip_root)/IMAGES and $(zip_root)/PREBUILT_IMAGES
Test: launch_cvd && atest vts_system_dlkm_partition_test
Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
Change-Id: I77dfcc51746fd97cb205aa9c139a08f5cdf3d9ea
diff --git a/core/Makefile b/core/Makefile
index e65e949..89b9f49 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1211,7 +1211,7 @@
INTERNAL_PREBUILT_SYSTEM_DLKM_IMAGE := $(BOARD_PREBUILT_SYSTEM_DLKM_IMAGE)
INSTALLED_SYSTEM_DLKM_IMAGE_TARGET := $(PRODUCT_OUT)/system_dlkm.img
$(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET): $(INTERNAL_PREBUILT_SYSTEM_DLKM_IMAGE)
- $(call pretty,"Using prebuilt system_dlkm image: $@")
+ $(call pretty,"Using prebuilt from: $(INTERNAL_PREBUILT_SYSTEM_DLKM_IMAGE)")
cp $(INTERNAL_PREBUILT_SYSTEM_DLKM_IMAGE) $@
else # BOARD_PREBUILT_SYSTEM_DLKM_IMAGE not defined
@@ -3669,7 +3669,8 @@
$(strip $(foreach item,$(1),\
$(if $(filter $(item),system_other),$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
$(if $(filter $(item),init_boot),$(INSTALLED_INIT_BOOT_IMAGE_TARGET),\
- $(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET)))))
+ $(if $(filter $(item),system_dlkm),$(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET),\
+ $(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET))))))
endef
# -----------------------------------------------------------------
@@ -4736,6 +4737,10 @@
$(hide) echo "init_boot=true" >> $@
$(hide) echo "init_boot_size=$(BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE)" >> $@
endif
+ifneq ($(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET),)
+ $(hide) echo "system_dlkm=true" >> $@
+ $(hide) echo "system_dlkm_size=$(BOARD_SYSTEM_DLKM_PARTITION_SIZE)" >> $@
+endif
ifeq ($(BOARD_RAMDISK_USE_LZ4),true)
echo "lz4_ramdisks=true" >> $@
endif
@@ -5496,6 +5501,16 @@
$(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
$(hide) cp $(INSTALLED_INIT_BOOT_IMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
endif
+ifdef BOARD_PREBUILT_SYSTEM_DLKM_IMAGE
+ $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
+ $(hide) cp $(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES
+else # BOARD_PREBUILT_SYSTEM_DLKM_IMAGE is not define
+ifdef INSTALLED_SYSTEM_DLKM_IMAGE_TARGET
+ $(hide) mkdir -p $(zip_root)/IMAGES
+ $(hide) cp $(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET) $(zip_root)/IMAGES/
+endif # INSTALLED_SYSTEM_DLKM_IMAGE_TARGET
+endif # BOARD_PREBUILT_SYSTEM_DLKM_IMAGE
+
ifndef BOARD_PREBUILT_BOOTIMAGE
ifneq (,$(strip $(INTERNAL_PREBUILT_BOOTIMAGE) $(filter true,$(BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES))))
ifdef INSTALLED_BOOTIMAGE_TARGET
@@ -5580,6 +5595,9 @@
$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/INIT_BOOT/pagesize
endif # BOARD_KERNEL_PAGESIZE
endif # BUILDING_INIT_BOOT_IMAGE
+ifdef BUILDING_SYSTEM_DLKM_IMAGE
+ $(hide) $(call package_files-copy-root, $(TARGET_SYSTEM_DLKM_OUT),$(zip_root)/SYSTEM_DLKM)
+endif
ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),)
$(call fs_config,$(zip_root)/VENDOR_BOOT/RAMDISK,) > $(zip_root)/META/vendor_boot_filesystem_config.txt
endif
@@ -5894,6 +5912,7 @@
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INSTALLED_INIT_BOOT_IMAGE_TARGET) \
+ $(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \