Toolchain
First you need to download all the tools and the cross compiler in order to compile a linux kernel for sunxi. These softwares are downloaded in your PC! The cross compiler installed in PC, will generate an image that will run in board. The same compiler also generates software and drivers that can run in board.
If you have not installed toolchain, folow these steps.
Add this link into your /etc/apt/sources.list:
Add this link into your /etc/apt/sources.list:
deb http://www.emdebian.org/debian/ unstable main
Note: Emdebian's armhf-toolchain is only available for Debian/unstable at the moment.
It is important to use armhf because most software currently is compiled for armhf. If you use armel, you must get software compatible with armel!
Run these commands in order to get cross compiler:
apt-get install emdebian-archive-keyring apt-get update apt-get install gcc-4.7-arm-linux-gnueabihf
Choose the same version of the compiler's distro, thus you avoid incompatibilities and broken packages. Type 'gcc -v' and check your version.
Create a symbolic link to arm-linux-gnueabihf-gcc:
Create a symbolic link to arm-linux-gnueabihf-gcc:
ln -s arm-linux-gnueabihf-gcc-4.7 arm-linux-gnueabihf-gcc
You need extra tools to compile linux kernel:
apt-get install build-essential git debootstrap u-boot-tools libncurses5-dev
Clone the repository
git clone -b sunxi-3.4 https://github.com/linux-sunxi/linux-sunxi.git
The kernel linux-sunxi is provided by sunxi community, but it is not included in the official linux kernel. The official linux kernel with support sunxi can be found in these links:
https://github.com/mripard/linux
https://github.com/jwrdegoede/linux-sunxi/tree/sunxi-devel
But still is not usable, for now use linux-sunxi.
Device drivers --> Network device support --> Wireless LAN --> <M> Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter
https://github.com/jwrdegoede/linux-sunxi/tree/sunxi-devel
But still is not usable, for now use linux-sunxi.
Configure
For A10 use:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun4i_defconfig
For A13 use:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun5i_defconfig
Configure additional parameters, such as drivers or debug options:
make ARCH=arm menuconfigTo A13-OLinuXino-Wifi enable Realtek's driver:
Device drivers --> Network device support --> Wireless LAN --> <M> Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter
Build
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules
Choose -jN according to the number of cores of your CPU. Four cores -j4, two cores -j2...
This command will copy all enabled modules in the specified folder by INSTALL_MOD_PATH:
make ARCH=arm INSTALL_MOD_PATH=output modules_install
Install
As a final result we will have kernel and modules:
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. So copy kernel image uImage to SD partition 1 and modules to partition 2, into rootfs.
Videos on Youtube:
Part 1: https://www.youtube.com/watch?v=3xNdH9SquL4Part 2: https://www.youtube.com/watch?v=ilDhOzmkORY
Part 3: https://www.youtube.com/watch?v=LWJ11nJ_0-k