Post Reply

[Guide] How to compile and install CM10 for Samsung i9000

4th August 2012, 03:02 AM   |  #1  
pmos69's Avatar
OP Senior Member
Flag Lisbon
Thanks Meter: 577
 
1,245 posts
Join Date:Joined: Feb 2009
More
This guide is an adaptation/update of the following guides to CM10:
DISCLAMER
Although the procedures in this guide were tested on 2012-08-03 and produced a working build on the i9000, I take no responsibility for any consequences derived from their use.


Thanks:
Requirements:
  • Linux - Ubuntu 12.04 - 64bit (AFAIK, a 64 bit host is needed to compile JB)
  • An i9000 with cm10 already installed - Get the latest nightly here: http://get.cm/?device=galaxysmtd
  • About 14GB of storage for the repository plus about 15GB for building
If you're using Windows or another OS, grab Virtual Box and install Ubuntu on a VM. It makes a nice development environment.
(Give the VM enough resources - A few cores and 2-4GB of RAM)


Building in other Linux distributions?
Here are some contibutions from fellow members:

__________________________________________________ __________________________________________________ ____



1 - Install Ubuntu Packages

1.1 - In terminal:
Code:
sudo apt-get install git-core gnupg flex bison python rar original-awk gawk p7zip-full gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool
sudo apt-get install libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils
sudo apt-get install g++-multilib lib32z1-dev ia32-libs lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib g++-multilib xsltproc

2 - Install JAVA

NOTE: Must be JDK 1.6 - Don't use other versions.


