Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,808,657 Members 43,216 Now Online
XDA Developers Android and Mobile Development Forum

[Tutorial] Compile ICS on Ubuntu

Tip us?
 
dastin1015
Old
(Last edited by dastin1015; 8th July 2012 at 08:54 AM.)
#1  
dastin1015's Avatar
Recognized Developer / Contributor - OP
Thanks Meter 10,398
Posts: 3,786
Join Date: Dec 2010
Location: Chula Vista, CA

 
DONATE TO ME
Default [Tutorial] Compile ICS on Ubuntu

To compile Ice Cream Sandwich on Ubuntu I'm going to first give you steps to set up your computer to get this thing rolling.

This will NOT make a fully functional ROM, but will give you a place to start. Also I CANNOT fix every error you run into.

Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.

1) You need the following:
-JDK 6 if you wish to build Ice Cream Sandwich. You can download it from java.sun.com. Or:
Code:
$ sudo apt-get install sun-java6-jdk
-Python 2.4 -- 2.7, which you can download from python.org. Or:
Code:
$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com. Or:
Code:
$ sudo apt-get install git-core
2) Install required packages. 64-bit (recommended)
Code:
$ 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 \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
  libxml2-utils
On newer versions of Ubuntu such as 11.10 you may need to do the following:
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
3) Configure your USB.
Code:
$ gksudo gedit /etc/udev/rules.d/51-android.rules
Inside of this blank text file insert:
Code:
#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"

#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"

#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"

#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"

#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"

#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"

#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"

#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"

#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"

#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"

#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"

#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"

#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"

#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"

#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"

#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"

#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"

#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"

#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"

#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"

#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"

#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"

#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"

#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"

#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"

#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"

#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"
4) Save the file and close it and then issue this command:
Code:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
5) Install the repo:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
6) Initialize the repo:
Code:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
7) When prompted, enter your real name and email address.

8) Gather the files:
Code:
$ repo sync
9) Compiling:
Code:
$ source build/envsetup.sh
Or:
Code:
$ . build/envsetup.sh
10) Issue:
Code:
$ lunch
11) Pick your poison.

12) Now issue:
Code:
$ make -j1

~How To Add A Device To The List~

1) Find the github for your device you wish to add. (For me it is the HTC Hero CDMA)

2) Now navigate to the location you are going clone the device tree to:
Code:
$ cd WORKING_DIRECTORY/device
$ mkdir htc
3) Clone the github device tree from remote to local: (The heroc would be whatever you want that folder to be named so make sure it is whatever standard name would be for your device, example: Nexus One [passion], Nexus S [crespo], Motorola Droid [sholes], HTC Incredible [inc], etc.)
Code:
$ git clone git://github.com/TeamICS/android_device_htc_heroc.git heroc
4) Now navigate into the folder:
Code:
$ cd heroc
5) Connect phone to computer and make sure USB debugging is enabled and you have adb set up.

6) Extract Device Proprietary Files:
Code:
$ ./extract-files.sh
7) Navigate back to your home directory for building:
Code:
$ cd ~/WORKING_DIRECTORY
8) Prepare To Compile:
Code:
$ source build/envsetup.sh
Or:
Code:
$ . build/envsetup.sh
9) Get your list of devices:
Code:
$ lunch
10) Pick your poison.

11) Now compile:
Code:
$ make -j1
Or for a flashable zip:
Code:
$ make -j1 otapackage
~NOTE~
If you are running into issues such as:

Code:
Which would you like? [full-eng] 5
build/core/product_config.mk:209: *** No matches for product "full_shooter".  Stop.
Device shooter not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Repository for shooter not found in the CyanogenMod Github repository list. If this is in error, you may need to manually add it to your local_manifest.xml.
build/core/product_config.mk:209: *** No matches for product "full_shooter".  Stop.

** Don't have a product spec for: 'full_shooter'
** Do you have the right repo manifest?
What you need to do is to edit your blob to match the PRODUCT_NAME to the file name. For example with mine I have full_shooter.mk therefore in this file I need to have PRODUCT_NAME to match it. Whatever error it is looking for you just need to change the PRODUCT_NAME line to match what the error shows.
The Following 45 Users Say Thank You to dastin1015 For This Useful Post: [ Click to Expand ]
 
