Project

General

Profile

Replicant 6.0 for the Samsung Galaxy S2

Added by Wolfgang Wiedmeyer about 7 years ago

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 this post for the Galaxy S3

I want to thank Grim Kriegor and Dllud for providing a Galaxy S2 device to make this port possible! And a big thank you to Jookia for doing the initial work!

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

See the changelog in the Galaxy S3 post. Basically all of it also applies to the S2.

Tips

Enabling llvmpipe as software renderer

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 following commands are necessary to enable llvmpipe:

adb root
adb remount
adb shell "grep -q "ro.libagl=1" /system/build.prop && sed "s/ro.libagl=1/ro.libagl=0/" -i /system/build.prop || sed "s/ro.libagl=0/ro.libagl=1/" -i /system/build.prop" 

If you want to go back to the Android sofware renderer, you will need to run the above commands again. A reboot is always necessary for the changes to be applied.

Barcode scanning

The mostly used barcode scanner app ZXing has a pretty slow preview. This barcode scanner app from F-Droid has a much faster preview.

Using an external wifi dongle

See this post.

Known issues

  • Some SIM cards are not recognized.
    If you want to help debugging this, do the following:
    Run adb logcat -d -b radio > replicant_radio_log.txt after the device booted.
    Install CyanogenMod 13.0 and capture the same log. The output of adb shell dmesg after CyanogenMod has booted could be helpful, too.
    You can send the logs in a PM as they can contain personal information.
  • The camera preview is slow
    See this mail for more info.
  • 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.

Build instructions

For now, only Debian Stretch is supported as build system. See this blog post on my personal blog for instructions on how to set up a Debian Stretch build environment in a chroot.

You need to install the following dependencies:

sudo apt-get build-dep gcc binutils llvm-defaults
sudo apt-get install gcc-arm-none-eabi cmake python-dev swig ant bc proguard maven-debian-helper libemma-java libasm4-java libguava-java libnb-platform18-java libnb-org-openide-util-java libandroidsdk-ddmlib-java libmaven-source-plugin-java libfreemarker-java libmaven-javadoc-plugin-java repo ca-cacert curl gawk libgmp3-dev libmpfr-dev libmpc-dev git-core gperf libncurses-dev squashfs-tools pngcrush zip zlib1g-dev lzma libc6-dev-i386 g++-multilib lib32z1-dev lib32readline-dev lib32ncurses5-dev zlib1g-dev:i386 xsltproc python-mako schedtool gradle dirmngr libandroidsdk-sdklib-java eclipse-jdt libgradle-android-plugin-java android-sdk-build-tools android-sdk-platform-23 aapt lzop

All my code is hosted at https://code.fossencdi.org. You can get the source code with the following commands:

repo init -u https://code.fossencdi.org/replicant_manifest.git -b replicant-6.0

If you want to contribute or if you simply want the latest and possibly unstable changes, you can also initialize with the development branch:

repo init -u https://code.fossencdi.org/replicant_manifest.git -b replicant-6.0-dev

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:

. build/envsetup.sh
lunch replicant_i9100-userdebug
make -j $(nproc) bacon

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 i9100

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

heimdall flash --KERNEL out/dist/recovery-i9100.img
adb sideload out/dist/replicant-6.0-i9100.zip

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.

Compiled images (build date: 18.2.17):

  1. Download the following files:
    https://fossencdi.org/replicant/replicant-6.0-i9100.zip
    https://fossencdi.org/replicant/replicant-6.0-i9100.zip.asc
    https://fossencdi.org/replicant/recovery-i9100.img
    https://fossencdi.org/replicant/recovery-i9100.img.asc
    https://fossencdi.org/replicant/images-i9100.sha256
  2. Add my key to your GPG keyring
    You 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.asc
    and import it with gpg --armor --import path/to/5816A24C10757FC4.asc
    The key should have the following fingerprint: 0F30 D1A0 2F73 F70A 6FEE 048E 5816 A24C 1075 7FC4
  3. Verify the signatures of the files:
    gpg --armor --verify path/to/replicant-6.0-i9100.zip.asc path/to/replicant-6.0-i9100.zip
    gpg --armor --verify path/to/recovery-i9100.img.asc path/to/recovery-i9100.img
    
  4. Check the checksums (in the folder with all the downloaded files):
     sha256sum -c images-i9100.sha256
    

Only install the images if all of these checks are successful!

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.


Replies (15)

RE: Replicant 6.0 for the Samsung Galaxy S2 - Added by Fil Bergamo about 7 years ago

Thanks everyone for the efforts!

Here on my I9100, the recovery seems not to work correctly..
Heimdall successfully flashes it on the device, then the device reboots.
Samsung splash screen appears, but it sticks there.. ..forever.

