How to update Samsung Galaxy S5 stock partitions without breaking custom ROM or recovery

Don’t just flash modem firmwares and think you’re done.

The following is directed at Samsung Galaxy S5s running custom ROMs and custom recovery environments only. The Galaxy S5’s internal storage has multiple partitions, each with its own separate image. For the sake of this discussion, we’ll divide the partitions into 2 groups: customized and stock.

Customized partitions are the ones you’ve put a custom image onto. For most devices running custom ROMs, that’s the /recovery – this is where TWRP, CWM, etc. live – and /system – where the actual (custom) Android phone OS lives – partitions.

Stock partitions are the partitions with unmodified OEM images. For most devices running custom ROMs, that’s every partition except /recovery and /system. Because some of these partitions contain firmware for the phone’s hardware components and said firmware was developed for a particular version of Android, it’s important to keep them updated. It isn’t too hard to see how, for example, pairing firmware designed for Android 4.4.2 with a custom Android 7.1.1 ROM could cause problems.

This guide will show you how to update as many of the stock partitions as possible without touching the customized partitions:

  1. Download and install 7-Zip.
  2. Download the latest stock firmware (where “firmware” in this sense means an archive containing images for all partitions) from SamMobile.You’ll need to search by your phone’s model number at that page.
  3. Decompress the archive from the above step. If you find it contains a .tar.md5 file; decompress that too.
  4. In the folder containing the extracted files, select the following:
    • NON-HLOS.bin – This is the 4G LTE modem firmware.
    • modem.bin – This is the 2G & 3G modem firmware.
    • rpm.bin – This is the resource and power manager.
    • sbl1.mbn – This is the secondary bootloader.
    • tz.mbn – This is the trust zone.
    • sdi.mbn – This contains transmission band info (?)
    • aboot.mbn – This is the phone bootloader. SELECT THIS ONLY IF YOUR PHONE SHIPPED WITH AN UNLOCKED BOOTLOADER (i.e. DO NOT SELECT IT IF YOU’RE USING A VERIZON S5 AS YOU WILL RE-LOCK THE BOOTLOADER.)
  5. Follow Steps 6 to 11 here.

And that’s it. All your partitions will be safely updated without touching your custom ROM or custom recovery.

Thanks haggertk for the method, E:V:A for partition details, and Campbell Vertesi for the NON-HLOS.bin and modem.bin descriptions.

Where to find the latest version of Odin

Is it Odin or Odin3? 🤔

If you’re reading this, you probably already know what Odin (or Odin3? Because that’s what the window title bar says) is and what it does. For the unitiated: Odin is a Samsung-internal Windows graphical utility that allows you to update Samsung Android phone storage partitions using image files from your PC. Samsung Kies does almost the same thing, but it downloads official files from Samsung only, while Odin allows the use of any image files compatible with the phone. It’s basically ADB for Samsung, but with a GUI.

Because it’s an internal tool, there’s no Samsung-official download site for it. However, you should always be able to find the latest version at XDA here. Odin is a portable .exe, so you can run it from anywhere.

How to rebuild the Samsung Galaxy S5 GPS NVRAM

Of course you want to return to TouchWiz to fix a problem. Ha, no you don’t.

Note: if you’re not running a custom ROM – i.e. you’re running stock TouchWiz – and need to do this, see Phase 4 only. You’ll need to be rooted.

If you’re running a custom ROM on your S5 and GPS can’t get a fix despite rebooting, battery pulling, flashing new builds, and using all of GPS Status & Toolbox‘s tricks, chances are you’ll need to do rebuild the GPS NVRAM. Here’s how.

Phase 1: Backup your current custom ROM installation.

Instructions (which assume you use TWRP) in Phase 9 here.

Phase 2: Wipe the phone in TWRP.

  1. Boot into TWRP.
  2. Tap Wipe.
  3. Swipe to wipe using the default settings.

