Docs: Adding kernel version/TARGET_PREBUILT_KERNEL
Bug: 11715246
Change-Id: I23b87a4dcce5f86391919d6778cedf36b4a50ff6
diff --git a/src/source/building-kernels.jd b/src/source/building-kernels.jd
index 3aef811..8e9fed1 100644
--- a/src/source/building-kernels.jd
+++ b/src/source/building-kernels.jd
@@ -122,9 +122,7 @@
<p>You will want to look at the git log for the kernel binary in the device
project that you are interested in.</p>
-
-
-Device projects are of the form device/<vendor>/<name>.</p>
+<p>Device projects are of the form device/<vendor>/<name>.</p>
<pre><code>$ git clone https://android.googlesource.com/device/ti/panda
$ cd panda
$ git log --max-count=1 kernel
@@ -135,6 +133,19 @@
The first entry in the log is the most recent, i.e. the one used to
build that kernel. You will need it at a later step.</p>
+
+<h2 id="id-version">Identifying kernel version</h2>
+<p>To determine the kernel version used in a particular system image, run the
+following command against the kernel file:</p>
+<pre><code>
+$ dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'
+</code></pre>
+<p>For Nexus 5 (hammerhead), this can be accomplished with:</p>
+<pre><code>
+$ bzgrep -a 'Linux version' vmlinux.bz2
+</code></pre>
+
+
<h2 id="downloading-sources">Downloading sources</h2>
<p>Depending on which kernel you want,</p>
<pre><code>$ git clone https://android.googlesource.com/kernel/common.git
@@ -183,6 +194,14 @@
<p>To build the tuna kernel, you may run the previous commands replacing all
instances of "panda" with "tuna".</p>
<p>
-The kernel binary is output as `arch/arm/boot/zImage`, and needs to be copied
+The kernel binary is output as: `arch/arm/boot/zImage` It can be copied
into the Android source tree in order to build the matching boot image.
</p>
+<p>Or you can include the <code>TARGET_PREBUILT_KERNEL</code> variable while
+using <code>make bootimage</code> or any other make command line that builds a
+boot image.</p>
+<pre><code>
+$ export TARGET_PREBUILT_KERNEL=$your_kernel_path/arch/arm/boot/zImage
+</code></pre>
+<p>That variable is supported by all devices as it is set up via
+device/common/populate-new-device.sh</p>