Replicant 6.0 builds for International versions of the Samsung Galaxy S3 are 
available for testing!

Compiled images can be found here (build date: 15.1.16):
https://fossencdi.org/replicant/replicant-6.0.zip md5sum: 
b478c9b8ac248bb1756abde384bd2bbd
https://fossencdi.org/replicant/recovery.img md5sum: 
cbf42c32af38688535e0ddec16cc1ba5

Below is Wolfgang's updated post about this from 6 days ago. Check these links 
to see updates in the comments.

https://redmine.replicant.us/boards/21/topics/12057
https://redmine.replicant.us/boards/21/topics/12057?page=2

Replicant 6.0, at least for the Samsung Galaxy S3

Added by Wolfgang Wiedmeyer 20 days ago

EDIT: added toolchain

The last weeks, I was working on getting Replicant updated to the Cyanogenmod 
13.0 branch, respectively to the AOSP 6.0.x release. This post should give an 
overview of what work has been done, what functionality is working on the 
device and what is left to be done. I only own a Galaxy S3 for testing, so I 
could only test my changes on this device and I did not work on the specific 
device sources of other phones. However, my work should also ease the migration 
for other devices, as a lot of the work is device-independent and many device 
specific changes also apply to other Samsung devices.

I will soon add a Video that shows a bit how everything looks and works.

First of all: Why did I choose the latest CyanogenMod branch and not an older 
one that is already marked stable, like the 12.1 branch? I started with the 
12.1 branch, but I quickly noticed that going this route results in more work 
than working with a branch that is still under development. The main issue was 
that the Galaxy S3 was not supported on the 12.x releases, so I had to backport 
changes from the 13.0 branch where support was added again and I had to look at 
forks that had maintained the device. When I hit a very strange compile error 
with the bionic lib, I decided to try the 13.0 branch. Working with a branch 
where changes are added daily is actually only very little additional work. 
Merging the changes from CyanogenMod is quickly done and there were no big 
changes anymore since quite some time. And on the upside: the latest security 
fixes are already included.

The following sections should give an overview of the most important areas 
where changes have to be made for getting Replicant working on a newer Android 
release.

Graphics

Android does not honor egl.cfg anymore. More information can be found here: 
http://www.2net.co.uk/tutorial/android-egl-cgf-is-dead
Android only falls back to the software renderer if it detects that it is 
running inside the emulator. I reused the ro.softwaregl property to add 
fallbacks. The overall performance is faster than on Replicant 4.2 in my 
experience and no crashes occurred in my latest tests.

Camera

CyanogenMod integrated the free software implementation from Replicant, but 
they adapted it for the proprietary graphics acceleration. I stayed with the 
version from replicant-4.2 as it works so far, but I noticed a few errors in 
the log. CyanogenMod's camera code may include some enhancements that could 
also be useful for Replicant.

I added the LegacyCamera app and taking pictures and recording video works. The 
preview is (annoyingly) slow, however. The gray background in the lower area 
gets rendered differently and I noticed that code relies on GLESv2 features, so 
I would assume that some changes in libraries on which the app depends led to a 
worse software rendering performance. The camera app code itself contains no 
changes in this regard compared to Replicant 4.2. Further investigation has to 
be done to get the preview back to the old speed.

The old Gallery app still works and even the thumbnails work now. I still don't 
know what exactly made them work, though.
Webview

A lot changed here. The Android webview is now fully maintained by the Chromium 
project. The AOSP code only includes binaries now. Building the webview with 
the AOSP code is not supported anymore. It has to be built by setting up a 
Chromium build environment.

The downside of this is that another huge and complex build environment has to 
be set up in order to build the Webview apk. The apk has to be copied and 
committed to the corresponding repo in the Replicant source tree. Then it gets 
automatically included in the build. The build environment for the Chromium 
code has to be reviewed, just like the one for Replicant itself. All 
dependencies must be free software and the prebuilt binaries should be 
verifiable and the aim should be to build them from source, too.

The upside is that it is very easy now to build the Webview based on the latest 
Chromium release and to install it in Replicant. This makes it finally possible 
to have a Webview in Android that is on the same level as the desktop browsers 
when it comes to latest security fixes and adherence to current security 
standards. Please note that the Webview includes its own versions of various 
libraries. So if e.g. a security issue gets fixed in the AOSP Boringssl code, 
this will have no effect on the Webview as it includes its own Boringssl 
version.

