[Guide][Advanced][Linux] Compile Cm9 for Samsung Galaxy S

Search This thread

Perka

Senior Member
Sep 15, 2010
3,642
3,122
This is how I compiled cm9 for galaxysmtd.
For sure there are other ways but this is the only way I know, and it works for me.
I use Linux Mint 12.
Reading helps. http://git-scm.com/documentation

Follow this guide until you have synced source. (Step 4D)

Also check 4h. Your Final .bashrc
http://xdaforums.com/showthread.php?t=1505006

2d. Add Extra Path For Device:

Code:
sudo gedit /etc/udev/rules.d/51-android.rules
Enter this in it:
Code:
#Samsung
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"

4c should be this
Code:
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b ics


Manifest
New terminal
Code:
cd ~/android/system
gedit .repo/local_manifest.xml

And add this to the file
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="CyanogenMod/android_device_samsung_galaxysmtd" path="device/samsung/galaxysmtd" />
  <project name="CyanogenMod/android_device_samsung_aries-common" path="device/samsung/aries-common" />
  <project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" />
  <project name="CyanogenMod/android_kernel_samsung_aries" path="kernel/samsung/aries" remote="github" revision="android-samsung-3.0-ics" />
</manifest>

Option 2: if you dont have cm9 installed look here <----Link

For the next step you need to have cm9 installed.
Connect you phone to pc and in terminal type
Code:
adb root

New terminal
Code:
cd ~/android/system/device/samsung/galaxysmtd/
./extract-files.sh

New terminal
Code:
cd ~/android/system/vendor/cm/
./get-prebuilts

New terminal
Code:
cd ~/android/system 
repo sync

New terminal
Code:
. build/envsetup.sh && brunch galaxysmtd


Should be it. Enjoy!

I can not give support on this. Sorry.

Code:
(Package complete: /home/perka/android/system/out/target/product/galaxysmtd/update-cm-9.0.0-RC0-galaxysmtd-KANG-signed.zip
31c9c1175132d005cc093679fc023067  update-cm-9.0.0-RC0-galaxysmtd-KANG-signed.zip)



Credit:
Cyanogen
TKGlitch
Smasher816
TeamHacksung
krarvind
blahbl4hblah
Faryaab
rtfpessoa
PaulForde
scheichuwe
kasper_h
lippol94
malcho
Google
Samsung?
Xda
did I forget you? tell me pls!
and all involved in Linux and Android
 
Last edited:

krarvind

Senior Member
Jun 15, 2011
5,916
13,161
Saint John, NB
@perka, forgot somebody in credits mate?

reason your boot.img didn't wokr is because of the ramdisks. you need special ones for SGS which has CWM recovery in it. Use the one from OneCosmic/Stratoksk/Zach/Tk-Glitch and compile boot.img from zImage/kernel.
 

Perka

Senior Member
Sep 15, 2010
3,642
3,122
@perka, forgot somebody in credits mate?

reason your boot.img didn't wokr is because of the ramdisks. you need special ones for SGS which has CWM recovery in it. Use the one from OneCosmic/Stratoksk/Zach/Tk-Glitch and compile boot.img from zImage/kernel.


Sorry now you are there :)
 

scheichuwe

Senior Member
Sep 23, 2009
473
270
happy place
...

New terminal
cd ~/android/system/device/samsung
git clone git://github.com/teamhacksung/android_device_samsung_galaxysmtd.git -b ics galaxysmtd

then
git clone git://github.com/teamhacksung/android_device_samsung_aries-common.git -b ics aries-common​

go to android/system/vendor/cm
edit file vendorsetup.sh
add this in between any of the lines

add_lunch_combo cm_galaxysmtd-userdebug​

...

You can use a local_maifest.xml instead of that, so these repos get synced, too.

Code:
<?xml version="1.0" encoding="UTF-8"?>
  <manifest>

    <project path="device/samsung/galaxysmtd" name="teamhacksung/android_device_samsung_galaxysmtd" />
    <project path="device/samsung/aries-common" name="teamhacksung/android_device_samsung_aries-common" />
    <project path="vendor/cm" name="teamhacksung/android_vendor_cm" />
    <project path="kernel/samsung-kernel-aries" name="teamhacksung/samsung-kernel-aries" remote="github" revision="android-samsung-3.0-ics" />

  </manifest>

I also made a very simple build script as I didn't know how to use teamhacksung's :D
It builds kernel and cm9-KANG

Code:
#!/bin/bash

