ubuntu 16下载编译android6x源码
2018-12-31 本文已影响27人
草蜢的逆袭
vm-tools安装
首先将你的用户切换到root下。su root 。如果root没有设置过密码可以输入sudo passwd root设置一下root密码。再用su root切换。切换好之后在命令行输入如下指令###
cd 文档
ls
tar -xczf VMware....(解压那个文件)
ls
cd vmware-tools-distrib
./vmware-install.pl
android源码下载
git安装及配置##
$ sudo apt-get install git
$ git config --global user.name xxxx
$ git config --global user.email xxxx
jdk安装
$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-get update
$ sudo apt-get install openjdk-7-jdk
安装依赖
$ sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386
$ sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
$ sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
$ sudo apt-get install git-core gnupg flex bison gperf build-essential
$ sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
$ sudo apt-get install libc6-dev-i386
$ sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
$ sudo apt-get install lib32z-dev ccache
$ sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
下载 repo 工具
mkdir ~/bin
PATH=~/bin:$PATH
curl -sSL 'https://gerrit-googlesource.proxy.ustclug.org/git-repo/+/master/repo?format=TEXT' |base64 -d > ~/bin/repo
chmod a+x ~/bin/repo
然后建立一个工作目录(名字任意)
mkdir and6x
cd and6x
初始化仓库
可以编辑 ~/bin/repo
REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
// repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-6.0.0_r4
或使用shell脚本,以下是脚本内容download.sh
#!/bin/bash
echo "======start repo sync======"
repo sync # 第一次下载android源代码
while [ $? != 0 ]; do
echo "======sync failed, re-sync again======"
sleep 2
repo sync # 如果出错,隔2秒后回继续调用repo sync下载android源代码
done
chmod 777 download.sh
./download.sh
原文:https://blog.csdn.net/a992036795/article/details/53462068
android源码编译
(1) 修改 mydroid/art/build/Android.common_build.mk 文件,定位到75行,将下面的代码
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := false
endif
ART_HOST_CLANG := false要设置成false要不然在编译的过程中会出现下面的错误:
make: *** [out/host/linux-x86/obj/lib/libartd.so] Error 1
warning: string 'gsm_alphabet_default_charset' has no default translation.
#### make failed to build some targets (01:11:24 (hh:mm:ss)) ####
(2)在 .bashrc文件末尾添加:export USE_CCACHE = 1
echo export USE_CCACHE=1 >> ~/.bashrc
(3) 为了提高编译效率,设置编译器高速缓存(不然很容易提示内存不够之类的问题)##
prebuilts/misc/linux-x86/ccache/ccache -M 50G
(4) 终端执行下面命令,提高Xmx的内存##
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
(5) 接着导入编译Android源码所需的环境变量和其它参数
source build/envsetup.sh
(6)lunch 选择1
(7)make -j16 (j后面跟cpy个数,根据具体电脑实际情况设置)
(8)编译成功如下图所示##
image运行源码
进入源码目录
source build/envsetup.sh
lunch aosp_arm-eng
emulator