Unfortunately, reality looks not that bright. All Webviews versions > 43 
crashed because of missing hardware acceleration. I tried to fix a recent 
version, but I did not succeed. The latest versions have to be tested if they 
include fixes for this problem. There are open bugreports on the Chromium issue 
tracker for this as also everyone is affected who uses the emulator without 
hardware acceleration. So let's hope that the Chromium devs care for this. 
Otherwise the changes between version 43 and 44 have to be closer investigated. 
If that also doesn't help, then we're stuck for now with v43 and this version 
and its dependencies have to be patched. This would still be a much better 
situation than having the unmaintained Webview as in Replicant 4.2. The version 
I included for now (43.0.2357.134) is still fairly new.
Sensors

CyanogenMod also includes now a free software implementation, based on the code 
from Replicant. I stayed with the code from CyanogenMod as it seems to work. 
Screen rotation works and I also tested the SatStat app and noticed no missing 
functionality. Please let me know if there is additional testing necessary.
Wifi and Bluetooth

I could make Wifi and Bluetooth work with the proprietary firmware files. Wifi 
sometimes turns off when the phone is in standby. It turns on again when the 
phone wakes up from standby. This is also a known issue in CyanogenMod. It is 
recommended to update the firmware files to the latest versions. I did not yet 
test audio over Bluetooth.

If you are also using an external GPS receiver over Bluetooth, then you might 
be interested in my fix for the BlueGps app in order to make it work with 
Marshmallow: https://code.fossencdi.org/BlueGPS.git/
Device Encryption

The encryption setup does not ask you to set up a password first. So I 
recommend to set a lock screen password first, preferably a passphrase. Then do 
the encryption setup. After the phone has rebooted, you can set a PIN for the 
lockscreen, so you don't have to enter the passphrase every time you unlock the 
screen. The passphrase for decrypting the data partition should not change.

SELinux

SELinux is set to permissive for now. There are some denials left to fix until 
it can be enabled. This basically only involves writing rules which should not 
be that much work. I didn't do work in this regard yet, but there are regularly 
new rules added on CyanogenMod's side.

RIL

I was able to get the Samsung-RIL and libsamsung-ipc code updated with the help 
from Paul on irc. Telephony, SMS and mobile data should work.
Toolchain and build instructions

There are even more binaries in the source code than with Replicant 4.2. I 
don't think that this is an acceptable situation. Most of these binaries are 
not well documented and very hard to rebuild. Thus they should not be trusted 
and removed. I was able to use more build tools that come with the Linux 
Distribution (in my case Debian Jessie) and get a big part of the toolchain 
build from source. For the GCC toolchain that builds the kernel the 
gcc-arm-none-eabi toolchain from Debian is used. The gcc-arm-linux-androideabi 
and host toolchains for LLVM and GCC are build from source. The host toolchains 
are build natively and don't rely on Google's modified Ubuntu sysroot, while 
the gcc-arm-linux-androideabi still relies on the sysroot from the NDK. I did 
not yet figure out how to completely bootstrap the gcc-arm-linux-androideabi 
toolchain with proper 1st and 2nd stage compilers and get rid of the dependency 
on prebuilt libs from the NDK.
The whole build system is now more complex and likely breaks on other 
Distributions than Debian Jessie. Additionally to the current Replicant 4.2 
dependencies, you need to install these:

sudo apt-get build-dep gcc-4.9 binutils llvm-defaults
sudo apt-get install gcc-arm-none-eabi cmake python-dev swig ant bc


A patch from vendor/replicant/toolchain needs to be applied to the prebuilt 
NDK. So in the prebuilts/ndk folder run the following command: git am 
../../vendor/replicant/toolchain/0001-math-header-fix-for-clang-toolchain.patch
Before you can build the ROM in the regular way, you need to run a build script 
that takes care of building the GCC/LLVM toolchains: 
./vendor/replicant/build-toolchain
The build script is very rudimentary for now. So if something breaks, you will 
need to take a look at it and figure out what exactly went wrong. The build of 
the jack/jill toolchain is not yet included in the script. The jack/jill 
binaries are build by executing ant dist in the respective source code 
directories under toolchain/src and copying the resulting binaries to 
prebuilts/sdk/tools.
All my code is hosted at https://code.fossencdi.org. If you want to get it: 
Just do a repo init -u https://code.fossencdi.org/replicant_manifest.git -b 
replicant-6.0 and then run repo sync.

