[Galaxy S I9000 Android Development] pmos69:
This guide is an adaptation/update of the following guides to CM10:

http://wiki.cyanogenmod.com/wiki/Samsung_Galaxy_S:_Compile_CyanogenMod_(Linux)

http://xdaforums.com/showthread.php?t=1505006

http://xdaforums.com/showthread.php?t=1533711

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:

stbenz

rycus86

kasper_h

gmhafiz

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:

Arch Linux: Replace steps 1 to 3 with gmhafiz's instructions

________________________________________________________________________________________________________

1 - Install Ubuntu Packages

1.1 - In terminal:

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:

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

2.4 - Install Java JDK:

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:

vi ~/.bashrc

Add these lines to .bashrc:​

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

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:

vi ~/.bashrc

Enter the Following:​

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

sudo vi /etc/udev/rules.d/99-android.rules

Enter this:​

#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:​

sudo chmod +x /etc/udev/rules.d/99-android.rules

3.6 - Close and open new terminal.

3.7 - Install Android SDK Tools

android

Check Android SDK Tools and Android SDK platform-tools and Install them​

4 - Install Repository

4.1 - Download Repo:

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:

vi ~/.bashrc

Enter the following:​

export PATH=$PATH:~/bin

4.3 - Close and open new terminal.

4.4 - Initialize Repository & Sync:

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:

. 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:​

adb root
cd ~/android/system/device/samsung/galaxysmtd/
./extract-files.sh

4.7 - Download Extra Files:

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

4.8 - Add Toolchain PATH:

vi ~/.bashrc

Enter the following:​

#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

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?

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:

make clobber

________________________________________________________________________________________________________

Want to customize the kernel?

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

.