The device used to work perfectly with Replicant 4.2 and the relative image..

Anyone else experiencing the same issue?

RE: Replicant 6.0 for the Samsung Galaxy S2 - Added by Wolfgang Wiedmeyer about 7 years ago

Fil Bergamo wrote:

Here on my I9100, the recovery seems not to work correctly..
Heimdall successfully flashes it on the device, then the device reboots.
Samsung splash screen appears, but it sticks there.. ..forever.

The signed images were in fact unusable. The unsigned images I tested locally worked. I fixed the signing scripts and updated the images. It should work now.

RE: Replicant 6.0 for the Samsung Galaxy S2 - Added by Fil Bergamo about 7 years ago

Wolfgang Wiedmeyer wrote:

The signed images were in fact unusable. The unsigned images I tested locally worked. I fixed the signing scripts and updated the images. It should work now.

I can confirm that now both the recovery and the zip work perfectly.
I now have Replicant 6.0 running on my i9100.
Thank you!

RE: Replicant 6.0 for the Samsung Galaxy S2 - Added by Jacob Bahn about 7 years ago

CONGRATULATIONS on this achievement and thanks a lot for all your efforts.

I successfully installed R6.0 on a S2 today. I haven't tried it yet with SIM card and wifi, but these are the next steps.

For now I have (at least) one issue: Under 'storage' I have 'Internal storage', sdcard0 and sdcard1. More or less by mistake I had my sdcard1 formatted as internal storage. The problem is that my sdcard0 is claimed to be corrupted and when I try to format it I get this error message: <'55 volume partition disk: 179_0 public' failed with '400 55 commanded failed'>. The "55" number goes up one for each try (I haven't tried 55 times though!).

I had this error message both before and after farmatting sdcard1 as internal storage.

Is this a known bug and is there a solution?

RE: Replicant 6.0 for the Samsung Galaxy S2 - Added by Jacob Bahn about 7 years ago

UPDATE:

I re-installed R6.0 on my S2. It works very well, but I have an issue with the internal memory.

I DO have 2 GB of internal memory, but it is not recognised as sdcard0. Under 'Storage & USB' I have listed three types of memory:

Device storage:
  • Internal storage (2.0 GB of which 538 MB are used)
Portable storage:
  • jbtlf (my removable micro SD card - 14.82 GB)
    and
  • sdcard0 which is claimed 'Corrupted'

Not having an/access to an sdcard0 means that I can't use the camera: It says 'Insert an SD card before using the camera'.

I also can't import archived (and encrypted) messages from the Silence app from before upgrading from R4.2 to R6.0.

Help on this issue is much appreciated.

Thanks again for all your efforts - you guys are not only giving us specific solutions but general hope as well. Please keep ud the good work.

RE: Replicant 6.0 for the Samsung Galaxy S2 - Added by Alexand(er|ra) Yst about 7 years ago

I had the same problem as Jacob Bahn. I ended up having to downgrade to Replicant 4.2 0004 to fix it. Replicant 4.2 0004 is able to format the "SD card", rendering it usabe but blank, but Replicant 6.0 fails every time that I try to have it format the "SD card". The error message is "command '13 9 volume partition disk: 179_0 public' failed with '400 15 Command failed'". Like Jacob, I'm unable to use the camera because of this.

Also of note, Replicant 6.0's recovery isn't able to read ext4 SD cards. I had to wipe my SD card and format it to even install Replicant 6.0. Replicant 4.2 0004's revovery, on the other hand, can read ext4 SD cards perfectly.

RE: Replicant 6.0 for the Samsung Galaxy S2 - Added by Jacob Bahn about 7 years ago

The above is not an issue with R6.0 on S3.

On the S2: Due to the mentioned memory problem, I can't take pictures with the standard camera app. Apparently it won't even start up, if it doesn't have access to memory. And it seems that memory location cannot be changed to e.g. external sdcard.

I downloaded another camera app from f-droid which stats up and let's me take pictures, only it's not saved. There is a configuration menu in which I can change memory location. Unfortunatly not to external sdcard and with the internal: Same issue.

One interesting thing though: I opposition to R6.0 on S3 and R4.2 on S2 I can use the front camera (but of course with no access to memory)

RE: Replicant 6.0 for the Samsung Galaxy S2 - Added by Alexand(er|ra) Yst about 7 years ago

You can't access the front camera on the GT-i9100 (SII) on Replicant 4.2 0004? Strange; I can. I've never had a use for the front camera, but I've seen that it works on my device.

I had that same problem with the GT-i9100 (SII) with a camera application from F-Droid. Open Camera didn't complain about the lack of storage, so I thought that I'd found a workaround. Instead, I took a bunch of photographs, expected them to be there, and after it was too late to retake them, I found that they hadn't been saved.

Suggestion for default terminal in R6.0 - Added by Fil Bergamo about 7 years ago

Hi,

..don't know if this is the right place to ask..
Also.. I know that this is not at all a priority, but I'm going to give my unwanted advice anyway :)

Due to the developing of the RepWifi application (alpha is coming soon!), I'm working quite a lot with the terminal app in Replicant 6, these days..
While it is functioning without any particular issue, I found out that the default terminal in Replicant 6 is very limited, and lacks all the features that made the "Terminal Emulator" app so easy and painless to use, such as basic key bindings that help writing numerous long commands less stressful.

I think I'm going to install Terminal Emulator via the apk anyway, but I just wanted to ask if it would be possible to switch to "Terminal Emulator" app as the default terminal in future releases of Replicant 6.0..
Is there any non-trivial work to be done to include it as the default app?
If not, I suggest using it, as I find it way more powerful and complete.

Thanks for everything, and Happy Hacking!

Fil

RE: Replicant 6.0 for the Samsung Galaxy S2 - Added by Wolfgang Wiedmeyer about 7 years ago

Jacob Bahn wrote:

For now I have (at least) one issue: Under 'storage' I have 'Internal storage', sdcard0 and sdcard1. More or less by mistake I had my sdcard1 formatted as internal storage. The problem is that my sdcard0 is claimed to be corrupted and when I try to format it I get this error message: <'55 volume partition disk: 179_0 public' failed with '400 55 commanded failed'>. The "55" number goes up one for each try (I haven't tried 55 times though!).

You could try the updated images. They should include some file system checks that run as part of the installation. If the issue persists, you could try the following:
  • Install LineageOS and check if the issue is there, too.
  • Do some research (e.g. enter the error message into your favorite search engine) and report back if some of the solutions that turn up work.

I can't do these steps for you as I can't reproduce the issue.

RE: Suggestion for default terminal in R6.0 - Added by Wolfgang Wiedmeyer about 7 years ago

Fil Bergamo wrote:

While it is functioning without any particular issue, I found out that the default terminal in Replicant 6 is very limited, and lacks all the features that made the "Terminal Emulator" app so easy and painless to use, such as basic key bindings that help writing numerous long commands less stressful.

Indeed, it's quite a minimal terminal app.

I think I'm going to install Terminal Emulator via the apk anyway, but I just wanted to ask if it would be possible to switch to "Terminal Emulator" app as the default terminal in future releases of Replicant 6.0..
Is there any non-trivial work to be done to include it as the default app?
If not, I suggest using it, as I find it way more powerful and complete.

The internal terminal app is coupled to the settings and I think one of the reasons is the possibility to enable/disable it depending on certain user profiles. So it's probably some work to get rid of it. I prefer to build the default apps in Replicant from source. Currently, only the F-Droid app is downloaded and not built from source. Adding the Terminal Emulator would add another app that is downloaded and where we'd have to keep up with version changes. Given all of this, I'd like to keep it as it is for now. As you wrote, it's trivial to install the Terminal Emulator from F-Droid. But what we could do is to set up a wiki page with recommended apps that "enhance the Replicant experience" or are otherwise particular useful to Replicant users and list apps like the Terminal Emulator there.

RE: Suggestion for default terminal in R6.0 - Added by Fil Bergamo about 7 years ago

The internal terminal app is coupled to the settings and I think one of the reasons is the possibility to enable/disable it depending on certain user profiles. So it's probably some work to get rid of it. I prefer to build the default apps in Replicant from source. Currently, only the F-Droid app is downloaded and not built from source. Adding the Terminal Emulator would add another app that is downloaded and where we'd have to keep up with version changes. Given all of this, I'd like to keep it as it is for now. As you wrote, it's trivial to install the Terminal Emulator from F-Droid. But what we could do is to set up a wiki page with recommended apps that "enhance the Replicant experience" or are otherwise particular useful to Replicant users and list apps like the Terminal Emulator there.

All that makes sense, indeed!
I strongly agree with avoiding other pre-built apps.
Thanks for explaining!

Fil

Can't receive MMS on S" with R6.0 - Added by Jacob Bahn about 7 years ago

Though I am happy with my R6.0@S2 there are some issues that a quite troublesome.

I already described that the sdcard0 doesn't work (which leads to the camera not working).

Another issue is that I can't reveive MMS. It's the same on S2 and S3 and I have tried re-installation a couple of times with no change.

Is this a now problem, or is it just me experiening this (on two different phone models).

/Jacob

Superuser App does not work - Added by Andr0id Di0rdna almost 7 years ago

Hi all,

i have installed Replicant 6.0 on my Samsung Galaxy S2 (GT-I9100) with the Recovery from CWM (CWM-KitKatCompatible-i9100.tar).
The Superuser Apps from F-Droid can be installed, but do not work properly as it should be.
There is no Apps list in Superuser App, for management and more.
I have installed the Superuser App from "Superuser Version 1.0.3.0".
(Link: https://f-droid.org/repository/browse/?fdfilter=superuser&fdid=com.koushikdutta.superuser)

But it did not work fine, i get the message: "The Superuser binary (su) must be updated. Pleae choose an installation method.
Recovery mode installation is recommended for HTC devices".
I choose the "Recovery" method, after reboot the Superuser binary (su) is not upated.

Same problem with the other App from "Superuser Version 1.0.3.3".
(Link: https://f-droid.org/repository/browse/?fdfilter=superuser&fdid=me.phh.superuser)

If i start the App "Lil' Debi", it displays a message: "Status: Lil' Debi needs root access install Superuser, GET SUPERUSER...".
I get the message without the Superuser App from Version 1.0.3.3 and with Root Access (Apps and ADB) too.
But with the App from "Superuser Version 1.0.3.0" the message is not displayed.
Both Superuser Apps did not work right on my Samsung Galaxy S2 (GT-I9100).

I try to install with the Superuser binary (su) from http://superuser.phh.me/superuser.zip with Recovery from CWM,
it aborts with the error message: "E: footer is wrong" and "E: signature verification failed".
Could this work for the Samsung Galaxy S3 (GT-I9300)?
I found the info there: http://redmine.replicant.us/boards/21/topics/12057?r=12183#message-12183,
under the section "Superuser / Root access management".

What can i do to get the App Superuser on the Replicant 6.0 running, please?

Thanks!

Und hier Deutscher Text:

Hallo alle,

ich habe Replicant 6.0 auf meinen Samsung Galaxy S2 (GT-I9100) installiert, mit Recovery von CWM (CWM-KitKatCompatible-i9100.tar).
Die Superuser Apps aus F-Droid lassen sich installieren, arbeiten aber nicht richtig wie es sein soll.
Es sind keine Apps in Superuser App aufgelistet, zum Management und mehr.
Ich habe das Superuser App von "Superuser Version 1.0.3.0" installiert.
(Link: https://f-droid.org/repository/browse/?fdfilter=superuser&fdid=com.koushikdutta.superuser)

Aber es funktioniert leider nicht richtig, ich bekomme die Meldung: "Die Superuser-Binärdatei (su) muss aktualisiert werden.
Bitte eine Installationsmethode auswählen. Bei HTC-Geräten wird die Installation via "Recovery" empfohlen."
Ich wählte die "Recovery" Methode aus, nach Neustart wurde die Superuser-Binärdatei (su) nicht aktualisiert.

Das gleiche Problem tritt auch mit der andere App von "Superuser Version 1.0.3.3" auf.
(Link: https://f-droid.org/repository/browse/?fdfilter=superuser&fdid=me.phh.superuser)

Wenn ich die App "Lil' Debi" starte kommt eine Meldung: "Status: Lil' Debi benötigt Superuser-Zugriff, installiere... WERDE SUPERUSER".
Ich bekomme die Meldung auch ohne den Superuser von Version 1.0.3.3 und mit Root-Zugriff auch.
Aber mit der App von "Superuser Version 1.0.3.0" erscheint so eine Meldung nicht.

Ich habe probiert mit der Supersu-Binärdatei (su) von http://superuser.phh.me/superuser.zip mit Recovery von CWM zu installieren,
es bricht mit der Fehlermeldung ab: "E: footer is wrong" und "E: signature verification failed".
Könnte das für nur den Samsung Galaxy S3 (GT-I9300) funktionieren?
Denn die Info habe ich dort gefunden: http://redmine.replicant.us/boards/21/topics/12057?r=12183#message-12183,
unter den Abschnitt "Superuser / Root access management".

Was kann ich also bitte tun, um die App Superuser auf dem Replicant 6.0 zum Laufen bringen?

Vielen Dank!

RE: Superuser App does not work - Added by Fil Bergamo almost 7 years ago

Andr0id Di0rdna wrote:

Hi all,

Hi!

What can i do to get the App Superuser on the Replicant 6.0 running, please?

I don't know what the "Superuser App" is really all about, but I guess it's just a workaround for phones that are not "rooted" (correct me if I'm wrong).
That said, I don't see why you would ever need such an app in Replicant, as it already comes with "su" command built in, which makes it possible to run applications that need root privileges.

What you're maybe missing, is that you need to explicitly enable root for applications. Go to:

Settings > Developer options > Root access

and select the option that suits you best. I suggest you give root access to "Apps only".
You could later enable it for ADB if you really need it in the future.

Please, let me know if that solves your issues.

Happy Hacking

Fil

    (1-15/15)