Installing Custom ROM on Galaxy S4 International from Ubuntu

Or as an alternative title “Liberating your Galaxy S4 Hardware from Samsung Bloatware”.

Unfortunately there is lots of (ad-infested) blogs and forums with dodgy pieces of information on this topic and I found it pretty hard to get descent concise information. So hopefully this might help some poor Linux User liberate their phone. Whilst this has been tested on a Samsung GT-I9505 S4 International LTE device (JFLTEXX series) it should be applicable to other similar Samsung phones that are not fastboot capable (ie. all but the Galaxy Nexus range).

Samsung Galaxy S4 - gap with dust by Janitors, on Flickr
Creative Commons Attribution 2.0 Generic License  by  Janitors 

NOTE: If you have encrypted your device do yourself a favor and do a factory reset BEFORE you start the process (otherwise you will be stuck in a boot-loop as the encryption key will be gone and the device will not start without it). See note below to recover to stock Samsung image if you need to.

Rooting

This area is the hardest to get decent (Ubuntu relevant) information. However (contrary to some forum entries out there) Heimdall is the most workable solution to use from Ubuntu – binary .deb packages are available from https://bitbucket.org/benjamin_dobell/heimdall/downloads. There is both a commandline package as well as a GUI available for Ubuntu 12.10 and 13.04 as well as other Linux distros.

Note [2014-11-24]: Had to upgrade my daughters S4 Mini and I noticed that Heimdall is now in the default UBUNTU Repositories. You can install simply by ‘sudo apt-get install heimdall-flash‘ now.

Make sure the device has Developer mode enabled

  • Go to Application > Settings.
  • In the upper-right corner of your screen, tap on “More” button.
  • Navigate to the bottom and select About.
  • Tap “Build number” several times until you see a message that says “Developer mode has been enabled“.
  • Tap the Back button and you will see the Developer options menu under the “System” heading, you can now set Developer options.
  • Check the USB debugging box under Developer options and you are ready to use your Samsung Galaxy S4 in debugging mode.

A very big THANK YOU to Benjamin Dobell from Glass Echidna. Can’t comment on the blog – your work is much appreciated.

Flash cf-auto-root images

Download the I9505 images from http://autoroot.chainfire.eu/ and extract.

Boot the device into download mode (Press POWER ON + VOLUME DOWN + HOME simultaneously and then when the green Android appears VOLUME UP)

This part took me a while to get right as there was not a lot of decent information around (NOTE: CASE-sensitive PIT partition name). You also need to have the “–no-reboot” flag as you need to boot straight into recovery as a reboot will revert back to the Samsung recovery image.
heimdall flash --no-reboot --RECOVERY recovery.img --CACHE cache.img.ext4

Reboot manually into Recovery Mode (Press POWER ON + VOLUME UP + HOME simultaneously) and the rooting process should complete.

Install Recovery Image

As per recommendation from the XDA Forums I used PhilZ recovery. The GT-I9505 files are at http://d-h.st/users/philz_touch/?fld_id=16685#files

Extract the recovery.img file from the ZIP and flash the recovery partition

heimdall flash --no-reboot --RECOVERY recovery.img

Install AOSP Google Play Edition

Boot into the Touch Recovery Boot (Press POWER ON + VOLUME UP + HOME simultaneously) and load the following file with

adb sideload 20130629-GoogleEdition.zip

If you are stuck with an error message that reads: error: closed

adb usb

Resources


EDIT (2013-07-23): Google Play Edtion ROM’s did not work for me (no data connection other than WIFI) – would be great to hear if this works for other people with Australian radios. Ended up using PAC Man ROM – https://plus.google.com/communities/103029729817409918322 which appears the most stable AOKP style firmware. So far looks good – no bloat & squishy noises !


EDIT (2013-08-13): Since the PAC Man ROM had problems with audio on some calls I have switched back to an AOSP Google Play Edition ROM. I have in the meantime worked out that the reason the original Google Play Edition install did not work was simply the missing APN settings for Telstra. D’oh!! I am now running the 4.3 S4 Google Edition ROM from: http://forum.xda-developers.com/showthread.php?t=2348272
image

Here is the TELSTRA (Australia) APN Settings:
Name: Telstra Internet
APN: telstra.internet
Proxy:
Port:
Username:
Password:
Server: wap.telstra.com/wap
MMSC: http://mmsc.telstra.com:8002
MMS Proxy: 10.1.1.180
MMS Port: 80
MCC: 505
MNC: 01
Authentication Type: CHAP
APN Type: default,mms


Reverting back to Samsung Stock ROM

If there are no backups you need to download the Stock ROM’s from http://www.samfirmware.com/ or similar site

