Pageviews

Thursday, January 23, 2014

How to download the latest Android Kernel source code for Nexus 7 v2 kitkat?

This post is based on Pete's blog.

1, Download the kernel source code using GIT.
git clone https://android.googlesource.com/kernel/msm.git kernel

...

Resolving deltas: 100% (2634067/2634067), done.

2, Use git branch -a to display local branch and remote branch ( -a means show remote branches).
git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/android-msm-2.6.35
  remotes/origin/android-msm-3.9-usb-and-mmc-hacks
  remotes/origin/android-msm-flo-3.4-jb-mr2
  remotes/origin/android-msm-mako-3.4-jb-mr1
  remotes/origin/android-msm-mako-3.4-jb-mr1-fr
  remotes/origin/android-msm-mako-3.4-jb-mr1-kgsl
  remotes/origin/android-msm-mako-3.4-jb-mr1.1
  remotes/origin/android-msm-mako-3.4-jb-mr2
  remotes/origin/android-msm-sony-cm-jb-3.0
  remotes/origin/master
3, check out the source code version for your device.
git checkout android-msm-flo-3.4-jb-mr2

4, Let me spare you the suspense there: As "documented" on their page, Google don't actually use branches or even tags for their development. Instead they force you to use an sha1 reference that's not attached to any helpful entity, in order to figure out the branch you should pick. Moreover, what they advise you to do to get that SHA is go for another large download of pointless binary data (650 MB) containing all the revision of their kernel files. Well, not everybody's running on Google Fibre, and my ISP also enforces quotas, so, since we're smarter than this, we're going to avoid downloading 650 MB in exchange of a few SHA bytes. Instead, we'll head directly tohttps://android.googlesource.com/device/asus/flo-kernel and look at the most recent "flo: prebuilt kernel", which, at the time of this post, is:   
https://android.googlesource.com/device/asus/flo-kernel/+/0c28782f203753a3ffb30b4aac7feb77df122949

flo: update prebuilt kernel
dafe22c ARM: 7809/1: perf: fix event validation for software group leaders
Bug: 11260636
Signed-off-by: Ed Tam <etam@google.com>

dafe22c is the SHA tag that you would like to refer to.

5, Checkout the latest revision of the source code.
git checkout -b android-4.3_r2.1 365a6e0