cdesai
Old
#2  
cdesai's Avatar
Recognized Developer
Thanks Meter 3,993
Posts: 2,277
Join Date: Jan 2011
Location: IN YOUR HEAD

 
DONATE TO ME
Make and make -j1 is the same thing.
CyanogenMod Maintainer | SGT7 | TeamBBQ

 
BBQLinux - An Arch based Linux distribution for Android developers
Website: http://www.bbqlinux.org | Downloads: [url]http://sourceforge.net/projects/bbqlinux/files//url]
IRC: #bbqlinux on freenode
The Following User Says Thank You to cdesai For This Useful Post: [ Click to Expand ]
 
dastin1015
Old
#3  
dastin1015's Avatar
Recognized Developer / Contributor - OP
Thanks Meter 10,398
Posts: 3,786
Join Date: Dec 2010
Location: Chula Vista, CA

 
DONATE TO ME
Quote:
Originally Posted by cdesai View Post
Make and make -j1 is the same thing.
Quite aware, but since source has come out I've been working on this with others and from what we have seen 'make -j1' causes less errors than any other make command.
The Following User Says Thank You to dastin1015 For This Useful Post: [ Click to Expand ]
 
cdesai
Old
#4  
cdesai's Avatar
Recognized Developer
Thanks Meter 3,993
Posts: 2,277
Join Date: Jan 2011
Location: IN YOUR HEAD

 
DONATE TO ME
Quote:
Originally Posted by dastin1015 View Post
Quite aware, but since source has come out I've been working on this with others and from what we have seen 'make -j1' causes less errors than any other make command.
Yea, it all depends on your machine

Also, maybe you can add this
AOSP source is synced at 4 jobs by default, and it is quite uncomfortable for people having a slow connection(makes it worse)

So, do this:
You need to edit the default.xml file
Its in WORKING_DIRECTORY/.repo/manifests/default.xml (notice the "." in front of repo)

You can edit it to change the default job no.:
Fire up Terminal
Copy/paste this:
Code:
gedit WORKING_DIRECTORY/.repo/manifests/default.xml
Change the default no. of jobs in this line

Code:
<default revision="refs/tags/android-4.0.1_r1"
           remote="aosp"
           sync-j="4" />
Change four to your preferred number.

Done!
CyanogenMod Maintainer | SGT7 | TeamBBQ

 
BBQLinux - An Arch based Linux distribution for Android developers
Website: http://www.bbqlinux.org | Downloads: [url]http://sourceforge.net/projects/bbqlinux/files//url]
IRC: #bbqlinux on freenode
The Following User Says Thank You to cdesai For This Useful Post: [ Click to Expand ]
 
lanternslight456
Old
#5  
lanternslight456's Avatar
Senior Member
Thanks Meter 519
Posts: 866
Join Date: Jan 2011
You said 64bit recommended, does this mean 32bit will work? I thought gingerbread and newer REQUIRED 64bit.
 
dmeadows013
Old
#6  
dmeadows013's Avatar
Recognized Developer
Thanks Meter 3,777
Posts: 2,395
Join Date: Sep 2010
Location: USA

 
DONATE TO ME
When I attempt to add my device (inc or vigor) I am given an error that the source cannot be found. I checked the Github repo and found that only the Hero and Desire are listed there. How would I go about adding the device to /devices/htc myself?
Current Devices: Google Nexus 5 (Black/32GB), Google Nexus 7 (Black/32GB)


MY WORK:
 
HTC Incredible
GingerStock Rom
AOKP ROM

HTC Rezound
AOKP ROM

Samsung GSIII
KitKangs


Like What I Do? Buy Me an Arizona!



 
dastin1015
Old
#7  
dastin1015's Avatar
Recognized Developer / Contributor - OP
Thanks Meter 10,398
Posts: 3,786
Join Date: Dec 2010
Location: Chula Vista, CA

 
DONATE TO ME
Quote:
Originally Posted by lanternslight456 View Post
You said 64bit recommended, does this mean 32bit will work? I thought gingerbread and newer REQUIRED 64bit.
32 bit will now work.

Quote:
Originally Posted by dmeadows013 View Post
When I attempt to add my device (inc or vigor) I am given an error that the source cannot be found. I checked the Github repo and found that only the Hero and Desire are listed there. How would I go about adding the device to /devices/htc myself?
You need to use your own github source. You can use Cyanogenmod's because our TeamICS only supports Hero CDMA, Hero GSM, and Droid Eris.
The Following User Says Thank You to dastin1015 For This Useful Post: [ Click to Expand ]
 
