1 搭建环境Ubuntu22基于WLS2sudo apt update sudo apt upgrade -y sudo apt install -y git curl python3 build-essential libssl-dev libffi-dev libpython3-dev \ openjdk-17-jdk zip unzip bison flex m4 libncurses5-dev x11proto-core-dev libx11-dev \ lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc ccache # 配置git基础信息必须否则repo会报错 git config --global user.name aosp-dev git config --global user.email aospexample.com拉代码cd ~/aosp rm -rf .repo使用清华的镜像。同时repo init 追加 --repo-url 参数 绕过默认谷歌地址。repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest \ -b android-14.0.0_r40 \ --repo-urlhttps://mirrors.tuna.tsinghua.edu.cn/git/git-repo \ --no-repo-verifyrepo sync -j4 -c --no-tagsjcLAPTOP-E7FQL6BT:~/qssitest$ repo init --depth1 --current-branch -u https://git.codelinaro.org/clo/la/la/system/manifest.git -b release -m AU_LINUX_ANDROID_LA.QSSI.14.0.R1.14.00.00.1001.246.00.xml --repo-urlhttps://git.codelinaro.org/clo/tools/repo.git --repo-branchqc-stable Get https://git.codelinaro.org/clo/la/la/system/manifest.git remote: Enumerating objects: 1461, done. remote: Counting objects: 100% (1461/1461), done. remote: Compressing objects: 100% (100/100), done. remote: Total 1461 (delta 1453), reused 1364 (delta 1361), pack-reused 0 (from 0) Receiving objects: 100% (1461/1461), 38.08 MiB | 37.00 KiB/s, done. Resolving deltas: 100% (1453/1453), done. From https://git.codelinaro.org/clo/la/la/system/manifest * [new branch] release - origin/release Updating files: 100% (3917/3917), done. Your identity is: jc chenjiang-cawear.ai If you want to change this, please re-run repo init with --config-name repo has been initialized in /home/jc/qssitest一共的空间占用大概是168G。jcLAPTOP-E7FQL6BT:~/aosp$ du -sh . 168G .文件大概如下jcLAPTOP-E7FQL6BT:~/aosp$ ls Android.bp WORKSPACE bionic bootstrap.bash cts developers device frameworks kernel libnativehelper pdk prebuilts system toolchain BUILD art bootable build dalvik development external hardware libcore packages platform_testing sdk test tools2 编译jcLAPTOP-E7FQL6BT:~/aosp$ source build/envsetup.sh jcLAPTOP-E7FQL6BT:~/aosp$ lunch aosp_x86_64-eng PLATFORM_VERSION_CODENAMEREL PLATFORM_VERSION14 PRODUCT_INCLUDE_TAGScom.android.mainline TARGET_PRODUCTaosp_x86_64 TARGET_BUILD_VARIANTeng TARGET_ARCHx86_64 TARGET_ARCH_VARIANTx86_64 TARGET_2ND_ARCHx86 TARGET_2ND_ARCH_VARIANTx86_64 HOST_OSlinux HOST_OS_EXTRALinux-6.18.33.1-microsoft-standard-WSL2-x86_64-Ubuntu-26.04-LTS HOST_CROSS_OSwindows BUILD_IDUD2A.231203.057.A1 OUT_DIRout jcLAPTOP-E7FQL6BT:~/aosp$ m -j$(nproc) 20:03:43 ************************************************************ 20:03:43 You are building on a machine with 15.4GB of RAM 20:03:43 20:03:43 The minimum required amount of free memory is around 16GB, 20:03:43 and even with that, some configurations may not work. 20:03:43 20:03:43 If you run into segfaults or other errors, try reducing your 20:03:43 -j value. 20:03:43 ************************************************************3 运行