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

Search This thread

pmos69

Senior Member
Feb 16, 2009
1,269
579
Lisbon
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/java/javase/downloads/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:

a0a0

Senior Member
Dec 21, 2009
81
12
Can you also write a small paragraph where you explain how compile a single application like Mms, Phone...

Thank you :)
 

a0a0

Senior Member
Dec 21, 2009
81
12
Yes but if i will try a small change in a code i must compile every time all the rom
 

pmos69

Senior Member
Feb 16, 2009
1,269
579
Lisbon
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
 

stbenz

Member
Mar 30, 2012
36
11
Is step 4.5 (Setup Manifest) really required? Can't test it at the moment, but I know, it isn't required for building CM9 anymore, despite it is mentioned in the guide for building CM9. As I understand it, its a relict from when the Galaxy S specific sources weren't yet merged to the CyanogenMod repository.
 

DerTeufel1980

Inactive Recognized Developer
Jul 31, 2011
10,368
27,668
Is step 4.5 (Setup Manifest) really required? Can't test it at the moment, but I know, it isn't required for building CM9 anymore, despite it is mentioned in the guide for building CM9. As I understand it, its a relict from when the Galaxy S specific sources weren't yet merged to the CyanogenMod repository.

It's not needed.

Gesendet von meinem GT-I9000 mit Tapatalk 2
 

kasper_h

Inactive Recognized Developer
Oct 8, 2010
5,308
16,087
Xiaomi Mi Mix 2S
Samsung Galaxy A52 4G
Is step 4.5 (Setup Manifest) really required? Can't test it at the moment, but I know, it isn't required for building CM9 anymore, despite it is mentioned in the guide for building CM9. As I understand it, its a relict from when the Galaxy S specific sources weren't yet merged to the CyanogenMod repository.

The local manifest is still needed to download the device specific files & kernel source (also for CM9).
The thing not needed for CM9 after some time was using the teamhacksung buildscript.

---------- Post added at 05:27 PM ---------- Previous post was at 05:27 PM ----------

It's not needed.

Gesendet von meinem GT-I9000 mit Tapatalk 2

Sure? I don't see the device-files in the default.xml manifest file...
 

pmos69

Senior Member
Feb 16, 2009
1,269
579
Lisbon
It's not needed.

Gesendet von meinem GT-I9000 mit Tapatalk 2

It shouldn't be, if it is like that, but I didn't get those sources until I added the manifest.
Perhaps a quirk, but that's how it worked.
The thing is, I had to put in the guide, as it was the way it worked, starting from a fresh, completely clean system.

Sent from my GT-I9000 using Tapatalk 2
 
Last edited:
  • Like
Reactions: DerTeufel1980

XYunknown

Retired Recognized Developer
Jun 29, 2012
201
837
Thanks again!
I was looking for something like this for quite a while now. Now I can finally compile my own builds :)
 
Feb 10, 2011
29
11
I compiled a build using this exact method 2 days ago, flashed the build to the phone and it went into constant pre-recovery bootloops. I had to flash GB with Odin to get back.

One thing was that I compile on a seperate box at home and transferred the file using scp. Maybe that corrupted, so I'm gonna try again tomorrow.

Could it be possible that the codebase itself was broken when I compiled? :-/
Did anybody have anythign similar? :S
 

pmos69

Senior Member
Feb 16, 2009
1,269
579
Lisbon
Could it be possible that the codebase itself was broken when I compiled? :-/
Did anybody have anythign similar? :S

Don't think so. The repo is not left with a broken code base.

The thing is, sometimes users get into the boot loop state even when installing the (un)official cm10 builds, so other factors cause them.


Sent from my GT-I9000 using Tapatalk 2
 

