[Replicant] New Phone support

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Fri Jun 19 15:09:51 UTC 2020


On Fri, 19 Jun 2020 16:02:27 +0200
Andrea Monaco <monacoandrea94 at gmail.com> wrote:

> Hello everyone!
Hi,

> I am new to this project. I have a Samsung Galaxy S9, model SM-G960F,
> which I see is not supported.
> Is it very hard to port Replicant to my device? I have some knowledge
> about programming and x86 assembly and I'm very eager to learn. If
> you could point any learning material I'd appreciate it

This device is shipped with Android 8.0, and is supported by the
following LineageOS versions:
- LineageOS 15.1 (Android 8.1.0)
- LineageOS 17.1 (Android 10)

So it would probably not be a good idea to port that to Replicant 6.0,
instead Replicant 10 would probably be a better base to use, however
it's not ready yet (many things are still missing), but that shouldn't
be a big problem.

Replicant 10 is very different from Replicant 6, we took the decision
of using kernels that are closely based on mainline Linux.

So you will need to kernel that uses the mainline interfaces at least,
and/or add support for your device upstream.

You will also need to add support for your device in libsamsung-ipc.
It's probably not that hard as most of the information is easy enough
to get:
- The boot sequence can be retrieved by looking at existing source code
  to understand a bit how it works, and for the part that isn't
  documented in libsamsung-ipc, the device kernel, or in the wiki,
  stracing the proprietary RIL should complete the picture.
- The kernel interface is most likely documented in the kernel source
  code, so with that and the existing implementations in libsamsung-ipc
  that should be easy enough to figure out.

I would be happy to help by giving some pointers for the libsamsung-ipc
part.

The biggest issue is that you would need to actually fork Replicant 10
and/or LineageOS: we took the decision of not supporting smartphones
that don't have non-replaceable batteries because they are complicated
to keep being usable daily over a long period of time: over time the
battery life in hours gets lower and lower, up to the point where the
device isn't usable anymore daily. This makes buying second hand
devices complicated. As I understand in many case, changing the battery
requires to use heat guns that damage the case during the process.

However we're would also be happy to help forks.

We are also open with collaborations with projects that relies on the
same code than Replicant like PostmarketOS that use mainline kernel and
that plan to use libsamsung-ipc for some devices.

The starting point of this project would probably be to look at the
device kernel and the list of free and nonfree libraries to understand
how standard it is and decide on which base to start from. 

If you plan to use LineageOS kernel, you will need to replace some of
the libraries that are in this list:
https://github.com/LineageOS/android_device_samsung_universal9810-common/blob/lineage-17.1/proprietary-files.txt

Most of them doesn't seem that important, however the audio libraries
are proprietary.

If the audio kernel interface is non-standard, I'm unsure if/how
Replicant 6.0 libraries could be reused for that, however there is
enough information out there to actually implement a library:
- There are examples implementations in Android source code
- There is some documentation on audio on https://source.android.com/
- The kernel of the device also has the information on the
  kernel/userspace interface for audio.

If it's standard, it's probably way easier to reuse the default android
implementation for that.

I'm unsure if just removing the nonfree library (after backuping it)
could make it work, but it would be something worth to try. I'm also
not sure if you need to recompile LineageOS or not to do that.

I recall that there is some mechanism to fall back on the .default
implementation when the vendor specific one is not found, but it needs
to be tried out to see if it really works with LineageOS in practice.

The next thing with audio would be to implement the interface between
libsamsung-ipc and the audio libraries. We have examples in Replicant 6
but we didn't port that to Replicant 10 yet, and I didn't dig into it
yet so I'm not very familiar with that part of the code, but it's
probably not that complicated.

As for where to start here are some links:
- We have an article that also cover the general hardware architecture
  of smartphones[1]. That can be super useful if you didn't look into
  smartphones yet.
- We also have some presentations[2] about in depth topics like porting
  AOSP to a new device, and the modem part, which are probably the most
  relevant presentations for that. The one about porting AOSP is
  short and can give a general idea on the generic part that needs be
  done, or how to do that kind of work, however it needs to be adapted
  if you use LineageOS, as a lot of the work is done already.
  The ones on the modem ("Replicant and modems: introduction" and
  "Replicant and modems: Samsung IPC" go in a lot of details but that
  can help understand the architecture of the code, which in turn makes
  it much more easier to contribute.

[1]https://www.replicant.us/freedom-privacy-security-issues.php
[2]https://redmine.replicant.us/projects/replicant/wiki/ContributorsMeetingJuly2019#Presentations

Denis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osuosl.org/pipermail/replicant/attachments/20200619/ac0c70b5/attachment.asc>


More information about the Replicant mailing list