Silentbtdeadly
Old
#8  
Silentbtdeadly's Avatar
Recognized Contributor
Thanks Meter 793
Posts: 1,568
Join Date: Sep 2010
Location: Jacksonville

 
DONATE TO ME
Quote:
Originally Posted by dastin1015 View Post
To compile Ice Cream Sandwich on Ubuntu I'm going to first give you steps to set up your computer to get this thing rolling.

This will NOT make a fully functional ROM, but will give you a place to start. Also I CANNOT fix every error you run into.

Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.

1) You need the following:
-JDK 6 if you wish to build Ice Cream Sandwich. You can download it from java.sun.com. Or:
Code:
$ sudo apt-get install sun-java6-jdk
-Python 2.4 -- 2.7, which you can download from python.org. Or:
Code:
$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com. Or:
Code:
$ sudo apt-get install git-core
2) Install required packages. 64-bit (recommended)
Code:
$ 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 \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
  libxml2-utils
On newer versions of Ubuntu such as 11.10 you may need to do the following:
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
3) Configure your USB.
Code:
$ gksudo gedit /etc/udev/rules.d/51-android.rules
Inside of this blank text file insert:
For all HTC Models:
Code:
#Acer
SUBSYSTEM==usb, SYSFS{idVendor}==0502, MODE=0666

#ASUS
SUBSYSTEM==usb, SYSFS{idVendor}==0b05, MODE=0666

#Dell
SUBSYSTEM==usb, SYSFS{idVendor}==413c, MODE=0666

#Foxconn
SUBSYSTEM==usb, SYSFS{idVendor}==0489, MODE=0666

#Garmin-Asus
SUBSYSTEM==usb, SYSFS{idVendor}==091E, MODE=0666

#Google
SUBSYSTEM==usb, SYSFS{idVendor}==18d1, MODE=0666

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

#Huawei
SUBSYSTEM==usb, SYSFS{idVendor}==12d1, MODE=0666

#K-Touch
SUBSYSTEM==usb, SYSFS{idVendor}==24e3, MODE=0666

#KT Tech
SUBSYSTEM==usb, SYSFS{idVendor}==2116, MODE=0666

#Kyocera
SUBSYSTEM==usb, SYSFS{idVendor}==0482, MODE=0666

#Lenevo
SUBSYSTEM==usb, SYSFS{idVendor}==17EF, MODE=0666

#LG
SUBSYSTEM==usb, SYSFS{idVendor}==1004, MODE=0666

#Motorola
SUBSYSTEM==usb, SYSFS{idVendor}==22b8, MODE=0666

#NEC
SUBSYSTEM==usb, SYSFS{idVendor}==0409, MODE=0666

#Nook
SUBSYSTEM==usb, SYSFS{idVendor}==2080, MODE=0666

#Nvidia
SUBSYSTEM==usb, SYSFS{idVendor}==0955, MODE=0666

#OTGV
SUBSYSTEM==usb, SYSFS{idVendor}==2257, MODE=0666

#Pantech
SUBSYSTEM==usb, SYSFS{idVendor}==10A9, MODE=0666

#Philips
SUBSYSTEM==usb, SYSFS{idVendor}==0471, MODE=0666

#PMC-Sierra
SUBSYSTEM==usb, SYSFS{idVendor}==04da, MODE=0666

#Qualcomm
SUBSYSTEM==usb, SYSFS{idVendor}==05c6, MODE=0666

#SK Telesys
SUBSYSTEM==usb, SYSFS{idVendor}==1f53, MODE=0666

#Samsung
SUBSYSTEM==usb, SYSFS{idVendor}==04e8, MODE=0666

#Sharp
SUBSYSTEM==usb, SYSFS{idVendor}==04dd, MODE=0666

#Sony Ericsson
SUBSYSTEM==usb, SYSFS{idVendor}==0fce, MODE=0666

#Toshiba
SUBSYSTEM==usb, SYSFS{idVendor}==0930, MODE=0666

#ZTE
SUBSYSTEM==usb, SYSFS{idVendor}==19D2, MODE=0666
4) Save the file and close it and then issue this command:
Code:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
5) Install the repo:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
6) Initialize the repo:
Code:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
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:
Code:
$ repo sync
9) Compiling:
Code:
$ source build/envsetup.sh
Or:
Code:
$ . build/envsetup.sh
10) Issue:
Code:
$ lunch
11) Pick your poison.

