Skip to content

Commit 7509fc2

Browse files
committed
Add tentative support for complete Android builds.
1 parent b79993e commit 7509fc2

7 files changed

+132
-122
lines changed

docker/Dockerfile.aarch64-linux-android

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN /qemu.sh aarch64
1616
ARG ANDROID_NDK=r21d
1717
ARG ANDROID_SDK=28
1818
ARG ANDROID_VERSION=9.0.0_r1
19+
ARG ANDROID_SYSTEM_COMPLETE=0
1920

2021
COPY android-ndk.sh /
2122
RUN /android-ndk.sh arm64

docker/Dockerfile.arm-linux-androideabi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN /qemu.sh arm
1616
ARG ANDROID_NDK=r21d
1717
ARG ANDROID_SDK=28
1818
ARG ANDROID_VERSION=9.0.0_r1
19+
ARG ANDROID_SYSTEM_COMPLETE=0
1920

2021
COPY android-ndk.sh /
2122
RUN /android-ndk.sh arm

docker/Dockerfile.armv7-linux-androideabi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN /qemu.sh arm
1616
ARG ANDROID_NDK=r21d
1717
ARG ANDROID_SDK=28
1818
ARG ANDROID_VERSION=9.0.0_r1
19+
ARG ANDROID_SYSTEM_COMPLETE=0
1920

2021
COPY android-ndk.sh /
2122
RUN /android-ndk.sh arm

docker/Dockerfile.i686-linux-android

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ RUN /qemu.sh i386
2424
ARG ANDROID_NDK=r21d
2525
ARG ANDROID_SDK=28
2626
ARG ANDROID_VERSION=9.0.0_r1
27+
ARG ANDROID_SYSTEM_COMPLETE=0
2728

2829
COPY android-ndk.sh /
2930
RUN /android-ndk.sh x86

docker/Dockerfile.thumbv7neon-linux-androideabi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN /qemu.sh arm
1616
ARG ANDROID_NDK=r21d
1717
ARG ANDROID_SDK=28
1818
ARG ANDROID_VERSION=9.0.0_r1
19+
ARG ANDROID_SYSTEM_COMPLETE=0
1920

2021
COPY android-ndk.sh /
2122
RUN /android-ndk.sh arm

docker/Dockerfile.x86_64-linux-android

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ RUN /qemu.sh x86_64
1717
ARG ANDROID_NDK=r21d
1818
ARG ANDROID_SDK=28
1919
ARG ANDROID_VERSION=9.0.0_r1
20+
ARG ANDROID_SYSTEM_COMPLETE=0
2021

2122
COPY android-ndk.sh /
2223
RUN /android-ndk.sh x86_64

docker/android-system.sh

Lines changed: 126 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -80,131 +80,135 @@ EOF
8080
curl --retry 3 -sSfL https://storage.googleapis.com/git-repo-downloads/repo -O
8181
chmod +x repo
8282

83-
# this is the minimum set of modules that are need to build bionic
84-
# this was created by trial and error
8583
python3 ./repo init -u "https://android.googlesource.com/platform/manifest" -b "android-${version}"
8684

