Make your own Android Build Environment

 

this instructions are made for ubuntu 64bit systems and building the cyanogenMOD source

download ADB from here

cp adb /usr/local/bin/

chmod a+x /usr/local/bin/adb

 

NOTE: On Ubuntu 10.10, and variants, you need to enable the parter repository to install sun-java6-jdk:
add-apt-repository "deb https://archive.canonical.com/ maverick partner"

 

sudo apt-get update
sudo apt-get install sun-java6-jdk

 

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

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 g++-multilib
 

Configuring USB Access

Under GNU/linux systems (and specifically under Ubuntu systems), regular users can't directly access USB devices by default. The system needs to be configured to allow such access.

The recommended approach is to create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it. "username" must be replaced by the actual username of the user who is authorized to access the phones over USB.

# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="username"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER=
"username"
# adb protocol on crespo (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER=
"username"
# fastboot protocol on crespo (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER=
"username"

Those new rules take effect the next time a device is plugged in. It might therefore be necessary to unplug the device and plug it back into the computer.

 


This section is for cyanogen MOD 7 Source compiling

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

To create them:
 

mkdir -p ~/android/system

Install the Repository

Enter the following to download make executable the "repo" binary:
 

curl https://android.git.kernel.org/repo > /usr/local/bin/repo
chmod a+x /usr/local/bin/repo


Now enter the following to initialize the repository (in this case it is gingerbread):

    cd ~/android/system/
    repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
    repo sync -j16

Copy proprietary files

    NOTE: This only needs done the first time you build. If you have already done these steps, you may skip to Download RomManager.

You will need to have a passion with a working copy of CyanogenMod install and ADB working on the computer. This script will copy the proprietary files from the device.

Connect the device to the computer and ensure that ADB is working properly (if you want to build for an other device then Nexus S you must change "crespo" to your device name).

    cd ~/android/system/device/htc/crespo/
    ./extract-files.sh

        NOTE: If some hardware isn't working, like camcorder or FM radio, you will need to find the updated prop blobs.

Download RomManager

    NOTE: This only needs to be done when an update to RomManager is released. If you are-up-to date, you may skip to Building CyanogenMod.

Download RomManager which is needed by the build:

    ~/android/system/vendor/cyanogen/get-rommanager

Building CyanogenMod
Check for updates

First, check for updates in the source:

    cd ~/android/system/
    repo sync

Configure Build & Compile

Now, the environment must be configured to build and the ROM compiled, from code, for the Nexus S. (if you want to build for an other device then Nexus S you must change "crespo" to your device name).

    . build/envsetup.sh && brunch crespo

Install

1. Copy your .zip file from ~/android/system/out/target/product/crespo/update.cm-XXXXX-signed.zip to the root of the SD card.

Optional: Download Google Apps for CyanogenMod 7 and place it on the root of the SD card. (you can find them in the download

section)

   2. Flash both of these .zip files from recovery.

 

 

This section is for Blandroid Source compiling (copied from blandroid.org)

#

Fetch the Blandroid manifest:
$ mkdir blandroid
$ cd blandroid
blandroid$ repo init -u git://github.com/blandroid/manifest.git
[ ... ]
blandroid$ repo sync
[ wait a long time while everything downloads... ]
#

Once the tree has finished downloading, ensure USB debugging is enabled on your phone (Settings -> Applications -> Development -> USB debugging) and extract the necessary proprietary files from your phone. For Nexus S/crespo:
blandroid$ cd device/samsung/crespo
blandroid/device/samsung/crespo$ sh extract-files.sh
[ ... ]
blandroid/device/samsung/crespo$ cd ../../..
blandroid$

For Nexus One/passion, make sure you are running a Gingerbread ROM (like Blandroid) first, as the Froyo (2.2) hardware camera drivers are incompatible.
blandroid$ cd device/htc/passion
blandroid/device/htc/passion$ sh extract-files.sh
[ ... ]
blandroid/device/htc/passion$ cd ../../..
blandroid$
#

Now you can build the tree. This will take a long time and use a lot of disk space, RAM, and CPU. For Nexus S/crespo:
bash -c '. build/envsetup.sh && lunch blandroid_crespo-userdebug && make otapackage'