Scratchpad – Building the Android Kernel
Posted by bridgette in scratchpad, on March 20, 2015/* Initialize Environment and Download source */
https://source.android.com/source/building-kernels.html
/* Download specific kernel */
git clone https://android.googlesource.com/kernel/msm.git
*** 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 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
/* 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
–save-scmversion
*** 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 **
EXTRAVERSION
Add compiler option flag -fno-pic