Linux Kernel

From linux-sunxi.org
(Redirected from Linux)
Jump to navigation Jump to search
MBOX icon important.png This page provides information about the legacy linux-sunxi kernels, which are based on the vendor code drops. It is only useful when accelerated 3D graphics and multimedia support is strictly necessary.


But the Mainline Kernel is already a much better choice for a headless server. And also the mainline kernel works fine even for a basic Linux desktop system running on top of a simple framebuffer, which may be good enough for the users who do not need fancy 3D graphics or video playback acceleration.

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[1] sources by Allwinner. Developement jumped forward after a source release of 3.0.8 made by Qware[2]

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 the entire (huge) repository by installing the git package and running:

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

but if you just want to build our kernel, then follow the guide below.

Kernel versions

Parts of the sunxi SoC are already supported by mainline kernel 3.8 and onwards.

In case you need support for e.g. display, 3D, hardware accelerated video decoding and audio support (for A10/A20), you should can check out the sunxi-3.4 or stage/sunxi-3.4 branch as this will get the most out of your hardware quickly. But beware that this is already obsolete and unmaintained.

Active branches

Name State Description
sunxi-3.4 stable sunxi support forward ported from sunxi-3.0 and keeping reference-3.4 as it's mainline reference. [PREFERRED]
stage/sunxi-3.4 testing fork of sunxi-3.4 with patches waiting to be accepted in stable sunxi-3.4
sunxi-next next mainline fork of mainline kernel including all patches, that are already accepted or merged for the next stable release

If unsure, use the sunxi-3.4 branch.

Stale/ archived branches

Name State Description
sunxi-3.0 stable sunxi support initially based on lichee3-3.0.8 and keeping reference-3.0 as it's mainline reference.
experimental/sunxi-3.10 scheduled for removal. DO NOT USE. sunxi support forward ported from sunxi-3.4, backporting from mainline and keeping reference-3.10 as it's mainline reference.
experimental/sunxi-3.14 highly experimental fix me
sunxi-2.6.36 legacy sunxi support based on the official 2.6.36 release.
reference-3.0 reference merge of mirror/android-3.0 and the latest v3.0.x mainline stable tag. Used to see what of sunxi-3.0 is sunxi specific.
reference-3.4 reference merge of mirror/android-3.4 and the latest v3.4.x mainline stable tag. Used to see what of sunxi-3.4 is sunxi specific.
reference-3.10 reference merge of mirror/android-3.10 and the latest v3.10.x mainline stable tag. Used to see what of sunxi-3.10 is sunxi specific.
mirror/allwinner-2.6.36 mirror mirror of allwinner's official 2.6.36 tree (aka lichee2)
mirror/android-2.6.36 mirror mirror of Android's kernel-common for Android 2.3 (Gingerbread)
mirror/android-3.0 mirror mirror of Android's kernel-common for Android 4.0 (Ice Cream Sandwich), 4.1 (Jelly Bean)
mirror/android-3.4 mirror mirror of Android's 3.4 kernel branch.
mirror/android-3.10 mirror mirror of Android's 3.10 kernel branch.
mirror/master mirror mirror of Linus Torvalds' master.
lichee-3.0.8-sun4i compat based on Qware's source release, kept only to let people drop-in new modules into a GPL-violating lichee3/A10 based install.
wip/* WIP experimental and very likely to 1) be rebased, 2) be seriously broken

Compilation

Get a toolchain

If you haven't done so before, get a suitable toolchain installed and added to your PATH.

Clone the repository

This command will clone the sunxi-3.4 branch:

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

If you just want a quick build and do not wish to download a big git repository, then run:

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

This will create a so-called shallow clone (still a 500MB download), which does not allow for much in the way of development or changes. Downloading a branch as a zip is recommended as the entire branch is compressed into 160MBs (unpacks into 500MB+). Recommended for users with slow or metered internet.

Set default config

MBOX icon important.png This page provides information about the legacy linux-sunxi kernels, which are based on the vendor code drops. It is only useful when accelerated 3D graphics and multimedia support is strictly necessary.


But the Mainline Kernel is already a much better choice for a headless server. And also the mainline kernel works fine even for a basic Linux desktop system running on top of a simple framebuffer, which may be good enough for the users who do not need fancy 3D graphics or video playback acceleration.

A10

For A10 use:

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

A13

For A13 use:

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

A10s

For A10s use:

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

But to get a booting system, you need to set:

CONFIG_SW_DEBUG_UART=1

to:

CONFIG_SW_DEBUG_UART=0

in .config.

Through menuconfig, you need to dig through:

System Type --->

Then:

Allwinner's sunxi options  --->

And then set this to 0:

(1) UART to use for low-level debug

A20

For A20 use:

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

Tweak config

After you have set a default configuration, you can fine-tune your kernel configuration.

For this you will need ncurses development code installed. So for example, on a system that uses the apt package manager, run the following:

apt-get install libncurses5-dev

Now you can run menuconfig, and edit your configuration:

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

Note that the sunxi kernel is based on an obsolete kernel version with vendor hacks thrown in to support the sunxi hardware. As a result some configurations that are possible to select will not build or work.

In particular some sunxi-specific drivers were not fixed to work both as built-in and as module and IPv6 only works as built-in.

If you plan on using a rootfs with systemd or upstart (e.g. Ubuntu) you should set CONFIG_FHANDLE=y in the kernel configuration. By default, .config reads "# CONFIG_FHANDLE is not set" The option can be found in General Setup, Open by fhandle syscalls.

Build

Make sure you have the package u-boot-tools installed, then:

make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules

As a final step, create the full module tree:

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

The INSTALL_MOD_PATH option specifies the directory where the full module tree will be made available, in this example, it will be the output directory under the kernel build directory itself.

Install

Now you have the following sitting in your kernel tree:

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

The uImage file (the kernel minus the modules) needs to be started by U-Boot, so it is usually copied to a boot partition where U-Boot will find it, load it in RAM and then transfer control to it (U-Boot can also pass parameters to the kernel). The modules subdirectory needs to be copied to /lib/modules on the target root file system.

Upstream code

Although it depends on the SoC, the status of mainline kernel is now almost suitable for normal use.

External links

Alternative 3.4 kernels are maintained and provided by

References