Download a 16.04 Bananian image/SD card (use SDHC card)

https://dl.bananian.org/releases/bananian-latest.zip

Unzip/copy to sdx (replace with your SD card device)

dd if=bananian-1604.img of=/dev/sdx bs=1M && sync

Mount it and setup networking

sudo mount /dev/sdx /mnt
sudo vim /mnt/etc/network/interfaces
# Configure networking here...
sudo umount /mnt

Put SD card into BananaPro, boot, setup, update

ssh root@(your BananaPro ip)
bananian-config
bananian-update
apt-get install linux-image-4.4-bananian
reboot

# After reboot
apt-get install u-boot-pro-bananian
apt-get install linux-headers-$(uname -r)
apt-get update
reboot

Make the 4.4.10 Kernel with patches (run script below)

#!/bin/bash

# To cross-compile use something like the following for the make step
# ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j12 uImage dtbs modules

# Install deps
apt-get install u-boot-tools libssl-dev bc build-essentials subversion git

# Get kernel
if [ ! -d "linux-4.4.10" ]; then
        wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.10.tar.xz
        tar -Jxvf linux-4.4.10.tar.xz
fi

# Get config and patches (commit d9f6c1965c96708a2dcf62c3086f036ff392a821)
if [ ! -d "bananian" ]; then
        git clone https://github.com/Bananian/bananian
fi

# Get sunxi-can-driver patches (commit f8a449b3ad99319008bb3ec28db5af1e4f8c4f22)
if [ ! -d "sunxi-can-driver" ]; then
        git clone https://github.com/GBert/sunxi-can-driver/
fi

cd linux-4.4.10

cp ../bananian/kernel/4.4.10/config/config .config

# Add Bananian patches
patch -p1 < ../bananian/kernel/4.4.10/patches/0001-dtb.patch
patch -p1 < ../bananian/kernel/4.4.10/patches/0002-b53_switch_driver.patch
patch -p1 < ../bananian/kernel/4.4.10/patches/0021-bananapro-codec.patch

# Patch the device tree
patch -p1 < ../sunxi-can-driver/800-dt-sun7i-add-can.patch
patch -p1 < ../sunxi-can-driver/801-dt-sun7i-add-can-bananapi.patch
patch -p1 < ../sunxi-can-driver/802-dt-sun7i-add-can-bananapro.patch

make -j2 LOADADDR=0x40008000 uImage dtbs modules

Copy the kernel/modules/dtb into place

mount /dev/mmcblk0p1 /boot
cp arch/arm/boot/uImage /boot/uImage-next
cp arch/arm/boot/dts/sun7i*dtb /boot/dtb/

mv /lib/modules/4.4.10 /lib/modules/old-4.4.10
make modules_install

umount /boot
reboot
# This will take a minute or two to boot... fret not

Setup CAN

apt-get install can-utils

# Set to 500kbps
ip link set can0 type can bitrate 500000 triple-sampling on
ifconfig can0 up
candump can0

Notes:

There is a bug in both the SocketCAN and can4linux implementation of the A20 CAN controller driver. If you have a high bus load, you should patch the kernel with CONFIG_PREEMPT_RT and make the kernel fully-preemptible. If an overrun occurs, there’s a chance that the CAN controller will spit out a few garbage messages and block on all read calls.