Make kernel modules into normal installed files

We sometimes see build failures when building platform.zip happens
at the same time as building vendor.img if the vendor.img rule
runs rm -rf $OUT/vendor/lib/modules at the same time that platform.zip
is zipping $OUT/vendor/.  Move the kernel modules into normal
installation rules so that they are in place by the time either
the vendor.img or platform.zip rules run.

This will also cause the kernel modules to show up in
installed-files*.txt.

Test: m vendorimage && ls $OUT/vendor/lib/modules
Change-Id: I178b1d54bfcdb5cf5c29885ace9183ac28fc8826
This commit is contained in:
Colin Cross
2019-06-05 11:53:43 -07:00
parent 9c560f17a8
commit 4f60e366db
2 changed files with 64 additions and 41 deletions

View File

@@ -54,9 +54,15 @@ $(foreach m,$(CUSTOM_IMAGE_MODULES),\
$(eval my_copy_pairs += $(bui):$(my_staging_dir)/$(my_copy_dest)))\
))
my_kernel_module_copy_files :=
my_custom_image_modules_var := BOARD_$(strip $(call to-upper,$(my_custom_image_name)))_KERNEL_MODULES
ifdef $(my_custom_image_modules_var)
my_kernel_module_copy_files += $(call build-image-kernel-modules,$(my_custom_image_modules_var),$(my_staging_dir),$(my_custom_image_name)/,$(call intermediates-dir-for,PACKAGING,depmod_$(my_custom_image_name)))
endif
# Collect CUSTOM_IMAGE_COPY_FILES.
my_image_copy_files :=
$(foreach f,$(CUSTOM_IMAGE_COPY_FILES),\
$(foreach f,$(CUSTOM_IMAGE_COPY_FILES) $(my_kernel_module_copy_files),\
$(eval pair := $(subst :,$(space),$(f)))\
$(eval src := $(word 1,$(pair)))\
$(eval my_image_copy_files += $(src))\
@@ -102,11 +108,6 @@ endif
ifeq (true,$(CUSTOM_IMAGE_SUPPORT_VERITY_FEC))
$(my_built_custom_image): $(FEC)
endif
my_custom_image_modules_var:=BOARD_$(strip $(call to-upper,$(my_custom_image_name)))_KERNEL_MODULES
my_custom_image_modules:=$($(my_custom_image_modules_var))
my_custom_image_modules_dep:=$(if $(my_custom_image_modules),$(my_custom_image_modules) $(DEPMOD),)
$(my_built_custom_image): PRIVATE_KERNEL_MODULES := $(my_custom_image_modules)
$(my_built_custom_image): PRIVATE_IMAGE_NAME := $(my_custom_image_name)
$(my_built_custom_image): $(INTERNAL_USERIMAGES_DEPS) $(my_built_modules) $(my_image_copy_files) $(my_custom_image_modules_dep) \
$(CUSTOM_IMAGE_DICT_FILE)
@echo "Build image $@"
@@ -117,8 +118,6 @@ $(my_built_custom_image): $(INTERNAL_USERIMAGES_DEPS) $(my_built_modules) $(my_i
$(eval pair := $(subst :,$(space),$(p)))\
mkdir -p $(dir $(word 2,$(pair)));\
cp -Rf $(word 1,$(pair)) $(word 2,$(pair));)
$(if $(PRIVATE_KERNEL_MODULES), \
$(call build-image-kernel-modules,$(PRIVATE_KERNEL_MODULES),$(PRIVATE_STAGING_DIR),$(PRIVATE_IMAGE_NAME)/,$(call intermediates-dir-for,PACKAGING,depmod_$(PRIVATE_IMAGE_NAME))))
$(if $($(PRIVATE_PICKUP_FILES)),$(hide) cp -Rf $(PRIVATE_PICKUP_FILES) $(PRIVATE_STAGING_DIR))
# Generate the dict.
$(hide) echo "# For all accepted properties, see BuildImage() in tools/releasetools/build_image.py" > $(PRIVATE_INTERMEDIATES)/image_info.txt