After some trial end error, I managed to build a fully functional kernel for the Banana Pi. The uImage is about 3.4 MB in size. I have disabled drivers that are dispensable for a headless server and compiled the sunxi_gmac ethernet driver as a module. I disabled the gmac_ethernet in script.bin and removed OTG kernel support. The Realtek 8192cu driver is compiled as a module. When the system has started, it requires about 187 MB (with Nginx, php5-fpm, MySQL, Exim4 and Dropbear running in the background). Here is my config.gz file for compiling the kernel.
Instructions for building a new kernel can be found on the Lemaker Wiki. Since compilation with the tool-chain provided with the OpenSuSe or Ubuntu Linux distribution failed, I compiled my own Linaro GCC toolchain.
The new mainline linux-kernel 3.19.x is going to support the ARM platform. Igor Pečovnik maintains some unofficial Debian images for the Banana Pi including a kernel 3.40.106 release with several bug-fixes. If you just need the kernel, you can download the kernel-source from github.
Roadmap for kernel compilation
First, I downloaded and installed crosstool-ng and followed the build instructions on the bottom of their page. Next, I prepared the cross toolchain for cortex-a8 with:
I used the options found in this blog-post. Building the toolchain took about 50 minutes. Meanwhile I cloned the Banana Pi BSP from github:
git clone https://github.com/LeMaker/bananapi-bsp.git
After getting the BSP, you must set some environmental variables, pointing to your cross-compiler, kernel source and output directory:
export KERNEL_SRC=$HOME/bananapi-bsp/linux-bananapi export CCPREFIX=$HOME/x-tools/arm-cortex_a8-linux-gnueabihf/bin/arm-cortex_a8-linux-gnueabihf- export MODULES_TEMP=$KERNEL_SRC/output
Then, do a:
./configure Bananapi make
This will compile a “default” kernel and will take some time. In order to customize it, do:
within the BSP directory. The new kernel uImage and modules will be placed into the output directory as a Bananapi_hwpack.tar.xz archive).