2.1 - Download Java JDK for Linux 64-bit from Java site: (http://www.oracle.com/technetwork/ja...ads/index.html)
Correct file will be something like: jdk-6u##-linux-x64.bin , where ## is the version number and will change with updates.

2.2 - Move jdk-6u##-linux-x64.bin to your home directory


2.3 - Remove any other java packages from system:

Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

2.4 - Install Java JDK:

Code:
sudo mkdir -p /opt/java/64/
sudo cp jdk-6u##-linux-x64.bin /opt/java/64
sudo su -
cd /opt/java/64
chmod +x jdk-6u##-linux-x64.bin
./jdk-6u##-linux-x64.bin
exit

2.5 - Add JDK PATH to .bashrc:

Code:
vi ~/.bashrc
Add these lines to .bashrc:
Code:
# Java PATHs
export JAVA_HOME=/opt/java/64/jdk1.6.0_##
export PATH=$PATH:$JAVA_HOME/bin

3 - Install Android SDK


3.1 - Setup directories:
Code:
cd ~
mkdir android
cd android
mkdir sdk
3.2 - Download Android SDK from http://developer.android.com/sdk/index.html

3.3 - Extract SDK contents to ~/android/sdk

3.4
- Add Android SDK Path:

Code:
vi ~/.bashrc
Enter the Following:
Code:
#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools
3.5 - Add Extra Path For Device:

Code:
sudo vi /etc/udev/rules.d/99-android.rules
Enter this:
Code:
#Samsung
SUBSYSTEM==usb, SYSFS{idVendor}==04e8, MODE=0666
	
SUBSYSTEM=="usb", ATTRS{idVendor}=="####:####", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev"
TEST=="/var/run/ConsoleKit/database", \
RUN+="udev-acl --action=$env{action} --device=$env{DEVNAME}"
Save/close file and run:
Code:
sudo chmod +x /etc/udev/rules.d/99-android.rules
3.6 - Close and open new terminal.

3.7 - Install Android SDK Tools

Code:
android
Check Android SDK Tools and Android SDK platform-tools and Install them

4 - Install Repository

4.1 - Download Repo:
Code:
mkdir -p ~/bin
mkdir -p ~/android/system
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo

4.2 - Add Repo Path:

Code:
vi ~/.bashrc
Enter the following:
Code:
export PATH=$PATH:~/bin

4.3 - Close and open new terminal.


4.4 - Initialize Repository & Sync:

Code:
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
repo sync -j16
NOTE: If you have trouble syncing due to connection issues, try repo sync -j1. It's slower but some ISPs have issues with -j16
Want to make sure you didn't get any connection errors and have the complete repository? Just run the repo sync command again. It can't give you ANY errors.
Go get a beer. And another. And another...

4.5 - Get Device Specific Repos:
Code:
. build/envsetup.sh && breakfast galaxysmtd
Get more beer...

4.6 - Extract files from phone:
NOTE: You need to have cm10 installed on the phone.
Connect phone to pc and in terminal type:
Code:
adb root
cd ~/android/system/device/samsung/galaxysmtd/
./extract-files.sh

4.7 - Download Extra Files:

Code:
~/android/system/vendor/cm/get-prebuilts

4.8 - Add Toolchain PATH:

Code:
vi ~/.bashrc
Enter the following:
Code:
#Android Toolchain PATH
export ARCH=arm
export CCOMPILE=$CROSS_COMPILE
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:/home/YOUR-USERNAME/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
4.9 - Close and open new terminal.


5 - Building Android
Code:
cd ~/android/system
. build/envsetup.sh && brunch galaxysmtd
Go get a beer. And another. And another...

6 - Install on Phone

6.1 - Copy your .zip file from ~/android/system/out/target/product/galaxysmtd/cm-10-XXXXXXXXX-UNOFFICIAL-galaxysmtd.zip to the root of the SD card.

6.2 - Optional: Download Google Apps for Jelly Bean from http://goo.im/gapps and place it on the root of the SD card.

6.3 - Flash both of these .zip files from recovery.
Call your mother. She misses you.

...and that's it.


__________________________________________________ __________________________________________________ ____



How to update?
Code:
cd ~/android/system
repo sync -j16
make installclean

find ./out/ -name 'build.prop' | xargs rm
find ./out/ -name 'cm_galaxysmtd-target_files-eng.*.zip' | xargs rm
NOTE: If you have trouble syncing due to connection issues, try repo sync -j1. It's slower but some ISPs have issues with -j16
...get beer, build and install.

Want to go "Steve Jobs" on the Android build? (Warning: Will take a gazillion years to re-build everything again)
Run:
Code:
make clobber

__________________________________________________ __________________________________________________ ____



Want to customize the kernel?

Look here: [Guide] How to customize the CM10 i9000 kernel

.
Last edited by pmos69; 3rd September 2012 at 09:47 PM.
The Following 81 Users Say Thank You to pmos69 For This Useful Post: [ View ]
4th August 2012, 03:11 AM   |  #2  
rajeshbabushrestha's Avatar
Senior Member
Thanks Meter: 73
 
170 posts
Join Date:Joined: Jan 2011
Donate to Me
More
will try this soon... thankx
4th August 2012, 12:55 PM   |  #3  
Member
Thanks Meter: 9
 
70 posts
Join Date:Joined: Dec 2009
Can you also write a small paragraph where you explain how compile a single application like Mms, Phone...

Thank you
4th August 2012, 01:18 PM   |  #4  
pmos69's Avatar
OP Senior Member
Flag Lisbon
Thanks Meter: 577
 
1,245 posts
Join Date:Joined: Feb 2009
More
Quote:
Originally Posted by a0a0

Can you also write a small paragraph where you explain how compile a single application like Mms, Phone...

Thank you

You get all the application apks in the produced build.
From there you can extract any single one you want...

Sent from my GT-I9000 using Tapatalk 2
The Following User Says Thank You to pmos69 For This Useful Post: [ View ]
4th August 2012, 01:21 PM   |  #5  
Member
Thanks Meter: 9
 
70 posts
Join Date:Joined: Dec 2009
Yes but if i will try a small change in a code i must compile every time all the rom
4th August 2012, 01:24 PM   |  #6  
pmos69's Avatar
OP Senior Member
Flag Lisbon
Thanks Meter: 577
 
1,245 posts
Join Date:Joined: Feb 2009
More
Quote:
Originally Posted by a0a0

Yes but if i will try a small change in a code i must compile every time all the rom

Not really.
Only changed files are compiled (and affected dependencies)

Sent from my GT-I9000 using Tapatalk 2
4th August 2012, 02:18 PM   |  #7  
kasper_h's Avatar
Recognized Developer
Thanks Meter: 15,565
 
5,169 posts
Join Date:Joined: Oct 2010
Donate to Me
With mmm you can build single apk files, see the cm9 compile thread for details...

Verstuurd van mijn GT-I9000
The Following 2 Users Say Thank You to kasper_h For This Useful Post: [ View ]
4th August 2012, 02:19 PM   |  #8  
abalam's Avatar
Senior Member
Thanks Meter: 1,443
 
1,413 posts
Join Date:Joined: Oct 2011
More
Thanks man

Verstuurd van mijn GT-I9000
4th August 2012, 03:37 PM   |  #9  
elitevet's Avatar
Senior Member
Flag Tel Aviv
Thanks Meter: 363
 
530 posts
Join Date:Joined: Mar 2011
More
Quote:

Requirements:
Linux - Ubuntu 12.04...

Does it have to be Ubuntu, provided I can find all listed packages for CentOS, for example?

Also, do you recommend the desktop or the server version?
Last edited by elitevet; 4th August 2012 at 03:42 PM.
The Following User Says Thank You to elitevet For This Useful Post: [ View ]
4th August 2012, 03:50 PM   |  #10  
pmos69's Avatar
OP Senior Member
Flag Lisbon
Thanks Meter: 577
 
1,245 posts
Join Date:Joined: Feb 2009
More
Quote:
Originally Posted by elitevet

Does it have to be Ubuntu, provided I can find all listed packages for CentOS, for example?

Also, do you recommend the desktop or the server version?

Doesn't have to be Ubuntu, as long as you can find the equivalent packages.

It can be the desktop or server version, as long as you have X in it.
The android SDK setup uses a GUI. (but perhaps there's a way to run it from the CLI)

Sent from my GT-I9000 using Tapatalk 2

The Following 3 Users Say Thank You to pmos69 For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools
Display Modes


Top Threads in Galaxy S I9000 Android Development by ThreadRank