Ubuntu 22.04 构建 Android 14
CPU 及内存
1 2 3 4 5 6 7
| CPU op-mode(s): 32-bit, 64-bit CPU(s): 32 On-line CPU(s) list: 0-31 CPU family: 6 CPU max MHz: 4000.0000 CPU min MHz: 800.0000 NUMA node0 CPU(s): 0-31
|
1 2
| total used free shared buff/cache available Mem: 60Gi 602Mi 59Gi 2.0Mi 448Mi 59Gi
|
磁盘空间
构建前磁盘空间情况
1 2 3 4 5 6 7 8
| Filesystem Size Used Avail Use% Mounted on tmpfs 6.1G 1.2M 6.1G 1% /run /dev/nvme0n1p3 591G 3.1G 563G 1% / tmpfs 31G 0 31G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/nvme0n1p2 197M 6.1M 191M 4% /boot/efi tmpfs 50M 0 50M 0% /usr/local/aegis/cgroup tmpfs 6.1G 4.0K 6.1G 1% /run/user/0
|
构建后磁盘情况
1 2 3 4 5 6 7
| Filesystem Size Used Avail Use% Mounted on tmpfs 6.1G 1.2M 6.1G 1% /run /dev/nvme0n1p3 591G 337G 230G 60% / tmpfs 31G 0 31G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/nvme0n1p2 197M 6.1M 191M 4% /boot/efi tmpfs 6.1G 4.0K 6.1G 1% /run/user/0
|
创建 SWAP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| swapon -s
swapoff -a
dd if=/dev/zero of=/swapfile bs=1M count=32768 dd if=/dev/zero of=/swapfile bs=1M count=65536 dd if=/dev/zero of=/swapfile bs=1M count=131072
mkswap /swapfile swapon /swapfile
swapon -s
|
安装依赖
1 2
| sudo apt-get update sudo apt-get install -y git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
|
安装 repo
1
| sudo apt-get install -y repo
|
或从 Google 下载
1 2 3 4
| mkdir ~/bin PATH=~/bin:$PATH curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo
|
准备构建环境
1 2 3 4 5 6 7 8 9 10 11 12
| mkdir AOSP && cd AOSP
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
git config --global user.name "YOUR_NAME" git config --global user.email "YOUR_EMAIL"
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-14.0.0_r28
repo sync
|
开始构建
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| source build/envsetup.sh
lunch
build_build_var_cache
lunch
lunch aosp_cf_x86_64_pc-userdebug
echo "$TARGET_PRODUCT-$TARGET_RELEASE-$TARGET_BUILD_VARIANT"
make -j$(nproc)
cd out/target/product/
|
References