九鼎创展论坛

标题: Initializing a Build Environment [打印本页]

作者: jjj    时间: 2011-11-15 14:55
标题: Initializing a Build Environment
The "Getting Started" section describes how to set up your local work environment, how to use Repo to get the Android files, and how to build the files on your machine. To build the Android source files, you will need to use Linux or Mac OS. Building under Windows is not currently supported.
Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.


作者: jjj    时间: 2011-11-15 14:56
标题: Setting up a Linux build environment
本帖最后由 jjj 于 2011-11-15 14:56 编辑

The Android build is routinely tested in house on recent versions of Ubuntu LTS (10.04), but most distributions should have the required build tools available. Reports of successes or failures on other distributions are welcome.
Note: It is also possible to build Android in a virtual machine. If you are running Linux in a virtual machine, you will need at least 16GB of RAM/swap and 30GB or more of disk space in order to build the Android tree.
In general you will need:
  • Python 2.4 -- 2.7, which you can download from python.org.
  • JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both from java.sun.com.
  • Git 1.7 or newer. You can find it at git-scm.com.

Detailed instructions for Ubuntu 10.04+ follow.


作者: jjj    时间: 2011-11-15 14:57
标题: Installing the JDK
本帖最后由 jjj 于 2011-11-15 14:58 编辑

The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.

Java 6: for Gingerbread and newer
  1. $ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
  2. $ sudo apt-get update
  3. $ sudo apt-get install sun-java6-jdk
复制代码
Java 5: for Froyo and older
  1. $ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
  2. $ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
  3. $ sudo apt-get update
  4. $ sudo apt-get install sun-java5-jdk
复制代码

作者: jjj    时间: 2011-11-15 14:59
标题: Installing required packages
本帖最后由 jjj 于 2011-11-15 14:59 编辑

64-bit (recommended)
  1. $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  2.   zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
  3.   x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
  4.   libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
  5.   libxml2-utils
复制代码
On newer versions of Ubuntu such as 11.10 you may need to do the following:
  1. $ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
复制代码
32-bit (experimental)
  1. $ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  2.   zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
  3.   libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
  4.   libxml2-utils
复制代码

作者: jjj    时间: 2011-11-15 15:00
标题: Configuring USB Access
本帖最后由 jjj 于 2011-11-15 15:00 编辑

Under GNU/linux systems (and specifically under Ubuntu systems), regular users can't directly access USB devices by default. The system needs to be configured to allow such access.

The recommended approach is to create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it. must be replaced by the actual username of the user who is authorized to access the phones over USB.
  1. # adb protocol on passion (Nexus One)
  2. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
  3. # fastboot protocol on passion (Nexus One)
  4. SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
  5. # adb protocol on crespo/crespo4g (Nexus S)
  6. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
  7. # fastboot protocol on crespo/crespo4g (Nexus S)
  8. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
  9. # adb protocol on maguro (Galaxy Nexus)
  10. SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
  11. # fastboot protocol on maguro (Galaxy Nexus)
  12. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
复制代码
Those new rules take effect the next time a device is plugged in. It might therefore be necessary to unplug the device and plug it back into the computer.

This is known to work on both Ubuntu Hardy Heron (8.04.x LTS) and Lucid Lynx (10.04.x LTS). Other versions of Ubuntu or other variants of GNU/linux might require different configurations.




欢迎光临 九鼎创展论坛 (http://bbs.9tripod.com/) Powered by Discuz! X3.2