1. 安装JDK
jdk1.6
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
jdk1.5
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
$ sudo apt-get update
$ sudo apt-get install sun-java5-jdk
安装必要的工具
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils
下载android2.2的源代码
安装 Repo
-
Make sure you have a bin/ directory in your home directory, and that it is included in your path:
$ mkdir ~/bin $ PATH=~/bin:$PATH
-
Download the Repo script and ensure it is executable:
$ curl https://android.git.kernel.org/repo > ~/bin/repo $ chmod a+x ~/bin/repo
-
The MD5 checksum for repo is bbf05a064c4d184550d71595a662e098
-
-
Create an empty directory to hold your working files:
$ mkdir WORKING_DIRECTORY $ cd WORKING_DIRECTORY
-
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, which specifies where the various repositories included in the Android source will be placed within your working directory.$ repo init -u git://android.git.kernel.org/platform/manifest.git
To check out a branch other than "master", specify it with -b:
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo
可能被黑了,替代方案
curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" >~/bin/repo
chmod a+x ~/bin/repo
PATH=~/bin:$PATH
cd your_download_folder
repo init -u git://codeaurora.org/platform/manifest.git -b gingerbread
同步代码
repo sync
下载android2.2 的linux内核代码
mkdir android_kernel
2. cd android_kernel
3. git clone git://android.git.kernel.org/kernel/common.git (下载默认版本内核源码)
下面是git常用的命令示例:
4. cd common
5. git branch(查看当前分支,结果为android-2.6.27)
6. git branch -r(显示远程branch列表)
origin/HEAD
origin/android-2.6.25
origin/android-2.6.27
origin/android-2.6.29
origin/android-2.6.32
origin/android-goldfish-2.6.27
origin/android-goldfish-2.6.29
7. git tag (显示tag列表,下面截取一部分结果)
8. git checkout -b android-2.6.29 v2.6.29 (检出一个新branch android-2.6.29)
git checkout -b android-2.6.25 v2.6.25 (检出一个新branch android-2.6.25)
9. git branch -d android-2.6.27 (删除branch android-2.6.27)
10. git checkout android-2.6.29 (切换至brach android-2.6.29)
11. git format-patch android-2.6.25..android-2.6.29 (会生成4万个patch)