Ubuntu18编译Android10源代码
Ubuntu18编译Android10源代码QQ1274807709、QQ3619049616
机型:piexl/Vmware虚拟机
前言
仅个人环境编译测试,部分版本对应的版本BUG很多,不做多排除BUG
一、链接引用
https://source.android.com/source/requirements.html #安卓各版本源码编译要求
https://source.android.com/source/build-numbers.html #代号和细分版本号
https://source.android.com/source/initializing.html #搭建编译环境
https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/ #下载源代码(清华大学开源软件镜像站)
https://source.android.com/setup/build/building #准备编译
https://source.android.com/setup/building-kernels #编译内核
https://source.android.com/source/running.html #谷歌手机刷机教程
http://download.lineageos.org.cn/ #LineageOS 镜像下载
http://androidxref.com/ #安卓源码阅读在线版
https://msdn.itellyou.cn/ #Windows系统
http://mirrors.aliyun.com/ubuntu-releases/ #Ubuntu阿里云镜像
https://developers.google.com/android/images #谷歌手机工厂镜像
https://developers.google.com/android/drivers #谷歌手机驱动下载
https://android.googlesource.com/ #安卓开放源代码项目
个人整理
细分版本 分支版本 版本代号 支持的设备
KTU84P android-4.4.4_r1 KitKat Nexus 4、5
LMY48M android-5.1.1_r14 Lollipop Nexus 4、5
MMB29V android-6.0.1_r17 Marshmallow Nexus 5、5X、6P
N2G47O android-7.1.2_r8 Nougat Nexus 5X、6P、Pixel
opm1.171019.011 android-8.1.0_r1
pq2a.190405.003 android-9.0.0_r35
#VM虚拟机复制BUG解决
虚拟机可能会造成VMTools无法使用,可以使用命令进行恢复:
sudo apt-get autoremove open-vm-tools
sudo apt-get install open-vm-tools
sudo apt-get install open-vm-tools-desktop
#Python版本BUG解决:默认可能是2.7.x版本,要换成3.5x
sudo apt install python3
sudo apt install python
sudo apt install python-minimal
python -> /etc/alternatives/python*
update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python (python) in auto mode
二、使用步骤
1.获取源代码
sudo apt-get update
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip
git config --global user.name "a1274807709"
git config --global user.email "1274807709@qq.com"
chmod 777 repo
mkdir -p Android10.0.0_r5
cd Android10.0.0_r5
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-10.0.0_r5
repo sync --no-clone-bundle
三、存在的报错解决
FAILED: out/target/product/generic_x86/obj/RENDERSCRIPT_BITCODE/libclcore.bc_intermediates/rs_matrix.bc
/bin/bash -c “PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-3289846/bin/clang -Iframeworks/rs/script_api/include -Iexternal/clang/lib/Headers -MD -DRS_VERSION=24 -std=c99 -c -O3 -fno-builtin -e
mit-llvm -target renderscript32-linux-androideabi -fsigned-char -D__i386__ -Wno-deprecated -Werror -Werror -Wall -Wextra -Iframeworks/rs/cpu_ref -DRS_DECLARE_EXPIRED_APIS -x renderscript frameworks/rs/
driver/runtime/rs_matrix.c -o out/target/product/generic_x86/obj/RENDERSCRIPT_BITCODE/libclcore.bc_intermediates/rs_matrix.bc”
prebuilts/clang/host/linux-x86/clang-3289846/bin/clang.real: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
命令
sudo apt install libncurses5