Top Liked Posts

  • There are no posts matching your filters.
  • 80
    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/java/javase/downloads/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

    .
    6
    For my first build 2 days ago i've got cm-10-20120806-UNOFFICIAL-galaxysmtd.zip, and today i've done a repo sync and rebuild and i'm still getting cm-10-20120806-UNOFFICIAL-galaxysmtd.zip

    Have I missed something ?

    You have to clean your /out directory, otherwise lots of files are reused and filename is not updated.

    I use the following script to clean my out directory:
    Code:
    #!/bin/bash
    
    out=~/android/system/out/target/product/galaxysmtd
    
    #****************************************************************
    ## Clean environment:
    make installclean
    rm $out/system/build.prop
    rm $out/obj/PACKAGING/target_files_intermediates/cm_galaxysmtd-target_files-eng.kasper.zip
    rm $out/obj/PACKAGING/target_files_intermediates/cm_galaxysmtd-target_files-eng.kasper/SYSTEM/build.prop

    Off course you have to adapt it if your username is not kasper :)
    4
    Guys. Can I move system dalvik on to my data partition (with the right perms/ownership of course)? Can data dalvik and system dalvik occupy the same space? I want to make my /system bigger but if I squeeze my cache it won't hold system dalvik....
    I'm talking OLD partitions here - /system & /cache on iNand, /data on OneNand etc

    Probably.
    I mean, on the cm10 lvm layout under testing, the /cache has been shrunk to 18MB and is basicaly unused (I think it's used only in recovery)

    cm10_lvm.png
    3
    I'm getting this error when I'm trying to do a repo sync. Can anyone help me out?

    Code:
    nick@nick-System-Product-Name:~$ cd ~/android/system/
    nick@nick-System-Product-Name:~/android/system$ repo sync -j16
    Fetching projects:  99% (309/312)  remote: Counting objects: 19, done.
    remote: Compressing objects: 100% (6/6), done.
    remote: Total 13 (delta 10), reused 10 (delta 7)
    Unpacking objects: 100% (13/13), done.
    From git://github.com/CyanogenMod/android_system_core
       6934c8f..92c3874  jellybean  -> github/jellybean
    Fetching projects: 100% (312/312), done.  
    Traceback (most recent call last):
      File "/home/nick/android/system/.repo/repo/main.py", line 385, in <module>
        _Main(sys.argv[1:])
      File "/home/nick/android/system/.repo/repo/main.py", line 365, in _Main
        result = repo._Run(argv) or 0
      File "/home/nick/android/system/.repo/repo/main.py", line 137, in _Run
        result = cmd.Execute(copts, cargs)
      File "/home/nick/android/system/.repo/repo/subcmds/sync.py", line 469, in Execute
        project.Sync_LocalHalf(syncbuf)
      File "/home/nick/android/system/.repo/repo/project.py", line 1049, in Sync_LocalHalf
        lost = self._revlist(not_rev(revid), HEAD)
      File "/home/nick/android/system/.repo/repo/project.py", line 1791, in _revlist
        return self.work_git.rev_list(*a, **kw)
      File "/home/nick/android/system/.repo/repo/project.py", line 1936, in rev_list
        p.stderr))
    error.GitError: CyanogenMod/android_system_core rev-list ('^92c3874861402821ac5d2ce94ef9e5c7310b05ca', 'HEAD', '--'): fatal: bad object 92c3874861402821ac5d2ce94ef9e5c7310b05ca
    
    nick@nick-System-Product-Name:~/android/system$

    what version of repo do you have
    Code:
     ~/android/system repo --version
    This is a relatively common error and an occurence was recently fixed in repo version 1.10.2

    If you're not already on 1.10.2 then try to update with
    Code:
    curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    chmod a+x ~/bin/repo
    3
    Yeah, I gave up after 4 days of repeatedly trying to sync over 4.5M ADSL. Always an error at some point. Git should switch to torrent for first time sync or something...

    Really frustrating :'(

    sent from CM10 powered SGS

    I know what you mean.
    One suggestion for people who get problems like that: do the syncs with -j1
    It takes longer but it gets around some ISPs behaving badly when handling repos with multiple threads.
    I've witnessed this first hand.