Scratchpad – Building the Android Kernel

Posted by in scratchpad, on March 20, 2015

/* Initialize Environment and Download source */

/* Download specific kernel */
git clone

*** when download is finished, you will have an empty directory until you checkout something ***

/* list branches available */
git branch -a
git branch -a –contains <commit>

/* checkout what you are after (a specific branch and/or a specific build/commit) */
git checkout <commit>

/* GrabĀ  Cross Compiler */
git clone

/* add toolchain to your PATH */

*** my preference is to add it to bashrc ***

*** dirty issue, the kernel will append -dirty to the build. To get rid of that **
Modify include/config/kernel.release

*** modify Makefile ***
add configuration flag to setlocalversion to get rid of the dirty issue

*** example ***
$(Q)echo “$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion –save-scmversion $(srctree))” > $@

/** Prepare for building */

*** if you are building for a specific device, or want module support ***
** modify Makefile **
Add compiler option flag -fno-pic

Leave a Reply