Use prebuilt Runtime (Bionic) APEX and SDK (reland 2).
Relands https://r.android.com/1324613 after adding
TARGET_BUILD_UNBUNDLED in more places (e.g. LUCI and Golem).
Test: `art/build/apex/runtests.sh` on aosp-master and master-art
Test: `m installclean && m TARGET_BUILD_UNBUNDLED=true build-art-target-golem`
on master-art, then compare file listings of
out/target/product/armv8/system/*/* without and with the CL topic,
and check with readelf that the Bionic libs in system/lib(64) aren't
stubs.
Test: art/build/run-gtests.sh
art/test/testrunner/testrunner.py --target --64 --optimizing
art/tools/run-libcore-tests.sh --mode=device --variant=X64
art/tools/run-libjdwp-tests.sh --mode=device --variant=X64
in device chroot on master-art (without Bionic repos), and
on AOSP master with Bionic sources (no regressions).
Test: art/test/testrunner/run_build_test_target.py art-linux-bionic-x64
Bug: 152255951
Change-Id: I15a6e978db3cce655d08ea823c0645dbf4283b38
diff --git a/Android.mk b/Android.mk
index d8340bd..63eb01e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -474,23 +474,6 @@
.PHONY: build-art-target
build-art-target: $(TARGET_OUT_EXECUTABLES)/art $(ART_TARGET_DEPENDENCIES) $(TARGET_CORE_IMG_OUTS)
-########################################################################
-# Workaround for not using symbolic links for linker and bionic libraries
-# in a minimal setup (eg buildbot or golem).
-########################################################################
-
-PRIVATE_BIONIC_FILES := \
- bin/bootstrap/linker \
- bin/bootstrap/linker64 \
- lib/bootstrap/libc.so \
- lib/bootstrap/libm.so \
- lib/bootstrap/libdl.so \
- lib/bootstrap/libdl_android.so \
- lib64/bootstrap/libc.so \
- lib64/bootstrap/libm.so \
- lib64/bootstrap/libdl.so \
- lib64/bootstrap/libdl_android.so \
-
PRIVATE_ART_APEX_DEPENDENCY_FILES := \
bin/dalvikvm32 \
bin/dalvikvm64 \
@@ -555,6 +538,18 @@
lib64/libprofile.so \
lib64/libvixl.so \
+PRIVATE_RUNTIME_APEX_DEPENDENCY_FILES := \
+ bin/linker \
+ bin/linker64 \
+ lib/bionic/libc.so \
+ lib/bionic/libdl.so \
+ lib/bionic/libdl_android.so \
+ lib/bionic/libm.so \
+ lib64/bionic/libc.so \
+ lib64/bionic/libdl.so \
+ lib64/bionic/libdl_android.so \
+ lib64/bionic/libm.so \
+
PRIVATE_CONSCRYPT_APEX_DEPENDENCY_LIBS := \
lib/libcrypto.so \
lib/libjavacrypto.so \
@@ -602,18 +597,9 @@
done
endef
-# Generate copies of Bionic bootstrap artifacts and ART APEX
-# libraries in the `system` (TARGET_OUT) directory. This is dangerous
-# as these files could inadvertently stay in this directory and be
-# included in a system image.
-#
-# Copy some libraries into `$(TARGET_OUT)/lib(64)` (the
-# `/system/lib(64)` directory to be sync'd to the target) for ART testing
-# purposes:
-# - Bionic bootstrap libraries, copied from
-# `$(TARGET_OUT)/lib(64)/bootstrap` (the `/system/lib(64)/bootstrap`
-# directory to be sync'd to the target);
-# - Programs and libraries from various APEXes.
+# Copy or extract some required files from APEXes to the `system` (TARGET_OUT)
+# directory. This is dangerous as these files could inadvertently stay in this
+# directory and be included in a system image.
#
# This target is only used by Golem now.
#
@@ -625,20 +611,21 @@
# ART APEX.
.PHONY: standalone-apex-files
standalone-apex-files: deapexer \
- libc.bootstrap \
- libdl.bootstrap \
- libdl_android.bootstrap \
- libm.bootstrap \
- linker \
$(RELEASE_ART_APEX) \
+ $(RUNTIME_APEX) \
$(CONSCRYPT_APEX) \
$(I18N_APEX)
- for f in $(PRIVATE_BIONIC_FILES); do \
- tf=$(TARGET_OUT)/$$f; \
- if [ -f $$tf ]; then cp -f $$tf $$(echo $$tf | sed 's,bootstrap/,,'); fi; \
- done
$(call extract-from-apex,$(RELEASE_ART_APEX),\
$(PRIVATE_ART_APEX_DEPENDENCY_LIBS) $(PRIVATE_ART_APEX_DEPENDENCY_FILES))
+ # The Runtime APEX has the Bionic libs in ${LIB}/bionic subdirectories,
+ # so we need to move them up a level after extraction.
+ $(call extract-from-apex,$(RUNTIME_APEX),\
+ $(PRIVATE_RUNTIME_APEX_DEPENDENCY_FILES)) && \
+ for libdir in $(TARGET_OUT)/lib $(TARGET_OUT)/lib64; do \
+ if [ -d $$libdir/bionic ]; then \
+ mv -f $$libdir/bionic/*.so $$libdir; \
+ fi || exit 1; \
+ done
$(call extract-from-apex,$(CONSCRYPT_APEX),\
$(PRIVATE_CONSCRYPT_APEX_DEPENDENCY_LIBS))
$(call extract-from-apex,$(I18N_APEX),\
@@ -651,10 +638,8 @@
# Also include libartbenchmark, we always include it when running golem.
# libstdc++ is needed when building for ART_TARGET_LINUX.
-# Also include the bootstrap Bionic libraries (libc, libdl, libdl_android,
-# libm). These are required as the "main" libc, libdl, libdl_android, and libm
-# have moved to the ART APEX. This is a temporary change needed until Golem
-# fully supports the ART APEX.
+# Also include the Bionic libraries (libc, libdl, libdl_android, libm) and
+# linker.
#
# TODO(b/129332183): Remove this when Golem has full support for the
# ART APEX.
@@ -690,7 +675,6 @@
$(TARGET_OUT)/etc/public.libraries.txt \
$(ART_TARGET_SHARED_LIBRARY_BENCHMARK) \
libartpalette-system \
- libc.bootstrap libdl.bootstrap libdl_android.bootstrap libm.bootstrap \
icu-data-art-test-i18n \
tzdata-art-test-tzdata tzlookup.xml-art-test-tzdata \
tz_version-art-test-tzdata icu_overlay-art-test-tzdata \
diff --git a/build/Android.common_path.mk b/build/Android.common_path.mk
index 54e337e..3ff2612 100644
--- a/build/Android.common_path.mk
+++ b/build/Android.common_path.mk
@@ -120,6 +120,8 @@
# Testing ART APEX, used in ART device testing.
TESTING_ART_APEX := com.android.art.testing
+# Runtime (Bionic) APEX
+RUNTIME_APEX := com.android.runtime
# Conscrypt APEX
CONSCRYPT_APEX := com.android.conscrypt
# i18n APEX
diff --git a/tools/buildbot-build.sh b/tools/buildbot-build.sh
index 3c39619..dd8c188 100755
--- a/tools/buildbot-build.sh
+++ b/tools/buildbot-build.sh
@@ -91,9 +91,8 @@
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 sh"
make_command+=" debuggerd su gdbserver"
- make_command+=" libstdc++ "
# vogar requires the class files for conscrypt.
- make_command+=" conscrypt "
+ make_command+=" conscrypt"
make_command+=" ${ANDROID_PRODUCT_OUT#"${ANDROID_BUILD_TOP}/"}/system/etc/public.libraries.txt"
# Targets required to generate a linker configuration for device within the
# chroot environment. The *.libraries.txt targets are required by
@@ -102,14 +101,9 @@
# 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 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"
+ make_command+=" event-log-tags"
+ # Needed to extract prebuilt APEXes.
+ make_command+=" deapexer"
# Build/install the required APEXes.
make_command+=" ${apexes[*]}"
fi
@@ -202,6 +196,23 @@
$ANDROID_PRODUCT_OUT/system/usr/share/zoneinfo/tzdata
fi
+ # Create system symlinks for the Runtime APEX. Normally handled by
+ # installSymlinkToRuntimeApex in soong/cc/binary.go, but we have to replicate
+ # it here since we don't run the install rules for the Runtime APEX.
+ for b in linker{,_asan}{,64}; do
+ echo "Symlinking /apex/com.android.runtime/bin/$b to /system/bin"
+ ln -sf /apex/com.android.runtime/bin/$b $ANDROID_PRODUCT_OUT/system/bin/$b
+ done
+ for p in $ANDROID_PRODUCT_OUT/system/apex/com.android.runtime/lib{,64}/bionic/*; do
+ lib_dir=$(expr $p : '.*/\(lib[0-9]*\)/.*')
+ lib_file=$(basename $p)
+ src=/apex/com.android.runtime/${lib_dir}/bionic/${lib_file}
+ dst=$ANDROID_PRODUCT_OUT/system/${lib_dir}/${lib_file}
+ echo "Symlinking $src into /system/${lib_dir}"
+ mkdir -p $(dirname $dst)
+ ln -sf $src $dst
+ done
+
# Create linker config files. We run linkerconfig on host to avoid problems
# building it statically for device in an unbundled tree.