From da2d4a29bf21e0375b40d2654619e529978cf97f Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Mon, 9 Jan 2023 16:26:23 +0900 Subject: [PATCH] vendor/etc/linker.config.pb from multiple input files When we have dedicated .mk files for each modules (e.g. usb, drm, etc) and those modules have their own linker configuration requirements, it would make more sense to have "fragments" for linker configuration. This change introduces a new list variable to store the list of linker configuration fragments. When it's set, vendor/etc/linker.config.pb is generated from the list of input fragments. Bug: 264330513 Test: set PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS Test: m vendorimage (generates vendor/etc/linker.config.pb) Change-Id: I9eed0f90add0191885b7195efdab94b5b1a4a62d --- core/Makefile | 12 ++++++++++++ core/product.mk | 3 +++ 2 files changed, 15 insertions(+) diff --git a/core/Makefile b/core/Makefile index 7a9dfe8fbd..b5f5b35ce2 100644 --- a/core/Makefile +++ b/core/Makefile @@ -3492,6 +3492,18 @@ ifdef BOARD_USES_VENDOR_DLKMIMAGE INTERNAL_VENDORIMAGE_FILES += $(call create-partition-compat-symlink,$(TARGET_OUT_VENDOR)/lib/modules,/vendor_dlkm/lib/modules,vendor_dlkm.img) endif +# Install vendor/etc/linker.config.pb when PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS is set +ifneq ($(strip $(PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS)),) +vendor_linker_config_file := $(TARGET_OUT_VENDOR)/etc/linker.config.pb +$(vendor_linker_config_file): private_linker_config_fragments := $(PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS) +$(vendor_linker_config_file): $(PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS) | $(HOST_OUT_EXECUTABLES)/conv_linker_config + $(HOST_OUT_EXECUTABLES)/conv_linker_config proto \ + --source $(call normalize-path-list,$(private_linker_config_fragments)) \ + --output $@ +$(call define declare-0p-target,$(vendor_linker_config_file),) +INTERNAL_VENDORIMAGE_FILES += $(vendor_linker_config_file) +endif + INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json) $(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR) diff --git a/core/product.mk b/core/product.mk index 7621c71314..3b22314e51 100644 --- a/core/product.mk +++ b/core/product.mk @@ -373,6 +373,9 @@ _product_single_value_vars += PRODUCT_MODULE_BUILD_FROM_SOURCE # If true, installs a full version of com.android.virt APEX. _product_single_value_vars += PRODUCT_AVF_ENABLED +# List of .json files to be merged/compiled into vendor/etc/linker.config.pb +_product_list_vars += PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS + # Whether to use userfaultfd GC. # Possible values are: # - "default" or empty: both the build system and the runtime determine whether to use userfaultfd