Raspberry Pi3

Build Kernel(Debian x64)


$ git clone https://github.com/raspberrypi/tools
$ sudo mv tools /opt/pi3
$ export PATH=$PATH:/opt/pi3/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/

Build Kernel

$ git clone --depth=1 https://github.com/raspberrypi/linux
$ cd linux
$ KERNEL=kernel7
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs

With sdb1 being the FAT (boot) partition, and sdb2 being the ext4 filesystem (root) partition.

$ mkdir -p mnt/fat32
$ mkdir -p mnt/ext4
$ sudo mount /dev/sdb1 mnt/fat32
$ sudo mount /dev/sdb2 mnt/ext4
$ sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install
$ sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
$ sudo scripts/mkknlimg arch/arm/boot/zImage mnt/fat32/$KERNEL.img
$ sudo cp arch/arm/boot/dts/*.dtb mnt/fat32/
$ sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
$ sudo cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/
$ sudo umount mnt/fat32
$ sudo umount mnt/ext4

Enable UART output for pi3

$ nano mnt/fat32/config.txt