CyanogenMod

This guide will get you started on adapting CyanogenMod to a new Allwinner device

Prepare the Build Environment

 * NOTE: You only need to do these steps the first time you build. If you previously prepared your build environment, skip to creating your device tree.

Install the ADB

 * Install the Android SDK

Install the Build Packages
Install using the package manager of your choice:

For 32-bit & 64-bit systems:

For 64-bit only systems:
 * NOTE:  is no longer available for Ubuntu 11.04 64-bit, but should still build without issue.
 * NOTE:  is no longer available for Ubuntu 11.04 64-bit, but should still build without issue.

Create the Directories
You will need to set up some directories in your build environment.

To create them:

Install the Repository
Enter the following to download make executable the "repo" binary:
 * NOTE: You may need to reboot for these changes to take effect.
 * NOTE: You may need to reboot for these changes to take effect.
 * NOTE: You may need to reboot for these changes to take effect.

It's time to choose your desired flavour, Ice Cream Sandwitch or Jelly Bean:

For use the ICS Repository
Now enter the following to initialize the repository:

For use the JB Repository
Now enter the following to initialize the repository:

Creating a basic new device tree
There is an example basic tree to support new Allwinner devices. It contains a convenience script to change most of the basic stuff:

With   being a single word, lowercase identifier (e.g. zatab),   being a mixed case, user-friendly name (e.g. ZaTab), and   being the user-friendly name of your vendor (e.g. ZaReason).

Once the naming is all set up, you might want to:
 * Adjust CWM recovery key mappings (see recovery_keys.c)
 * Make a kernel defconfig for your device (generally  _defconfig, it can be adjusted on BoardConfig.mk)
 * Adjust kernel modules to be loaded on boot, see init.sun4i.modules.rc
 * Adjust WiFi configuration, see BoardConfig.mk on device/allwinner/common/ for the configuration variables, and adjust them on your own BoardConfig.mk
 * Adjust proprietary files list, see proprietary-files.txt

Copy proprietary files
To copy the proprietary files, connect the device to the computer and ensure that ADB is working properly.

The proprietary files listed in the template include the Mali GPU libraries (, etc.). However, these need to match the API version of the  module in your kernel. Since you're going to be building your own up-to-date kernel from the linux-sunxi source, you'll need to obtain the right versions of the Mali libraries from the sunxi-mali repository. (If your libraries don't match the kernel, then Android's graphics system won't start up;  will show something like  .)

Fetch Prebuilts

 * NOTE: This only needs to be done when an update to the prebuilts is released. If you are-up-to date, you may skip to the next step.

Download the prebuilts which are needed by the build:

Configure Build & Compile
To build using your new device tree, issue

Install

 * 1) Copy your .zip file from ~/android/system/out/target/product/yourdevice/cm-XXXXX.zip to the root of the SD card.
 * Optional: Download Google Apps for CyanogenMod 9 and place it on the root of the SD card.
 * 1) Flash both of these .zip files from recovery.