Build Linux For Raspberry Pi 2/3

Building Linux Kernel

Checkout cross compiler toolchain:-
git clone https://github.com/raspberrypi/tools

and export path for tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/

better put it in your .bashrc

You can also build 64 bit, however, at the moment, default/recommended is 32 bit.

Check out the latest source of kernel from:-
git clone — depth=1 https://github.com/raspberrypi/linux

Configure for Rapsberry Pi 2/3 boards:-
cd linux
KERNEL=kernel7
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig

Build the kernel source:-
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs

References:-
https://www.raspberrypi.org/documentation/linux/kernel/building.md