1.Ubuntu系统的安装
最好使用ubuntu18.0.4
2.工具环境包的安装
// 安装Android8.1源码编译环境
sudo apt-get install openjdk-8-jdk --------------ok
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
--------------ok
sudo apt-get install -y flex bison gperf build-essential libncurses5-dev:i386
--------------ok
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
--------------ok
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
------------Unable to locate package libesd0-dev 参考https://blog.csdn.net/sophiahongku/article/details/106522495
sudo apt-get install gnupg flex bison gperf build-essential
---------------ok
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
-----------ok
sudo apt-get install libc6-dev-i386
---------------libc6-dev-i386 is already the newest version (2.27-3ubuntu1.6).
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
------------ok
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
---------------ok
sudo apt-get install lib32z-dev ccache
---------------ok
sudo apt-get install u-boot-tools
---------------ok
3.解压代码+git apply导入patch
git apply xxx/xx/xx/x(patch所在的文件路径)
【精选】Git生成和导入Patch_git导入patch_ChampionDragon的博客-CSDN博客
4.编译
4.1 FAILED:setup-jack-server
解决:参考Ubuntu aosp 编译过程中Jack server SSL error 错误解决方法_ubuntu ssl error-CSDN博客
4.2 FAILED: out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex
/bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex.rsp
Out of memory error (version 1.3-rc7 'Douarn' (445000 d7be3910514558d6715ce455ce0861ae2f56925a by android-jack-team@google.com)).
GC overhead limit exceeded.
解决:
Ubuntu18.04/20.04虚拟机编译Android4/5/6/7/8/9/10/11系统源码的常见问题解决方法 - 简书
解决方案一(执行命令:ulimit -c unlimited)
命令解释
ulimint -a 用来显示当前的各种用户进程限制
Linux对于每个用户,系统限制其最大进程数,为提高性能,可以根据设备资源情况,
设置个Linux用户的最大进程数,一些需要设置为无限制:
数据段长度无限制
ulimit -d unlimited
最大内存大小无限制
ulimit -m unlimited
堆栈大小无限制
ulimit -s unlimited
core文件大小无限制
ulimit -c unlimited