AOSP
源码里不包含内核源代码,需要单独下载。不同的内核对应不同的代码仓库,下面我们使用模拟器内核代码来学习。
下载模拟器对应的内核代码:
$ cd $WORKING_DIRECTORY
$ mkdir kernel
$ cd kernel
$ git clone https://android.googlesource.com/kernel/goldfish.git
被墙的话,使用国内镜像:
$ git clone https://aosp.tuna.tsinghua.edu.cn/kernel/goldfish
或
$ git clone git://mirrors.ustc.edu.cn/aosp/kernel/goldfish.git
切换到我们需要的分支:
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/android-3.10
remotes/origin/android-3.18
remotes/origin/android-3.4
remotes/origin/android-goldfish-2.6.29
remotes/origin/android-goldfish-3.10
remotes/origin/android-goldfish-3.10-k-dev
remotes/origin/android-goldfish-3.10-l-mr1-dev
remotes/origin/android-goldfish-3.10-m-dev
remotes/origin/android-goldfish-3.10-n-dev
remotes/origin/android-goldfish-3.18
remotes/origin/android-goldfish-3.18-dev
remotes/origin/android-goldfish-3.4
remotes/origin/android-goldfish-3.4-l-mr1-dev
remotes/origin/android-goldfish-4.4-dev
remotes/origin/heads/for/android-goldfish-3.18-dev
remotes/origin/linux-goldfish-3.0-wip
remotes/origin/master
$ git checkout android-goldfish-2.6.29