[Nexus One Android Development] dferreira:
Here I am again, with a guide for compiling your own ROM from source. At the moment, you can compile AOSP using Mac OS Snow Leopard and Ubuntu 64bits.

The following script will allow you to get the proprietary drivers from your phone, download the source itself and compile it. In the end, you'll have recovery.img, system.img, boot.img and userdata.img. I suggest you only flashing the system, boot and userdata, because if you keep the recovery that exists by default, you'll be able to get the official OTA updates.

For Mac OS X Snow Leopard, you'll need to install GIT: http://code.google.com/p/git-osx-installer/

You'll also need to have XCode installed and MacPorts: http://www.macports.org/install.php. XCode you'll find it online at Apple's website or on your Mac's installation DVD. Just make sure you check for updates once you install it, to make sure you are up to date.

After you install MacPorts, you'll need to revert gmake to 3.81, because 3.82 doesn't work for AOSP (for now at least). The problem began when macports updated gmake from 3.81 to 3.82. If you simply did a selfupdate, you can use the simple commands above to reset to gmake 3.81. The more difficult case is seen by anyone who did a fresh install of macports after September 7, 2010 - you'll only have 3.82.

The "InstallingOlderPort" link is fairly generic, but will give you enough clues to resolve this problem. Here are the steps I worked out. Maybe there's a simpler way?

Here's how to downgrade to 3.81:

1. Visit http://trac.macports.org/log/trunk/dports/devel/gmake

2. Click the link that says "@50980" - although it doesn't explicitly say 3.81, this is it

3. Click the link that says "Portfile"

4. Scroll to the bottom and just below "Download in other formats:" click "Original Format"

5. This is subtle but important: If your browser e.g. Chrome renamed it to Portfile.txt, you need to rename it to simply "Portfile"

6. cd to the location of Portfile and $ sudo port install

This should install and configure gmake 3.81, after which:

$ sudo port installed gmake

The following ports are currently installed:

gmake @3.81_0 (active)

gmake @3.82_0

For Ubuntu: sudo apt-get install git

Create a text-only file and place the following content in it. Please edit the SOURCE_FOLDER variable to match to where you want the source code to be stored:

#!/bin/bash
#Checkout and compile MASTER repositories from source.android.com

SOURCE_FOLDER=/Volumes/AOSP

#Check for Repo
if [ ! -f ~/bin/repo ]
then
cd ~
mkdir bin
curl http://android.git.kernel.org/repo >~/bin/repo
chmod a+x ~/bin/repo
PATH="$HOME/bin:$PATH"
fi

#Create project folder
if [ ! -d $SOURCE_FOLDER ]
then
mkdir $SOURCE_FOLDER
fi

cd $SOURCE_FOLDER

#clean old compiled files, there can be new stuff!
make installclean
make clean

#Get updated source files from AOSP
repo init -u git://android.git.kernel.org/platform/manifest.git -b master
repo sync #update repo's

#extract the proprietary files from Nexus One - connect your phone via USB to the computer
if [ ! -d vendor/htc/passion/proprietary ]
then
cd $SOURCE_FOLDER/device/htc/passion/
./extract-files.sh
fi

#setup compiling environment and build images
cd $SOURCE_FOLDER
. build/envsetup.sh

lunch
make -j4

#get to compiled folder
cd $SOURCE_FOLDER/out/target/product/passion/
echo 'Your files ready for flashing are here:'
ls *.img

In the end, you'll find your files ready to be flashed using fastboot on SOURCE_FOLDER/out/target/product/passion/

If you don't remember where you can get fastboot: http://developer.htc.com/google-io-device.html#s2

To enter fastboot mode on your phone, turn off your phone, press power+trackball until you see a white screen with android skaters on the bottom.

How to use fastboot:

fastboot flash boot boot.img; fastboot flash system system.img; fastboot flash userdata userdata.img

There are some things that need to be fixed on the source code to have an almost bug free AOSP and I'll add them here later as I don't remember them all from my head.

For those who don't want to go through this trouble, you can flash my own compiled images. There isn't anything else besides the AOSP official code. You can get your contacts, calendar and email using Google's exchange settings:

Where it asks for the domain: google.com\youremail@gmail.com

Where it asks for the server: m.google.com

That will bring you push email, contacts and calendar working without any Google Apps required.

[Last update: 6th March 2011]Download it here: http://www.denzilferreira.com/projects/passion-ota-eng.df.zip

----- ADDONS + FIXES FOR LATEST AOSP -----

Facebook Sync + Nexus One build.prop + HD Video Recording: http://xdaforums.com/showpost.php?p=11860795&postcount=93

Fix for Tethering: http://xdaforums.com/showpost.php?p=11808842&postcount=83

Keyboard dictionaries - Thanks to hewitt

I haven't found a better way to add dictionaries to fix predictive typing, but you can pull the dictionaries out of Cyanogenmod and slip them into LatinIME. It's absolutely ridiculous that these files do not already exist in the AOSP.

git clone https://github.com/CyanogenMod/android_vendor_cyanogen.git

Copy any of the raw language directories from 'android_vendor_cyanogen/overlay/common/packages/inputmethods/LatinIME/java/res/'

(such as raw-en for English or raw-de for German) to your AOSP repo in

'/packages/inputmethods/LatinIME/java/res/'.

Rebuild LatinIME and push it to your phone, then set language with Settings->Language & Keyboard->Android Keyboard->Input Languages. Just select your preferred languages, which should indicate below in small text, "Dictionary available".

vvvvvvvvvvvvv OLD FIXES BELOW, FOR HISTORICAL PURPOSES vvvvvvvvvvvvvvv

{BELOW NOT NEEDED ANYMORE SINCE 2.3.3 OTA DRIVERS}

----- FIXES IN THE SOURCE CODE TO GET IT TO COMPILE AND WORK PROPERLY ------

To fix the RGB_565 problem

Go to frameworks/base/services/surfaceflinger/Android.mk and add:

ifeq ($(BOARD_NO_RGBX_8888), true)
LOCAL_CFLAGS += -DNO_RGBX_8888
endif

then add BOARD_NO_RGBX_8888 := true to your device vendor board config file

To fix the camera

https://github.com/CyanogenMod/andr...8/services/camera/libcameraservice/Android.mk

and

https://github.com/CyanogenMod/andr...ces/camera/libcameraservice/CameraService.cpp

Then add to the device vendor board config file:

BOARD_USE_FROYO_LIBCAMERA := true