Profile

Replicant

Replicant 6.0 for the Samsung Galaxy S3

This post contains outdated information and links to outdated images. See the wiki and blog for development updates, up-to-date documentation and current images!See the archived post for documentation about my initial work and findingsSee this post for the Galaxy S2

Changelog of the latest version (replicant-6.0-beta-0001 from 27.1.17)¶

Added support for external WiFi dongles that use the AR9271 chipset Makes it possible to use WiFi with only free software as free firmware exists for the chip

January security updates for the kernel

Changelog of the sixth alpha release (replicant-6.0-alpha-0006 from 6.1.17)¶

Only the most relevant changes are listed.

Fixed sending of longer SMS messages

Fixed entering the SIM lock PIN Previously, if the PIN was entered incorrectly once, every subsequent try failed, even if the PIN was correct.

Reduced the camera preview resolution to speed up the preview a little bit

Moved the build system from Debian Jessie to Debian Stretch and fixed various build errors This allows to use the manifest merger tool and the Eclipse Java compiler from Debian.

Added the possibility to enable llvmpipe as software renderer by making it buildable for ARM See the Tips section below

Applied various performance improvements and fixes for graphics rendering, mostly from the Android-x86 project

Ported various security/privacy enhancements from the CopperheadOS project This includes the possibility to set an encryption password that is different from the lock screen pin/password. The phone will reboot if the PIN was entered incorrectly more than four times. Some privacy enhancements for the browser

llvmpipe has more complete EGL support than the Android software renderer, so more apps work with it, like Firefox-based browser or more recent webviews. Unfortunately, llvmpipe is still too slow to be the default renderer, but I made it possible to switch back and forth between llvmpipe and the Android software renderer. ADB and root over ADB needs to be enabled in the developer settings.

The camera "locks" sometimes or the error "Can't connect to camera" is displayed. Logs might help debugging this, at least the issue with the error message. Recent versions have a fix which allows to take a picture if the camera app seems to be unresponsive and you press the shutter button a second time.

Only the Galaxy S2 and S3 are supported. If you want to help getting other Replicant devices supported: Add the missing device repositories and try to merge the changes from CyanogenMod. If the device is not supported on the CyanogenMod 13.0 branch, you will have to look at forks that took up the development. Merging with an older branch could also be sufficient to get basic functionality working.

Newer webviews can't be used because they don't work with the software rendering Webview version 43.0.2357.134 is currently in use. It was released in July 2015. This can be fixed by making llvmpipe fast enough so it can be used as the default software renderer. Currently, the Android software renderer is the default.

There are still prebuilt binaries in the source tree I got rid of a lot of prebuilt binaries to make the build more trustworthy and to ensure that all tools are properly built from source with free software, but there are still a few left. The gcc-arm-linux-androideabi toolchain needs to be bootstrapped with proper 1st and 2nd stage compilers so it doesn't rely on the sysroot from the NDK. In general, there are still some prebuilt binaries from the NDK, SDK and other places in use, but nearly all of them shouldn't run on the host, but only on the Replicant device.

Please note that the build might even be broken on this branch and there are no git tags on this branch which pin the source code to certain versions.

Then download the source code:

repo sync

The F-Droid binary is downloaded separately. The download script will check if the signature of the F-Droid binary comes from the F-Droid release signing key. You can retrieve the current signing key with the command gpg --recv-key 7A029E54DD5DCE7A. Run the download script to get F-Droid:

./vendor/replicant/get-prebuilts

Before you can build the ROM in the regular way, you need to run a build script that takes care of building the toolchain:

./vendor/replicant/build-toolchain

In order to prevent strange errors, I recommend running the script in a newly opened shell, in which you haven't already run one of the commands like . build/envsetup.sh, lunch or make that change the environment.

Then you can run the regular build commands to create a Replicant 6.0 zip and recovery:

I also added a script that signs your build, takes care of generating the necessary keys and puts everything in the out/dist directory. Using this script, it is possible to rely on your own keys and not on the test keys which are not recommended to use because the private test keys are publicly available. Building from source and flashing the default image that is signed with the test keys basically disables all the security measures in Android that are based on signing keys. The script also makes it possible to use password-encrypted private keys. The images below are signed with my keys using this script. You can run the script the following way:

./vendor/replicant/sign-build i9300

And finally you can flash the recovery in the download mode and sideload the zip in recovery mode:

If you have already built Replicant at some point and now you are getting build errors: Run make clobber and retry in a newly opened shell.If make fails, it may be necessary that run mka org.cyanogenmod.platform-res.

Add my key to your GPG keyringYou can retrieve it from the keyserver of your choice (gpg --recv-key 5816A24C10757FC4).Alternatively, you can download it from here: https://wiedmeyer.de/keys/ww.ascand import it with gpg --armor --import path/to/5816A24C10757FC4.ascThe key should have the following fingerprint: 0F30 D1A0 2F73 F70A 6FEE 048E 5816 A24C 1075 7FC4

You need to flash the new recovery first before you can flash the zip to your device. A full wipe is also necessary. Updating your ADB installation might help if you have problems with ADB.See the wiki for more details.

I'm currently (since 2 hours) using Mali blobs again ... I'm somehow just much more productive with the proprietary graphics driver.

Would you mind explaining what to do to get the proprietary drivers working with Replicant 6.0? I know this somehow defeats the whole purpose of Replicant. but until there is better integration it is a tradeoff I'm willing to take.

I had the "no SIM card" issue and solved it by unlocking it first with another ROM (cyanogenmod),nevertheless, it seems that, once with replicant 6.0, if I try to lock the SIM card, I fall back tothis issue. That surprised me as I read in one earlier post that this issue was fixed.

There is an su executable preinstalled, i.e. you have root access to the system e.g. via a terminal.I think there is also an application pre-installed which gives you fine-grained control about what app has root previleges -- if not, it's installable from F-Droid.

There is indeed a preinstalled su executable. But in order to use superuser app, you'll need to flash superuser.zip.Otherwise, superuser will complain that su executable is not up to date and it will not manage root access (granted for all by default !)

It seems that the permission to write to the external media has changed from "android.permission.WRITE_EXTERNAL_STORAGE" to "android.permission.WRITE_MEDIA_STORAGE".

Applications which have the latest can indeed access with write permission to the external SD card, whereas others, even with WRITE_EXTERNAL_STORAGE cannot.

Adding <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" /> in the relevant application section in /data/system/packages.xml gives back the good permission for it, actually it makes the application be part of the media_rw or sdcard_rw group.

I updated my initial post. There is now a section about the toolchain and build instructions. I merged my changes to the toolchain in the replicant-6.0 branch, so most of the toolchain needs to be build from source from now on. The security patch level should now be the correct one.

I also included links to a compiled zip and recovery if you are not able to build it from source for whatever reason and want to try it nonetheless.

Could you post more/previous output? This basically only shows that make gives up, but the actual error happened somewhere before.My 2 cents about using Arch for building this: Google uses an old and modified Ubuntu LTS release for building Android. Debian Jessie comes pretty close to this setup in terms of configuration and package versions. So I only had to fix very few build errors here and there. Arch however has very new package versions and differs quite a bit. I don't want you to switch to a different distribution for building Android. Indeed, I think it is very important that we make it possible to build Replicant on Arch, because then it is very likely that building it will work on various other distributions. But I just want to let you know that you will likely have more build errors in the future and that it could become quite challenging. I will definitely try to help you with build errors.

I will need logs for fixing the SIM card problem. I tested it with two different SIM cards (albeit same provider) on two devices and they always get recognized. So I don't know what could be the culprit.

Setting->Sound->Other did not yet crash on me but I will look into this at some point.

Encryption should also work. If this does in fact not work, then the logcat from the shutdown after the encryption was enabled and from the following boot needs to be inspected. The last time I checked, encryption did not work on CyanogenMod 13 because they likely forgot to add some SELinux rules.

