Version 36 (modified by divx118, 22 months ago)

Added some small corrections to the commands of openaos-setup script

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  https://gitorious.org/openaos-cyanogenmod/

The build image will work with the modified archos kernel which sources can be found  https://gitorious.org/archos-buildroots/

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  posting to the Android Building group

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 <your login>:<your group> /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 <option> : 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 <device name> : Builds cyanogenmod for the specified device. (supported gen7, gen8 or all)
  • --jobs <n> : 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 <type> : Specify the type default will be dist.
  • --products <device name> : 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: 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://gitorious.org/openaos-cyanogenmod/openaos_scripts.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

If you get an error error: revision gingerbread in CyanogenMod/android_device_lge_thunderg not found then edit /usr/src/cyan/.repo/manifest.xml

$ sudo gedit /usr/src/cyan/.repo/manifest.xml

Change the following line

<project path="device/lge/thunderg" name="CyanogenMod/android_device_lge_thunderg" remote="github"/>

to

<project path="device/lge/thunderg" name="CyanogenMod/android_device_lge_thunderg" remote="github" revision="master"/>

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

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/'

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

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

If you run into an error like build/envsetup.sh: 1: Syntax error: "(" unexpected You probably have dash enabled. Disable dash by running

$ sudo dpkg-reconfigure dash

Then choose "no".

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  http://wiki.cyanogenmod.com/wiki/Template:Build_from_source where I got my info.

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

$ sudo add-apt-repository "deb http://archive.canonical.com/ 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

Back to Android development