Phase 2: Flash the latest baseband in Odin.

  1. Find the latest baseband under the “Odin” heading here. If the files there are .tar archives, you’ll need to extract the .bin baseband files (usually called modem.bin and/or NON-HLOS.bin) from them.
  2. Flash it using instructions in Phase 3 here. You will need to do perform this for modem.bin and NON-HLOS.bin separately as ODIN reboots the phone after each individual flash.

Phase 3: Restore your rooted TouchWiz ROM.

If you don’t already have one of those, here’s how to get one. If you’re setting up a rooted TouchWiz ROM for the 1st time then you don’t have to restore anything because it’ll already be running, so you can proceed to the next phase.

Otherwise:

  1. Boot into TWRP.
  2. Tap Restore.
  3. Tap Select Storage.
  4. Select the folder containing the backup.
  5. Swipe to restore.

Phase 4: Rebuild the GPS NVRAM.

  1. Boot into TouchWiz.
  2. Install Shotcut Master (Lite).
  3. Follow these instructions starting from “Open ‘Secret Explorer’ menu” onward onto the 3rd to last sentence.

Phase 3: Wipe the phone in TWRP.

Same process as Phase 2.

Phase 4: Restore the backup you made in Phase 1.

Same process as Phase 3, but with the custom ROM backup instead.

GPS should be back to working now. I have no idea what causes this problem, but so far this is the most involved custom ROM-related fix I’ve had to do.

How to make and flash your own rooted stock Lollipop TouchWiz ROM for the Verizon S5

If you’re reading this, you’re probably trying to solve a frustrating problem. Relax, I’m here to help.

The following are prerequisites for this to work:

  • Rooted Verizon Samsung Galaxy S5 (SM-G900V) with unlocked bootloader.
  • TWRP custom recovery installed.
  • 7-Zip installed on your PC.
  • SuperSU downloaded to the top level directory of a USB flash drive.
  • A USB OTG cable.

Steps:

  1. Download full stock firmware.
  2. From the above archive, extract system.img.ext4, boot.img, modem.bin, NON-HLOS.bin, into a new folder on your PC.
  3. Open 7-Zip.
  4. Navigate to the folder containing the files from Step 2.
  5. Select all files from Step 2.
  6. Click Add.
  7. In the Add to Archive window that pops up, enter a filename and desired path.
  8. Click the Archive Format dropdown.
  9. Click tar.
  10. Click OK to make the files into a .tar archive
  11. Flash the .tar archive from Step 4 in Odin using the AP slot as described here.
  12. Boot into the ROM and set it up as you would a new phone, including updating all the apps on it.
  13. Boot into TWRP.
  14. Connect the USB flash drive containing SuperSU to the S5 using the USB OTG cable.
  15. In TWRP, tap Install.
  16. Tap Select Storage.
  17. Tap USB Storage.
  18. Select the SuperSU .zip file.
  19. Swipe to flash SuperSU.

And that’s it. This will give you a fully stock, rooted Lollipop ROM you can boot right into.

If you run custom ROMs, the stock ROM is pretty useful to keep handy as some troubleshooting methods (especially advanced ones involving the baseband) work on it only. As such, it’s a pretty good idea to back it up so you can restore it as needed. Instructions found in Phase 9 here.

 

How to get a radio logcat from the terminal in Android

It’s easier and less complicated than it sounds.

Radio logcats are useful for troubleshooting network connectivity, especially on modded (rooted &/or custom ROM) devices. If you’re reporting such an issue it’s often useful to provide the radio logcat in addition to the regular logcat to help the developer resolve the problem.

Screenshot_20160705-082949
That “123456” isn’t supposed to happen; my network provider’s name should be there instead. This is a situation in which a radio logcat would be useful.

There are 3 ways to get a radio logcat:

Using MatLog

