diff options
-rw-r--r-- | build/apex/Android.bp | 16 | ||||
-rw-r--r-- | runtime/runtime.cc | 8 | ||||
-rwxr-xr-x | tools/buildbot-build.sh | 98 | ||||
-rwxr-xr-x | tools/buildbot-sync.sh | 54 |
4 files changed, 103 insertions, 73 deletions
diff --git a/build/apex/Android.bp b/build/apex/Android.bp index a1112b73d4..45a8401333 100644 --- a/build/apex/Android.bp +++ b/build/apex/Android.bp @@ -216,6 +216,14 @@ apex_defaults { "art_apex_boot_integrity", "com.android.i18n", ], + // ART APEXes depend on bouncycastle which is disabled for PDK builds. + // Since the dependency is disabled, ART APEXes can't be built either. + // Disable the APEXes too. See b/157267166. + product_variables: { + pdk: { + enabled: false, + }, + }, } // Default values shared by (device) Debug and Testing ART APEXes. @@ -345,6 +353,14 @@ art_apex_test_host { }, }, }, + // ART APEXes depend on bouncycastle which is disabled for PDK builds. + // Since the dependency is disabled, ART APEXes can't be built either. + // Disable the APEXes too. See b/157267166. + product_variables: { + pdk: { + enabled: false, + }, + }, } python_binary_host { diff --git a/runtime/runtime.cc b/runtime/runtime.cc index b534fd23ad..0420e0be56 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1788,6 +1788,14 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { callbacks_->NextRuntimePhase(RuntimePhaseCallback::RuntimePhase::kInitialAgents); } + if (IsZygote() && IsPerfettoHprofEnabled()) { + constexpr const char* plugin_name = kIsDebugBuild ? + "libperfetto_hprofd.so" : "libperfetto_hprof.so"; + // Load eagerly in Zygote to improve app startup times. This will make + // subsequent dlopens for the library no-ops. + dlopen(plugin_name, RTLD_NOW | RTLD_LOCAL); + } + VLOG(startup) << "Runtime::Init exiting"; // Set OnlyUseSystemOatFiles only after boot classpath has been set up. diff --git a/tools/buildbot-build.sh b/tools/buildbot-build.sh index 60e4772087..dde156dbe6 100755 --- a/tools/buildbot-build.sh +++ b/tools/buildbot-build.sh @@ -65,6 +65,14 @@ done # Allow to build successfully in master-art. extra_args="SOONG_ALLOW_MISSING_DEPENDENCIES=true" +apexes=( + "com.android.art.testing" + "com.android.conscrypt" + "com.android.i18n" + "com.android.runtime" + "com.android.tzdata" +) + if [[ $mode == "host" ]]; then make_command="build/soong/soong_ui.bash --make-mode $j_arg $extra_args $showcommands build-art-host-tests $common_targets" make_command+=" dx-tests junit-host" @@ -75,36 +83,29 @@ elif [[ $mode == "target" ]]; then exit 1 fi make_command="build/soong/soong_ui.bash --make-mode $j_arg $extra_args $showcommands build-art-target-tests $common_targets" - make_command+=" libnetd_client-target toybox toolbox sh" + make_command+=" libnetd_client-target toybox sh" make_command+=" debuggerd su gdbserver" make_command+=" libstdc++ " # vogar requires the class files for conscrypt. make_command+=" conscrypt " make_command+=" ${ANDROID_PRODUCT_OUT#"${ANDROID_BUILD_TOP}/"}/system/etc/public.libraries.txt" - if [[ -n "$ART_TEST_CHROOT" ]]; then - # Targets required to generate a linker configuration on device within the - # chroot environment. - make_command+=" linkerconfig" - # Additional targets needed for the chroot environment. - make_command+=" crash_dump event-log-tags" - fi + # Targets required to generate a linker configuration for device within the + # chroot environment. The *.libraries.txt targets are required by + # linkerconfig but not included in host_linkerconfig_all_targets. We cannot + # use linkerconfig, because building the device binary statically might not + # work in an unbundled tree. + make_command+=" host_linkerconfig_all_targets sanitizer.libraries.txt vndkcorevariant.libraries.txt" + # Additional targets needed for the chroot environment. + make_command+=" crash_dump event-log-tags" # Needed to extract prebuilts apexes. make_command+=" deapexer " - # Build the Testing ART APEX (which is a superset of the Release and Debug ART APEXes). - make_command+=" com.android.art.testing" - # Build the Runtime (Bionic) APEX. - make_command+=" com.android.runtime" # Build the bootstrap Bionic artifacts links (linker, libc, libdl, libm). # These targets create these symlinks: # - from /system/bin/linker(64) to /apex/com.android.runtime/bin/linker(64); and # - from /system/lib(64)/$lib to /apex/com.android.runtime/lib(64)/$lib. make_command+=" linker libc.bootstrap libdl.bootstrap libdl_android.bootstrap libm.bootstrap" - # Build the Conscrypt APEX. - make_command+=" com.android.conscrypt" - # Build the i18n APEX. - make_command+=" com.android.i18n" - # Build the Time Zone Data APEX. - make_command+=" com.android.tzdata" + # Build/install the required APEXes. + make_command+=" ${apexes[*]}" fi mode_specific_libraries="libjavacoretests libjdwp libwrapagentproperties libwrapagentpropertiesd" @@ -118,6 +119,24 @@ echo "Executing $make_command" eval "$make_command" if [[ $mode == "target" ]]; then + if [[ -z "${ANDROID_HOST_OUT}" ]]; then + echo "ANDROID_HOST_OUT environment variable is empty; using $out_dir/host/linux-x86" + ANDROID_HOST_OUT=$out_dir/host/linux-x86 + fi + + # Extract prebuilt APEXes. + debugfs=$ANDROID_HOST_OUT/bin/debugfs_static + for apex in ${apexes[@]}; do + dir="$ANDROID_PRODUCT_OUT/system/apex/${apex}" + file="$ANDROID_PRODUCT_OUT/system/apex/${apex}.apex" + if [ -f "${file}" ]; then + echo "Extracting APEX file: ${apex}" + rm -rf $dir + mkdir -p $dir + $ANDROID_HOST_OUT/bin/deapexer --debugfs_path $debugfs extract $file $dir + fi + done + # Create canonical name -> file name symlink in the symbol directory for the # Testing ART APEX. # @@ -143,24 +162,8 @@ if [[ $mode == "target" ]]; then eval "$cmd" done - - conscrypt_dir="$ANDROID_PRODUCT_OUT/system/apex/com.android.conscrypt" - conscrypt_apex="$ANDROID_PRODUCT_OUT/system/apex/com.android.conscrypt.apex" - if [ -f "${conscrypt_apex}" ]; then - # If there is a conscrypt apex prebuilt, extract it. - rm -rf $conscrypt_dir - mkdir $conscrypt_dir - if [[ -z "${ANDROID_HOST_OUT}" ]]; then - echo "ANDROID_HOST_OUT environment variable is empty; using $out_dir/host/linux-x86" - ANDROID_HOST_OUT=$out_dir/host/linux-x86 - fi - echo -e "Listing contents of the conscrypt apex" - ls -l $conscrypt_apex - debugfs=$ANDROID_HOST_OUT/bin/debugfs_static - $ANDROID_HOST_OUT/bin/deapexer --debugfs_path $debugfs list $conscrypt_apex - $ANDROID_HOST_OUT/bin/deapexer --debugfs_path $debugfs extract $conscrypt_apex $conscrypt_dir - fi # Temporary fix for libjavacrypto.so dependencies in libcore and jvmti tests (b/147124225). + conscrypt_dir="$ANDROID_PRODUCT_OUT/system/apex/com.android.conscrypt" conscrypt_libs="libjavacrypto.so libcrypto.so libssl.so" if [ ! -d "${conscrypt_dir}" ]; then echo -e "Missing conscrypt APEX in build output: ${conscrypt_dir}" @@ -184,4 +187,29 @@ if [[ $mode == "target" ]]; then fi done done + + # Create linker config files. We run linkerconfig on host to avoid problems + # building it statically for device in an unbundled tree. + + # For linkerconfig to pick up the APEXes correctly we need to make them + # available in $ANDROID_PRODUCT_OUT/apex. + mkdir -p $ANDROID_PRODUCT_OUT/apex + for apex in ${apexes[@]}; do + src="$ANDROID_PRODUCT_OUT/system/apex/${apex}" + if [[ $apex == com.android.art.* ]]; then + dst="$ANDROID_PRODUCT_OUT/apex/com.android.art" + else + dst="$ANDROID_PRODUCT_OUT/apex/${apex}" + fi + echo "Copying APEX directory from $src to $dst" + rm -rf $dst + cp -r $src $dst + done + + platform_version=$(build/soong/soong_ui.bash --dumpvar-mode PLATFORM_VERSION) + linkerconfig_root=$ANDROID_PRODUCT_OUT/linkerconfig + echo "Generating linkerconfig in $linkerconfig_root" + rm -rf $linkerconfig_root + mkdir -p $linkerconfig_root + $ANDROID_HOST_OUT/bin/linkerconfig --target $linkerconfig_root --root $ANDROID_PRODUCT_OUT --vndk $platform_version fi diff --git a/tools/buildbot-sync.sh b/tools/buildbot-sync.sh index 8bf6885766..55bd3b792d 100755 --- a/tools/buildbot-sync.sh +++ b/tools/buildbot-sync.sh @@ -54,18 +54,28 @@ if [[ "$(build/soong/soong_ui.bash --dumpvar-mode TARGET_FLATTEN_APEX)" != "true fi -# `/system` "partition" synchronization. -# -------------------------------------- +# Sync relevant product directories +# --------------------------------- + +sync_dir() { + local dir=${1} + echo -e "${green}Syncing $dir directory...${nc}" + adb shell mkdir -p "$ART_TEST_CHROOT/$dir" + adb push "$ANDROID_PRODUCT_OUT/$dir" "$ART_TEST_CHROOT/" +} + +sync_dir system +sync_dir linkerconfig +sync_dir data -# Sync the system directory to the chroot. -echo -e "${green}Syncing system directory...${nc}" -adb shell mkdir -p "$ART_TEST_CHROOT/system" -adb push "$ANDROID_PRODUCT_OUT/system" "$ART_TEST_CHROOT/" # Overwrite the default public.libraries.txt file with a smaller one that # contains only the public libraries pushed to the chroot directory. adb push "$ANDROID_BUILD_TOP/art/tools/public.libraries.buildbot.txt" \ "$ART_TEST_CHROOT/system/etc/public.libraries.txt" +# Create the framework directory if it doesn't exist. Some gtests need it. +adb shell mkdir -p "$ART_TEST_CHROOT/system/framework" + # APEX packages activation. # ------------------------- @@ -98,35 +108,3 @@ activate_apex com.android.i18n activate_apex com.android.runtime activate_apex com.android.tzdata activate_apex com.android.conscrypt - - -# Linker configuration. -# --------------------- - -# Statically linked `linkerconfig` binary. -linkerconfig_binary="/system/bin/linkerconfig" -# Generated linker configuration file path (since Android R). -ld_generated_config_file_path="/linkerconfig/ld.config.txt" -# Location of the generated linker configuration file. -ld_generated_config_file_location=$(dirname "$ld_generated_config_file_path") - -# Generate linker configuration files on device. -echo -e "${green}Generating linker configuration files on device in" \ - "\`$ld_generated_config_file_path\`${nc}..." -adb shell chroot "$ART_TEST_CHROOT" \ - "$linkerconfig_binary" --target "$ld_generated_config_file_location" || exit 1 -ld_generated_config_files=$(adb shell find $ART_TEST_CHROOT/linkerconfig ! -type d | sed 's/^/ /') -echo -e "${green}Generated linker configuration files on device:${nc}" -echo -e "${green}$ld_generated_config_files${nc}" - - -# `/data` "partition" synchronization. -# ------------------------------------ - -# Sync the data directory to the chroot. -echo -e "${green}Syncing data directory...${nc}" -adb shell mkdir -p "$ART_TEST_CHROOT/data" -adb push "$ANDROID_PRODUCT_OUT/data" "$ART_TEST_CHROOT/" - -# Create the framework directory if it doesn't exist. Some gtests need it. -adb shell mkdir -p "$ART_TEST_CHROOT/system/framework" |