@Simon: Yes, it uses Replicant's RIL and the proprietary graphics drivers are not used. It is unlikely that there was a different proprietary acceleration module added to the source code and I would not be aware of it. Feel free to check the source! I already went through quite some code and e.g. removed the linking to proprietary play services that CyanogenMod added. I will also watch out for the one-pixel split graphics bug.I won't provide support for running proprietary software on the AP, but if you want to get GPS working, you might start by looking at this commit: https://code.fossencdi.org/device_samsung_i9300.git/commit/?h=replicant-6.0&id=eb564f1803a0145eef68b59cdbb75362175d05a7

robin p: I won't do work on getting a sdk or ndk build ready for now. I don't see a point in doing so for the moment because there are still so many binaries. I think it has be investigated first if the build process for the sdk or ndk just repackages a lot of these binaries. Just to be clear: I see similar problems with the Replicant 4.2 source code. For now I recommend building an app directly from the source code. Just place it somewhere and run mmm path/to/app. The app just needs a Android.mk. It can be simple as this one: https://code.fossencdi.org/BlueGPS.git/tree/Android.mk. You should have run a complete build of the ROM before so that all dependencies are in place or you could try to run mmma path/to/app. Of course, if the app has a lot of dependencies, then it might not work because not all of them are there.

Hello!About a month ago I installed Replicant 6.0 (build from 2016-03-25, according to phone settings), and I would like to sum up my experiences here in hope that they may be of some use to someone.

The installation itself went fairly well. I made use of the pre-built images. What I actually had to do did not match up with the provided instructions for 4.2, but it was close and the wonderful folks at #replicant helped me get it right.

As for turning the phone on, it's really slow, and feels kind of broken. The whole process of booting up usually takes anywhere from 10 to 50 minutes. During this time, the Replicant logo is shown, then the phone goes on to "Update Apps" and often does these two things over and over again several times. On some occasions I restarted the phone during boot (after it was taking too long) and it booted up quickly afterwards.

The performance of the system is okay. Usually the animations are choppy, but the phone doesn't feel slow or laggy. It happened a few times that the phone was very slow and laggy for a while, which was quite uncomfortable. On the other hand, everything's been very smooth and responsive today. This was after installing a protective tempered glass and rebooting the phone, so it could be because of a fresh instance, or because of better/reduced touch reception. (Just making assumptions here.)

As for the features, the phone recognized my SIM card just fine. SMS and calls are both working very well. WiFi does not work (as expected), Modem I did not test, and Tethering I tried to set up but failed. The fault was likely at my computers' side though. When I try opening the camera app, the screen is black for a short while and then it says "Camera error; Can't connect to the camera". That's probably the only missing thing I would really really like to have working. (I did not try with other apps; see the part about internet connectivity.)

Altogether, the system feels like what I expected plus bugs. Quick booting and camera are all I'm missing from being very content with it. I'll try to get USB tethering working later on, although it would be nice to have the tutorials confirmed to work with 6.0.

Thanks for all the work put into this release! I'll be looking forward to the next one and hoping I can help make it better in some way. Long live free software!

I added build instructions to the readme: https://code.fossencdi.org/BlueGPS.git/about/The instructions only cover building it as part of the source code of an Android ROM like Replicant.Of course, it's also possible to build it with the SDK, but I never tested it. It's probably possible to build it with the Replicant SDK.

And I rewrote the post. It now contains the changelog, tips, and known issues besides the build instructions and image downloads.

Some of you asked about the nonfree GPS and graphics blobs. I won't provide support for such nonfree software that runs on the main CPU, neither in the Replicant forum nor elsewhere. But I created a post on my personal blog about installing nonfree firmware to enable various functionalities: https://blog.fossencdi.org/nonfree-firmware-android.html

As for turning the phone on, it's really slow, and feels kind of broken. The whole process of booting up usually takes anywhere from 10 to 50 minutes. During this time, the Replicant logo is shown, then the phone goes on to "Update Apps" and often does these two things over and over again several times. On some occasions I restarted the phone during boot (after it was taking too long) and it booted up quickly afterwards.

It shouldn't take so much time to boot the phone. It should be much faster. Did you do a factory reset?

