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

Chromebook tips to get started

Just got myself (actually it’s for our Office Manager back in OZ) one of these Chromebooks while in Europe (since Google Australia with their absolutely hopeless hardware strategy do not seem to be able to ship any devices – Nexus 4 anyone ?) .

Since the first days turned out to be a bit of a frustrating experience, I thought I share some of the findings as I had a hard time finding much useful info on troubleshooting ChromeOS.

Wireless Connection (WIFI)

Do not use WPA (or for that matter WEP) connections with ChromeOS. I had extreme difficulties browsing webpages on the Chrombook. Some pages would load, some pages would not load at all. There seemed to be no consitency to it as some would load one day, but not another. Somewhere in the Google Groups there seemed to be people reporting issues with wireless connections using WEP. It turned out that the Wireless Modem Router (Telekom Austria supplied Pirelli PBS modem) where I was staying was set to WPA encryption only by default. Once I figured out how to set the unit to WPA2 (which these days should really be the default anyway) things started to actually work consistently. Check the sections below (specially chrome://diagnostics) to see how you can find out what’s going wrong.

However to save some trouble & frustrations, before you do anything make sure your Chrombook connects using WPA2 !

Terminal

CTRL+ALT+T will launch the Chrome Shell which is a slightly odd and very cut-down command line shell. Other than a ‘ping’ utility and some debug tools there really seems to be only the ‘ssh’ command that would be very useful to connect to remote systems. Unfortunately the SSH implementation is quite unusual compared to my normal OpenSSH client.

Poking under the hood

  • Get diagnostic info: chrome://diagnostics/
  • Settings: chrome://chrome/settings/
  • Get hard-disk space: chrome://quota-internals/
  • Bandwidth used: chrome://net-internals/#bandwidth
  • Factory reset the unit: chrome://chrome/settings/factoryResetData
  • Complete listing of ‘chrome’ URL’s: chrome://chrome-urls/

Developer mode

To make some serious mods to the Chromebooks you need to boot into Developer mode. On the Samsung 303C ARM Chromebook this is achieved by holding ESC + Refresh buttons when pushing the power button to turn the unit on. Probably best left alone unless you know what you are doing.

Galaxy Nexus Firmware Upgrade on Ubuntu (manual)

As a Galaxy Nexus Owner I have been waiting for months for an OTA (over the air) upgrade to the factory installed Firmware (4.0.2). I am finally sick of waiting and complaining to Google (an absolute lost cause).

After some research it turns out that (contrary to popular opinion) not every unlocked Google Nexus actually has the ‘official’ Google Firmware. Some of them have a Samsung variant (WTF !?) of the firmware. Now I really don’t want to get off the technical topic, but I personally think that this means Google is misleading their most loyal customer base. The reason I chose a Nexus device over the (from a hardware perspective) superior HTC One X was the fact that they were supposed to have the official Google Firmware and I did not have to wait forever for bugfixes from the manufacturers.

There are a reportedly several different versions out there. Google’s ‘official’ build for the GSM version of the Galaxy Nexus is named ‘yakju’. Samsung builds ‘yakjusc’, ‘yakjuxw’ and ‘yakjuux’. While they appear mostly the same, only Google’s yakju build is likely to get updates as they happen. Go figure why there was a need for others … :(

To find out which version your Nexus uses you can use this key combination (in the phone app)

*#*#4636#*#*

or for a more permanent option grab “Android System Info” from the Google Market.

Disclaimer: this procedure obiously has the potential to ‘brick’ your mobile. Only attempt this if you are absolutely comfortable with flashing device firmware. Proceed at your own risk !!! If you decide to proceed – BACKUP YOUR DEVICE FIRST ! Check the documentation for ‘adb backup‘.

All the notes below are for GSM (HSPDA+) NEXUS (GT I9250 – maguro) devices !

Android SDK Install

The Android SDK can be downloaded from the Androide Site: http://developer.android.com/sdk/index.html)

Android Fastboot Mode

For all the following procedures to work the device needs to be in ‘Fastboot Mode’
How put your phone in fastboot mode:

  1. Power off the phone
  2. Hold the Volume Up Key + Volume Down Key pressed and at the same time press the Power button.

You should now see an Android robot with it’s body opened (see photo).


wget http://dl.google.com/android/android-sdk_r18-linux.tgz
tar -xzf android-sdk_r18-linux.tgz
android-sdk-linux/tools/android update sdk --no-ui
#test fastboot mode
#this should show the serial number of the connected device
cd android-sdk-linux/platform-tools/
fastboot devices

Adding the USB Driver definitions for the Galaxy Nexus

vim /etc/udev/rules.d/70-android.rules
#add this line:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

Unlocking the Bootloader

NOTE: This command will erase the whole device. Make sure backups have been taken before (check the ‘adb backup’ tool http://developer.android.com/guide/developing/tools/adb.html).

fastboot oem unlock

Flashing the new Firmware

The ‘factory images’ for Nexus devices can be found here: https://developers.google.com/android/nexus/images – make sure to choose the correct model. The commands below are for the European GSM/HSPDA+ version of 4.0.4 (yakju)

wget https://dl.google.com/dl/android/aosp/yakju-imm76i-factory-8001e72f.tgz
tar -xzf yakju-imm76i-factory-8001e72f.tgz
fastboot flash bootloader yakju-imm76i/bootloader-maguro-primela03.img
fastboot reboot-bootloader
fastboot flash radio yakju-imm76i/radio-maguro-i9250xxla02.img
fastboot reboot-bootloader
fastboot -w update yakju-imm76i/image-yakju-imm76i.zip

After the last step the handset will reboot and you should be presented with a Google “Stock” device and go through the normal Android setup wizard. As it should have been when I purchased this “Google” branded device in the first place – thank you Google (and of course SAMSUNG) for wasting my time !

If you want to lock your bootloader after the upgrade (not necessary) you can go into Fastboot Mode again and issue the following command:

fastboot oem lock

Accessing Samsung Galaxy Nexus as USB Media Device Ubuntu 12.04

To use a Samsung Galaxy Nexus as a media device (MTP) there is a utility called gMTP.

sudo apt-get install gmtp mtpfs mtp-tools

NOTE: Unfortunately there is a bug in the 64-bit version at the moment (https://bugs.launchpad.net/ubuntu/+source/mtpfs/+bug/936165) – which means it’s not all that useful to me at the moment.

Installing Samsung Multifunction Printer – Ubuntu 11.10

Getting Multifunction Printers to scan under Linux can be a bit of a pain. The Samsung SCX-3400 I had to install recently was no exception.

Here are the necessary steps I had to perform:

  1. Ignore all Samsung Provided CD’s and downloads. They do not work under Oneiric Ocelot (11.10)
  2. Add Samsung Unified Driver repository http://www.bchemnet.com/suldr/smfpv3.html
  3. Install Samsung drivers and libsane-extras
  4. Edit sane configuration files
vim /etc/apt/sources.list
#add the Samsung Unified Driver Repo
deb http://www.bchemnet.com/suldr/ debian extra
wget http://www.bchemnet.com/suldr/suldr.gpg
apt-key add suldr.gpg
apt-get update
apt-get install samsungmfp-data samsungmfp-driver samsungmfp-network samsungmfp-scanner samsungmfp-configurator-data samsungmfp-configurator-qt4 libsane-extras

The following sane config files need to be modified (add lines)

/etc/sane.d/xerox_mfp.conf

# Samsung SCX-3400
usb 0x04e8 0x344f

/lib/udev/rules.d/40-libsane.rules

# Samsung SCX-3400
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="344f", ENV{libsane_matched}="yes"

The entries above are for the SCX-3400 model. To find the USB ID’s for other models use

sane-find-scanner

Thanks to the following Ubuntu Forum participants for providing some the tips: http://forum.ubuntuusers.de/topic/installation-samsung-scx/