diff options
-rw-r--r-- | core/check_elf_file.mk | 3 | ||||
-rw-r--r-- | core/soong_cc_prebuilt.mk | 1 | ||||
-rw-r--r-- | core/tasks/art-host-tests.mk | 29 | ||||
-rwxr-xr-x | tools/check_elf_file.py | 14 | ||||
-rw-r--r-- | tools/releasetools/add_img_to_target_files.py | 65 | ||||
-rwxr-xr-x | tools/releasetools/merge_target_files.py | 2 |
6 files changed, 67 insertions, 47 deletions
diff --git a/core/check_elf_file.mk b/core/check_elf_file.mk index d54a5b70ba..b5be81f9d7 100644 --- a/core/check_elf_file.mk +++ b/core/check_elf_file.mk @@ -14,12 +14,14 @@ # - my_installed_module_stem # - my_prebuilt_src_file # - my_check_elf_file_shared_lib_files +# - my_system_shared_libraries ifndef LOCAL_IS_HOST_MODULE ifneq ($(filter $(LOCAL_MODULE_CLASS),SHARED_LIBRARIES EXECUTABLES NATIVE_TESTS),) check_elf_files_stamp := $(intermediates)/check_elf_files.timestamp $(check_elf_files_stamp): PRIVATE_SONAME := $(if $(filter $(LOCAL_MODULE_CLASS),SHARED_LIBRARIES),$(my_installed_module_stem)) $(check_elf_files_stamp): PRIVATE_ALLOW_UNDEFINED_SYMBOLS := $(LOCAL_ALLOW_UNDEFINED_SYMBOLS) +$(check_elf_files_stamp): PRIVATE_SYSTEM_SHARED_LIBRARIES := $(my_system_shared_libraries) # PRIVATE_SHARED_LIBRARY_FILES are file paths to built shared libraries. # In addition to $(my_check_elf_file_shared_lib_files), some file paths are # added by `resolve-shared-libs-for-elf-file-check` from `core/main.mk`. @@ -33,6 +35,7 @@ $(check_elf_files_stamp): $(my_prebuilt_src_file) $(my_check_elf_file_shared_lib --skip-unknown-elf-machine \ $(if $(PRIVATE_SONAME),--soname $(PRIVATE_SONAME)) \ $(foreach l,$(PRIVATE_SHARED_LIBRARY_FILES),--shared-lib $(l)) \ + $(foreach l,$(PRIVATE_SYSTEM_SHARED_LIBRARIES),--system-shared-lib $(l)) \ $(if $(PRIVATE_ALLOW_UNDEFINED_SYMBOLS),--allow-undefined-symbols) \ --llvm-readobj=$(LLVM_READOBJ) \ $< diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk index f98253d806..770408c159 100644 --- a/core/soong_cc_prebuilt.mk +++ b/core/soong_cc_prebuilt.mk @@ -91,6 +91,7 @@ endif ifdef LOCAL_INSTALLED_MODULE ifneq ($(LOCAL_CHECK_ELF_FILES),) my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE) + my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES) include $(BUILD_SYSTEM)/check_elf_file.mk endif endif diff --git a/core/tasks/art-host-tests.mk b/core/tasks/art-host-tests.mk new file mode 100644 index 0000000000..96e2c7426f --- /dev/null +++ b/core/tasks/art-host-tests.mk @@ -0,0 +1,29 @@ +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +.PHONY: art-host-tests + +intermediates_dir := $(call intermediates-dir-for,PACKAGING,art-host-tests) +art_host_tests_zip := $(PRODUCT_OUT)/art-host-tests.zip +$(art_host_tests_zip) : $(COMPATIBILITY.art-host-tests.FILES) $(SOONG_ZIP) + echo $(sort $(COMPATIBILITY.art-host-tests.FILES)) | tr " " "\n" > $@.list + grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true + grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true + $(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list -P target -C $(PRODUCT_OUT) -l $@-target.list + rm -f $@.list $@-host.list $@-target.list + +art-host-tests: $(art_host_tests_zip) +$(call dist-for-goals, art-host-tests, $(art_host_tests_zip)) + +tests: art-host-tests diff --git a/tools/check_elf_file.py b/tools/check_elf_file.py index ee8efd502a..1ff8e65e7a 100755 --- a/tools/check_elf_file.py +++ b/tools/check_elf_file.py @@ -397,7 +397,7 @@ class Checker(object): sys.exit(2) - def check_dt_needed(self): + def check_dt_needed(self, system_shared_lib_names): """Check whether all DT_NEEDED entries are specified in the build system.""" @@ -417,6 +417,11 @@ class Checker(object): dt_needed = sorted(set(self._file_under_test.dt_needed)) modules = [re.sub('\\.so$', '', lib) for lib in dt_needed] + # Remove system shared libraries from the suggestion since they are added + # by default. + modules = [name for name in modules + if name not in system_shared_lib_names] + self._note() self._note('Fix suggestions:') self._note( @@ -502,6 +507,11 @@ def _parse_args(): parser.add_argument('--shared-lib', action='append', default=[], help='Path to shared library dependencies') + # System Shared library names + parser.add_argument('--system-shared-lib', action='append', default=[], + help='System shared libraries to be hidden from fix ' + 'suggestions') + # Check options parser.add_argument('--skip-bad-elf-magic', action='store_true', help='Ignore the input file without the ELF magic word') @@ -535,7 +545,7 @@ def main(): if args.soname: checker.check_dt_soname(args.soname) - checker.check_dt_needed() + checker.check_dt_needed(args.system_shared_lib) if not args.allow_undefined_symbols: checker.check_symbols() diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index a1f8e31b87..eb041ecea8 100644 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -739,6 +739,18 @@ def ReplaceUpdatedFiles(zip_filename, files_list): common.ZipClose(output_zip) +def HasPartition(partition_name): + """Determines if the target files archive should build a given partition.""" + + return ((os.path.isdir( + os.path.join(OPTIONS.input_tmp, partition_name.upper())) and + OPTIONS.info_dict.get( + "building_{}_image".format(partition_name)) == "true") or + os.path.exists( + os.path.join(OPTIONS.input_tmp, "IMAGES", + "{}.img".format(partition_name)))) + + def AddImagesToTargetFiles(filename): """Creates and adds images (boot/recovery/system/...) to a target_files.zip. @@ -767,49 +779,16 @@ def AddImagesToTargetFiles(filename): has_boot = OPTIONS.info_dict.get("no_boot") != "true" has_vendor_boot = OPTIONS.info_dict.get("vendor_boot") == "true" - # {vendor,odm,product,system_ext,vendor_dlkm,odm_dlkm}.img - # are unlike system.img or - # system_other.img, because it could be built from source, or dropped into - # target_files.zip as a prebuilt blob. We consider either of them as - # {vendor,product,system_ext}.img being available, which could be - # used when generating vbmeta.img for AVB. - has_vendor = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, "VENDOR")) and - OPTIONS.info_dict.get("building_vendor_image") == "true") or - os.path.exists( - os.path.join(OPTIONS.input_tmp, "IMAGES", "vendor.img"))) - has_odm = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, "ODM")) and - OPTIONS.info_dict.get("building_odm_image") == "true") or - os.path.exists( - os.path.join(OPTIONS.input_tmp, "IMAGES", "odm.img"))) - has_vendor_dlkm = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, - "VENDOR_DLKM")) and - OPTIONS.info_dict.get("building_vendor_dlkm_image") - == "true") or - os.path.exists( - os.path.join(OPTIONS.input_tmp, "IMAGES", - "vendor_dlkm.img"))) - has_odm_dlkm = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, - "ODM_DLKM")) and - OPTIONS.info_dict.get("building_odm_dlkm_image") - == "true") or - os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES", - "odm_dlkm.img"))) - has_product = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, "PRODUCT")) and - OPTIONS.info_dict.get("building_product_image") == "true") or - os.path.exists( - os.path.join(OPTIONS.input_tmp, "IMAGES", "product.img"))) - has_system_ext = ( - (os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM_EXT")) and - OPTIONS.info_dict.get("building_system_ext_image") == "true") or - os.path.exists( - os.path.join(OPTIONS.input_tmp, "IMAGES", "system_ext.img"))) - has_system = ( - os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM")) and - OPTIONS.info_dict.get("building_system_image") == "true") - - has_system_other = ( - os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM_OTHER")) and - OPTIONS.info_dict.get("building_system_other_image") == "true") + # {vendor,odm,product,system_ext,vendor_dlkm,odm_dlkm, system, system_other}.img + # can be built from source, or dropped into target_files.zip as a prebuilt blob. + has_vendor = HasPartition("vendor") + has_odm = HasPartition("odm") + has_vendor_dlkm = HasPartition("vendor_dlkm") + has_odm_dlkm = HasPartition("odm_dlkm") + has_product = HasPartition("product") + has_system_ext = HasPartition("system_ext") + has_system = HasPartition("system") + has_system_other = HasPartition("system_other") has_userdata = OPTIONS.info_dict.get("building_userdata_image") == "true" has_cache = OPTIONS.info_dict.get("building_cache_image") == "true" diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py index 45532f50d0..bfd2f90c44 100755 --- a/tools/releasetools/merge_target_files.py +++ b/tools/releasetools/merge_target_files.py @@ -197,8 +197,6 @@ DEFAULT_VENDOR_ITEM_LIST = ( 'PREBUILT_IMAGES/*', 'RADIO/*', 'VENDOR/*', - 'VENDOR_DLKM/*', - 'ODM_DLKM/*', ) # VENDOR_EXTRACT_SPECIAL_ITEM_LIST is a list of items to extract from the |