Reprinted: http://www.zzzyb.com/html/fuwuqijishu/Linux/20090822/13345.html
Thanks to the original author!
Bytes -----------------------------------------------------------------------------------------------------------------
1. First install some packages dependent on git.
yum install zlib-devel
yum install openssl-devel
yum install perl
yum install cpio
yum install expat-devel
yum install gettext-devel
Next, if you have installed curl, skip this step. If not, install it.
wget http://curl.haxx.se/download/curl-7.18.0.tar.gz
tar xzvf curl-7.18.0.tar.gz
cd curl-7.18.0
./configure
make
make install
Check whether/usr/local/lib is in the lD. So. conf file. This file is prepared for Git-http-push.
VI/etc/lD. So. conf
# Insert the following code
/Usr/local/lib
Save the file and run:
/sbin/ldconfig
We 'd better download git and install it.
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
tar xzvf git-latest.tar.gz
cd git-{date}
autoconf
./configure --with-curl=/usr/local
make
make install
2. Download the repo Tool
$ Mkdir $ home/bin
$ VI. bashrc
Join
Export Path = $ home/bin: $ path
$ Source. bashrc
$ Curl http://android.git.kernel.org/repo> $ home/bin/Repo
$ CD $ home/bin
$ Chmod + x Repo
3. Export the android Project
$ Cd
$ Mkdir android
$ CD android
$ Repo init-u git: // android.git.kernel.org/platform/manifest.git
Complete the prompt configuration, so that the directory we created has been linked to the Google Android source code library.
4. Download the source code of Android platform.
$ Repo sync
Because the source code of Android is very large, the complete code is now more than 3 GB, so the most sub-folder for Synchronous download. To download kernel:
$ Repo sync Kernel
If you want to use a branch instead of the Code on the main line, you need to use the-B parameter to specify the branch name, for example:
Repo init-u git: // android.git.kernel.org/platform/manifest.git-B cupcake
In another case, we only need the code of a project, such as kernel/common, without Repo. Just use git.
Git clone git: // android.git.kernel.org/kernel/common.git
This also takes a lot of time, because it will copy the entire Linux kernel code.
If you need a branch code, use git checkout. For example, if we have just obtained the kernel/common. Get code, we should first enter the common directory and then use the following command:
Git checkout origin/Android-goldfish-2.6.27-B goldfish
So we built a local Android-goldfish-2.6.27 branch named goldfish, and the code was synchronized with the android-goldgish-2.6.27. You can use git branch to list all local branches.
5. Synchronize the version Library
UseRepo syncCommand to synchronize the entire android code tree to the local device. Similarly, we can use
Repo sync project1 project2...
This command is used to synchronize several projects.
To synchronize a single project in Android, you only need to execute a simple
Git pull
You can.
Now, you can do other things to allow the computer to automatically download the source code.