Linux Kernel

This page describes how to get the sunxi specific linux kernel built for your device.

= History =

Public Linux Kernel support for the sunxi family (Allwinner A10, A13, ...) started with a source drop of 2.6.36 made by Ainol, followed by an official release of 2.6.36 sources by Allwinner. Developement jumped forward after a source release of 3.0.8 made by Qware

Initially living in amery's github now our community driven sunxi kernel repo is located in the linux-sunxi's github.

= Repository =

The main sunxi kernel repository is available at our projects github.

You can clone this repository by running:

git clone https://github.com/linux-sunxi/linux-sunxi.git

= Kernel versions =

There are several branches in our kernel tree. Unless you wish to do some specific development, you should probably stick to the sunxi-3.4 branch as this will get the most out of your hardware quickly.

If unsure, use the sunxi-3.4 branch.

= Compilation = The fastest way to compile a kernel is to cross-compile on a powerful PC. For that, you first need to install a suitable toolchain and you need to add its location to your PATH. Then you can proceed as follows:


 * Clone the sunxi kernel repository, and descend into the resulting directory:

git clone -b sunxi-3.4 https://github.com/linux-sunxi/linux-sunxi.git cd linux-sunxi

For A10 use:
 * Configure your kernel, depending on the SoC you have:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun4i_defconfig

For A13 use:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun5i_defconfig

For A20 use:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig

At this point you can fine-tune your kernel configuration by running:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig


 * Now you can build the kernel image and the modules:

make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules

The -j4 option runs 4 make instances in parallel to speed up compilation. Please adjust this to the number of CPUs available.


 * To complete compilation, you need to create a full module tree:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=output modules_install


 * Now you have the following sitting in your kernel tree:

arch/arm/boot/uImage output/lib/modules/3.4.XXX/

The uImage file needs to be started by u-boot, and the modules directory needs to be copied to the /lib/modules on the target rootfs.

= Upstream code =

There is some sunxi code available in linus's tree. But this is not suited for normal use yet, and will likely need a lot more work to get there. For more information, see our mainline kernel howto.

= External links =
 * Official linux-sunxi git repository

= References =