12) Now issue:
Code:
$ make
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.


~How To Add A Device To The List~

1) Find the github for your device you wish to add. (For me it is the HTC Hero CDMA)

2) Now navigate to the location you are going clone the device tree to:
Code:
$ cd WORKING_DIRECTORY/device
$ mkdir htc
3) Clone the github device tree from remote to local: (The heroc would be whatever you want that folder to be named so make sure it is whatever standard name would be for your device, example: Nexus One [Passion], Nexus S [Crespo], Motorola Droid [Sholes], HTC Incredible [Inc], etc.)
Code:
$ git clone git://github.com/TeamICS/android_device_htc_heroc.git heroc
4) Now navigate into the folder:
Code:
$ cd heroc
5) Connect phone to computer and make sure USB debugging is enabled and you have adb set up.

6) Extract Device Proprietary Files:
Code:
$ ./extract-files.sh
7) Navigate back to your home directory for building:
Code:
$ cd ~/WORKING_DIRECTORY
8) Prepare To Compile:
Code:
$ source build/envsetup.sh
Or:
Code:
$ . build/envsetup.sh
9) Get your list of devices:
Code:
$ lunch
10) Pick your poison.

11) Now compile:
Code:
$ make -j1
Or for a flashable zip:
Code:
$ make -j1 otapackage
First, thanks for gathering just about everything I needed in one place, I had gotten pretty far in the process on windows before I decided doing it in windows was a stupid idea..

When I ran this-- 2) Install required packages. 64-bit (recommended)
Code:
$ 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 \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
  libxml2-utils
I got back some errors, but I think these things were already loaded, or it was because I hadn't approved the sources..? Not sure, but I'm downloading the source now so it couldn't be THAT important(yet). I'm using ubuntu 11.10 if that helps at all.

At this point: 9) Compiling:
Code:
$ source build/envsetup.sh
Or:
Code:
$ . build/envsetup.sh
could I have done
Code:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r
and just be downloading ICS source? Because at the moment, it looks like it is downloading the source for all of the previous android source too.. isn't a bad thing, but I only made my partition 100gb in size because i was going to just work with ICS.
I'll probably go through this thread a little more throughly and do some other research while this download is going on-- thanks again for putting this thread together!

Issues with the AMAZE 4g? Come stalk the always up to date, always maintained, Ultimate Guide to Everything Amaze-ing!(Amaze 4g BIBLE!)!
Current Device: International Galaxy S3 i9300
Other Devices: Nexus 7
The Following 3 Users Say Thank You to Silentbtdeadly For This Useful Post: [ Click to Expand ]
 
dmeadows013
Old
#9  
dmeadows013's Avatar
Recognized Developer
Thanks Meter 3,777
Posts: 2,395
Join Date: Sep 2010
Location: USA

 
DONATE TO ME
Quote:
Originally Posted by dastin1015 View Post
32 bit will now work.



You need to use your own github source. You can use Cyanogenmod's because our TeamICS only supports Hero CDMA, Hero GSM, and Droid Eris.
Well the Vigor (Rezound) was just released, so it is not yet on the CM source. Do I need the kernel source to get what I need?
Current Devices: Google Nexus 5 (Black/32GB), Google Nexus 7 (Black/32GB)


MY WORK:
 
HTC Incredible
GingerStock Rom
AOKP ROM

HTC Rezound
AOKP ROM

Samsung GSIII
KitKangs


Like What I Do? Buy Me an Arizona!



 
dastin1015
Old
#10  
dastin1015's Avatar
Recognized Developer / Contributor - OP
Thanks Meter 10,398
Posts: 3,786
Join Date: Dec 2010
Location: Chula Vista, CA

 
DONATE TO ME
Quote:
Originally Posted by dmeadows013 View Post
Well the Vigor (Rezound) was just released, so it is not yet on the CM source. Do I need the kernel source to get what I need?
You need more than the kernel. You need vendor files as well. Vendor files tell what your phones hardware is and how to build, etc. You usually get this from CM when they support your phone.

私のエボ3Dから送信される。

The Following 2 Users Say Thank You to dastin1015 For This Useful Post: [ Click to Expand ]
Tags
compile, ics, source
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes