CyanogenMod for Samsung Captivate
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
cd ~/android/system ./build.sh captivate
The build.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:
- Download the following: http://goo-inside.me/google-apps/gapps-gb-20110120-signed.zip
- Load the "File Manager" app
- Change the directory to /sdcard/download
- Tap and hold on "gapps-gb-20110120-signed.zip"
- Select Move
- Select "SD" (or move back to /sdcard)
- Select "Move here"
- Power off phone
- 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
Quick Build
Instead of rebuilding the update all the time and reflashing in CWM, here's a fast way to make a quick change and test.
Manual Initial Build
This is want build.sh does under the hood:
cd ~/android/system source build/envsetup.sh lunch cyanogen_captivate-eng brunch captivate
Additional Build
Now you can start from here and keep making changes. This example is showing the "SystemUI.apk"
mmm frameworks/base/packages/SystemUI
Transfer to Phone
./adb shell mount -o remount -rw -n /system ./adb push ~/android/system/out/target/product/captivate/system/app/SystemUI.apk /system/app ./adb shell mount -o remount -r -n /system
Quick Restart
Since SystemUI.apk is the UI we would normally need to reboot to see our changes. Instead we'll just force the UI to reload with the following.
./adb shell killall system_server
Using Eclipse
After building (from above) without any errors, then follow these steps.
- Copy the .classpath to the root of the repo
cp ~/android/system/development/ide/eclipse/.classpath ~/android/system
- Run Eclipse
- Click File->New->Java Project
- Set "Project name" to Cyanogen
- Uncheck "Use default location"
- Change "Location" to ~/android/system/
- Click Next
- It will take a few moments, so be patient
- Click Finish
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
- ROM Thread: http://forum.xda-developers.com/showthread.php?t=978150
- FAQ Thread: http://forum.xda-developers.com/showthread.php?t=982776
- Build Guide
- Quick Build
- Secret Codes (ssssh, don't tell no one... ok... k): http://cmsgs.com/mediawiki/index.php?title=List_of_Secret_Codes
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