repo sync -j`grep 'processor' /proc/cpuinfo | wc -l`
. build/envsetup.sh
cd kernel/samsung-kernel-aries
#make clean
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:~/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/
make aries_galaxysmtd_defconfig
time make -j`grep 'processor' /proc/cpuinfo | wc -l`
cp -f ~/android/system/kernel/samsung-kernel-aries/arch/arm/boot/zImage ~/android/system/device/samsung/galaxysmtd/kernel
find . -name "*.ko" -exec cp -f {} ~/android/system/device/samsung/galaxysmtd/ \;
cd ../..
lunch cm_galaxysmtd-userdebug
#make clobber
time make -j`grep 'processor' /proc/cpuinfo | wc -l` otapackage

With the new builds /system only has limited space left, so you have to delete some files before flashing gapps. Otherwise you'll end up in android.process.acore fc's (that's what happened to me...).
 
  • Like
Reactions: Perka

Perka

Senior Member
Sep 15, 2010
3,642
3,122
You can use a local_maifest.xml instead of that, so these repos get synced, too.

Code:
<?xml version="1.0" encoding="UTF-8"?>
  <manifest>

    <project path="device/samsung/galaxysmtd" name="teamhacksung/android_device_samsung_galaxysmtd" />
    <project path="device/samsung/aries-common" name="teamhacksung/android_device_samsung_aries-common" />
    <project path="vendor/cm" name="teamhacksung/android_vendor_cm" />
    <project path="kernel/samsung-kernel-aries" name="teamhacksung/samsung-kernel-aries" remote="github" revision="android-samsung-3.0-ics" />

  </manifest>

I also made a very simple build script as I didn't know how to use teamhacksung's :D
It builds kernel and cm9-KANG

Code:
#!/bin/bash

repo sync -j`grep 'processor' /proc/cpuinfo | wc -l`
. build/envsetup.sh
cd kernel/samsung-kernel-aries
#make clean
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:~/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/
make aries_galaxysmtd_defconfig
time make -j`grep 'processor' /proc/cpuinfo | wc -l`
cp -f ~/android/system/kernel/samsung-kernel-aries/arch/arm/boot/zImage ~/android/system/device/samsung/galaxysmtd/kernel
find . -name "*.ko" -exec cp -f {} ~/android/system/device/samsung/galaxysmtd/ \;
cd ../..
lunch cm_galaxysmtd-userdebug
#make clobber
time make -j`grep 'processor' /proc/cpuinfo | wc -l` otapackage

With the new builds /system only has limited space left, so you have to delete some files before flashing gapps. Otherwise you'll end up in android.process.acore fc's (that's what happened to me...).

Great will give it a go and after update the OP.

Thanks for helping :)
 

malcho

Senior Member
Aug 30, 2010
3,838
4,336
Sarajevo
These last step i missed when i try to compile it.
Very good job.
Perka could you please add same giude for themes.
I surf alot these days i found program called Idiot for themes but i think it doesn't work with ics.
Thanks alot.
 

DaXmax

Senior Member
Sep 16, 2008
10,846
9,928
Singapore
These last step i missed when i try to compile it.
Very good job.
Perka could you please add same giude for themes.
I surf alot these days i found program called Idiot for themes but i think it doesn't work with ics.
Thanks alot.

All you need is XML editing and eclipse.

Sent from my Nexus S using Tapatalk
 

Perka

Senior Member
Sep 15, 2010
3,642
3,122

Perka

Senior Member
Sep 15, 2010
3,642
3,122
Ok I will work on this guide to make it better and try to include how to add and edit source before compiling.

I dont have much time but as i go I will make notes of what i do and will add it to the guide later.

If you have input/stuff to add pls post and we can make this much better.

thx all :D
 
  • Like
Reactions: cantIntoCode

Top Liked Posts

  • There are no posts matching your filters.
  • 46
    This is how I compiled cm9 for galaxysmtd.
    For sure there are other ways but this is the only way I know, and it works for me.
    I use Linux Mint 12.
    Reading helps. http://git-scm.com/documentation

    Follow this guide until you have synced source. (Step 4D)

    Also check 4h. Your Final .bashrc
    http://xdaforums.com/showthread.php?t=1505006

    2d. Add Extra Path For Device:

    Code:
    sudo gedit /etc/udev/rules.d/51-android.rules
    Enter this in it:
    Code:
    #Samsung
    SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"

    4c should be this
    Code:
    cd ~/android/system/
    repo init -u git://github.com/CyanogenMod/android.git -b ics


    Manifest
    New terminal
    Code:
    cd ~/android/system
    gedit .repo/local_manifest.xml

    And add this to the file
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
      <project name="CyanogenMod/android_device_samsung_galaxysmtd" path="device/samsung/galaxysmtd" />
      <project name="CyanogenMod/android_device_samsung_aries-common" path="device/samsung/aries-common" />
      <project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" />
      <project name="CyanogenMod/android_kernel_samsung_aries" path="kernel/samsung/aries" remote="github" revision="android-samsung-3.0-ics" />
    </manifest>

    Option 2: if you dont have cm9 installed look here <----Link

    For the next step you need to have cm9 installed.
    Connect you phone to pc and in terminal type
    Code:
    adb root

    New terminal
    Code:
    cd ~/android/system/device/samsung/galaxysmtd/
    ./extract-files.sh

    New terminal
    Code:
    cd ~/android/system/vendor/cm/
    ./get-prebuilts

    New terminal
    Code:
    cd ~/android/system 
    repo sync

    New terminal
    Code:
    . build/envsetup.sh && brunch galaxysmtd


    Should be it. Enjoy!

    I can not give support on this. Sorry.

    Code:
    (Package complete: /home/perka/android/system/out/target/product/galaxysmtd/update-cm-9.0.0-RC0-galaxysmtd-KANG-signed.zip
    31c9c1175132d005cc093679fc023067  update-cm-9.0.0-RC0-galaxysmtd-KANG-signed.zip)



    Credit:
    Cyanogen
    TKGlitch
    Smasher816
    TeamHacksung
    krarvind
    blahbl4hblah
    Faryaab
    rtfpessoa
    PaulForde
    scheichuwe
    kasper_h
    lippol94
    malcho
    Google
    Samsung?
    Xda
    did I forget you? tell me pls!
    and all involved in Linux and Android
    26
    Cherry Picking from Gerrit:

    Find your gerrit, I use cm9 as an example.
    http://review.cyanogenmod.com/#q,status:open+branch:ics,n,z
    and I look in open section.

    find your cherry you want to pick :) this maybe?
    http://review.cyanogenmod.com/#change,13511

    look at the middle of the page, click cherry pick and it will give you the link to use.
    Cherry_pick_link.png

    copy the link that you get when you click cherry pick

    then look at the project name to know where it goes in source.
    Project_name.png


    in this case in terminal go to ~/android/system/frameworks/base paste the link and enter.

    You have just picked your cherry ;)

    Check out CNA Gerrit, also great stuff
    http://review.codenameandroid.com/#/q/status:merged,n,z

    as for Git cherry picking I don't know yet how to but when I do I will post.
    If anyone knows pls help out and teach us. :)
    SHA-1 is the way to go I think.
    http://progit.org/ebook/progit.pdf

    Enjoy!
    14
    Great thread, have been building cm7 for some time now. Tried CM9 last night and was successful with the guide in the OP (didn't flash it yet).

    Just an overview of how I cherry-pick commits:

    >cd ~/android system
    >repo sync (to be up-to-date)
    >cd ~/android/system/cherrypicklocation (e.g. /frameworks/base)
    >git branch --track localtesting github/ics (by tracking remote, you stay in the localtesting branch the next time you do repo sync,and keep it up-to-date)
    >git checkout localtesting
    >git fetch http://review.cyanogenmod.com/p/CyanogenMod/android_* && git cherry-pick FETCH_HEAD

    If you do it like this, the cherry-pick will stay also when doing a repo sync. And by keeping the cherry-picks in their own branch (in the example above the branch 'localtesting'), you can always easily get back to the master branch and get rid off all the things you've done. I use the same approach if I change thing in the source code myself. When changing things in the master branch, it's easier to end up in problems/conflicts.

    One thing to take care of: it can happen that a patch on review.cyanogenmod.com gets updated. In that case, I manually remove the cherry-pick and use the procedure above to download the latest patch.
    If you don't have the latest patch cherry-picked, and an updated version of the patch gets merged, you will get errors upon doing a repo sync.

    Two tools which I often use are qgit (to see what's happening in different branches) and meld (to compare files/folders).
    5
    buildscripts/kernel

    if anybody was wondering about the error at the end of compiling - 'kernel ...' - it's about some missings, particularly build.sh.

    so i modified some files.

    now, with default build-command
    Code:
    ~/android/system/buildscripts/samsung$ [B]./build.sh galaxysmtd[/B]
    you will get cm-build

    +

    flashable kernel-update-zip.



    you can also build a standalone kernel-update-zip - >
    Code:
    ~/android/system/buildscripts/samsung$ [B]./build.sh galaxysmtd kernel[/B]

    ---

    How to?

    extract zips content to
    Code:
    [B]~/android/system/buildscripts/samsung[/B]

    (overwrite build.sh, and/or make a -bak-)
    4
    Can you post the contents of your local_manifest.xml? Did you change the kernel revision to jellybean (in OP it is set to android-3.0-ics).

    I posted an updated guide for compiling cm10 here:
    http://xdaforums.com/showthread.php?t=1813924

    Sent from my GT-I9000 using Tapatalk 2