General

There are still a lot of graphics with the CyanogenMod logo that need to be 
replaced with the Replicant logo. Additionally, I did not care for the repos 
that include code which is not relevant for building the ROM or that did not 
add any improvements to functionality. The sdk repo comes to mind, for example. 
These repos need to be merged with the Replicant branch or the relevant commits 
have to be cherry-picked.

The kernel code includes some changes from me that might break the build for 
other devices. If you try to get a different device working that also uses this 
kernel, let me know if it works! If not, then I'll create a branch that doesn't 
include my additional changes.

In the current state the ROM should be usable as a daily driver, at least for 
my use cases. I will replace the Replicant 4.2 version with this version on my 
main device in the coming days. Let's see if there are any bugs left.

Before you can flash your build to your device, you need to flash the new 
recovery first. A full wipe is also necessary. If you start adb from the 
terminal you already built the ROM from, you will actually use an adb version 
from the out directory that was added to your $PATH. If you use adb from a 
different terminal, you might notice that it won't work. You will need to 
update your android-tools-adb installation. I backported the package from 
Debian Testing.

If you want to add support for a different device: Add the missing device 
repositories and try to merge the changes from CyanogenMod. If the device is 
not supported on the CyanogenMod 13 branch, you will have to look at forks that 
took up the development. Merging with an older branch could also be enough to 
get basic functionality working.

Compiled images if you are too lazy to build it yourself (build date: 15.1.16):
https://fossencdi.org/replicant/replicant-6.0.zip md5sum: 
b478c9b8ac248bb1756abde384bd2bbd
https://fossencdi.org/replicant/recovery.img md5sum: 
cbf42c32af38688535e0ddec16cc1ba5

I hope that my work benefits the Replicant project in some way and that we can 
have an official Replicant 6.0 release soon!


On Sun, 17 Jan 2016 22:52:47 +0000
Kurtis Hanna <kur...@riseup.net> wrote:

> FYI
> 
> Begin forwarded message:
> 
> Date: Wed, 13 Jan 2016 14:41:44 +0100
> From: Wolfgang Wiedmeyer <w...@wiedmeyer.de>
> To: replicant@lists.osuosl.org
> Subject: Re: [Replicant] Replicant 6.0
> 
> 
> The last weeks I was successful in getting rid of prebuilt binaries from
> the source. I could build the necessary GCC/LLVM and jack/jill
> toolchains from source and reduce the general amount of prebuilt
> binaries by also replacing them with software that already comes with
> Debian. I did not yet have the time to include all of this in my
> public repositories, though.
> 
> While working on this, some questions came up, which I want to ask the free
> software experts on this list. A lot of this prebuilt binaries are
> accompanied with very little or not easy accessible information and I am
> wondering if this is enough to be compliant with free software licences.
> 
> An example: Is it enough to place a text file along the binary which
> only includes a pointer to a source code directory and the hint that the
> binary can be built using this source code, but no further instructions
> how the binary can build using that source code are included? Also, there 
> might be no
> information from exactly which version of the source code the binary was
> built. Even looking at git logs might not help to identify the exact
> version.
> 
> Another example: A jar file is not accompanied with any hint at
> all. Opening the jar reveals a version.property that includes a
> hash. With a bit experience one might know that this hash belongs to a git
> commit. However, the actual repository with this commit cannot be
> identified going through the jar. Only by searching the web, some
> experience with the Android platform/toolchain build system and guessing
> From the name of the jar, one might be able to identify the
> repository. Then the build instructions are still missing and it is
> investigative work and again experience necessary in order to figure out
> how the jar might have been build from the source code.
> 
> Last question: What if some these jars were built using a non-free java
> version?
> 
> Already may thanks for your input on this!
> 

_______________________________________________
Replicant mailing list
Replicant@lists.osuosl.org
http://lists.osuosl.org/mailman/listinfo/replicant

Reply via email to