Replicant developer interview: Building a truly free Android

Android has made massive strides forward since its debut in 2008, and in Q3 2011 more than half of all smartphones sold worldwide ran Google's mobile platform. In one sense it represents a massive validation for open source, and proof that free software is not condemned to a future of 'merely' running servers.

At Android's core is the Linux kernel, and many of the other components are made available under open source licences. However, Free Software Foundation Europe has only described Android as quot;mostly freequot;, and Richard Stallman, founder of the free software movement, noted in an September 2011 op-ed that Android includes "nonfree 'binary blobs'"; that is, compiled code for which the source is not available for users to read and modify. This issue is at the heart of free software.

Hadoop: How open source can whittle Big Data down to size

Dries' vision for Drupal 8

The road to a successful open source project: Learning lessons from Drupal

Open Source Ecology: Can open source save the planet?

Python vs. PHP: Choosing your next project's language

"Android platforms use other nonfree firmware, too, and nonfree libraries. Aside from those, the source code of Android versions 1 and 2, as released by Google, is free software #8212; but this code is insufficient to run the device," Stallman wrote.

It is this reliance on non-free software that led to the creation of the Replicant project (named after the androids in 1982's Blade Runner). It came about because "the Android Open Source Project [AOSP], is not, in fact, entirely free software", Paul Kocialkowski told Techworld Australia.

Kocialkowski is the current Replicant lead developer. He got involved in the project after his Neo FreeRunner, a smartphone released in 2008 that ran the open source Openmoko OS, broke down. "I needed another phone running free software," Kocialkowski explains.

"When Android 1.0 was released [in 2008], along with the HTC Dream/Google G1, lots of people were excited to see a free mobile operating system, though we already had the Openmoko Neo 1973 and Neo FreeRunner initiatives.

"However the ones who wanted a truly free operating system, without any non-free blob running on CPU, soon discovered that AOSP relied on non-free blobs, and were disappointed.

"These non-free blobs are always the pieces of software which are dealing with the hardware, like a camera library, or the part that deals with the modem, the RIL [Radio Interface Layer]. As a result, some decided to start a project aiming to run a truly free version of Android on the HTC Dream/Google G1 #8212; Replicant was born."

"Of course, we are free software supporters," Kocialkowski says. "Some people agree with these principles but in reality, may use non-free software from time to time, for convenience issues. The Replicant team is composed by people who are going one step further: in addition to agreeing with these principles, we fully reject anything non-free running on the main CPU."

Page Break

When he first began to get involved in Replicant, Kocialkowski says his low-level programming skills were nonexistent and he was "a Linux kernel newbie". "I didn't even know how to use Git at all," he says.

"I started by getting the Replicant source tree and trying to get stuff to build. I fixed some build-related problems and then started to look at some source code." Thanks to help from the lead Replicant developer at the time he learned to understand the source and began to write code for the project.

"After a few months, I had a good enough understanding of the situation to be able to do some real low-level work, so I started working on improving support for the HTC Dream. I kept going with the Nexus S, but that time, I was alone, and a few months later, I became the one doing most of the work."

Android itself is still a step forward for open source, according to Kocialkowski: "[It is a huge contribution to free software in my opinion. It's the first widely spread 'open source' stack running on phones. That's in itself a big step for free software."

However, to run Android on a phone or tablet requires non-free binaries and for Kocialkowski, having free software on a phone is about being able to control what your device is doing and capable of. "We know that if the non-free software running a phone's GPS, the microphone or the data we store on our handset is compromised, that has the potential to do a lot of harm," he says.

"Not that I am paranoid or that I believe that if I put a single piece of non-free software, it'll give the FBI my GPS location. I just don't want software I have no control over to have such power. It's just like living under a government making arbitrary decisions: It probably won't decide to murder you just like that, but it has the power to do so, and this is, to me, unacceptable.

"On the other hand, for some other people, particularly political dissidents in countries where there is that kind of arbitrary power, it is crucial for them to have control over the technology they use. For them, I believe it is totally unacceptable and very risky for them to use a phone where there is software they have absolutely no control over that can access the Internet and their GPS position, as well as listening."

After several months of work by people involved in starting the project, it was finally possible to make calls using a free version of Android. Replicant ended up forking CyanogenMod, replacement firmware developed independently of Google for Android phones that offers "a bunch of advantages compared to AOSP", Kocialkowski says.

Google offered some support to the project in the form of two Nexus One handsets to work with. "They [the developers involved in the early stages of Replicant] finally managed to run Replicant on the Nexus One, even though it did (and still does) depend on non-free firmwares."

Kocialkowski says the project acknowledges that there is also non-free software on parts of the phone other than the CPU, such as the modem, GPS and Wi-Fi chips.

"It is much harder to write free software for the modem or any embedded chip than to write replacements for the non-free software running on the top of Android, and this is out of the scope of the Replicant project," he says.

The policy of the project is to not distribute any non-free software, even if it's running on a chip other than the CPU, but Replicant will still load non-free firmwares if the user puts them on the phone and will make use of firmware that is already on the phone, such as the firmware for controlling the modem.

The Replicant team is small #8212; Kocialkowski, who is also a student, and several developers working on specific aspects of the project, as well as a community of users.

There's a lot of work to do on Replicant, and the project welcomes fresh blood. "Some tasks require high programming and low-level skills, some only require Java development knowledge and some others even less," Kocialkowski says. In addition, there are opportunities for people to promote Replicant and submit issues in the project's bug tracking system. The team is working with the Free Software Foundation to set up a donation system.

Currently Replicant supports the HTC Dream, the HTC Magic, the Nexus one (though sound relies on firmware that is not distributed by the project) and the Nexus S.

"More targets are to be supported in the future, particularly the Samsung Galaxy S and related Samsung phones," Kocialkowski says.

"The GTA04, produced by Golden Delicious, which aims to replace the old GTA02 (Neo FreeRunner) PCB by an OMAP-powered board, with a 800Mhz CPU, 512MB of RAM and other exciting features should be supported by Replicant in the long term #8212; if I can get my hands over a device," he adds.

Page Break

One of the key challenges faced by developers is chips that use non-standard protocols. "For instance, we started the work to add support for the Nexus S GPS chip, which is handled by non-free software on AOSP, and after setting the transport layer correctly, we faced an amount of unknown and non-trivial data that we assume to be the protocol the GPS chip speaks." The protocol was undocumented, and the developers were faced with trying to discern it from the non-free binary.

"Sometimes, we meet talented people who succeed at decoding the protocol and then we start the work of writing a free implementation, which remains a crazy amount of work," Kocialkowski says. "Things are going slowly mainly because there aren't enough people working on the issues. We do our best and we don't give up."

"The work to bring a usable free version of Android on phones isn't that hard; the number of components to rewrite isn't that huge #8212; let's say around 10 to rewrite per-phone #8212; and we have all the tools to succeed," he says.

"We have never been a team of highly skilled engineers working full-time on the project; we're more like a couple of enthusiastic students with programming skills.

"I started the port of the Nexus S this summer, and I was able to make the first phone call using free software on this device less than six months after, even though I was the only one to work on the device and did it on my free time. I take that as a success. That's now the device I use daily, and it works just fine."

Replicant will continue to use Android as its base. The project has been defined as an attempt to build a fully free version of Android, Kocialkowski says. "There are some others, which are based on GNU/Linux, like the SHR project." He said Replicant could have used the Intel- and Nokia-sponsored MeeGo OS as a base, but it also relies on non-free software and would require a large amount of work that could otherwise go to expanding the number of devices Replicant supports.

Follow Rohan Pearce on Twitter: @rohan_p

Follow Techworld Australia on Twitter: @techworld_au

Copyright © 2012 IDG Communications, Inc.

8 simple ways to clean data with Excel
Shop Tech Products at Amazon