Skip to content

Commit 4a2739d

Browse files
committed
Initial Android 6 support.
1 parent eca60e6 commit 4a2739d

File tree

1 file changed

+77
-62
lines changed

1 file changed

+77
-62
lines changed

docker/android-system.sh

Lines changed: 77 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#
77
# The versions are:
88
# 5.0: 21 (tested at NDK r13b)
9-
# 5.1: 22 (tested at NDK r21d, unused DT entry warnings)
10-
# 6.0: 23
9+
# 5.1: 22 (tested at NDK r21d, unused DT)
10+
# 6.0: 23 (tested at NDK r21d, unused DT)
1111
# 7.0: 24
1212
# 7.1: 25
1313
# 8.0: 26
@@ -28,7 +28,7 @@ main() {
2828
local arch="${1}"
2929
local version="${ANDROID_VERSION}"
3030
local major_version="${version//.*/}"
31-
export ANDROID_TAG="android-${version}"
31+
local tag="android-${version}"
3232

3333
if [[ "${ANDROID_SYSTEM_COMPLETE}" != "1" ]] && [[ "${major_version}" -ge "12" ]]; then
3434
echo "Only minimal Android builds for versions 11 or lower are supported" 1>&2
@@ -76,11 +76,9 @@ EOF
7676
xz-utils
7777
purge_list+=(default-jre)
7878

79-
# curl --retry 3 -sSfL https://storage.googleapis.com/git-repo-downloads/repo -O
80-
# chmod +x repo
81-
#
82-
# # TODO(ahuszagh) Add --depth 1
83-
# python3 ./repo init -u "https://android.googlesource.com/platform/manifest" -b "android-${version}"
79+
curl --retry 3 -sSfL https://storage.googleapis.com/git-repo-downloads/repo -O
80+
chmod +x repo
81+
python3 ./repo init -u https://android.googlesource.com/platform/manifest -b "${tag}"
8482

8583
local tools=(
8684
cat chmod chown cmp cp ctrlaltdel date df dmesg du hd id ifconfig
@@ -97,10 +95,9 @@ EOF
9795
android_repo_v5 "${arch}"
9896
tools+=(dd getevent getprop grep newfs_msdos)
9997
;;
100-
# 6)
101-
# #android_repo_v6 "${arch}"
102-
# # TODO(ahuszagh) Here.
103-
# ;;
98+
6)
99+
android_repo_v6 "${arch}"
100+
;;
104101
# 7)
105102
# #android_repo_v7 "${arch}"
106103
# # TODO(ahuszagh) Here.
@@ -162,25 +159,20 @@ build_android() {
162159
# FIXME: Currently failing on Android 10 with:
163160
# FAILED: ninja: 'out/soong/missing', needed by 'out/soong/generic_arm64/dex_bootjars_input/android.test.base.jar', missing and no known rule to make it
164161
# 23:31:18 ninja failed with: exit status 1
165-
mmma system/apex/
162+
mmma art/build/apex
166163
fi
167164

168165
set -u
169166
}
170167

171168
install_android() {
172169
local arch="${1}"
173-
local srcdir=
174170
shift
175171

176172
if [[ "${arch}" = "arm" ]]; then
177-
srcdir=out/target/product/generic
173+
mv out/target/product/generic/system/ /
178174
else
179-
srcdir="out/target/product/generic_${arch}"
180-
fi
181-
mv "${srcdir}/system" /
182-
if [[ "${major_version}" -ge 10 ]]; then
183-
mv "${srcdir}/apex" /
175+
mv "out/target/product/generic_${arch}/system"/ /
184176
fi
185177

186178
# list from https://elinux.org/Android_toolbox
@@ -197,19 +189,12 @@ install_android() {
197189
# set of modules required for each android version, starting with
198190
# a minimal number of dependencies.
199191

200-
sync() {
201-
local path="${1}"
202-
local url=https://android.googlesource.com/platform
203-
mkdir -p "${path}"
204-
git clone "${url}/${path}" "${path}" --branch "${ANDROID_TAG}" --depth 1
205-
#python3 ./repo sync -c --no-clone-bundle "${@}"
206-
}
207-
208192
android_repo_complete() {
209-
sync
193+
python3 ./repo sync -c
210194
}
211195

212196
# tested on 5.0.0_r1 (SDK 21)
197+
# tested on 5.1.1_r38 (SDK 22)
213198
android_repo_v5() {
214199
local arch="${1}"
215200

@@ -252,14 +237,71 @@ android_repo_v5() {
252237
sed -i -e 's/if (!kernel_supplied_AT_SECURE)/if (false)/g' bionic/linker/linker_environ.cpp
253238
}
254239

240+
# tested on 6.0.1_r81 (SDK 23)
241+
android_repo_v6() {
242+
local arch="${1}"
243+
244+
sync bionic
245+
sync build
246+
sync external/compiler-rt
247+
sync external/libcxx
248+
sync external/libcxxabi
249+
sync external/elfutils
250+
sync external/jemalloc
251+
sync external/mksh
252+
sync external/safe-iop
253+
sync external/zlib
254+
sync libnativehelper
255+
sync prebuilts/clang/linux-x86/host/3.6
256+
sync prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8
257+
sync prebuilts/misc
258+
sync system/core
259+
260+
case "${arch}" in
261+
arm)
262+
sync prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9
263+
;;
264+
arm64)
265+
sync prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9
266+
sync prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
267+
;;
268+
x86)
269+
sync prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9
270+
;;
271+
x86_64)
272+
sync prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9
273+
;;
274+
esac
275+
276+
# avoid build tests
277+
rm bionic/linker/tests/Android.mk
278+
rm bionic/tests/Android.mk
279+
rm bionic/benchmarks/Android.mk
280+
# we don't need the relocation packer, and removing
281+
# the unittests from it is a bit of work.
282+
rm bionic/tools/relocation_packer/Android.mk
283+
}
284+
285+
# TODO
286+
android_repo_v7() {
287+
# TODO(ahuszagh) This is the first one using the soong build system
288+
local arch="${1}"
289+
290+
sync bionic
291+
sync build
292+
sync prebuilts/clang/linux-x86/host/3.6
293+
# TODO(ahuszagh) Here...
294+
# TODO(ahuszagh) Having issues rn with using git directly.
295+
}
296+
255297
# tested on 9.0.0_r1 (SDK 28)
256298
android_repo_v9() {
257299
local arch="${1}"
258300

259301
sync art
260302
sync bionic
261-
sync build/blueprint
262303
sync build/make
304+
sync build/blueprint
263305
sync build/soong
264306
sync external/clang
265307
sync external/compiler-rt
@@ -280,8 +322,8 @@ android_repo_v9() {
280322
sync hardware/interfaces
281323
sync libnativehelper
282324
sync prebuilts/build-tools
283-
sync prebuilts/clang-tools
284325
sync prebuilts/clang/host/linux-x86
326+
sync prebuilts/clang-tools
285327
sync prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8
286328
sync prebuilts/go/linux-x86
287329
sync prebuilts/misc
@@ -327,17 +369,9 @@ android_repo_v10() {
327369
sync build/make
328370
sync build/blueprint
329371
sync build/soong
330-
sync external/apache-xml
331-
sync external/avb
332-
sync external/boringssl
333-
sync external/bouncycastle
334372
sync external/clang
335373
sync external/compiler-rt
336-
sync external/conscrypt
337-
sync external/e2fsprogs
338374
sync external/elfutils
339-
sync external/expat
340-
sync external/icu
341375
sync external/jemalloc
342376
sync external/jemalloc_new
343377
sync external/libcxx
@@ -347,24 +381,12 @@ android_repo_v10() {
347381
sync external/llvm
348382
sync external/lzma
349383
sync external/mksh
350-
sync external/pcre
351-
sync external/protobuf
352-
sync external/python/cpython2
353-
sync external/python/six
354-
sync external/robolectric-shadows
355-
sync external/selinux
356-
sync external/sqlite
357384
sync external/turbine
358385
sync external/vixl
359386
sync external/zlib
360-
sync external/zopfli
361-
sync prebuilts/jdk/jdk8
362387
sync prebuilts/jdk/jdk9
363388
sync external/golang-protobuf
364-
sync frameworks/base
365389
sync frameworks/hardware/interfaces
366-
sync frameworks/opt/setupwizard
367-
sync libcore
368390
sync libnativehelper
369391
sync prebuilts/go/linux-x86
370392
sync prebuilts/build-tools
@@ -381,9 +403,6 @@ android_repo_v10() {
381403
sync system/libhidl
382404
sync system/tools/aidl
383405
sync system/tools/hidl
384-
sync system/tools/xsdc
385-
sync tools/apksig
386-
sync tools/metalava
387406

388407
case "${arch}" in
389408
arm)
@@ -411,15 +430,11 @@ android_repo_v10() {
411430
rm bionic/tests/headers/Android.bp
412431
rm bionic/tests/headers/posix/Android.bp
413432

414-
#rm frameworks/base/core/xsd/vts/Android.mk
415-
#rm frameworks/base/packages/SettingsLib/tests/robotests/Android.mk
416-
# include test/vts/tools/build/Android.host_config.mk
417-
418433
python3 /remove_soong_tests.py
419-
sed -i -z -e 's/include test\/vts\/tools\/build\/Android.host_config\.mk//g' frameworks/base/services/core/xsd/vts/Android.mk
420-
#sed -i -z -e 's/cc_test {.*}//g' bionic/libc/malloc_debug/Android.bp
421-
#sed -i -z -e 's/cc_test {.*}//g' bionic/libc/malloc_hooks/Android.bp
422-
#sed -i -z -e 's/cc_test {.*}//g' bionic/linker/Android.bp
434+
}
435+
436+
sync() {
437+
python3 ./repo sync -c --no-clone-bundle "${1}"
423438
}
424439

425440
# TODO(ahuszagh) Remove this

0 commit comments

Comments
 (0)