본문 바로가기
정보기술/Android

How to build CyanogenMod 10 (Jellybean) for Samsung Galaxy S III (Sprint) SPH-L710

by fermi 2012. 12. 13.


참고:


Samsung Galaxy S III (Sprint) 디바이스 코드명: d2spr

1. Requirements:

Linux - Ubuntu 12.04 - 64bit (AFAIK, a 64 bit host is needed to compile JB)
About 14GB of storage for the repository plus about 15GB for building (Recommend 50GB)

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 4GB of RAM) 

2. Ubuntu 준비


필수: Ubuntu 12.04.1 LTS Desktop 64-bit

다운로드: http://www.ubuntu.com/start-download?distro=desktop&bits=64&release=lts


2.1 - Ubuntu 한글 입력 환경:

키보드 레이아웃은 English 로 그대로 나두고, Language Support 에서 Korean 추가

Language Support 에서 Input Method 만 ibus를 선택 후 시스템 restart.

이후 태스크 메뉴의 ibus 아이콘을 클릭하여 Preference 에서 Input Method 에 Korean 을 추가하고 Input Method On/Off 단축키를 Shift+space로 설정


2.2 - Time Zone:

Time Zone 서울로 변경


3. Install Ubuntu Packages


3.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


4. Install JAVA


NOTE: Must be JDK 1.6 - Don't use other versions.


4.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.


4.2 - Move jdk-6u##-linux-x64.bin to your home directory


4.3 - Remove any other java packages from system:

Code:

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


4.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


4.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


5. Install Android SDK


5.1 - Setup directories:

Code:

cd ~

mkdir android

cd android

mkdir sdk


5.2 - Download Android SDK from http://developer.android.com/sdk/index.html


5.3 - Extract SDK contents to ~/android/sdk


5.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


5.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


5.6 - Close and open new terminal.


5.7 - Install Android SDK Tools

Code:

android

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


6. Install Repository


6.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


6.2 - Add Repo Path:

Code:

vi ~/.bashrc

Enter the following:

Code:

export PATH=$PATH:~/bin


6.3 - Close and open new terminal.


6.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...


6.5 - Get Device Specific Repos:

Code:

. build/envsetup.sh && breakfast d2spr

Get more beer...


6.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/d2spr/

./extract-files.sh


6.6 - Get proprietary files:

Code:

cd ~/android/system

git clone https://github.com/TheMuppets/proprietary_vendor_samsung.git vendor/samsung


6.7 - Download Extra Files:

Code:

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


6.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


6.9 - Close and open new terminal.


7. Building Android


Code:

cd ~/android/system

. build/envsetup.sh && brunch d2spr

Go get a beer. And another. And another...


8. Install on Phone


8.1 - Copy your .zip file from ~/android/system/out/target/product/d2spr/cm-10-XXXXXXXXX-UNOFFICIAL-d2spr.zip to the root of the SD card.


8.2 - Optional: Download Google Apps for Jelly Bean from http://goo.im/gapps and place it on the root of the SD card.


8.3 - Flash both of these .zip files from recovery.

Call your mother. She misses you.


...and that's it.


9. How to update?


Code:

cd ~/android/system

repo sync -j16

make installclean


find ./out/ -name 'build.prop' | xargs rm

find ./out/ -name 'cm_d2spr-target_files-eng.*.zip' | xargs rm

rm -rf ~/android/system/out

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


10. 한글 SMS 코드 수정


http://wwww.matpclub.com/?m=bbs&bid=imbed&uid=91803

http://code.google.com/p/cyanogenmod/issues/detail?id=2410

http://code.google.com/p/cyanogenmod/issues/attachmentText?id=2410&aid=8690011502386790186&name=sms_mms_korean.diff

sms_mms_korean.diff


10.1 - sms_mms_korean.diff:

diff --git a/core/java/com/google/android/mms/pdu/CharacterSets.java b/core/java/com/google/android/mms/pdu/CharacterSets.java

index 4e22ca5..78441b3 100644

--- a/core/java/com/google/android/mms/pdu/CharacterSets.java

+++ b/core/java/com/google/android/mms/pdu/CharacterSets.java

