quarta-feira, 2 de abril de 2014

Compiling linux for sunxi A13/A10

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:
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:
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:

But still is not usable, for now use linux-sunxi.

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 menuconfig
To A13-OLinuXino-Wifi enable Realtek's driver:
Device drivers --> Network device support --> Wireless LAN --> <M> Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter

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
As a final result we will have kernel and modules:
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=3xNdH9SquL4
Part 2: https://www.youtube.com/watch?v=ilDhOzmkORY
Part 3: https://www.youtube.com/watch?v=LWJ11nJ_0-k

2 comentários:

  1. Really Nice blog ..I was searching something like this and I also found an expert Linux Embedded Development in Ukraine

  2. One of the best things about the Panel PC is the kind of interaction and versatility that it provides. It is integrated into a slim form factor enclosure and is ready for panel mount or wall mount application.

    embedded data acquisition