Crux-arm RaspberryPi2 Linux Kernel

NOTE: This README is wip. Some instructions are either vague or missing.

upstream sources:
  https://www.kernel.org/pub/linux/kernel/v4.x
  git://git.kernel.org/pub/scm/linux/kernel/git/statble/linux-stable.git
  https://github.com/raspberrypi/linux

Type make or make all to build kernel image, the device tree files/overlays,
modules and related files. You may also find some of the other targets useful;
either for rebuilding only a certain target or possibly downloading files for
later offline build. These currently include:

all:        build all targets
clean:      clean out built files/directories
distclean:  clean, plus remove even downloaded files also
files:      download all remote files
config:     unpatch the kernel and copy the default config into the kernel tree
image:      build zImage and rpi2 prep'd kernel image files
dtb:        build device tree database/overlay files, tarball
modules:    build kernel modules, tarball
menuconfig: run menuconfig for kernel, starting with default kernel config

For booting the kernel, you will also need to download these addition files:
bootcode.bin: https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin
start.elf: https://github.com/raspberrypi/firmware/raw/master/boot/start.elf
fixup.dat: https://github.com/raspberrypi/firmware/raw/master/boot/start.elf

(Two other files are needed in the boot partition: config.txt and cmdline.txt.
 I will add more about these files next edit, as well as provide links to
 existing official/semi-official documentation for this files)

my current config.txt:
disable_splash=1
gpu_mem=256
kernel=kernel7-4.5.4.img
avoid_warnings=2
dtoverlay=vc4-kms-v3d

my current cmdline.txt:
dwg_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty root=/dev/mmcblk0p3 rootfstype=ext4 rootwait

For the above two files, bare in mind that my sd card partition layout is as follows:
mmcblk0p1: fat32, boot files (mounted to /boot in fstab)
mmcblk0p2: swap
mmcblk0p3: ext4, root filesystem

Sd card layout (as found on most howtos in the wild):

first partition, boot (fat32):
kernel-$version.img, System.map-$version, bootcode.bin, start.elf, fixup.dat,
 config.txt, and  cmdline.txt
Untar the dtb tarball (dtb-$version.tar.*) to the boot partition.

second partition, root (ext{2,3,4}, xfs, btrfs, etc):
Untar the modules tarball (modules-$version.tar.*) to the root partition.
Untar all the package files created by crossrootfs and raspberrypi2-arm to
 the root partition.

Generating the kernel patch:

This is a stripped down description of how I generated the kernel patch.
It is based on how I thought it might have been done by Alpine Linux for
there raspberrypi kernel.

git clone -b rpi-4.5.y https://github.com/raspberrypi/linux.git linux-rpi
cd linux-rpi
git remote add -b linux-4.5.y stable-4.5 \
	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git pull stable-4.5
git diff linux-4.5.y..rpi-4.5.y > ../linux-4.5.y-rpi-$(date +%Y%m%d).patch