CyanogenMod for Samsung Captivate

From Oh Mad Lab
Revision as of 06:11, 21 March 2011 by Ohayden (talk | contribs) (→‎Resources)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Setup Environment

  • Open the apt sources to add canonical for the sun-java6-jdk package
vim /etc/apt/sources.list
  • Add non-free to the end of the deb line
  • Setup development environment:
aptitude install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush g++-multilib gcc-4.3-multilib g++-4.3-multilib schedtool lzma
  • 64-Bit
aptitude install lib32z1-dev lib32ncurses5-dev lib32readline5-dev
  • 32-Bit
aptitude install libreadline5-dev libncurses5-dev
  • Create Directories:
mkdir -p ~/bin
mkdir -p ~/android/system
cd ~/android/system 
  • Setup Repository
curl http://android.git.kernel.org/repo > ~/bin/repo
chmod a+x ~/bin/repo
reboot
  • Initialize Repository
repo init -u git://github.com/teamhacksung/android.git -b gingerbread

Syncing Repository

repo sync -j2

NOTE: I see others using -j<large number> and this for some reason causes errors for me, such as:

Fetching projects:  56% (134/239)  fatal: Unable to look up android.git.kernel.org (port 9418) (Name or service not known)
error: Cannot fetch platform/external/tcpdump

Download ROMManager and gApps

This is typically only needed one time.

./build.sh prepare

Build Initial

The initial needs to be done only the first time you convert over to CyanogenMod.

cd ~/android/system/releasetools
./efsbackup.sh captivate
./initial.sh captivate

The efsbackup.sh script will generate:

~/android/system/out/target/product/captivate/captivate-efsbackup.zip

The initial.sh script will generate:

~/android/system/out/target/product/captivate/cm7-captivate-initial-20110318.zip
~/android/system/out/target/product/captivate/cm7-captivate-initial-kernel.tar

Build Update

./build.sh captivate

The initial.sh script will generate:

~/android/system/out/target/product/captivate/update-cm-7.0.0-RC0-Captivate-KANG-signed.zip

Initial Update

Check List

Verify HSPA

If you're doing this the first time then you need to make sure that you haven't disabled anything in HSPA.

  • Dial *#301279# on your phone
  • Select:
[2] CHANGE HSPA REVISION
  • Select:
[3] RELEASE 6 (HSDPA/HSUPA)

You'll then see:

CHANGE_REL5
HSDPA ON, HSUPA ON
  • Press menu then end

Verify Space

  • Ensure you have at least 200MB free on your internal sd card (\sdcard)

Verify Charge

  • Ensure your battery is charged to 100% as the process will a bit of time

Flashing Initial

Preparing

  • Attach your phone to the wall wart
  • Copy the following to your internal sd card (\sdcard)
~/android/system/out/target/product/captivate/captivate-efsbackup.zip
~/android/system/out/target/product/captivate/cm7-captivate-initial-20110318.zip
  • If your already on a ROM with ClockworkMod Recovery, then you can skip this next section to move on to "Installing CyanogenMod"

Flashing Kernel with ClockworkMod Recovery

  • If your on stock, then you need to download a kernel with ClockworkMod Recovery and flash it instead of a full blown ROM
wget http://crackerjackbox.com/android/speedmod-kernel-i897-k13c-500hz.tar
  • Extract the zImage from the archive
tar xf speedmod-kernel-i897-k13c-500hz.tar
  • Put phone in download mode (The yellow screen that says "Downloading..." "Do not turn off Target!!")
  • Connect the phone up to the computer via USB
  • On the computer run:
heimdall flash --kernel ./zImage 
  • Once done it will reboot but it can't load all the way, so just pull the battery then continue on below

Installing CyanogenMod

  • Reboot into recovery mode using 3 button combo, see Method 1 here for how

NOTE: CyanogenMod wiki says: Don't use "reboot recovery" command or other shiny things to do this! I don't know why, but I'm not one to throw caution into the wind.

  • In the "ClockworkMod Recovery" menu:
    • Select "install zip from sdcard"
    • Select "choose zip from sdcard"
    • Scroll down and select "captivate-efsbackup.zip"
    • Scroll down and select "Yes - Install captivate-efsbackup.zip"

Your output should be as such:

-- Installing: SDCARD:captivate-efsbackup.zip
Finding update package...
Opening update package...
Installing update...
EFS BACKUP TOOL
Done

Install from sdcard complete
  • Still in the ClockworkMod menu:
    • Select "+++++Go Back+++++"
    • Select "advanced"
    • Select "Reboot to Download mode"
  • You will now be in the yellow "Downloading..." "Do not turn off Target!!" screen (download mode):
  • Connect the phone up to the computer via USB
  • On the computer:
cd ~/android/system/out/target/product/captivate
tar xf cm7-captivate-initial-kernel.tar
heimdall flash --kernel ./zImage

Your output should be as such:

Heimdall, Copyright (c) 2010, Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/


Claiming interface...   Failed. Attempting to detach driver...
Claiming interface again...   Success
Setting up interface...   Success
Beginning session...
Handshaking with Loke...   Success

