Test-driving the Android free software alternative Replicant
GNU Android
It is easy to replace Windows with Linux on a standard PC. Is it just as easy to replace the pre-installed Android OS on your smartphone with a free Android system like Replicant? Read on and find out!
The dream of free software remains illusive for many people and many computers, especially in the smartphone industry. Competition is tough, which explains why it is not just the chipset producers who try to outdo each other and block each other with software patents, but also the vendors who integrate even the tiniest features as proprietary solutions.
Android is Linux, and Linux is open source, so is Android open? It turns out that a mobile phone is much more than just a kernel. Many of the surrounding components – including the firmware and drivers, as well as the fleet of onboard applications, are proprietary. The non-free nature of these Android components is a problem for many Free Software advocates. Also, privacy advocates object to the constant monitoring and data collection that has become commonplace in the mobile phone industry. As you might expect, much of this monitoring occurs through closed-source applications, and it is impossible to see what these components are really doing because you can't see the source code.
The Replicant project [1] began as an attempt to create a free Android distribution that "puts the emphasis on privacy and security." Replicant is one of several non-Google Android alternatives. (See my article on CyanogenMod in the July, 2015 issue of this magazine.) Of all these Android alternatives, Replicant is perhaps the most similar to the Free Software community in its outlook, but does it work? Can you build a smartphone experience from Free tools and come up with something equivalent to what you get from conventional Android? I decided to find out.
Replicant is currently at version 4.2 003 (based on Android 4.2.2) and it only supports older Samsung phones, including the Galaxy Note, the Samsung Galaxy S3, and about a dozen other devices [2]. I tried out Replicant on my Galaxy Nexus.
Custom ROM – Business as Usual
Replicant is not a complete Android replacement but simply a standard custom ROM. In other words, you can install the firmware like any other Android image by means of a custom recovery. If you already have a custom recovery installed on your phone, the steps are limited to the following.
- Download the Replicant image for your device
- Boot to recovery mode
- Select Install ZIP from Sideload
- Install the firmware via
adb sideload
- Perform a data and factory reset
If you do not have any previous experience with custom ROMs for Android, the following section contains a detailed HowTo. Replicant's own recovery is based on the ClockworkMod recovery image, a popular tool that is used with many Android custom ROMs. ClockworkMod expects the typical zip files. (Originally, the Replicant project used its own IMG files, which could only be installed using a special recovery tool.)
Preparations: ADB and Fastboot
If you want to take a look at Replicant, but you do not have any experience with custom ROMs on Android, your best approach is to follow this guide or check out the article on the Replicant wiki. For this article, I "upgraded" a Galaxy Nexus (maguro) with Replicant 4.2 003. You will find a complete installation guide in the wiki [3]. You could also refer to my article on CyanogenMod in the July 2015 issue [4], which provides a description of how to install an alternative system on your Android phone.
You need two tools for this exercise:
adb
– the Android Debug Bridge, which lets a Linux development system communicate with an Android device;fastboot
– a tool that will allow you to re-flash partitions on your mobile device.
If these tools are installed correctly, you won't need to run them as root. These utilities are part of the android-tools
package on most Linux distributions. If you have installed the Android SDK on your Linux system, you will already have these two command-line tools. You can also run apt-get install android-tools
(for Debian-based systems) or zypper install android-tools
(for openSUSE) to install the Android tools. If you fail to find the necessary device console package for your distribution, you need to install the Android SDK by Google (the standalone SDK Tools, without Android Studio, is fine) [5].
Another basic requirement for the installation is unlocking the bootloader. The bootloader is a kind of "Android BIOS" with various options. On Nexus devices, you can unlock the bootloader with one simple command:
fastboot oem unlock
On devices by other vendors, unlocking the bootloader can be far more complicated. Your best approach is to consult the guide for your phone on the Replicant wiki.
You need to enable USB debugging to communicate with your phone from your Linux computer via a USB cable. Scroll to the bottom of the Android settings until you find the About Phone entry and tap the build number seven times until you see a notice to the effect that "You are now a developer" (Figure 1).
Above the About phone entry, you will find a new Developer options item. Tapping on Developer options opens the options; you need to check USB debugging or Android debugging and then connect your phone to your computer. You are then prompted to decide whether to allow USB debugging from this computer. Check the box and tap Yes.
To find out whether everything worked, check the output from adb devices
in a terminal window on your Linux computer. The output should look something like this:
marcel@linux-taw3:~> adb devices List of devices attached 013c26e0416d412d device
For your own safety, you will still see a prompt on your phone asking you to confirm this request (Figure 2).
If the output from the command tells you that the device is offline, either the display is locked or you forgot to confirm the dialog for authenticating the phone (Figure 3). In very rare cases, the problem can also be caused by an obsolete version of the adb
tool.
Preparations: Unlocking the Boot Loader
If the boot loader on your own device is still locked, you need to unlock it. For security reasons, the Android system then does a factory reset automatically and deletes all the data on the device. Nexus devices and Android One devices do not need an unlock code – in contrast to most other phones. Follow the guide on the Replicant wiki. On supported Samsung devices, the Heimdall flashing tool gives you an easy option [6]. If you have a Nexus device and adb
and fastboot
are working properly, unlocking after enabling USB debugging simply means running the following two commands:
adb reboot bootloader fastboot oem unlock
After the unlock
command, you will see a security prompt on the display of your Galaxy Nexus; you need to confirm via the volume buttons and the power button. You can tell that unlocking worked (or that the bootloader has already been unlocked) and that the phone is in fastboot mode by an entry reading LOCK STATE – unlocked on the display of your device. At the same time, when you boot your phone, you will see an unlocked padlock below the Google logo. Other vendors will possibly display warnings. You can press the power button (marked with a green start label) to reboot the Nexus device. Alternatively, simply call fastboot reboot
in the terminal. Do not worry if the first boot takes longer than you expect.
The rest of the installation is fairly simple now, assuming your device is not SIM locked. (See the "SIM Lock" box.)
SIM Lock
If your phone is SIM locked out-of-the-box, and you killed the SIM lock by running a tool, you first need to back up the settings for the SIM lock. In other words, before you install the system, create a backup of the files /data/radio/nv_data.bin
and /data/radio/nv_data.bin.md5
on your Linux computer! You can restore the backup after installing Replicant.
Next, pick up the required recovery.img
file and the firmware itself (e.g., replicant-4.2-maguro.zip
for the Galaxy Nexus) from the Replicant home-page. You will find the files for all supported devices at the Replicant website [7].
Now switch the Android device to bootloader mode by issuing the adb reboot bootloader
command on your Linux computer. You can test whether everything worked by typing the following command:
fastboot devices
This command shows you whether the device is really in fastboot mode. If the output from your smartphone/tablet confirms that you are in fastboot mode, you can use the following command to install the recovery:
fastboot flash recovery recovery.img
This action just takes a few seconds. You can then use the volume buttons to select the Recovery item and open the newly installed recovery. The Replicant recovery is based on version 6 of the ClockworkMod recovery.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.