diff options
-rw-r--r-- | core/base_rules.mk | 14 | ||||
-rw-r--r-- | core/binary.mk | 164 | ||||
-rw-r--r-- | core/board_config.mk | 5 | ||||
-rw-r--r-- | core/main.mk | 3 | ||||
-rw-r--r-- | core/soong_config.mk | 1 | ||||
-rw-r--r-- | target/board/BoardConfigGsiCommon.mk | 10 | ||||
-rw-r--r-- | target/product/gsi/Android.mk | 10 | ||||
-rw-r--r-- | target/product/gsi/init.gsi.rc | 2 | ||||
-rw-r--r-- | target/product/gsi/init.legacy-gsi.rc | 3 | ||||
-rw-r--r-- | target/product/gsi/init.vndk-27.rc | 3 | ||||
-rw-r--r-- | target/product/gsi/init.vndk-nodef.rc | 3 | ||||
-rw-r--r-- | target/product/gsi_release.mk | 3 | ||||
-rw-r--r-- | target/product/legacy_gsi_release.mk | 14 | ||||
-rwxr-xr-x | tools/check_identical_lib.sh | 16 |
14 files changed, 141 insertions, 110 deletions
diff --git a/core/base_rules.mk b/core/base_rules.mk index 3f93c2ca88..abe059b256 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -77,6 +77,20 @@ LOCAL_SYSTEM_EXT_MODULE := true endif _path := +ifeq ($(LOCAL_HOST_MODULE),true) +my_image_variant := host +else ifeq ($(LOCAL_VENDOR_MODULE),true) +my_image_variant := vendor +else ifeq ($(LOCAL_OEM_MODULE),true) +my_image_variant := vendor +else ifeq ($(LOCAL_ODM_MODULE),true) +my_image_variant := vendor +else ifeq ($(LOCAL_PRODUCT_MODULE),true) +my_image_variant := product +else +my_image_variant := core +endif + # TODO(b/135957588) Remove following workaround # LOCAL_PRODUCT_SERVICES_MODULE to LOCAL_PRODUCT_MODULE for all Android.mk ifndef LOCAL_PRODUCT_MODULE diff --git a/core/binary.mk b/core/binary.mk index be7dc2737a..0b03f6a879 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -64,10 +64,64 @@ my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS) my_export_c_include_deps := $(LOCAL_EXPORT_C_INCLUDE_DEPS) my_arflags := +# Disable clang-tidy if it is not found. +ifeq ($(PATH_TO_CLANG_TIDY),) + my_tidy_enabled := false +else + # If LOCAL_TIDY is not defined, use global WITH_TIDY + my_tidy_enabled := $(LOCAL_TIDY) + ifeq ($(my_tidy_enabled),) + my_tidy_enabled := $(WITH_TIDY) + endif +endif + +# my_tidy_checks is empty if clang-tidy is disabled. +my_tidy_checks := +my_tidy_flags := +ifneq (,$(filter 1 true,$(my_tidy_enabled))) + # Set up global default checks + my_tidy_checks := $(WITH_TIDY_CHECKS) + ifeq ($(my_tidy_checks),) + my_tidy_checks := $(call default_global_tidy_checks,$(LOCAL_PATH)) + endif + # Append local clang-tidy checks. + ifneq ($(LOCAL_TIDY_CHECKS),) + my_tidy_checks := $(my_tidy_checks),$(LOCAL_TIDY_CHECKS) + endif + my_tidy_flags := $(strip $(WITH_TIDY_FLAGS) $(LOCAL_TIDY_FLAGS)) + # If tidy flags are not specified, default to check all header files. + ifeq ($(my_tidy_flags),) + my_tidy_flags := $(call default_tidy_header_filter,$(LOCAL_PATH)) + endif + # If clang-tidy is not enabled globally, add the -quiet flag. + ifeq (,$(filter 1 true,$(WITH_TIDY))) + my_tidy_flags += -quiet -extra-arg-before=-fno-caret-diagnostics + endif + + ifneq ($(my_tidy_checks),) + # We might be using the static analyzer through clang-tidy. + # https://bugs.llvm.org/show_bug.cgi?id=32914 + my_tidy_flags += -extra-arg-before=-D__clang_analyzer__ + + # A recent change in clang-tidy (r328258) enabled destructor inlining, + # which appears to cause a number of false positives. Until that's + # resolved, this turns off the effects of r328258. + # https://bugs.llvm.org/show_bug.cgi?id=37459 + my_tidy_flags += -extra-arg-before=-Xclang + my_tidy_flags += -extra-arg-before=-analyzer-config + my_tidy_flags += -extra-arg-before=-Xclang + my_tidy_flags += -extra-arg-before=c++-temp-dtor-inlining=false + endif +endif + +my_tidy_checks := $(subst $(space),,$(my_tidy_checks)) + # Configure the pool to use for clang rules. # If LOCAL_CC or LOCAL_CXX is set don't use goma or RBE. +# If clang-tidy is being used, don't use the RBE pool (as clang-tidy runs in +# the same action, and is not remoted) my_pool := -ifeq (,$(strip $(my_cc))$(strip $(my_cxx))) +ifeq (,$(strip $(my_cc))$(strip $(my_cxx))$(strip $(my_tidy_checks))) my_pool := $(GOMA_OR_RBE_POOL) endif @@ -102,6 +156,8 @@ my_ndk_sysroot_include := my_ndk_sysroot_lib := my_api_level := 10000 +my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) + ifneq ($(LOCAL_SDK_VERSION),) ifdef LOCAL_IS_HOST_MODULE $(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module) @@ -110,7 +166,6 @@ ifneq ($(LOCAL_SDK_VERSION),) # Make sure we've built the NDK. my_additional_dependencies += $(SOONG_OUT_DIR)/ndk_base.timestamp - my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) ifneq (,$(filter arm64 x86_64,$(my_arch))) my_min_sdk_version := 21 else @@ -1060,37 +1115,39 @@ asm_objects += $(asm_objects_asm) endif ################################################################### -## When compiling a CFI enabled target, use the .cfi variant of any -## static dependencies (where they exist). +## Convert to sanitized names where they exist. +## These lists come from sanitizerStaticLibsMap; see +## build/soong/cc/sanitize.go +## +## $(1): list of static dependencies +## $(2): name of sanitizer (e.g. cfi, hwasan) ################################################################## -define use_soong_cfi_static_libraries - $(foreach l,$(1),$(if $(filter $(l),$(SOONG_CFI_STATIC_LIBRARIES)),\ - $(l).cfi,$(l))) +define use_soong_sanitized_static_libraries + $(foreach lib,$(1),$(if $(filter $(lib),\ + $(SOONG_$(2)_$(my_image_variant)_$(my_arch)_STATIC_LIBRARIES)),\ + $(lib).$(2),$(lib))) endef +################################################################### +## When compiling a CFI enabled target, use the .cfi variant of any +## static dependencies (where they exist). +################################################################## ifneq ($(filter cfi,$(my_sanitize)),) - my_whole_static_libraries := $(call use_soong_cfi_static_libraries,\ - $(my_whole_static_libraries)) - my_static_libraries := $(call use_soong_cfi_static_libraries,\ - $(my_static_libraries)) + my_whole_static_libraries := $(call use_soong_sanitized_static_libraries,\ + $(my_whole_static_libraries),cfi) + my_static_libraries := $(call use_soong_sanitized_static_libraries,\ + $(my_static_libraries),cfi) endif -ifneq ($(LOCAL_USE_VNDK),) - my_soong_hwasan_static_libraries := $(SOONG_HWASAN_VENDOR_STATIC_LIBRARIES) -else - my_soong_hwasan_static_libraries = $(SOONG_HWASAN_STATIC_LIBRARIES) -endif - -define use_soong_hwasan_static_libraries - $(foreach l,$(1),$(if $(filter $(l),$(my_soong_hwasan_static_libraries)),\ - $(l).hwasan,$(l))) -endef - +################################################################### +## When compiling a hwasan enabled target, use the .hwasan variant +## of any static dependencies (where they exist). +################################################################## ifneq ($(filter hwaddress,$(my_sanitize)),) - my_whole_static_libraries := $(call use_soong_hwasan_static_libraries,\ - $(my_whole_static_libraries)) - my_static_libraries := $(call use_soong_hwasan_static_libraries,\ - $(my_static_libraries)) + my_whole_static_libraries := $(call use_soong_sanitized_static_libraries,\ + $(my_whole_static_libraries),hwasan) + my_static_libraries := $(call use_soong_sanitized_static_libraries,\ + $(my_static_libraries),hwasan) endif ########################################################### @@ -1480,61 +1537,10 @@ ifneq (,$(filter -Weverything,$(my_all_cflags))) endif endif -# Disable clang-tidy if it is not found. -ifeq ($(PATH_TO_CLANG_TIDY),) - my_tidy_enabled := false -else - # If LOCAL_TIDY is not defined, use global WITH_TIDY - my_tidy_enabled := $(LOCAL_TIDY) - ifeq ($(my_tidy_enabled),) - my_tidy_enabled := $(WITH_TIDY) - endif -endif - -# my_tidy_checks is empty if clang-tidy is disabled. -my_tidy_checks := -my_tidy_flags := -ifneq (,$(filter 1 true,$(my_tidy_enabled))) +ifneq ($(my_tidy_checks),) tidy_only: $(cpp_objects) $(c_objects) $(gen_c_objects) $(gen_cpp_objects) - # Set up global default checks - my_tidy_checks := $(WITH_TIDY_CHECKS) - ifeq ($(my_tidy_checks),) - my_tidy_checks := $(call default_global_tidy_checks,$(LOCAL_PATH)) - endif - # Append local clang-tidy checks. - ifneq ($(LOCAL_TIDY_CHECKS),) - my_tidy_checks := $(my_tidy_checks),$(LOCAL_TIDY_CHECKS) - endif - my_tidy_flags := $(strip $(WITH_TIDY_FLAGS) $(LOCAL_TIDY_FLAGS)) - # If tidy flags are not specified, default to check all header files. - ifeq ($(my_tidy_flags),) - my_tidy_flags := $(call default_tidy_header_filter,$(LOCAL_PATH)) - endif - # If clang-tidy is not enabled globally, add the -quiet flag. - ifeq (,$(filter 1 true,$(WITH_TIDY))) - my_tidy_flags += -quiet -extra-arg-before=-fno-caret-diagnostics - endif - - ifneq ($(my_tidy_checks),) - # We might be using the static analyzer through clang-tidy. - # https://bugs.llvm.org/show_bug.cgi?id=32914 - my_tidy_flags += -extra-arg-before=-D__clang_analyzer__ - # A recent change in clang-tidy (r328258) enabled destructor inlining, - # which appears to cause a number of false positives. Until that's - # resolved, this turns off the effects of r328258. - # https://bugs.llvm.org/show_bug.cgi?id=37459 - my_tidy_flags += -extra-arg-before=-Xclang - my_tidy_flags += -extra-arg-before=-analyzer-config - my_tidy_flags += -extra-arg-before=-Xclang - my_tidy_flags += -extra-arg-before=c++-temp-dtor-inlining=false - endif -endif - -my_tidy_checks := $(subst $(space),,$(my_tidy_checks)) - -# Add dependency of clang-tidy and clang-tidy.sh -ifneq ($(my_tidy_checks),) + # Add dependency of clang-tidy and clang-tidy.sh $(cpp_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY) $(c_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY) $(gen_cpp_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY) diff --git a/core/board_config.mk b/core/board_config.mk index d4fe6182d8..391e280555 100644 --- a/core/board_config.mk +++ b/core/board_config.mk @@ -91,6 +91,11 @@ _dynamic_partitions_var_list += \ _board_strip_readonly_list += $(_dynamic_partitions_var_list) +# Kernel related variables +_board_strip_readonly_list += \ + BOARD_KERNEL_BINARIES \ + BOARD_KERNEL_MODULE_INTERFACE_VERSIONS \ + _build_broken_var_list := \ BUILD_BROKEN_DUP_RULES \ BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \ diff --git a/core/main.mk b/core/main.mk index 4578d90305..ab9962adbb 100644 --- a/core/main.mk +++ b/core/main.mk @@ -213,6 +213,9 @@ ifneq ($(TARGET_BUILD_VARIANT),user) ADDITIONAL_SYSTEM_PROPERTIES += persist.debug.dalvik.vm.core_platform_api_policy=just-warn endif +# Define ro.sanitize.<name> properties for all global sanitizers. +ADDITIONAL_SYSTEM_PROPERTIES += $(foreach s,$(SANITIZE_TARGET),ro.sanitize.$(s)=true) + # Sets the default value of ro.postinstall.fstab.prefix to /system. # Device board config should override the value to /product when needed by: # diff --git a/core/soong_config.mk b/core/soong_config.mk index 98ab07dd9a..01b355e897 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -217,6 +217,7 @@ $(call add_json_bool, InstallExtraFlattenedApexes, $(PRODUCT_INSTALL_EXTRA_FLATT $(call add_json_bool, BoardUsesRecoveryAsBoot, $(BOARD_USES_RECOVERY_AS_BOOT)) $(call add_json_list, BoardKernelBinaries, $(BOARD_KERNEL_BINARIES)) +$(call add_json_list, BoardKernelModuleInterfaceVersions, $(BOARD_KERNEL_MODULE_INTERFACE_VERSIONS)) $(call json_end) diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk index d0aeb1c717..9d55f42af5 100644 --- a/target/board/BoardConfigGsiCommon.mk +++ b/target/board/BoardConfigGsiCommon.mk @@ -33,20 +33,14 @@ BOARD_USES_METADATA_PARTITION := true # updating the last seen rollback index in the tamper-evident storage. BOARD_AVB_ROLLBACK_INDEX := 0 -ifndef BUILDING_GSI # Enable AVB chained partition for system. # https://android.googlesource.com/platform/external/avb/+/master/README.md BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048 BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP) BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1 -else -# Enable vbmeta_system on GSI targets -BOARD_AVB_VBMETA_SYSTEM := system -BOARD_AVB_VBMETA_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem -BOARD_AVB_VBMETA_SYSTEM_ALGORITHM := SHA256_RSA2048 -BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP) -BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION := 1 +ifdef BUILDING_GSI +# super.img spec for GSI targets BOARD_SUPER_PARTITION_SIZE := 3229614080 BOARD_SUPER_PARTITION_GROUPS := gsi_dynamic_partitions BOARD_GSI_DYNAMIC_PARTITIONS_PARTITION_LIST := system diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk index c491d4a593..6775131dbd 100644 --- a/target/product/gsi/Android.mk +++ b/target/product/gsi/Android.mk @@ -211,3 +211,13 @@ LOCAL_SYSTEM_EXT_MODULE := true LOCAL_MODULE_RELATIVE_PATH := init include $(BUILD_PREBUILT) + + +include $(CLEAR_VARS) +LOCAL_MODULE := init.vndk-nodef.rc +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS := ETC +LOCAL_SYSTEM_EXT_MODULE := true +LOCAL_MODULE_RELATIVE_PATH := init + +include $(BUILD_PREBUILT) diff --git a/target/product/gsi/init.gsi.rc b/target/product/gsi/init.gsi.rc index c6faba78d9..f482843220 100644 --- a/target/product/gsi/init.gsi.rc +++ b/target/product/gsi/init.gsi.rc @@ -1,3 +1,5 @@ # # Android init script for GSI required initialization # + +import /system/system_ext/etc/init/init.vndk-${ro.vndk.version:-nodef}.rc diff --git a/target/product/gsi/init.legacy-gsi.rc b/target/product/gsi/init.legacy-gsi.rc deleted file mode 100644 index 00dd576fc1..0000000000 --- a/target/product/gsi/init.legacy-gsi.rc +++ /dev/null @@ -1,3 +0,0 @@ -# If ro.vndk.version is not defined, import init.vndk-27.rc. -import /system/etc/init/gsi/init.vndk-${ro.vndk.version:-27}.rc - diff --git a/target/product/gsi/init.vndk-27.rc b/target/product/gsi/init.vndk-27.rc deleted file mode 100644 index d464a2f396..0000000000 --- a/target/product/gsi/init.vndk-27.rc +++ /dev/null @@ -1,3 +0,0 @@ -on early-init - # Set ro.vndk.version to 27 so that O-MR1-VENDOR can run latest GSI. - setprop ro.vndk.version 27 diff --git a/target/product/gsi/init.vndk-nodef.rc b/target/product/gsi/init.vndk-nodef.rc new file mode 100644 index 0000000000..efeef117be --- /dev/null +++ b/target/product/gsi/init.vndk-nodef.rc @@ -0,0 +1,3 @@ +on early-init + # Must define BOARD_VNDK_VERSION + exec - root -- /system/bin/reboot bootloader diff --git a/target/product/gsi_release.mk b/target/product/gsi_release.mk index 5421ee06fc..46c956d963 100644 --- a/target/product/gsi_release.mk +++ b/target/product/gsi_release.mk @@ -49,7 +49,8 @@ PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES := true # GSI specific tasks on boot PRODUCT_PACKAGES += \ gsi_skip_mount.cfg \ - init.gsi.rc + init.gsi.rc \ + init.vndk-nodef.rc \ # Support additional P and Q VNDK packages PRODUCT_EXTRA_VNDK_VERSIONS := 28 29 diff --git a/target/product/legacy_gsi_release.mk b/target/product/legacy_gsi_release.mk index c1646bba3b..09b96fb529 100644 --- a/target/product/legacy_gsi_release.mk +++ b/target/product/legacy_gsi_release.mk @@ -16,22 +16,8 @@ include $(SRC_TARGET_DIR)/product/gsi_release.mk -PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST += \ - system/etc/init/init.legacy-gsi.rc \ - system/etc/init/gsi/init.vndk-27.rc \ - system/etc/ld.config.vndk_lite.txt \ - # Legacy GSI support additional O-MR1 interface PRODUCT_EXTRA_VNDK_VERSIONS += 27 -# Support for the O-MR1 devices -PRODUCT_COPY_FILES += \ - build/make/target/product/gsi/init.legacy-gsi.rc:system/etc/init/init.legacy-gsi.rc \ - build/make/target/product/gsi/init.vndk-27.rc:system/etc/init/gsi/init.vndk-27.rc - -# Namespace configuration file for non-enforcing VNDK -PRODUCT_PACKAGES += \ - ld.config.vndk_lite.txt - # Legacy GSI relax the compatible property checking PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := false diff --git a/tools/check_identical_lib.sh b/tools/check_identical_lib.sh index c3aa41a722..c9f436f0bb 100755 --- a/tools/check_identical_lib.sh +++ b/tools/check_identical_lib.sh @@ -26,7 +26,19 @@ function strip_lib() { strip_lib ${CORE} ${stripped_core} strip_lib ${VENDOR} ${stripped_vendor} if ! cmp -s ${stripped_core} ${stripped_vendor}; then - echo "VNDK library not in vndkMustUseVendorVariantList but has different core and vendor variant: $(basename ${CORE})" - echo "If the two variants need to have different runtime behavior, consider using libvndksupport." + echo "ERROR: VNDK library $(basename ${CORE%.so}) has different core and" \ + "vendor variants! This means that the copy used in the system.img/etc" \ + "and vendor.img/etc images are different. In order to preserve space on" \ + "some devices, it is helpful if they are the same. Frequently, " \ + "libraries are different because they or their dependencies compile" \ + "things based on the macro '__ANDROID_VNDK__' or they specify custom" \ + "options under 'target: { vendor: { ... } }'. Here are some possible" \ + "resolutions:" + echo "ERROR: 1). Remove differences, possibly using the libvndksupport" \ + "function android_is_in_vendor_process in order to turn this into a" \ + "runtime difference." + echo "ERROR: 2). Add the library to the VndkMustUseVendorVariantList" \ + "variable in build/soong/cc/config/vndk.go, which is used to" \ + "acknowledge this difference." exit 1 fi |