Android
开源了,获取源代码祥见 http://source.android.com/download
我用的是Ubuntu Linux (i386),故步骤如下:
The Android build is routinely tested on recent versions of Ubuntu
(6.06 and later), but reports of successes or failures on other
distributions are welcome.
To set up your Linux development
environment, make sure you have the following:
Git
1.5.4 or newer. To
install Git and the GNU Privacy Guard, run
$
sudo
apt-get install git-core gnupg
JDK
5.0, update 12 or higher: run
$ sudo apt-get install
sun-java6-jdk
The following packages:
flex, bison, gperf, libsdl-dev,
libesd0-dev, libwxgtk2.6-dev (optional), build-essential, zip, curl. To
make sure you have all these packages, run
$ sudo apt-get install flex
bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev
build-essential zip curl libncurses5-dev
You might also want Valgrind, a
tool that will help you find memory leaks, stack corruption, array
bounds overflows, etc. To install it, run
$ sudo apt-get install
valgrind
Installing Repo
Repo is a tool that makes it
easier to work with Git in the context of Android. For more information
about Repo, see Using Repo and
Git.
To install, initialize, and configure Repo, follow these
steps:
Make sure you have a
~/bin directory
in your home directory, and check to be sure that this bin directory is
in your path:
$ cd ~
$ mkdir bin
$ echo $PATH
Download the repo script and make
sure it is executable:$ curl
http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x
~/bin/repo
Create an empty directory to hold
your working files:
$ mkdir
mydroid$ cd mydroid
Run repo
init to bring down the latest version of Repo with all
its most recent bug fixes. You must specify a URL for the
manifest:
$ repo
init -u
git://android.git.kernel.org/platform/manifest.git
When prompted, configure Repo with
your real name and email address. If you plan to submit code, use an
email address that is associated with a Google account.
A successful initialization will end
with a message such as repo initialized in
/mydroid
Your client directory should now
contain a .repo directory
where files such as the manifest will be kept. What will my name and email be
used for?
To
use the Gerrit code-review tool, you
will need an email address that is connected with a registered Google account
(which
does not have to be a Gmail address). Make sure this is a
live address at which
you can receive messages. The real name that you provide here
will show up in attributions for your code
submissions.
What is a manifest file?
The
Android source files are divided among a number of different repositories.
A manifest file
contains a mapping of where the files from these repositories will be
placed within your working directory when you synchronize your files.
Getting the files
To pull down files to your working
directory from the repositories as specified in the default manifest, run
$ repo sync
For more about repo sync and other Repo
commands, see Using Repo and
Git.
The Android source files will be
located in your working directory under their project
names.
Building the codeTo build the files, run make from within your
working directory:
$ cd
~/mydroid
$ make
If your build fails, complaining about a missing "run-java-tool", try
setting the ANDROID_JAVA_HOME env var to $JAVA_HOME before making.
E.g.,
$ export
ANDROID_JAVA_HOME=$JAVA_HOME
What's next?To
learn about reporting an issue and searching previously reported issues,
see Report bugs
. For
information about editing the files and uploading changes to the
code-review server, see Contribute
.