android source code

ubuntu12.04 X64

终端依赖安装更新:

sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

源码存入目录:

mkdir /home/works/android/sourcecode
PATH=/home/works/android/sourcecode:$PATH #查看echo $PATH

curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > /home/works/android/sourcecode/repo
chmod a+x /home/works/android/sourcecode/repo

cd /home/works/android/sourcecode
repo init -u https://android.googlesource.com/platform/manifest
如果成功提示:repo has been initialized in /home/works/android/sourcecode,并生成了一个.repo隐藏文件夹

  若想让repo下载指定的branch而非master,可执行:

  repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.3_r1

下载源码:repo sync

编译:
配置Ccache编译缓存。将以下内容拷贝至/etc/profile中:export USE_CCACHE=1
source /etc/profile
cd /home/works/android/sourcecode
prebuilts/misc/linux-x86/ccache/ccache -M 50G
使用源码中build/envsetup.sh配置编译所需环境:
source build/envsetup.sh
lunch full-eng #明确待会儿编译的目标为模拟器上的android系统(真机不能用)
make

 

参考:

  Linux下使用Repo和Git下载Android源代码并编译

  把Android源代码加入SDK

  Android拓展系列--Android源码下载

posted @ 2013-09-20 14:21  WenEric  阅读(542)  评论(0编辑  收藏  举报