General info setting up buildenvironment Cyanogenmod

This guide will help you to set up your build environment to build gingerbread for your archos gen7 or gen8.

The archos specific sources for cyanogenmod can be found on

The build image will work with the modified archos kernel which sources can be found

Note: Only 64-bit build environments are supported by Android beyond froyo/2.2. Although it will build on a 32 bit build environment it is recommended to use 64 bit. (See also

Creating a work directory

We need a place on or host PC where we can get our work done. I am using /usr/src/cyan. First make the dir and then run the chown command so you get full read/write access as normal user. If it isn't stated otherwise in this guide I assume you run the commands that are mentioned in this directory.

$ sudo mkdir -p /usr/src/cyan/out /usr/src/cyan/openaos/scripts
$ sudo chown : /usr/src/cyan/out
$ cd /usr/src/cyan

Info about the build scripts that are used

openaos-setup script

This script will setup your build environment and keep it up to date.

Commandline options openaos-setup:

  • --version : Displays the version of the script.
  • --dependencies : Will install dependencies needed to build cyanogenmod. Your linux distro must be supported.
  • --applypatches : Automatic apply patches when found, already applied patches are detected. The patches that should be applied are in a file called series (same dir as patch files). Order of the filenames in the file series determines in which order the patches are applied.
  • --nosync : Nothing will be updated, usefull if you for example only want to apply patches.
  • --sync : Specify what will be updated, current options are "all", "android" and "openaos". If you specify no option or "all" CM and openaos repos are updated. "android" will only sync cyanogenmod and "openaos" only our git.
  • --selfupdate : Scripts will be updated from the git.
  • --target : Is not mandatory, if you are in the cynagenmod repo where there is .repo In our case /usr/src/cyan.

openaos-build script

This script will build the Cyanogenmod sources in the ./out dir.

Commandline options openaos-build:

  • --version : Displays the version of the script.
  • --products : Builds cyanogenmod for the specified device. (supported gen7, gen8 or all)
  • --jobs : How many cores you want to use during build.

openaos-dist script

This script will build the image file in ./openaos/target

Commandline options openaos-dist:

  • --version : Displays the version of the script.
  • --type : Specify the type default will be dist.
  • --products : Builds cyanogenmod image for the specified device. (supported gen7, gen8 or all)
  • --nosgx : Builds cyanogenmod image without sgx, this can be usefull for gen7 todo some testing. The image will probably not boot.
  • --nocompress : This will not pack the image file but leave it unpacked, easier for testing.

Automatic setup script

Note: You will need to install git if you don't already have it (apt-get install git-core).

Note: If you come across setup or building errors then look at our Build and setup error section or ask on irc  #openaos.

Note: Most of operations MUST be done as root (openaos-setup and openaos-dist). openaos-build can be done as your user (just don't forget to own the out directory)

Note: The script only only supports Ubuntu maverick or natty for installing dependencies. Feel free to add support for other linux distros.

$ sudo git clone git:// /usr/src/cyan/openaos/scripts
$ sudo ln -s /usr/src/cyan/openaos/scripts/openaos-setup /usr/local/bin/openaos-setup
$ sudo ln -s /usr/src/cyan/openaos/scripts/openaos-build /usr/local/bin/openaos-build
$ sudo ln -s /usr/src/cyan/openaos/scripts/openaos-dist /usr/local/bin/openaos-dist
$ sudo openaos-setup --dependencies --sync all --target /usr/src/cyan

If you get an error that your distro is not supported goto the manually install dependencies.

Then you execute the script again, but leave out the dependencies parameter.

$ sudo openaos-setup --sync all --target /usr/src/cyan

When everything goes well you will now have your sources. A log file of the script is in /tmp/openaos-cyanogenmod-repo.log

You will need to apply patches the first time.

Patches can be applied also with the openaos-setup script by using --applypatches. This should apply all patches. Patches that where already done are detected.

Note: There is a file called series in the patches dir. In this file are the names of the patches that need to be applied. The order of the names in the file determines the order in which the patches are applied.

sudo openaos-setup --applypatches --target /usr/src/cyan

If you want to see if patches are applied correctly then cat the log file, because if they fail you get "Already applied" after running the script.

$ cat /tmp/openaos-cyanogenmod-repo.log

Manual way of applying patches you see below.

$ cd frameworks/base
$ sudo patch -p1 <../../device/archos/common/patches/frameworks/base/touchscreen_calibration.patch
$ cd  ../../system/core
$ sudo patch -p1 <../../device/archos/common/patches/system/core/init_mknod_support.patch
$ cd ../../

Building Cyanogenmod for gen8 or gen7

In the example commands I will use gen8 to build for, but if you want to build for gen7 just replace "gen8" with "gen7" or "all" if you want to build both.

Note: If you are building for gen7 you need first to copy 'gfx_rel_es3.x_android' content (from TI package) into 'openaos/gen7/sgx/' see Getting SGX for gen7

Note: Resulted image (*.img.gz*) will be generated into 'openaos/target/'

$ cd /usr/src/cyan
$ sudo openaos-build --products gen8 (gen7 or all) 

Build the image file

Note: If you want to build both you just have to use "all", but you also have to use "all" for build the build script then.

cd /usr/src/cyan
sudo openaos-dist --type dist --products gen8 (gen7 or all)

The image file will appear in /usr/src/cyan/openaos/target

Manually install dependencies

If the script didn't work for you, this will help you to install dependencies manually.

Note: I use Ubuntu 10.10 32bit, so your distro may differ. You can have a look at and where I got my info.

Getting the dependencies, after that go back to follow the guide where you left.

$ sudo add-apt-repository "deb maverick partner"
$ sudo apt-get update
$ sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool

Getting sgx for gen7

First make a dir to download the git repositry.

$ cd /usr/src
$ mkdir sgx
$ cd sgx
$ git clone git://

Then we install the SDK just follow onscreen instructions

$ cd /usr/src/sgx/ti_android_sgx_sdk
$ ./install_SDK.exp

Now we only have to copy the content of "SDK/gfx_rel_es3.x_android" to "openaos/gen7/sgx/"

$ sudo mkdir -p /usr/src/cyan/openaos/gen7/sgx/
$ sudo cp -r /usr/src/sgx/ti_android_sgx_sdk/SDK/gfx_rel_es3.x_android/* /usr/src/cyan/openaos/gen7/sgx/

Build and setup errors

Setup errors

Syncing with Cyanogenmod, sometimes "screws" up your build environment. You will then get errors like make: *** No rule to make target ... or other things. Most of the time you can just adjust the file for the source where the error occurs. However very important is that you always keep track on what you have adjusted so on a next sync you revert back to the old situation and see if it is fixed. If you come across such things, then please mention it on irc so others can choose not to sync or can apply your temporary fix.

  • error: revision gingerbread in CyanogenMod/android_device_lge_thunderg not found Edit /usr/src/cyan/.repo/manifest.xml
$ sudo gedit /usr/src/cyan/.repo/manifest.xml

Change the following line


Build errors

  • build/ 1: Syntax error: "(" unexpected You probably have dash enabled. Disable dash by running
$ sudo dpkg-reconfigure dash

Then choose "no".

  • If you the get the below message
You have tried to change the API from what has been previously approved.

To make these errors go away, you have two choices:
   1) You can add "@hide" javadoc comments to the methods, etc. listed in the
      errors above.

   2) You can update current.xml by executing the following command:
         make update-api

      To submit the revised current.xml to the main Android repository,
      you will need approval.

Just type

$ cd /usr/src/cyan
$ sudo make update-api
$ sudo openaos-build --products gen8 (gen7 or all)
  • On ubuntu 11.10 I got the following build error
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/dexlist_intermediates/dexlist] Error 1
make: *** Waiting for unfinished jobs....
/usr/bin/ld: cannot find -lz


sudo apt-get install lib32z1-dev

Back to Android development