HOW TO COMPILE stand alone KERNEL binary: first of all, tegra devices doesn't allow kernel in tree compilation, that means we need to compile whole SDK, unless we do the following.
STEP 1: copy your kernel folder from the source to another directory, because we need to make a change a compile kernel only that won't alllow us to compile whole SDK later.
STEP 2: download this file and copy it to arch/arm/boot/dts (to the folder where you copied kernel)
https://mega.nz/#!U5gw1DqK!UNONoBdfahGtmIwMxdDiv-LW1VwYGDzPlzPjGKFSr-ESTEP 3: We need to edit the following file located at drivers/staging/ozwpan/ozeventtrace.h
The end of the fle should be that way:
#define TRACE_INCLUDE_PATH ../../drivers/staging/ozwpan/
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE ozeventtrace
#include <trace/define_trace.h>
With that we are reasy compile kernel binary. Nvidia uses arm eabi 4.7. It's located in prebuilts/gcc folders of your whole SDK source. I personally a folder called Toolchains with all the toolchains I use. So if you have your toolchain in other location, just change my example with your path to your toolchain:
Now we open terminal, we go to our new kernel directory and run followin command.
1- make ARCH=arm CROSS_COMPILE=~/toolchain/arm-eabi-4.7/bin/arm-eabi- clean (this step is optional to clean previous buils if there are any)
2- make ARCH=arm CROSS_COMPILE=~/toolchain/arm-eabi-4.7/bin/arm-eabi- tegra12_android_defconfig
3- make ARCH=arm CROSS_COMPILE=~/toolchain/arm-eabi-4.7/bin/arm-eabi- tegra124-tn8-e1780-1100-a03-battery.dtb
4- make ARCH=arm CROSS_COMPILE=~/toolchain/arm-eabi-4.7/bin/arm-eabi- -j5
After it compiles we'll see out zImage binary kernel under arch(arm/boot
If we add new modules to the kernel we can run the following commands: make ARCH=arm CROSS_COMPILE=~/toolchain/arm-eabi-4.7/bin/arm-eabi- INSTALL_MOD_PATH=build_modules modules
and then
make ARCH=arm CROSS_COMPILE=~/toolchain/arm-eabi-4.7/bin/arm-eabi- INSTALL_MOD_PATH=build_modules modules_install
we will get our new modules under build_modules directory
Have in mind this is only a binary kernwl without a ramdisk, so we need to include it inside our boot.img. You can get boot.img from your already compiled source, or just take from the firmware JXD provides.
We can use a tool like Android Image Kitchen to umpack and repack a boot,img, we just need to replace our new zImage for the one included in boot,img. We can also can make changes to the ramdisk if we want to. there are many image kitchen tools to do that, like this one:
http://forum.xda-developers.com/showthread.php?t=2073775And that's all. Happy compiling.