This is the easiest method.

  1. Install MatLog.
  2. Tap the Options menu icon.
  3. Tap Settings.
  4. Under Configuration, tap Log Buffer(s).
  5. Tap the logcats you want (Radio in this case, but you can request others too).
  6. Exit Settings.
  7. Tap the Options menu icon again.
  8. Tap File.
  9. Tap Record to start logcat collection.
  10. When you’re done, stop the recording by tapping the corresponding location. The logcat file will be at /catlog in your primary (read: internal or adopted external) user storage.

Using the terminal on your device

  1. Install Terminal Emulator.
  2. Follow these instructions to set Terminal Emulator to start with root permissions.
  3. Start Terminal Emulator.
  4. Enter logcat -b radio > /sdcard/radio_logcat.txt – This dumps the logcat file radio_logcat.txt at the root of your SD card. logcat -b radio works too, but I have no idea where it puts the file and have never tried it myself.
  5. Reproduce this issue you’re getting the logcat for.
  6. When you’re done with Step 5, close Terminal Emulator.
  7. Navigate to the root of your SD card to find the file there.

Using ADB on your PC

While I know this method exists, I’ve never used it. The command to enter is adb logcat -b radio, and adb logcat -b radio > /sdcard/radio_logcat.txt probably works too.

How to change SELinux Mode from Enforcing to Permissive

Alternative title: How to get FlashFire working on CyanogenMod 13

The best app for this is SELinuxModeChanger (SELMC). You can sideload it, but it’s best to get it via the F-Droid marketplace app.

SELMC enables use of apps such as FlashFire – which needs either permissive SELinux or SuperSU – on CyanogenMod (which is incompatible with SuperSU).

Don’t forget to set SELinux back to Enforcing after you’re done using Permissive, as it’s a really important part of Android security.

The above worked on a Samsung SM-G900V running the kltevzw build of CyanogenMod 13.

Stop fooling yourselves: Allo has NO chance

Google’s dogmatic view of how people (should) communicate puts Allo firmly on the path to failure.

Android Central asks:

What if there was an app that had the simple appeal of Apple’s iMessage, but was available for every person using an iPhone or an Android?

My response:

Unfortunately the article’s premise works only if Allo ships pre-installed on devices. Even if Google does that for Android, Apple would never allow it for iOS. This would leave Allo with the same need for manual installation as other 3rd party messengers, except those other messengers are already far more successful.

There’s an existing case of this: Hangouts. Hangouts was preinstalled on Android devices and worked automagically via Android’s Gmail account prerequisite. Yet it never took off on any other platform (except perhaps the desktop) and isn’t even in the top 5 messaging apps.

Facebook handled this challenge in a completely different manner: they simply opened up Facebook Messenger to use by anyone with a phone number. BOOM: Messenger is now the world’s #2 messaging app despite needing manual installation on all platforms.

I think it’s hilarious how every Android (fan)blog conveniently ignores that iMessage also has a desktop component that Allo doesn’t. So does Facebook Messenger and Whatsapp, which are available on all platforms, thus enabling them to span form factors.

Another mistake here is the extreme iMessage tunnelvision. iMessage may be big in the US where iOS rules, but Android rules the rest of the world. If Allo is indeed the anti-iMessage, that would make it a narrow and incomplete solution that addresses only one market.

Even Microsoft haven’t been as disingenuos as Google. Say what you will about Skype, but at least Microsoft haven’t pushed a completely incompatible service that no one has any real reason to use.

The market failure of Google Talk, Google Voice (as a messaging solution), and Hangouts shows that Google still doesn’t fundamentally get how people actually communicate. They think they can sell every feature/application solely on ideological purism. That doesn’t work in the real world.

 

How to install the latest emoji on Android (flashable .zip included)

Rooted or got an unlocked bootloader? You’re good to go.

NOTE: If you run CyanogenMod 13+ Nightly, you probably don’t need to do this.

Although Google has done a great job maintaining some Android features as standalone apps, fonts – which contain emoji – are still delivered via OTA updates. Android’s well documented slow (carrier device) OTA update rollout process is frustrating for those who want to use the latest emoji, ergo here’s how to do the latter.