Uploading kernel
100%
Kernel upload successful
Ending session...
Rebooting device...
Re-attaching kernel driver...
  • The phone will reboot and you'll see a pretty "Galaxy S" "cyanogen(mod)" boot logo
    • Pull the phone from the USB cable
    • Pull the battery and then reboot into recovery mode using 3 button combo, see Method 1 here for how
  • Attach your phone to the wall wart
  • In the "ClockworkMod Recovery" menu:
    • Select "mounts and storage"
    • Select "format /system"
    • Scroll down and select "Yes - Format"
    • Select "format /cache"
    • Scroll down and select "Yes - Format"
    • Select "format /data"
    • Scroll down and select "Yes - Format"
    • Select "+++++Go Back+++++"
    • Select "install zip from sdcard"
    • Select "choose zip from sdcard"
    • Scroll down and select "cm7-captivate-initial-20110318.zip"
    • Scroll down and select "Yes - Install cm7-captivate-initial-20110318.zip"

Your output should be as such:

-- Installing: /sdcard/cm7-captivate-initial-20110318.zip
E:no misc partition
Finding update package...
Opening update package...
Installing update...
Welcome to CyanogenMod-7.0.0-GalaxyS
Formatting partitions...
Installing system...
Creating symlinks...
Setting permissions...
Flashing radio image...
Restoring efs...
Done.

Install from sdcard complete.
  • Still in the ClockworkMod menu:
    • Select "+++++Go Back+++++"
    • Select "wipe data/factory reset"
    • Scroll down and select "Yes - delete all user data"
    • Select "reboot system now"

Installing Google Apps

  • In your phone's browser:
  • Reboot into recovery mode using 3 button combo, see Method 1 here for how
  • In the "ClockworkMod Recovery" menu:
    • Select "install zip from sdcard"
    • Select "choose zip from sdcard"
    • Scroll down and select "gapps-gb-20110120-signed.zip"
    • Scroll down and select "Yes - gapps-gb-20110120-signed.zip"
    • Select "reboot system now"
    • Your phone will now reboot and you will now have the Market Place app along with the various other Google apps

Restore to Factory

Eclair

Firmware Version: 2.1-update1
Baseband Version: I897UCJF6
Kernel Version: 2.6.29 / jataek.lee@sep-11 #2
Build Number: ECLAIR
  • Download I897UCJF6.tar
wget http://crackerjackbox.com/android/I897UCJF6.tar
  • Extract
tar xf I897UCJF6.tar
  • Put phone in download mode (The yellow screen that says "Downloading..." "Do not turn off Target!!")
  • Connect phone to computer via USB
  • Flash via heimdall
heimdall flash --cache cache.rfs --dbdata dbdata.rfs --kernel zImage --modem modem.bin

Log for Reporting Bugs

  • Using the Goolge Android SDK
adb logcat > logcat.txt
adb shell
cat /proc/last_kmsg > /sdcard/last_kmsg.txt
exit
adb pull /sdcard/last_kmsg.txt ./

Resources

Errors / Solutions

IOError: [Errno 2] No such file or directory: u'./android/system/prebuilt/.git/HEAD'

rm -rf prebuilt/
repo sync -j2

prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: /lib/i686/cmov/libc.so.6: version `GLIBC_2.11' not found (required by prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc)

cd prebuilt/linux-x86/toolchain/
mv arm-eabi-4.4.3 arm-eabi-4.4.3.flc
ln -s arm-eabi-4.4.0  arm-eabi-4.4.3

make: *** No rule to make target `vendor/cyanogen/proprietary/RomManager.apk', needed by `out/target/product/galaxys/system/app/RomManager.apk'. Stop.

cd vendor/cyanogen
./get-rommanager 

error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'

If you get this error, detail provided below, then it's because your gcc is out of date and has a bug! I know that gcc that comes with lenny (4.3) has this bug. Once I rebuilt my lxc with squeeze, which has "gcc (Debian 4.4.5-8) 4.4.5", I had no problems whatsoever with this error.

target Executable: make_ext4fs (out/target/product/galaxys/obj/EXECUTABLES/make_
ext4fs_intermediates/LINKED/make_ext4fs)
target Non-prelinked: make_ext4fs (out/target/product/galaxys/symbols/system/bin
/make_ext4fs)
target Strip: make_ext4fs (out/target/product/galaxys/obj/EXECUTABLES/make_ext4f
s_intermediates/make_ext4fs)   
Install: out/target/product/galaxys/system/lib/libext4_utils.so
Install: out/target/product/galaxys/system/bin/make_ext4fs
target SharedLib: libeffects (out/target/product/galaxys/obj/SHARED_LIBRARIES/li
beffects_intermediates/LINKED/libeffects.so)
target Non-prelinked: libeffects (out/target/product/galaxys/symbols/system/lib/libeffects.so)
target Strip: libeffects (out/target/product/galaxys/obj/lib/libeffects.so)
target thumb C: liba2dp <= external/bluetooth/bluez/audio/../sbc/sbc_primitives_neon.c
external/bluetooth/bluez/audio/../sbc/sbc_primitives_neon.c: In function 'sbc_calc_scalefactors_j_neon':
external/bluetooth/bluez/audio/../sbc/sbc_primitives_neon.c:309: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
external/bluetooth/bluez/audio/../sbc/sbc_primitives_neon.c:309: error: 'asm' operand has impossible constraints
make: *** [out/target/product/galaxys/obj/SHARED_LIBRARIES/liba2dp_intermediates/../sbc/sbc_primitives_neon.o] Error 1