[Android] dastin1015:
How to compile Gingerbread on a 32 bit environment on Ubuntu 10.10

Ok for setting up Ubuntu 10.10 to compile Gingerbread on a 32 bit environment I'm going to first give you steps to set up your computer to get this thing rolling.

*These instructions are compiled by me from different sources such as source.android.com, Cyanogen Wiki, this blog for the work around.*

This may or may not work for you, but this has worked for me. Enjoy! :D

1) You need the following:

-Python 2.4 -- 2.7, which you can download from python.org. Or:

$ sudo add-apt-repository ppa:fkrull/deadsnakes
$ sudo apt-get update
$ sudo apt-get install python2.5

-JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both from java.sun.com. Or:

$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk

-Git 1.5.4 or newer. You can find it at git-scm.com. Or:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git-core

-(optional) Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc. Download from valgrind.org. Or:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install valgrind

2) Install required packages.

$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev
lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev

3) Configure your USB.

$ gksudo gedit /etc/udev/rules.d/51-android.rules

Inside of this blank text file insert:

For all HTC Models:

SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

For Nexus One:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e11", MODE="0666", OWNER="<your user name>" #Normal nexus one
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e12", MODE="0666", OWNER="<your user name>" #Debug & Recovery nexus one
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0fff", MODE="0666", OWNER="<your user name>" #Fastboot nexus

For Nexus S:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e21", MODE="0666", OWNER="<your user name>" #Normal nexus s
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e22", MODE="0666", OWNER="<your user name>" #Debug & Recovery nexus s
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e20", MODE="0666", OWNER="<your user name>" #Fastboot nexus s

For MyTouch 4G:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0ff9", MODE="0666", OWNER="<your user name>" #Normal g2
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c96", MODE="0666", OWNER="<your user name>" #Debug & Recovery g2
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0fff", MODE="0666", OWNER="<your user name>" #Fastboot g2

For Motorola Droid:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="22b8", ATTRS{idProduct}=="41db", MODE="0666", OWNER="<your user name>" #Normal, Debug & Recovery droid

4) Save the file and close it and then issue this command:

$ sudo chmod a+r /etc/udev/rules.d/51-android.rules

5) Download the repo:

$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl http://android.git.kernel.org/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

6) Initialize the repo:

$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY

For master branch:

$ repo init -u git://android.git.kernel.org/platform/manifest.git

For specific branch [In the (insert branch here) you would put in gingerbread without the parenthesizes:

$ repo init -u git://android.git.kernel.org/platform/manifest.git -b (insert branch here)

7) When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.

8) Gather the files:

$ repo sync

9) Verify and insert public key block:

$ gpg --import

-----BEGIN PGP PUBLIC KEY BLOC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GWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+
OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----

10) After copying and pasting the public key block press Crtl+D to end the input.

*Now for the work around*

11) In your file manager navigate to:

WORKING_DIRECTORY/build/core/main.mk

12) On line 75 you will find this:

ifneq (64,$(findstring 64,$(build_arch)))

Change it to:

ifneq (i686,$(findstring i686,$(build_arch)))

13) Next navigate to:

WORKING_DIRECTORY/external/clearsilver

14) Find the cgi folder and locate the Android.mk file. In this file you will find:

LOCAL_CFLAGS += -m64
LOCAL_LDFLAGS += -m64

Change it to:

LOCAL_CFLAGS += -m32
LOCAL_LDFLAGS += -m32

15) Repeat step 14 for the Android.mk files in folders cs, java-jni, and util.

16) Compiling:

$ source build/envsetup.sh

Or:

$ . build/envsetup.sh

17) Issue:

$ lunch

18) Pick your poison.

19) Now issue:

$ make

20) Now just cross your fingers and hope it all works out!

21) Issue this command to create a flashable zip:

$ make otapackage

Or if you want to test on an emulator:

$ emulator

22) If all went well you can either run your build on an emulator or flash it on a device.

Please note that you have already selected your build target with lunch, and it is unlikely at best to run on a different target than it was built for.