5,600,919 Members 41,168 Now Online
XDA Developers Android and Mobile Development Forum

[HOW-TO] Compile AOSP Gingerbread + [ROM] Master AOSP

Tip us?
 
dferreira
Old
(Last edited by dferreira; 6th March 2011 at 11:41 PM.) Reason: 20110305 - latest AOSP as OTA package.
#1  
dferreira's Avatar
Senior Member - OP
Thanks Meter 60
Posts: 1,370
Join Date: Jan 2007
Location: Oulu

 
DONATE TO ME
Lightbulb [HOW-TO] Compile AOSP Gingerbread + [ROM] Master AOSP

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:
Code:
#!/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:
Code:
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/projec...ota-eng.df.zip

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

Facebook Sync + Nexus One build.prop + HD Video Recording: http://forum.xda-developers.com/show...5&postcount=93
Fix for Tethering: http://forum.xda-developers.com/show...2&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.

Code:
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:

Code:
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/andro...ice/Android.mk

and

https://github.com/CyanogenMod/andro...eraService.cpp

Then add to the device vendor board config file:
BOARD_USE_FROYO_LIBCAMERA := true
Dropbox | Homepage | Twitter
How-to: Install Google ION Android 1.6 ROM | Compile AOSP for Sapphire | Nexus One
Google Marketplace: Overcharged | Calendar Awareness | CallerName
Donations: You can offer me a beer if you wish
The Following 13 Users Say Thank You to dferreira For This Useful Post: [ Click to Expand ]
 
clarksonator
Old
#2  
Member
Thanks Meter 7
Posts: 73
Join Date: Jun 2010
Did you have to make any changes to get the camera working? I pulled the 2.3.1 branch and had to make changes just to get the camera working. How about the camcorder? What ROM/version were you running when you ran the extract_files.sh?

Thanks
 
dferreira
Old
#3  
dferreira's Avatar
Senior Member - OP
Thanks Meter 60
Posts: 1,370
Join Date: Jan 2007
Location: Oulu

 
DONATE TO ME
Quote:
Originally Posted by clarksonator View Post
Did you have to make any changes to get the camera working? I pulled the 2.3.1 branch and had to make changes just to get the camera working. How about the camcorder? What ROM/version were you running when you ran the extract_files.sh?

Thanks
I was running the official Froyo 2.2.1, the latest 83D. And yes, I had to make changes to get the camera to work and fix the RGB_565 to RGBA_8888 for the transitions to work properly.

The camcorder doesn't work, it doesn't record a thing, no clue how to fix it yet.
Dropbox | Homepage | Twitter
How-to: Install Google ION Android 1.6 ROM | Compile AOSP for Sapphire | Nexus One
Google Marketplace: Overcharged | Calendar Awareness | CallerName
Donations: You can offer me a beer if you wish
 
Atlas.rouge
Old
#4  
Atlas.rouge's Avatar
Senior Member
Thanks Meter 11
Posts: 530
Join Date: Sep 2010
Location: Alexandria
Stupid question, but...will this work on other devices? I'm trying to get into modding and was directed here by overground (from the DInc forums), and see that this is for the N1...which is fine, except that I don't have an N1. If I need to get one, then I'll do that, but I'm just wondering if I just have to make a few modifications here to make this process work for the DInc.

Thanks!
_______________________________________________
Device - Droid RAZR
 
MrNameless
Old
#5  
MrNameless's Avatar
Senior Member
Thanks Meter 41
Posts: 414
Join Date: Jan 2010
Location: Italy
I Get this error


Quote:
make: *** No rule to make target `installclean'. Stop.
make: *** No rule to make target `clean'. Stop.
./ciao: line 29: repo: command not found
./ciao: line 30: repo: command not found
./ciao: line 35: cd: /Users/luke/Desktop/AOSP/device/htc/passion/: No such file or directory
./ciao: line 36: ./extract-files.sh: No such file or directory
./ciao: line 41: build/envsetup.sh: No such file or directory
./ciao: line 43: lunch: command not found
make: *** No targets specified and no makefile found. Stop.
./ciao: line 47: cd: /Users/luke/Desktop/AOSP/out/target/product/passion/: No such file or directory
Your files ready for flashing are here:
ls: *.img: No such file or directory
Follow Me on Twitter


If you like my hard work and the time it takes me, please consider buying me a coffee!



AndroidITA .com
<--- My site About Android

Ex Maintainer of GingerS ROM for Nexus S
 
koudd
Old
#6  
koudd's Avatar
Member
Thanks Meter 108
Posts: 81
Join Date: Jan 2011
What dependencies are needed on OSX to compile? (compiler versions and so on), you only mention git here
 
houzuoguo
Old
#7  
houzuoguo's Avatar
Senior Member
Thanks Meter 88
Posts: 578
Join Date: Jun 2010
Location: Hamburg
Thanks for the guide!

Sent from my Nexus One using XDA App
Google Nexus One
Cyanogen Mod 7 Nightly + IntersectRaven's Customizable AVS kernel
Sandisk 32GB Class 4 MicroSDHC

Follow me on Twitter http://twitter.com/hzguo
 
dferreira
Old
#8  
dferreira's Avatar
Senior Member - OP
Thanks Meter 60
Posts: 1,370
Join Date: Jan 2007
Location: Oulu

 
DONATE TO ME
Quote:
Originally Posted by MrNameless View Post
I Get this error
Hum... apparently it's not finding repo on your system. And also according to the output, it can't find the folder AOSP on your desktop. Change the SOURCE_FOLDER value to ~/Desktop/AOSP if you have that folder there.
Dropbox | Homepage | Twitter
How-to: Install Google ION Android 1.6 ROM | Compile AOSP for Sapphire | Nexus One
Google Marketplace: Overcharged | Calendar Awareness | CallerName
Donations: You can offer me a beer if you wish
 
dferreira
Old
#9  
dferreira's Avatar
Senior Member - OP
Thanks Meter 60
Posts: 1,370
Join Date: Jan 2007
Location: Oulu

 
DONATE TO ME
Quote:
Originally Posted by Atlas.rouge View Post
Stupid question, but...will this work on other devices? I'm trying to get into modding and was directed here by overground (from the DInc forums), and see that this is for the N1...which is fine, except that I don't have an N1. If I need to get one, then I'll do that, but I'm just wondering if I just have to make a few modifications here to make this process work for the DInc.

Thanks!
It should work, as long you have the correct vendor files for the Incredible
Dropbox | Homepage | Twitter
How-to: Install Google ION Android 1.6 ROM | Compile AOSP for Sapphire | Nexus One
Google Marketplace: Overcharged | Calendar Awareness | CallerName
Donations: You can offer me a beer if you wish
 
dferreira
Old
#10  
dferreira's Avatar
Senior Member - OP
Thanks Meter 60
Posts: 1,370
Join Date: Jan 2007
Location: Oulu

 
DONATE TO ME
Quote:
Originally Posted by koudd View Post
What dependencies are needed on OSX to compile? (compiler versions and so on), you only mention git here
make needs to be 3.81, not 3.82 (the version on MacPorts). I forgot to mention that you'll need macports. I'll update the guide to include it.
Dropbox | Homepage | Twitter
How-to: Install Google ION Android 1.6 ROM | Compile AOSP for Sapphire | Nexus One
Google Marketplace: Overcharged | Calendar Awareness | CallerName
Donations: You can offer me a beer if you wish

Tags
aosp, compile, gingerbread, nexus one
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes