Skip to content

Commit

Permalink
Use a newer android sdk for arm and x86 (v24 -> v28)
Browse files Browse the repository at this point in the history
  • Loading branch information
fkm3 committed Apr 22, 2022
1 parent 50bdc64 commit 8a64a22
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
7 changes: 4 additions & 3 deletions ci/android-install-sdk.sh
Expand Up @@ -16,11 +16,12 @@ unzip -q -d sdk/cmdline-tools commandlinetools-linux-${SDK}_latest.zip

case "$1" in
arm | armv7)
api=24
image="system-images;android-${api};default;armeabi-v7a"
api=28
# Using the arm64 image because there is no armeabi-v7a image for api>24.
image="system-images;android-${api};google_apis;arm64-v8a"
;;
aarch64)
api=24
api=28
image="system-images;android-${api};google_apis;arm64-v8a"
;;
i686)
Expand Down
26 changes: 18 additions & 8 deletions ci/android-sysimage.sh
Expand Up @@ -19,20 +19,30 @@ main() {

local system
system="$(find . -name system.img)"

# The ext4 partition of this particular version of "system.img" is offset.
# `e2cp` can't handle the offset, so we use `dd` to trim the start of the
# file.
#
# The offset number might change for future system.img files, look at the
# fdisk output to adjust it when upgrading the system.img.
fdisk -l "$system" # Sector size 512, partition start 2048.
fallocate -c -o 0 -l 1048576 "$system"

mkdir -p ${dest}/{bin,lib,lib64}

# Extract android linker and libraries to /system
# This allows android executables to be run directly (or with qemu)
if [ "${arch}" = "x86_64" ] || [ "${arch}" = "arm64" ]; then
e2cp -p "${system}:/bin/linker64" "${dest}/bin/"
e2cp -p "${system}:/lib64/libdl.so" "${dest}/lib64/"
e2cp -p "${system}:/lib64/libc.so" "${dest}/lib64/"
e2cp -p "${system}:/lib64/libm.so" "${dest}/lib64/"
e2cp -p "${system}:/system/bin/linker64" "${dest}/bin/"
e2cp -p "${system}:/system/lib64/libdl.so" "${dest}/lib64/"
e2cp -p "${system}:/system/lib64/libc.so" "${dest}/lib64/"
e2cp -p "${system}:/system/lib64/libm.so" "${dest}/lib64/"
else
e2cp -p "${system}:/bin/linker" "${dest}/bin/"
e2cp -p "${system}:/lib/libdl.so" "${dest}/lib/"
e2cp -p "${system}:/lib/libc.so" "${dest}/lib/"
e2cp -p "${system}:/lib/libm.so" "${dest}/lib/"
e2cp -p "${system}:/system/bin/linker" "${dest}/bin/"
e2cp -p "${system}:/system/lib/libdl.so" "${dest}/lib/"
e2cp -p "${system}:/system/lib/libc.so" "${dest}/lib/"
e2cp -p "${system}:/system/lib/libm.so" "${dest}/lib/"
fi

# clean up
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/x86_64-linux-android/Dockerfile
Expand Up @@ -18,7 +18,7 @@ RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
# We do not run x86_64-linux-android tests on an android emulator.
# See ci/android-sysimage.sh for information about how tests are run.
COPY android-sysimage.sh /android/
RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip
RUN bash /android/android-sysimage.sh x86_64 x86_64-28_r04.zip

ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
Expand Down

0 comments on commit 8a64a22

Please sign in to comment.