@@ -40,6 +40,7 @@ public class CharacterSets {

     public static final int ISO_8859_8  = 0x0B;

     public static final int ISO_8859_9  = 0x0C;

     public static final int SHIFT_JIS   = 0x11;

+    public static final int EUC_KR      = 0x26;

     public static final int UTF_8       = 0x6A;

     public static final int BIG5        = 0x07EA;

     public static final int UCS2        = 0x03E8;

@@ -66,6 +67,7 @@ public class CharacterSets {

         ISO_8859_8,

         ISO_8859_9,

         SHIFT_JIS,

+        EUC_KR,

         UTF_8,

         BIG5,

         UCS2,

@@ -87,6 +89,7 @@ public class CharacterSets {

     public static final String MIMENAME_ISO_8859_8  = "iso-8859-8";

     public static final String MIMENAME_ISO_8859_9  = "iso-8859-9";

     public static final String MIMENAME_SHIFT_JIS   = "shift_JIS";

+    public static final String MIMENAME_EUC_KR      = "euc-kr";

     public static final String MIMENAME_UTF_8       = "utf-8";

     public static final String MIMENAME_BIG5        = "big5";

     public static final String MIMENAME_UCS2        = "iso-10646-ucs-2";

@@ -110,6 +113,7 @@ public class CharacterSets {

         MIMENAME_ISO_8859_8,

         MIMENAME_ISO_8859_9,

         MIMENAME_SHIFT_JIS,

+        MIMENAME_EUC_KR,

         MIMENAME_UTF_8,

         MIMENAME_BIG5,

         MIMENAME_UCS2,

diff --git a/core/java/com/google/android/mms/pdu/PduPersister.java b/core/java/com/google/android/mms/pdu/PduPersister.java

index 9fdd204..09c2214 100644

--- a/core/java/com/google/android/mms/pdu/PduPersister.java

+++ b/core/java/com/google/android/mms/pdu/PduPersister.java

@@ -425,8 +425,13 @@ public class PduPersister {

                     if (ContentType.TEXT_PLAIN.equals(type) || ContentType.APP_SMIL.equals(type)

                             || ContentType.TEXT_HTML.equals(type)) {

                         String text = c.getString(PART_COLUMN_TEXT);

-                        byte [] blob = new EncodedStringValue(text != null ? text : "")

-                            .getTextString();

+                        byte [] blob;

+                        try {

+                            blob = (text != null ? text : "").getBytes(CharacterSets.getMimeName(charset));

+                        } catch (Exception e) {

+                            Log.w(TAG, "Failed to decode an MMS text.", e);

+                            blob = new byte[0];

+                        }

                         baos.write(blob, 0, blob.length);

                     } else {

 

@@ -741,7 +746,7 @@ public class PduPersister {

                     || ContentType.APP_SMIL.equals(contentType)

                     || ContentType.TEXT_HTML.equals(contentType)) {

                 ContentValues cv = new ContentValues();

-                cv.put(Telephony.Mms.Part.TEXT, new EncodedStringValue(data).getString());

+                cv.put(Telephony.Mms.Part.TEXT, new EncodedStringValue(part.getCharset(), data).getString());

                 if (mContentResolver.update(uri, cv, null, null) != 1) {

                     throw new MmsException("unable to update " + uri.toString());

                 }

diff --git a/telephony/java/com/android/internal/telephony/SimRegionCache.java b/telephony/java/com/android/internal/telephony/SimRegionCache.java

index 2cf6d25..7825781 100644

--- a/telephony/java/com/android/internal/telephony/SimRegionCache.java

+++ b/telephony/java/com/android/internal/telephony/SimRegionCache.java

@@ -17,14 +17,58 @@

 package com.android.internal.telephony;

 

 import android.os.SystemProperties;

+import android.util.Log;

 

 public class SimRegionCache {

+

+    private static final String LOG_TAG = "GSM";

+    private static final String PROPERTY_CACHED_MCC = "gsm.cachedMcc";

+

     public static final int MCC_UNSET  = Integer.MIN_VALUE;

     public static final int MCC_KOREAN = 450;

 

     private static int regionFromMcc = MCC_UNSET;

 

     /**

+     * Updates the cache of the SIM card region code manually with the

+     * specified MCC (Mobile Country Code).  Specify null if you want

+     * to get the ICC operator numeric from SystemProperties.

+     */

+    public static void setRegion(String mcc) {

+        if (mcc == null) {

+            if (regionFromMcc != MCC_UNSET) {

+                return;

+            }

+            mcc = SystemProperties.get(PROPERTY_CACHED_MCC, null);

+            if (mcc == null) {

+                mcc = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, null);

+            }

+        }

+        if (mcc == null || mcc.length() < 3) {

+            regionFromMcc = MCC_UNSET;

+            return;

+        }

+

+        mcc = mcc.substring(0, 3);

+

+        try {

+            regionFromMcc = Integer.parseInt(mcc);

+        } catch (Exception e) {

+            Log.w(LOG_TAG, "Invalid MCC: " + mcc, e);

+            return;

+        }

+

+        // Store the cached MCC in the system properties to avoid class loader issues.

+        SystemProperties.set(PROPERTY_CACHED_MCC, mcc);

+

+        if (regionFromMcc == MCC_KOREAN) {

+            Log.w(LOG_TAG, "Korean SIM detected - alternative message encoding might be applied on the received SMS and MMS messages.");

+        } else {

+            Log.d(LOG_TAG, "Detected MCC: " + regionFromMcc);

+        }

+    }

+

+    /**

      * Returns the region as read from the MCC of the SIM card.

      * If the property {@link TelephonyProperties#

      * PROPERTY_ICC_OPERATOR_NUMERIC}

@@ -34,17 +78,7 @@ public class SimRegionCache {

      */

     public static int getRegion() {

         if (regionFromMcc == MCC_UNSET) {

-            String plmn = SystemProperties.get(

-                    TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC,

-                    null);

-

-            if (plmn != null && plmn.length() >= 3) {

-                try {

-                    regionFromMcc = Integer.parseInt(plmn.substring(0, 3));

-                } catch(Exception e) {

-                    // Nothing that can be done here.

-                }

-            }

+            setRegion(null);

         }

         return regionFromMcc;

     }

diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java

index b4e7b63..ddd1c5d 100644

--- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java

+++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java

@@ -35,6 +35,7 @@ import com.android.internal.telephony.IccUtils;

 import com.android.internal.telephony.IccVmFixedException;

 import com.android.internal.telephony.IccVmNotSupportedException;

 import com.android.internal.telephony.MccTable;

+import com.android.internal.telephony.SimRegionCache;

 

 import java.util.ArrayList;

 

@@ -498,6 +499,8 @@ public final class SIMRecords extends IccRecords {

 

                 Log.d(LOG_TAG, "IMSI: " + imsi.substring(0, 6) + "xxxxxxxxx");

 

+                SimRegionCache.setRegion(imsi);

+

                 if (mncLength == UNKNOWN) {

                     // the SIM has told us all it knows, but it didn't know the mnc length.

                     // guess using the mcc

diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java

index d87f395..331648c 100644

--- a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java

+++ b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java

@@ -791,7 +791,7 @@ public class SmsMessage extends SmsMessageBase{

             String ret;

 

             try {

-                ret = new String(pdu, cur, byteCount, "KSC5601");

+                ret = new String(pdu, cur, byteCount, "EUC-KR");

             } catch (UnsupportedEncodingException ex) {

                 // Should return same as ENCODING_UNKNOWN on error.

                 ret = null;

@@ -1075,11 +1075,21 @@ public class SmsMessage extends SmsMessageBase{

                     break;

 

                 case 1: // 8 bit data

-                case 3: // reserved

                     Log.w(LOG_TAG, "1 - Unsupported SMS data coding scheme "

                             + (dataCodingScheme & 0xff));

                     encodingType = ENCODING_8BIT;

                     break;

+

+                case 3: // reserved (or KSC5601 for Korean SIM)

+                    Log.w(LOG_TAG, "3 - Unsupported SMS data coding scheme "

+                            + (dataCodingScheme & 0xff));

+                    if (SimRegionCache.getRegion() == SimRegionCache.MCC_KOREAN) {

+                        Log.w(LOG_TAG, "Korean SIM, using KSC5601 for decoding.");

+                        encodingType = ENCODING_KSC5601;

+                    } else {

+                        encodingType = ENCODING_8BIT;

+                    }

+                    break;

                 }

             }

         } else if ((dataCodingScheme & 0xf0) == 0xf0) {


11. 기타


설치 전에 순정 롬을 백업하고 나중에 리스토어할 수 있는가?