环境信息:
Ubuntu:v 12.04
Vmware 6.7
具体步骤:
1 . 初始化编译环境
设置编译环境:
- 安装Python 2.6 -- 2.7 命令:sudo apt-get install python-setuptools
参考:http://pymcu.com/Installation.html#LinInstall
安装成功验证命令: python --version
- 安装GNU Make 3.81 -- 3.82 命令:sudo apt-get install build-essential
参考:https://help.ubuntu.com/community/InstallingCompilers
安装成功验证命令: make --version
- 安装JDK 6 命令:http://blog.csdn.net/luhuajcdd/article/details/8777926
参考:http://www.liberiangeek.net/2012/07/download-and-install-sun-java-6-7-in-ubuntu-12-04-precise-pangolin-easily-with-this-script/
安装成功验证命令: java -version
- 安装Git 1.7 or newer 命令:sudo apt-get install git
参考:https://www.digitalocean.com/community/articles/how-to-install-git-on-ubuntu-12-04
安装成功验证命令: git --version
2.安装必须的软件(
Ubuntu 12.04
) sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libglapi-mesa:i386 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
3. 配置USB访问文件位置:/etc/udev/rules.d/51-android.rules
内容:
# adb protocol on passion (Nexus One)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"# fastboot protocol on passion (Nexus One)SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"# adb protocol on crespo/crespo4g (Nexus S)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"# fastboot protocol on crespo/crespo4g (Nexus S)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"# adb protocol on stingray/wingray (Xoom)SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"# fastboot protocol on stingray/wingray (Xoom)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"# adb protocol on maguro/toro (Galaxy Nexus)SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"# fastboot protocol on maguro/toro (Galaxy Nexus)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"# adb protocol on panda (PandaBoard)SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"# fastboot protocol on panda (PandaBoard)SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"# usbboot protocol on panda (PandaBoard)SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"# usbboot protocol on panda (PandaBoard ES)SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"# adb protocol on grouper/tilapia (Nexus 7)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0600", OWNER="<username>"# fastboot protocol on grouper/tilapia (Nexus 7)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0600", OWNER="<username>"# adb protocol on manta (Nexus 10)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0600", OWNER="<username>"# fastboot protocol on manta (Nexus 10)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"
<username>要换成真正需要访问USB的用户名字。
4. 设置ccache
在~/.bashrc中添加:
export USE_CCACHE=1
缓存大小建议在50 - 100 GB。下载了源代码需要运行以下命令(适用于4.0或者之后的版本):
prebuilts/misc/linux-x86/ccache/ccache -M 50G