As for the features, the phone recognized my SIM card just fine. SMS and calls are both working very well. WiFi does not work (as expected), Modem I did not test, and Tethering I tried to set up but failed. The fault was likely at my computers' side though. When I try opening the camera app, the screen is black for a short while and then it says "Camera error; Can't connect to the camera". That's probably the only missing thing I would really really like to have working. (I did not try with other apps; see the part about internet connectivity.)

You could try if the latest image improves the situation. At least a reboot should fix the camera error.

A new release is available. The biggest addition is support for the Galaxy S2. More information here.

And it's now possible to use an external WiFi dongle that has the AR9271 chipset. As a free firmware exists for this chip, it's possible to use WiFi with only free software. There are different variants of such a dongle available. You can also buy a dongle at Tehnoetic and other online shops that provide freedom-respecting hardware. See the updated post for more information.

And I rewrote the post. It now contains the changelog, tips, and known issues besides the build instructions and image downloads.

Some of you asked about the nonfree GPS and graphics blobs. I won't provide support for such nonfree software that runs on the main CPU, neither in the Replicant forum nor elsewhere. But I created a post on my personal blog about installing nonfree firmware to enable various functionalities: https://blog.fossencdi.org/nonfree-firmware-android.html

WiFi does not get installed with your script (or if it does, it does not work). I installed WiFi firmware flashing the zip file from CM 10.1 as explained in Paul's blog. Also front camera doesn't work (maybe it could be a CM issue?) and bluetooth, although it can be enabled, cannot detect devices and it is not visible for others.

Just for the record, front camera worked in Replicant 4.2, so that's why I think it may be a CM bug, also Bluetooth worked perfectly for me in 4.2, maybe it's another bug. Does anyone else has these issues?

WiFi does not get installed with your script (or if it does, it does not work). I installed WiFi firmware flashing the zip file from CM 10.1 as explained in Paul's blog. Also front camera doesn't work (maybe it could be a CM issue?) and bluetooth, although it can be enabled, cannot detect devices and it is not visible for others.

I can confirm that the script does not work for the newest beta version.

WiFi does not get installed with your script (or if it does, it does not work). I installed WiFi firmware flashing the zip file from CM 10.1 as explained in Paul's blog. Also front camera doesn't work (maybe it could be a CM issue?) and bluetooth, although it can be enabled, cannot detect devices and it is not visible for others.

Just for the record, front camera worked in Replicant 4.2, so that's why I think it may be a CM bug, also Bluetooth worked perfectly for me in 4.2, maybe it's another bug. Does anyone else has these issues?

All of this should work. Can you paste some output from the script? Simply saying that it doesn't work doesn't help at all to debug this.

I'm fully aware that tools exist, but I don't want to add any dependencies to the script that are not available as GNU/Linux packages, so users only have to worry about having ADB working.

P.D. 2: Why dont't you try a more modern camera app? the kitkat camera it's ok, is very complete.

Did you test it? It should crash on Replicant as it uses the Camera2 API that depends on some EGL extensions that are not supported by the Android software renderer.

Gumbor W wrote:

David Pizarro wrote:

WiFi does not get installed with your script (or if it does, it does not work). I installed WiFi firmware flashing the zip file from CM 10.1 as explained in Paul's blog. Also front camera doesn't work (maybe it could be a CM issue?) and bluetooth, although it can be enabled, cannot detect devices and it is not visible for others.

I can confirm that the script does not work for the newest beta version.

Again, please provide more information like the output from the script.

Again, please provide more information like the output from the script.

Thanks for the fast reply! The script says that everything is successful. It is just not working on my phone (WiFi is turning off again and the camera app is unable to connect to the front camera). My script output is attached to this message.

I completely forgot to mention: Great work! Great to see that this project is getting better and better.

UPDATE Now that I looked into it.. it only seems to push the first line in fw_file.txt .UPDATE2 Found the bug.. I just do not know how to fix the script. $ADB shell mkdir -p "$path" somehow messes with the while loop. Making sure the folder is already created on the phone and uncommenting it fixes the issue.