FydeOS-ArcHero/anbox_platform_manifests 7.1 编译笔记

本文参考编译:

编译环境:Ubuntu 22.04 LTS
硬盘空间:建议500G
内存:建议32G

安装包

$ sudo apt update
$ sudo apt-get install openjdk-8-jdk openjdk-8-jre

下载编译Anbox

$ mkdir $HOME/anbox-work
$ cd $HOME/anbox-work
# anbox分支是7.1版本
$ repo init -u https://github.com/FydeOS-ArcHero/anbox_platform_manifests.git -b anbox
$ repo sync -j4
$ . build/envsetup.sh
$ lunch anbox_x86_64-userdebug
$ make -j4

# 开始编译android镜像
# These two packages are required
$ sudo apt-get install -y attr squashfs-tools
$ cd $HOME/anbox-work/vendor/anbox
$ scripts/create-package.sh \
    $PWD/../../out/target/product/x86_64/ramdisk.img \
    $PWD/../../out/target/product/x86_64/system.img

编译时长

i7-13700k 24核大概需要一个多小时。


问题汇总

授权问题

android.googlesource.com进行生成授权相关代码后在终端执行

error: cannot find symbol @nullable

参见

prebuilts/misc/linux-x86/bison/bison: No such file or directory

添加x86架构包

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))’ failed.

设置LOCALE

export LC_ALL=C

SSL error when connecting to the Jack server. Try ‘jack-diagnose’

After the two steps below were applied, the AOSP was successfully built.

Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms in /etc/java-8-openjdk/security/java.security file
Restart the jack server: cd /prebuilts/sdk/tools/ ./jack-admin kill-server ./jack-admin start-server

dex2oatd fails due to unexpected mmap address

FAILED: /bin/bash -c "(rm -f out/target/product/x86_64/obj/JAVA_LIBRARIES/javax.obex_intermediates/oat/x86/javalib.odex ) && (mkdir -p out/target/product/x86_64/obj/JAVA_LIBRARIES/javax.obex_intermediates/oat/x86/ ) && (ANDROID_LOG_TAGS=\"*:e\" out/host/linux-x86/bin/dex2oatd --runtime-arg -Xms64m --runtime-arg -Xmx512m --runtime-arg -classpath --runtime-arg \"&\" --boot-image=out/target/product/x86_64/dex_bootjars/system/framework/boot.art --dex-file=out/target/common/obj/JAVA_LIBRARIES/javax.obex_intermediates/javalib.jar --dex-location=/system/framework/javax.obex.jar --oat-file=out/target/product/x86_64/obj/JAVA_LIBRARIES/javax.obex_intermediates/oat/x86/javalib.odex --android-root=out/target/product/x86_64/system --instruction-set=x86 --instruction-set-variant=x86 --instruction-set-features=default --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info --abort-on-hard-verifier-error --no-inline-from=core-oj.jar   --compile-pic )"
FAILED: /bin/bash -c "(rm -f out/target/product/x86_64/obj/JAVA_LIBRARIES/javax.obex_intermediates/oat/x86/javalib.odex ) && (mkdir -p out/target/product/x86_64/obj/JAVA_LIBRARIES/javax.obex_intermediates/oat/x86/ ) && (ANDROID_LOG_TAGS=\"*:e\" out/host/linux-x86/bin/dex2oatd --runtime-arg -Xms64m --runtime-arg -Xmx512m --runtime-arg -classpath --runtime-arg \"&\" --boot-image=out/target/product/x86_64/dex_bootjars/system/framework/boot.art --dex-file=out/target/common/obj/JAVA_LIBRARIES/javax.obex_intermediates/javalib.jar --dex-location=/system/framework/javax.obex.jar --oat-file=out/target/product/x86_64/obj/JAVA_LIBRARIES/javax.obex_intermediates/oat/x86/javalib.odex --android-root=out/target/product/x86_64/system --instruction-set=x86 --instruction-set-variant=x86 --instruction-set-features=default --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info --abort-on-hard-verifier-error --no-inline-from=core-oj.jar   --compile-pic )"
 Attempting to fall back to imageless running. Error was: Failed to load /system image 

参考该patch
https://android-review.googlesource.com/c/platform/art/+/2226578/2/runtime/mem_map.cc#505
修复如下:

3 个赞