The following process worked on a rooted Verizon Samsung Galaxy S5 (SM-G900V) running CyanogenMod 13 (Android 6.0.1) and TWRP recovery, but it should work on any Android 6.0+ device. Since the flashing process occurs entirely in the recovery environment, your device may not have to be rooted for it to work.*

This post uses and recommends the open source, very actively developed, and beautifully minimalist EmojiOne emoji, but can probably be used for other emoji sets too.

  1. Download the original flashable .zip created by the EmojiOne developers. Although it’s outdated, it can be reused for newer emoji by updating its contents, which is done in subsequent steps.
  2. Download the latest EmojiOne .ttf  file (you can also download the .ttf from any other emoji set if you’d rather use that instead)
  3. Unzip the file to \EmojiOneAndroid.
  4. Replace the emojione-android.ttf file at \EmojiOneAndroid\system\fonts with the one downloaded in Step 2.
  5. Re-zip \EmojiOneAndroid.
  6. Flash the above zip using your preferred method (Flashfire, TWRP, etc.). TWRP instructions are found in Phase 7 here.
  7. Reboot your device.

And that’s it! You should know have the custom emoji of your choosing installed to your device.

For convenience, I’ve uploaded a flashable .zip containing the latest EmojiOne .ttf here. I’ll try to keep it updated as new versions (RSS feed) come out.

Want these emoji on Windows? Instructions here.

*An alternative method of updating emoji is to manually replace the corresponding system file. However, this requires both root access and manually setting the correct permissions for the new .ttf file, and the device still has to be rebooted afterwards. Flashing a .zip as described here is far simpler and there’s less that can go wrong.

How to start Android Terminal Emulator as root

As usual with Linux, anything beyond simple use cases is a minor ordeal.

You probably know the su or sudo commands on Linux, but those don’t seem to work in the Android terminal.* Fortunately, you can get around that via a terminal emulator setting. Here’s how to do that:

  1. Install Android Terminal Emulator.
  2. Open the above.
  3. Tap the options menu icon.
  4. Tap Preferences.
  5. Scroll down to Shell.
  6. Tap Command line.
  7. Enter /system/xbin/su -c "/system/xbin/bash -" as shown below.

    Screenshot_20160426-080222
    One thing Android does have in common with desktop Linux is even the simplest things are always unnecessarily complicated for the sake of engineering ideological purism.
  8. Tap OK.
  9. Back out of Preferences.
  10. Close the terminal window.
  11. Restart the app.
  12. Approve the root permissions request that pops up.

You’ll now have superuser permissions every time you start the terminal.

Thanks bitmaster2000 for the method.

 

*I suspect the main reason for this is Android doesn’t handle user/administrator/root accounts in the same manner desktop Linux does. On Android every app is a user in Linux parlance, while Android users are something else entirely.

How to wipe the Nvidia Shield K1’s cache

Nvidia takes poor documentation to the next level: incorrect documentation.

Nvidia’s instructions for the original Shield are wrong for the K1 and the support forum’s instructions are incomplete, so here’s how you do it:

  1. Shut the K1 down.
  2. While pressing and holding the Volume Down key, press and release the Power key. This will put the K1 into fastboot mode with several options on the screen.
  3. Using the Volume Down (or Volume Up if you missed it), scroll down to the Recovery mode option.
  4. Press the Power key to select the Recovery mode option. The K1 will show the Nvidia boot logo and then a screen with an Android laying on its back and the the text no command below it.
  5. While pressing and holding the Power button down, press and release Volume Up.
  6. A Recovery mode screen will appear with Wipe cache as one of the options. Follow the instructions on the screen to select and engage it.
    Supported API: 3
    ...Wiping cache...
    Formatting /cache...
    will appear.Wiping (and formatting) the cache partition takes much longer on the K1 than it does on other devices, so be patient if nothing seems to be happening. When the above is complete, the Recovery mode screen will reappear.
  7. Select the Reboot option to get back to Android.