heimdall flash --no-reboot --RECOVERY recovery.img --BOOT boot.img --SYSTEM system.img.ext4 --CACHE cache.img.ext4 --HIDDEN hidden.img.ext4

Note: you need to boot into recovery mode and do a facory reset to remove device encryption completely.

https://play.google.com/store/apps/details?id=nl.bvgemert.flasher&hl=en
https://play.google.com/store/apps/details?id=eu.chainfire.triangleaway

Author: Leo Gaggl

ict business owner specialising in mobile learning systems. interests: sustainability, internet of things, ict for development, open innovation, agriculture

6 thoughts on “Installing Custom ROM on Galaxy S4 International from Ubuntu”

  1. Thank you for this comprehensive information, you saved a lot of my time and effort. I appreciate your post !

  2. Thanks a lot for sharing your experience! I have used this as a basis for installing Omnirom. That’s how it worked for me. Maybe this will help someone else too:
    System: Kubuntu Linux 14.04
    Heimdall: Version 1.4.0
    Phone: Galaxy S4 I9505 (JFLTEXX)

    WARNING: Doing so will result in the loss of warranty on your phone. It may even brick your phone so it won’t be usable anymore. Don’t blame me if something goes wrong… You’ve been warned.

    1. Preparations
    STOCK ROM
    1.1 Settings –> About phone –> Tap on “Build number” 7x until this message pops up: “You are now a developer”
    1.2 Settings –> Developer options –> activate “USB debugging”
    COMPUTER
    1.3 Download CF-Auto-Root here: http://autoroot.chainfire.eu/ (direct link: http://download.chainfire.eu/316/CF-Root/CF-Auto-Root/CF-Auto-Root-jflte-jfltexx-gti9505.zip)
    1.4 Unzip this file
    1.5 Untar the file CF-Auto-Root-jflte-jfltexx-gti9505.tar.md5 (which is inside of the zip-file). It contains cache.img.ext4 and recovery.img)
    1.6 Download TWRP image file from http://teamw.in (direct link: http://techerrata.com/file/twrp2/jfltexx/openrecovery-twrp-2.7.0.1-jfltexx.img)
    1.7 Download ROM – in my case OmniROM: http://dl.omnirom.org/jflte/ – choose latest NIGHLY
    1.8 Download corresponding GApps at http://forum.xda-developers.com/showthread.php?t=2397942 (direct link: http://goo.gl/SvsTI)
    1.9 Put everything on a MicroSD Card:
    *cache.img.ext4
    *recovery.img
    *openrecovery-twrp-2.7.0.1-jfltexx.img
    * omni-4.4.2-{DATE}-jflte-NIGHTLY.zip
    *pa_gapps-{VERSION}-4.4.2-{DATE}-signed.zip
    1.10 Put SD Card into the phone
    1.11 Install heimdall (if not installed yet): apt-get install heimdall-flash

    2. Root the phone
    2.1 Boot phone into download mode (press POWER ON + VOLUME DOWN + HOME simultaneously)
    2.2 Connect USB cable to Computer (without phone plugged in)
    2.3 Connect phone to USB cable
    2.4 On a console enter: heimdall flash –no-reboot –RECOVERY recovery.img –CACHE cache.img.ext4
    If an error like “Protocol initialisation failed!” appears take a look at the phone. If the download bar is visible and the download seems to be completed, just go on.
    2.5 Reboot phone into Recovery Mode (press POWER ON + VOLUME UP + HOME simultaneously)

    3 Flash Recovery
    3.1 Boot phone into download mode (press POWER ON + VOLUME DOWN + HOME simultaneously)
    3.2 On a console enter: heimdall flash –no-reboot –RECOVERY openrecovery-twrp-2.7.0.1-jfltexx.img

    4. Install ROM and GApps
    4.1 Reboot phone into Recovery Mode (press POWER ON + VOLUME UP + HOME simultaneously
    4.2 Backup Stock ROM: Backup –> check system, data, boot, efs –> Wipe at the bottom
    4.3 Clean system: Home –> Wipe –> Wipe at the bottom (files on the internal SD Card won’t be deleted)
    4.4 Install –> Choose omni-4.4.2-{DATE}-jflte-NIGHTLY.zip on the external SD Card –> Wipe at the bottom
    4.5. Wipe cache/dalvik –> Wipe at the bottom
    4.6. Home –> Install –> Choose pa_gapps-{VERSION}-4.4.2-{DATE}-signed.zip on the external SD Card –> Wipe at the bottom
    4.7. Wipe cache/dalvik –> Wipe at the bottom
    4.8. Reboot

    First boot may take a little time. That’s it. Enjoy the new system :)

Leave a Reply