Cyanogenmod ROM Samsung Galaxy S5 Duos (SM-G900FD / SM-G900MD) (klteduos)
Download (nightly build)
CyanogenMod 14.1 (Android 7.1 (Nougat))
Main sections for Samsung Galaxy S5 Duos (“klteduos”)
Special boot modes
- Recovery: With the device powered off, hold Volume Up, Home & Power. When the blue text appears, release the buttons.
- Download: With the device powered off, hold Vol Down & Home & Power
|Also known as:||SM-G900FD, SM-G900MD|
|Platform:||Qualcomm Snapdragon 801|
|CPU:||2.5 GHz quad-core Krait 400|
|Weight:||145 g (5.11 oz)|
|Dimensions:||142 mm (5.59 in) H
72.5 mm (2.85 in) W
8.1 mm (0.31 in) D
|Screen size:||130 mm (5.1 in)|
|Screen density:||432 ppi|
|Screen type:||Full HD Super AMOLED|
|SD Card:||up to 128GB|
|Main camera:||16MP, flash: LED|
|Power:||2800 mAh Li-ion battery, removable|
|Peripherals:||Fingerprint recognition, Heart rate sensor, Motion Coprocessor,Accelerometer, Gesture sensor, Gyroscope, Proximity sensor, Compass, Barometer, Hall effect sensor, Magnetic sensor, RGB ambient light, Infrared (IR) LED sensor|
|CM supported:||12.1, 13, 14.1|
How to Install CyanogenMod on the Samsung Galaxy S5 Duos (klteduos)
Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.
Installing a custom recovery
Samsung devices come with a unique boot mode called Download Mode which is very similar to Fastboot Mode on some devices with unlocked bootloaders. Heimdall is a cross-platform, open source tool for interfacing with Download Mode on Samsung devices. The preferred method of installing a custom recovery is through this boot mode. Rooting the stock firmware is neither recommended nor necessary.
- Download and install the Heimdall Suite
- Windows: Extract the Heimdall suite and take note of the directory holding
heimdall.exe. You can verify Heimdall is working by opening a command prompt in this directory and typing
heimdall version. If you receive an error, be sure that you have the Microsoft Visual C++ 2012 Redistributable Package (x86/32bit) installed on your computer.
- Linux: Pick the appropriate installation package based on your distribution. The
-frontendpackages are not required for this guide. After installation, heimdall should be available from the terminal; type
heimdall versionto verify installation succeeded.
- Mac: Install the dmg package. After installation, heimdall should be available from the terminal; type
heimdall versionto verify installation succeeded.
- Building from source: The source code for the Heimdall Suite is available on Github. For more details about how to compile the Heimdall Suite, please refer to the
READMEfile on Github under the relevant operating system directory. You can also refer to the Install and compile Heimdall instructions on this wiki.
- Windows: Extract the Heimdall suite and take note of the directory holding
- Download recovery — you can directly download a recovery image using the link below, or visit TWRP site to check for the latest version of recovery for your device (if your device can be found there). For general info about recoveries click here.
- Recovery: Download
- Power off the Galaxy S5 Duos and connect the USB adapter to the computer but not to the Galaxy S5 Duos, yet.
- Boot the Galaxy S5 Duos into download mode. With the device powered off, hold Vol Down & Home & Power Accept the disclaimer on the device. Then, insert the USB cable into the device.
- Windows (only) driver installation – Skip this step if you are using Linux or Mac
- A more complete set of the following instructions can be found in the Zadig User Guide.
zadig.exefrom the Drivers folder of the Heimdall Suite.
- Choose Options » List All Devices from the menu.
- Select Samsung USB Composite Device or MSM8x60 or Gadget Serial or Device Name from the drop down menu. (If nothing relevant appears, try uninstalling any Samsung related Windows software, like Samsung Windows drivers and/or Kies).
- Click Replace Driver (having selecting “Install Driver” from the drop down list built into the button).
- If you are prompted with a warning that the installer is unable to verify the publisher of the driver, select Install this driver anyway. You may receive two more prompts about security. Select the options that allow you to carry on.
- At this point, familiarize yourself with the Flashing with heimdall notes below so that you are prepared for any strange behaviour if it occurs.
- On the computer, open a terminal (or Command Prompt on Windows) in the directory where the recovery image is located and type:
heimdall flash --RECOVERY recovery.img --no-reboot
- Tip: The file may not be named identically to what’s in this command. If the file is wrapped in a zip or tar file, extract the file first, because heimdall isn’t going to do it for you.
- A blue transfer bar will appear on the device showing the recovery being transferred.
- Unplug the USB cable from your device.
- NOTE: Be sure to reboot into recovery immediately after having installed the custom recovery. Otherwise the custom recovery will be overwritten and the device will reboot (appearing as though your custom recovery failed to install).
- Manually reboot the phone into recovery mode by performing the following. With the device powered off, hold Volume Up, Home & Power. When the blue text appears, release the buttons.
- The Galaxy S5 Duos now has a custom recovery installed. Continue to the next section.
Note: Flashing with heimdall
- In Windows 7 UAC (User Account Control) may need switching off. Once Heimdall is finished it can be re-enabled.
- Protocol initialization can fail if the device is connected via a USB hub – connect the USB cable directly to the PC
- It may be necessary to run the heimdall flash command as root in Linux or Mac OS X:
sudo heimdall flash [...]. Typical symptoms of this are:
- a blue bar doesn’t show up after the process has finished
- Failed to confirm end of file transfer sequence!
- It may be necessary to capitalize the name of the partition on some devices. Try
- If on Linux 64bit you get “unable to execute ./heimdall: No such file or directory”, try the 32bit version and make sure to run it with sudo: reference.
- On Mac OS X you may see this message: “ERROR: Claiming interface failed!”. If so, you need to disable the default USB drivers with the following commands:
sudo kextunload -b com.apple.driver.AppleUSBCDC;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMData;
If you have installed Samsung Kies, you may further need to unload those USB drivers with the following commands:
sudo kextunload -b com.devguru.driver.SamsungComposite;
sudo kextunload -b com.devguru.driver.SamsungACMData
sudo kextunload -b com.devguru.driver.SamsungACMControl
- Using Heimdall version 1.4.0 (the latest version available for download on the Glass Echidna website) you may see this message or one similar to it:
Error: Failed to confirm end of PIT file transfer!
If you experience this error, follow the instructions for compiling Heimdall from source to get the latest version on GitHub with the issue patched.
- The stock ROM may overwrite your custom recovery on boot. To prevent this, boot immediately into recovery after leaving Download Mode instead of letting the ROM boot up normally. If your recovery is overwritten, simply redo the steps you followed above and catch it before it boots next time.
- Note for upgrades from gingerbread to jellybean remember the recovery is changed. This means once you install do NOT restore to old-gingerbread-stock ROM from cwm-recovery.
- To upgrade from stock/CM7/CM9/CM10.1.2/CM10.1.3 to CM10.2, you must first boot into recovery and wipe data, cache, and dalvik cache (factory reset). Due to the new partition layout in CM10.2, failing to perform these steps will result in a bootloop. See here for details; more about repartitioning here. If you missed this step before installing, boot to recovery and factory reset, then reinstall CM10.2.
- Some users have reported connection errors if the device is connected to a USB hub. If you experience such errors it is recommended that you try connecting your device to a USB port on the motherboard.
- Antivirus software may prevent Heimdall from connecting properly. Disable your antivirus before proceeding.
- When Heimdall fails to connect, the Download mode may get stuck, making all further attempts fail too. To retry, you may need to restart the Download mode: turn off the phone by holding Power for 5-10 seconds (or by pulling out the battery), then boot into Download mode and run Heimdall again.
- If Heimdall fails to connect (errors related to initializing the protocol, or transferring data):
- if you just installed the driver, try rebooting your computer and trying again.
- if you still have troubles after reboot, in Zadig try installing the libusbK driver rather than the WinUSB driver.
Installing CyanogenMod from recovery
- Make sure your computer has working adb.
- Download the CyanogenMod build package for your device that you’d like to install to your computer.
- Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
- Place the CyanogenMod
.zippackage, as well as any optional
.zippackages, on the root of
- Using adb:
adb push filename.zip /sdcard/
- Note: You can copy the
.zippackages to your device using any method you are familiar with. The
adbmethod is used here because it is universal across all devices and works in both Android and recovery mode. If you are in recovery mode, you may need to ensure
/sdcard(sometimes called Internal Storage) is mounted by checking its status in the Mounts menu. If you have booted regularly, USB debugging must be enabled.
- Using adb:
- If you are not already in recovery, boot to recovery mode now.
- With the device powered off, hold Volume Up, Home & Power. When the blue text appears, release the buttons.
- In Team Win Recovery Project, select menu choices by tapping on the appropriately labelled button.
- Optional (Recommended): Select the Backup button to create a backup.
- Select Wipe and then Factory Reset.
- Select Install.
- Navigate to
/sdcardand select the CyanogenMod
- Follow the on-screen notices to install the package.
- Optional: Install any additional packages you wish using the same method (if you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it).
- Once installation has finished, return to the main menu and select Reboot, then System. The device will now boot into CyanogenMod.
How To Build CyanogenMod For Samsung Galaxy S5 Duos (klteduos)
- 1 Introduction
- 2 Build CyanogenMod and CyanogenMod Recovery
- 2.1 Prepare the Build Environment
- 2.2 Create the directories
- 2.3 Install the repo command
- 2.4 Put the ~/bin directory in your path of execution
- 2.5 Initialize the CyanogenMod source repository
- 2.6 Download the source code
- 2.7 Get prebuilt apps (CM11 and below)
- 2.8 Prepare the device-specific code
- 2.9 Extract proprietary blobs
- 2.10 Turn on caching to speed up build
- 2.11 Start the build
- 2.12 If the build breaks…
- 3 Install the build
These instructions will hopefully assist you to start with a stock Galaxy S5 Duos, unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.
It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.
Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.
What you’ll need
- A Galaxy S5 Duos
- A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
- A USB cable compatible with the Galaxy S5 Duos (typically micro USB, but older devices may use mini USB or have a proprietary cable)
- A decent internet connection & reliable electricity :)
- Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as
cdfor “change directory”, the concept of directory hierarchies, that in Linux they are separated by
If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.
You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set
BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.
Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)
So let’s begin!
Build CyanogenMod and CyanogenMod Recovery
Prepare the Build Environment
You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.
Install the SDK
- If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.
Install the Build Packages
Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.
A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the
apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)
For both 32-bit & 64-bit systems, you’ll need:
bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev
In addition to the above, for 64-bit systems, get these:
g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
For Ubuntu 15.10 (wily) and newer, substitute:
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
- CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
- CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
- CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
- CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
- CyanogenMod 14.1: OpenJDK 1.8
Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:
- Obtain OpenJDK 1.7 from the openjdk-r PPA
- Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your
Also see http://source.android.com/source/initializing.html which lists needed packages.
Create the directories
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin $ mkdir -p ~/android/system
Enter the following to download the “repo” binary and make it executable (runnable):
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo
~/bin directory in your path of execution
In recent versions of Ubuntu,
~/bin should already be in your PATH. You can check this by opening
~/.profile with a text editor and verifying the following code exists (add it if it is missing):
# set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi
Initialize the CyanogenMod source repository
Enter the following to initialize the repository:
- Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/ $ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
Download the source code
To start the download of all the source code to your computer:
$ repo sync
The CM manifests include a sensible default configuration for
repo, which we strongly suggest you use (i.e. don’t add any options to
sync). For reference, our default values are
-j 4 and
-j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to
-j 3 or
-c will ask repo to pull in only the current branch, instead of the entire CM history.
Prepare to wait a long time while the source code downloads.
repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.
Get prebuilt apps (CM11 and below)
$ cd ~/android/system/vendor/cm
You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.
Prepare the device-specific code
Helpful Tip – Errors during breakfast
Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun
After the source downloads, ensure you are in the root of the source code (
cd ~/android/system), then type:
$ source build/envsetup.sh $ breakfast klteduos
This will download the device specific configuration and kernel source for your device. An alternative to using the
breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.
If you want to know more about what
source build/envsetup.sh does or simply want to know more about the
lunch commands, you can head over to the Envsetup help page.
Instead of typing
cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you:
croot. To use this command, you must first run
source build/envsetup.sh from
Extract proprietary blobs
Now ensure that your Galaxy S5 Duos is connected to your computer via the USB cable and that you are in the
~/android/system/device/samsung/klteduos directory (you can
cd ~/android/system/device/samsung/klteduos if necessary). Then run the
You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the
~/android/system/vendor/samsung directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.
Your device should already be running a build of CyanogenMod for the branch you wish to build for the
extract-files.sh script to function properly.
It’s important that these proprietary files are extracted to the
~/android/system/vendor/samsung directory by using the
extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!
Turn on caching to speed up build
You can speed up subsequent builds by adding
prebuilts/misc/linux-x86/ccache/ccache -M 50G
50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.
If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples:
export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and
Start the build
Time to start building! So now type:
$ croot $ brunch klteduos
The build should begin.
If the build doesn’t start, try
lunch and choose your device from the menu. If that doesn’t work, try
breakfast and choose from the menu. The command
make klteduos should then work.
A second, bonus tip! If you get a command not found error for
lunch, be sure you’ve done the
source build/envsetup.sh command in this Terminal session from the
A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here
If the build breaks…
- If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/klteduos/cm_klteduos-ota-eng.root.zip] Error 1
…you may want to make the following change to
Search for instances of
-Xmx2048m (it should appear either under
OPTIONS.java_args or near usage of
signapk.jar), and replace it with
Then start the build again (with brunch).
- If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.
Install the build
Assuming the build completed without error (it will be obvious when it finishes), type:
$ cd $OUT
in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in
/system is in a folder called
system. The stuff that will become your ramdisk is in a folder called
root. And your kernel is called…
But that’s all just background info. The two files we are interested in are (1)
recovery.img, which contains CyanogenMod Recovery, and (2)
cm-13.0-20161224-UNOFFICIAL-klteduos.zip, which is the CyanogenMod installation package.
Back to the
$OUT directory on your computer– you should see a file that looks something like:
The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “
KANG” rather than
UNOFFICIAL version. Regardless, the file name will end in
.zip and should be titled similarly to official builds.
Now you can flash the
cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.
Success! So….what’s next?
You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.
Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.
Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.
Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.