cm-10.2-20131022-NIGHTLY issues

Upgraded my GT-i9305T to the latest CyanogenMod nightly, and had quite a few issues. Namely, my phone would no longer connect to 3G/4G, and the APN settings were blank.  Trying to re-enter APN settings didn’t work (nothing would go into the APN list!).  I tried rolling back to a previous nightly, but then the phone just kept rebooting.

The solution was to install the nightly above, and then reboot into ClockwordMod and clear the cache.  After I did that and rebooted, my APN settings were normal and I connected to the data network without issues.

Latest CM Nightly with the i9305T

Went and installed the latest nightly for my i9305T.  What I didn’t notice was the nightly is for CyanogenMod 10.2, which is based on Android 4.3 .  Since the version of Google Apps I had installed was for Android 4.2, it went badly.

Anyway, after a lot of sweating, I got the phone all back and running again with no lost data.  The take-home there is, if you install the recent nightlies (eg http://get.cm/?device=i9305 ) where they are CM 10.2, you have to also install the latest Google Apps (eg http://goo.im/gapps/gapps-jb-20130813-signed.zip ) as well.

The ‘right’ way to do this now would be to download the CM package and the GApps packages, put them on your external SD card, then boot into ClockworkMod, and install the CM zip, then the GApps zip.  Reboot the phone and you should be golden.

Take a backup first using ClockworkMod.

New radio firmware for GT-i9305T with CM10.1

EDIT:  The new radio firmware didn’t stop my mdm_hsic_pm0 problem, but enabling data roaming has seemed to.  I’m definitely not out-of-country or in a position where data roaming should be a thing, so I’m not too worried about having it on.  However, turning it on seems to have immediately put a stop to the mdm_hsic_pm0 shenannigans.  Very strange, but I’m suspicious that doing so may have gotten around some kind of bug in the radio firmware.  More if I find out more.

There’s a new radio firmware available for the GT-i9305T (Samsung Galaxy S3 International, Telstra Australia variant).  The new firmware is coded UBBMB2, and can be downloaded from this thread at XDA Developers.

I usually avoid updating radio firmware unless there’s an actual need to.  In this case, my phone with the old DVALI5 radio on it was randomly blowing half the battery overnight, with mdm_hsic_pm0 being the top wakelock consumer (and having a wake time of half the time the phone was unplugged!).  This is typically associated with Fast Dormancy issues.  So, I went and updated the radio, and yesterday the phone only used an average of 0.9% battery per hour, with mdm_hsic_pm0 being a lower consumer and with a much, much lower proportion of wake time compared to run time.

In addition, for anyone using the official CyanogenMod 10.1 nightlies for the GT-i9305T, keep in mind that the nightlies have changed over to CM 10.1.  This means if you’re using them, you should update your Google Apps install to the latest version too.  You can get them from Goo.im here.

Note, updating both of the above items (gapps update, radio firmware) can be done without a factory reset, so you won’t lose your stuff.  But I still advise doing a nandroid backup anyway.

To update, just drop the ZIPs onto your SD card, boot up into ClockModRecovery, and flash them.

Installing a CyanogenMod ROM onto a GT-i9305

DANGER!  Installing a custom recovery and firmware can void your warranty, and in some rare circumstances render your phone irrevocably bricked (broken).  Be aware of what you’re doing when you do this, and be aware of the consequences of installing third-party firmware.  I can’t be held responsible if your phone is bricked, buggy, or anything bad happens as a result of doing this.  

Notably, any firmware intended for the GT-i9305 will work with a GT-i9305T.  They’re the same phone, although the radio firmware likely differs.  We won’t be messing with radio firmware though.

Getting a custom firmware onto a GT-i9305 comes in a couple of steps;

  • Install a custom recovery.  We’ll use ClockworkMod for this.
  • Take a nandroid backup of the phone using CWM (pre-rooting).
  • Root the phone so that we have superuser access and can install TitaniumBackup
  • Then, we’ll root the phone, which lets you have superuser access.
  • Take backups of everything with TitaniumBackup.
  • Back up the IMEI / NVRAM data (the i9305 stores IMEI data on flash, so it’s possible for a bad firmware flash to wipe your IMEI, which is really really bad).
  • Reboot into CWM and flash the CyanogenMod 10.1 build ZIP.
  • Factory reset the phone.
  • Set it back up again.

Now, a couple of things we need to get out of the way;

Recovery Boot Modes

In order to boot to ClockworkMod Recovery mode, turn off the phone, and hold volume UP + Home + Power.  When you see the Samsung splash screen, let go of the power button, but keep holding down the other two until you see CWM’s boot screen.

In order to boot to Download Mode (used with ODIN), turn off the phone, and hold volume DOWN + Home + Power.  When you see the Samsung splash screen, let go of the power button, but keep holding the other two until you see the big Android warning.  Follow the prompts.

Host OS Choice

I did all this on a Windows 7 x64 box.  You can theoretically do this with Linux, but I haven’t tried.  Your mileage may vary with other OSes.

Let’s get cracking!

Continue reading “Installing a CyanogenMod ROM onto a GT-i9305”

CyanogenMod 10.1 for the GT-i9305 from source

Bit the bullet, and built my own CyanogenMod 10.1 for my GT-i9305T phone from source.  Works great, and that means I now have Android 4.2.2 on it!

Following is a quick piece on how to build your own CM 10.1 from source for the i9305.

First, some info, then we’ll get into it;

Reference Links

http://forum.xda-developers.com/showthread.php?t=1971645
http://forum.xda-developers.com/showthread.php?p=33038053
http://forum.xda-developers.com/showthread.php?t=2157651

Machine Prep

I used an Ubuntu 12.10 x64 virtual machine running under VMware Workstation.  Give the machine a pretty fair amount of CPU and RAM (I went 4Gb ram and 4 vCPU since I have a quad-core box).  Build times are heavily limited by CPU.

You will also need a significant amount of disk space.  The built source tree takes up about 35Gb, so go with a 50Gb VM and you should have enough.

Once done, update the machine entirely, then from a Terminal prompt, run this to download pre-requisites;

  sudo apt-get install git-core gnupg flex bison gperf build-essential \
      zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
      libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
      libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
      python-markdown libxml2-utils schedtool pngcrush xsltproc zlib1g-dev:i386
  sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Repository Synchronization

Download the repo tool and set it up;

    mkdir ~/bin
    PATH=~/bin:$PATH
    cd ~/bin
    curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    chmod a+x ~/bin/repo

Create source repo for CyanogenMod and then synchronize;

    mkdir ~/cm10.1
    cd ~/cm10.1
    repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
    repo sync

Create the file ~/cm10.1/.repo/local_manifests/i9305.xml with this text;

<manifest>
        <project name="CyanogenMod/android_device_samsung_i9305" path="device/samsung/i9305" remote="github" revision="cm-10.1"/>
        <project name="CyanogenMod/android_device_samsung_smdk4412-common" path="device/samsung/smdk4412-common" remote="github" revision="cm-10.1"/>
        <project name="CyanogenMod/android_kernel_samsung_smdk4412" path="kernel/samsung/smdk4412" remote="github" revision="cm-10.1"/>
        <project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-10.1"/>
    </manifest>

Resync the repository to grab the latest sources etc for the i9305;

    repo sync

Note!  This will take a LONG time, and will download a lot of stuff!

At this point you will have an assembled source tree.  Now we need to set up the JDK and Android SDKs before we can build;

Configure Java JDK

It’s possible to build CM with OpenJDK, but it’s recommended that you build with the Sun Java 1.6 JDK instead.  So we’ll discuss how to do that.  NOTE – Doing this will change your default Java version to the Sun one instead of OpenJDK!

Download the latest Sun Java 1.6 JDK x64 ( jdk-6u43-linux-x64.bin ) and install;

    cd ~/Downloads
    chmod +x jdk-6u43-linux-x64.bin
    ./jdk-6u43-linux-x64.bin
    sudo mv jdk1.6.0_43 /usr/lib/jvm/jdk-6u43-linux-x64.bin

Configure Java alternatives;

    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u43-linux-x64.bin/bin/javac 1
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-6u43-linux-x64.bin/bin/java 1
    sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-6u43-linux-x64.bin/bin/javaws 1
    sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk-6u43-linux-x64.bin/bin/javadoc 1
    sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk-6u43-linux-x64.bin/bin/javah 1
    sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk-6u43-linux-x64.bin/bin/javap 1
    sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-6u43-linux-x64.bin/bin/jar 1

Set the default Java version for your system to that JDK

    sudo update-alternatives --config javac
    sudo update-alternatives --config java
    sudo update-alternatives --config javaws
    sudo update-alternatives --config javadoc
    sudo update-alternatives --config javah
    sudo update-alternatives --config javap
    sudo update-alternatives --config jar

Run ‘java -version’ and check that the version matches what you installed.

Check that all the alternatives symlinks point to the JDK you installed;

    ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar

Extract proprietary files

Note, your phone will already have to be rooted in order to be able to do this.  This will extract the necessary vendor-specific proprietary files you will need to be able to build a working firmware.  If your phone isn’t rooted, root it now.

Download the Android SDK ( android-sdk_r21.1-linux.tgz ) and install;

    cd ~/Downloads
    mkdir ~/android
    tar -zxvf android-sdk_r21.1-linux.tgz
    mv android-sdk-linux ~/android/sdk
    PATH=~/android/sdk:~/android/sdk/platform-tools:~/android/sdk/tools:$PATH

Run the Android SDK Tools with ‘android’, then select both of these components and install them;

+ Android SDK Tools
+ Android SDK Platform-tools
+ Android 4.2.2 (API 17)
– Deselect ‘Intel x86 Atom System Image’
– Deselect ‘MIPS System Image’

Let it download.  This will probably take a while.

Enable USB Debugging mode on your phone, then plug it in. In order to enable this, go to Settings -> About Phone, then tap the Build number field seven times.  This will enable Developer Options.  In Settings, go to Developer Options, and turn on USB Debugging mode.

Now, collect the proprietary files from the phone.

    cd ~/cm10.1
    . build/envsetup.sh
    cd ~/cm10.1/device/samsung/i9305
    ./extract-files.sh

It may be necessary to manually copy out ‘/sbin/cbd’ from your phone.  You can do this by SSH’ing out of your phone by running a terminal emulator (rooted!) on the phone and then running ssh into your Ubuntu VM.  After that’s all done, you can turn USB Debugging back off again.

Now fetch any prebuilts required for CM-10.1;

    ~/cm10.1/vendor/cm/get-prebuilts

At this point, you have a completed and ready source tree, and can now build your rom.

Building the ROM

Rebuild like this (you do this the first time, and also do these steps subsequent times you want to update your build);

    PATH=~/bin:~/android/sdk:~/android/sdk/platform-tools:~/android/sdk/tools:$PATH
    cd ~/cm10.1
    repo sync
    . build/envsetup.sh
    brunch i9305

At the end, you should find a built ZIP file in ~/cm10.1/out/target/product/i9305 .

What now?

Next up, you’re going to have to get that onto your phone.  I’ll write up soon about how to install ClockworkMod and get that newly compiled ROM into your phone.