87-
python3 ./repo sync -c art
88-
python3 ./repo sync -c bionic
89-
if [[ "${has_make}" == 1 ]]; then
90-
python3 ./repo sync -c build/make
91-
fi
92-
python3 ./repo sync -c build/blueprint
93-
python3 ./repo sync -c external/clang
94-
python3 ./repo sync -c external/compiler-rt
95-
python3 ./repo sync -c external/elfutils
96-
python3 ./repo sync -c external/jemalloc
97-
python3 ./repo sync -c external/libcxx
98-
python3 ./repo sync -c external/libcxxabi
99-
python3 ./repo sync -c external/libunwind
100-
python3 ./repo sync -c external/libunwind_llvm
101-
python3 ./repo sync -c external/llvm
102-
python3 ./repo sync -c external/lzma
103-
python3 ./repo sync -c external/mksh
104-
python3 ./repo sync -c external/zlib
105-
python3 ./repo sync -c frameworks/hardware/interfaces
106-
python3 ./repo sync -c hardware/interfaces
107-
python3 ./repo sync -c libnativehelper
108-
python3 ./repo sync -c prebuilts/build-tools
109-
python3 ./repo sync -c prebuilts/clang/host/linux-x86
110-
python3 ./repo sync -c prebuilts/clang-tools
111-
python3 ./repo sync -c "prebuilts/gcc/linux-x86/host/x86_64-linux-${glibc_version}"
112-
python3 ./repo sync -c prebuilts/misc
113-
python3 ./repo sync -c prebuilts/sdk
114-
python3 ./repo sync -c system/core
115-
116-
if [[ "${major_version}" -le 9 ]]; then
117-
python3 ./repo sync -c external/safe-iop
118-
python3 ./repo sync -c external/valgrind
119-
fi
120-
if [[ "${major_version}" -ge 5 ]]; then
121-
python3 ./repo sync -c external/vixl
122-
fi
123-
if [[ "${major_version}" -ge 7 ]]; then
124-
python3 ./repo sync -c prebuilts/go/linux-x86
125-
python3 ./repo sync -c build/soong
126-
fi
127-
if [[ "${major_version}" -ge 8 ]]; then
128-
python3 ./repo sync -c system/libhidl
129-
python3 ./repo sync -c system/tools/hidl
130-
fi
131-
if [[ "${major_version}" -ge 10 ]]; then
132-
python3 ./repo sync -c kernel/configs
133-
python3 ./repo sync -c external/libxml2
134-
python3 ./repo sync -c system/sepolicy
135-
python3 ./repo sync -c system/tools/xsdc
136-
python3 ./repo sync -c external/golang-protobuf
137-
python3 ./repo sync -c external/jemalloc_new
138-
python3 ./repo sync -c external/icu
139-
python3 ./repo sync -c prebuilts/ndk
140-
python3 ./repo sync -c prebuilts/vndk/v28
141-
fi
142-
if [[ "${major_version}" -ge 11 ]]; then
143-
python3 ./repo sync -c prebuilts/vndk/v29
144-
python3 ./repo sync -c system/hardware/interfaces
145-
python3 ./repo sync -c system/tools/aidl
146-
python3 ./repo sync -c system/libvintf
147-
python3 ./repo sync -c tools/metalava
148-
python3 ./repo sync -c libcore
149-
python3 ./repo sync -c bootable/recovery
150-
python3 ./repo sync -c system/apex
151-
python3 ./repo sync -c external/avb
152-
python3 ./repo sync -c external/e2fsprogs
153-
python3 ./repo sync -c external/selinux
154-
python3 ./repo sync -c external/conscrypt
155-
python3 ./repo sync -c external/sqlite
156-
python3 ./repo sync -c prebuilts/python/linux-x86/2.7.5
157-
fi
158-
159-
case "${arch}" in
160-
arm|arm64)
161-
python3 ./repo sync "prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-${gcc_version}"
162-
if [[ "${arch}" == "arm64" ]]; then
163-
python3 ./repo sync "prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-${gcc_version}"
164-
fi
165-
if [[ "${major_version}" -ge 10 ]]; then
166-
python3 ./repo sync -c external/arm-optimized-routines
167-
fi
168-
;;
169-
x86)
170-
python3 ./repo sync "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-${gcc_version}"
171-
;;
172-
x86_64)
173-
python3 ./repo sync "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-${gcc_version}"
174-
;;
175-
esac
176-
177-
# avoid build tests. these can fail in newer versions, so allow failures.
178-
set +e
179-
rm bionic/linker/tests/Android.mk
180-
rm bionic/tests/Android.mk
181-
rm bionic/tests/Android.bp
182-
rm bionic/benchmarks/Android.bp
183-
rm bionic/tests/libs/Android.bp
184-
rm bionic/tests/headers/Android.bp
185-
rm bionic/tests/headers/posix/Android.bp
186-
if [[ "${major_version}" -ge 11 ]]; then
187-
rm system/libvintf/xsd/halManifest/vts/Android.bp
188-
rm system/libvintf/xsd/halManifest/vts/Android.mk
189-
rm system/libvintf/xsd/compatibilityMatrix/vts/Android.bp
190-
rm system/libvintf/xsd/compatibilityMatrix/vts/Android.mk
191-
fi
192-
193-
sed -i -z -e 's/cc_test {.*}//g' bionic/libc/malloc_debug/Android.bp
194-
sed -i -z -e 's/cc_test {.*}//g' bionic/libc/malloc_hooks/Android.bp
195-
if [[ "${major_version}" -le 9 ]]; then
196-
sed -i -z -e 's/cc_test_host {.*}//g' bionic/tools/relocation_packer/Android.bp
197-
fi
198-
if [[ "${major_version}" -ge 10 ]]; then
199-
sed -i -z -e 's/cc_test {.*}//g' bionic/linker/Android.bp
85+
if [[ "${ANDROID_SYSTEM_COMPLETE}" == "1" ]]; then
86+
python3 ./repo sync -c
87+
else
88+
# this is the minimum set of modules that are need to build bionic
89+
# this was created by trial and error
90+
python3 ./repo sync -c art
91+
python3 ./repo sync -c bionic
92+
if [[ "${has_make}" == 1 ]]; then
93+
python3 ./repo sync -c build/make
94+
fi
95+
python3 ./repo sync -c build/blueprint
96+
python3 ./repo sync -c external/clang
97+
python3 ./repo sync -c external/compiler-rt
98+
python3 ./repo sync -c external/elfutils
99+
python3 ./repo sync -c external/jemalloc
100+
python3 ./repo sync -c external/libcxx
101+
python3 ./repo sync -c external/libcxxabi
102+
python3 ./repo sync -c external/libunwind
103+
python3 ./repo sync -c external/libunwind_llvm
104+
python3 ./repo sync -c external/llvm
105+
python3 ./repo sync -c external/lzma
106+
python3 ./repo sync -c external/mksh
107+
python3 ./repo sync -c external/zlib
108+
python3 ./repo sync -c frameworks/hardware/interfaces
109+
python3 ./repo sync -c hardware/interfaces
110+
python3 ./repo sync -c libnativehelper
111+
python3 ./repo sync -c prebuilts/build-tools
112+
python3 ./repo sync -c prebuilts/clang/host/linux-x86
113+
python3 ./repo sync -c prebuilts/clang-tools
114+
python3 ./repo sync -c "prebuilts/gcc/linux-x86/host/x86_64-linux-${glibc_version}"
115+
python3 ./repo sync -c prebuilts/misc
116+
python3 ./repo sync -c prebuilts/sdk
117+
python3 ./repo sync -c system/core
118+
119+
if [[ "${major_version}" -le 9 ]]; then
120+
python3 ./repo sync -c external/safe-iop
121+
python3 ./repo sync -c external/valgrind
122+
fi
123+
if [[ "${major_version}" -ge 5 ]]; then
124+
python3 ./repo sync -c external/vixl
125+
fi
126+
if [[ "${major_version}" -ge 7 ]]; then
127+
python3 ./repo sync -c prebuilts/go/linux-x86
128+
python3 ./repo sync -c build/soong
129+
fi
130+
if [[ "${major_version}" -ge 8 ]]; then
131+
python3 ./repo sync -c system/libhidl
132+
python3 ./repo sync -c system/tools/hidl
133+
fi
134+
if [[ "${major_version}" -ge 10 ]]; then
135+
python3 ./repo sync -c kernel/configs
136+
python3 ./repo sync -c external/libxml2
137+
python3 ./repo sync -c system/sepolicy
138+
python3 ./repo sync -c system/tools/xsdc
139+
python3 ./repo sync -c external/golang-protobuf
140+
python3 ./repo sync -c external/jemalloc_new
141+
python3 ./repo sync -c external/icu
142+
python3 ./repo sync -c prebuilts/ndk
143+
python3 ./repo sync -c prebuilts/vndk/v28
144+
fi
145+
if [[ "${major_version}" -ge 11 ]]; then
146+
python3 ./repo sync -c prebuilts/vndk/v29
147+
python3 ./repo sync -c system/hardware/interfaces
148+
python3 ./repo sync -c system/tools/aidl
149+
python3 ./repo sync -c system/libvintf
150+
python3 ./repo sync -c tools/metalava
151+
python3 ./repo sync -c libcore
152+
python3 ./repo sync -c bootable/recovery
153+
python3 ./repo sync -c system/apex
154+
python3 ./repo sync -c external/avb
155+
python3 ./repo sync -c external/e2fsprogs
156+
python3 ./repo sync -c external/selinux
157+
python3 ./repo sync -c external/conscrypt
158+
python3 ./repo sync -c external/sqlite
159+
python3 ./repo sync -c external/python/cpython2
160+
fi
161+
162+
case "${arch}" in
163+
arm|arm64)
164+
python3 ./repo sync "prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-${gcc_version}"
165+
if [[ "${arch}" == "arm64" ]]; then
166+
python3 ./repo sync "prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-${gcc_version}"
167+
fi
168+
if [[ "${major_version}" -ge 10 ]]; then
169+
python3 ./repo sync -c external/arm-optimized-routines
170+
fi
171+
;;
172+
x86)
173+
python3 ./repo sync "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-${gcc_version}"
174+
;;
175+
x86_64)
176+
python3 ./repo sync "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-${gcc_version}"
177+
;;
178+
esac
179+
180+
# avoid build tests. these can fail in newer versions, so allow failures.
181+
set +e
182+
rm bionic/linker/tests/Android.mk
183+
rm bionic/tests/Android.mk
184+
rm bionic/tests/Android.bp
185+
rm bionic/benchmarks/Android.bp
186+
rm bionic/tests/libs/Android.bp
187+
rm bionic/tests/headers/Android.bp
188+
rm bionic/tests/headers/posix/Android.bp
189+
if [[ "${major_version}" -ge 11 ]]; then
190+
rm system/libvintf/xsd/halManifest/vts/Android.bp
191+
rm system/libvintf/xsd/halManifest/vts/Android.mk
192+
rm system/libvintf/xsd/compatibilityMatrix/vts/Android.bp
193+
rm system/libvintf/xsd/compatibilityMatrix/vts/Android.mk
194+
fi
195+
196+
sed -i -z -e 's/cc_test {.*}//g' bionic/libc/malloc_debug/Android.bp
197+
sed -i -z -e 's/cc_test {.*}//g' bionic/libc/malloc_hooks/Android.bp
198+
if [[ "${major_version}" -le 9 ]]; then
199+
sed -i -z -e 's/cc_test_host {.*}//g' bionic/tools/relocation_packer/Android.bp
200+
fi
201+
if [[ "${major_version}" -ge 10 ]]; then
202+
sed -i -z -e 's/cc_test {.*}//g' bionic/linker/Android.bp
203+
fi
204+
set -e
205+
206+
export ALLOW_MISSING_DEPENDENCIES=true
207+
208+
# patch the linker to avoid the error
209+
# FATAL: kernel did not supply AT_SECURE
210+
#sed -i -e 's/if (!kernel_supplied_AT_SECURE)/if (false)/g' bionic/linker/linker_environ.cpp
200211
fi
201-
set -e
202-
203-
export ALLOW_MISSING_DEPENDENCIES=true
204-
205-
# patch the linker to avoid the error
206-
# FATAL: kernel did not supply AT_SECURE
207-
#sed -i -e 's/if (!kernel_supplied_AT_SECURE)/if (false)/g' bionic/linker/linker_environ.cpp
208212

209213
set +u
210214
# shellcheck disable=SC1091

0 commit comments

Comments
 (0)