Project

General

Profile

Upstream » History » Version 400

Denis 'GNUtoo' Carikli, 11/29/2020 08:35 PM
move devices to upstreaming sub project

1 12 Denis 'GNUtoo' Carikli
h1. Upstream Linux
2 1 Denis 'GNUtoo' Carikli
3 57 Denis 'GNUtoo' Carikli
{{>toc}}
4
5 362 Denis 'GNUtoo' Carikli
h2. Tracking upstream patches
6 100 Denis 'GNUtoo' Carikli
7 362 Denis 'GNUtoo' Carikli
We have a "new issue tracker":https://redmine.replicant.us/projects/upstreaming/issues for tracking upstream status of various patches.
8 100 Denis 'GNUtoo' Carikli
9 11 Denis 'GNUtoo' Carikli
h2. Benefits of using Upstream Linux
10 2 Denis 'GNUtoo' Carikli
11 11 Denis 'GNUtoo' Carikli
Currently, Replicant uses device specific Hardware Abstraction Layers, because device manufacturers implemented non-standard kernel interfaces. However, Android works with upstream kernels and supports plug-n-play hardware nowadays, so it makes sense to have generic Hardware Abstraction Layers for the standard interfaces of the Linux kernel (ALSA, V4L2, etc).
12 2 Denis 'GNUtoo' Carikli
13
Benefits:
14
* It would allow supporting external WiFi dongles such as the ones supported by the ath9k_htc driver and free firmwares without the need for a specific application or configuration.
15 46 Denis 'GNUtoo' Carikli
* It would make devices last longer by alleviating the device specific maintenance burden: If LineageOS stops supporting a Replicant supported device, Replicant would need to maintain it by its own. This would require a lot of work, unless the device is already supported the upstream Linux kernel and generic hardware abstractions layers. This would also enable Replicant to support devices that are not currently supported by LineageOS with a lot less work.
16 11 Denis 'GNUtoo' Carikli
* It would enable the support for devices that are or will be added to upstream Linux.
17 2 Denis 'GNUtoo' Carikli
18 22 Denis 'GNUtoo' Carikli
As GNU/Linux expects standard kernel interfaces, this would also enable to run GNU/Linux out of the box on such devices.
19
This has some interesting outcomes:
20 46 Denis 'GNUtoo' Carikli
* The device specific work could be shared between GNU/Linux communities and Replicant communities. This could result in less work to do to support individual devices. Since Android libraries depends on Android's libc, non-standard proprietary libraries might be harder to reuse than the free software implementations, so we might get even more collaboration thanks to that.
21
* It would enable GNU/Linux distributions to more easily support smartphones and tablets, which would hopefully enable FSDG distributions to be able to focus on usability instead of hardware support. This way, if one day Android devices stop using the Linux kernel, stops being free software, or if the code takes directions that are too much problematic, already having GNU/Linux based Android alternatives would reduce the amount of work needed to be able to get again a fully free software distribution for smartphones and tablets.
22 23 Denis 'GNUtoo' Carikli
* Older devices with less amount of RAM than Replicant current minimum requirements could be used with GNU/Linux and possibly repurposed for other usages, reducing the amount of electronic devices waste.
23 22 Denis 'GNUtoo' Carikli
24 2 Denis 'GNUtoo' Carikli
h2. Requirements
25
26 11 Denis 'GNUtoo' Carikli
* For the other standard interfaces (like ASLA, etc) a device running a upstream Linux Kenrel with as few patches as possible is required.
27 2 Denis 'GNUtoo' Carikli
28 4 Denis 'GNUtoo' Carikli
h2. Devices
29
30 5 Denis 'GNUtoo' Carikli
It is best to use a device that requires the least amount of work to be functional under Replicant.
31
More precisely we want to minimize:
32 11 Denis 'GNUtoo' Carikli
* The work needed to have the device usable with upstream Linux.
33 5 Denis 'GNUtoo' Carikli
* The work porting or writing Android hardware abstractions layers.
34
35
To achieve that we can choose a device that:
36
* requires no or very minimal work to be fully supported by Linux.
37
* have less hardware features (so we don't need to support them in Linux and in the HALs).
38
* is easy to buy, so the work can be shared among multiple people.
39 53 Denis 'GNUtoo' Carikli
* doesn't have more freedom flaws than the devices currently supported by Replicant
40 5 Denis 'GNUtoo' Carikli
41 54 Denis 'GNUtoo' Carikli
It is also a good idea to keep one image per device at first, as trying to make a single image that
42 55 Denis 'GNUtoo' Carikli
would work on all ARM device supported by upstream Linux is complicated: Even GNU/Linux
43
distributions have a hard time doing that for ARM devices.
44 6 Denis 'GNUtoo' Carikli
45 58 Denis 'GNUtoo' Carikli
h2. Linux upstream status
46
47 363 Denis 'GNUtoo' Carikli
In some cases, even if the upstream status looks good, nonfree bootlaoders can get in the way. We have a list of stock bootloaders incompatible with upstream Linux in this page: [[BootloadersIncompatibleWithLinux]].
48
49 400 Denis 'GNUtoo' Carikli
See "LinuxSupportedDevices":https://redmine.replicant.us/projects/upstreaming/wiki/LinuxSupportedDevices in the upstreaming sub project for the upstream status for various devices.
50 78 Denis 'GNUtoo' Carikli
51 134 Denis 'GNUtoo' Carikli
h1. Bootloaders
52 1 Denis 'GNUtoo' Carikli
53
h2. Bootloader status
54
55
|_. Formfactor |_. Vendor |_. Product  |_. signatures |_. Source code |_. u-boot status |_. Verdict |
56 257 Kurtis Hanna
|/6.Smartphone |/6.Samsung | Galaxy S - i9000  | The bootloader is probably signed | "downstream u-boot":https://github.com/xc-racer99/u-boot-galaxys4g/ | * u-boot mainline was placed in BL2, copying much of the bootloader work done on the i9300 and n7100
57 246 Denis 'GNUtoo' Carikli
* That u-boot also supports being installed in place of the Linux kernel, leaving the stock bootloader in place | * Probably signed
58
* The port to run instead of the Linux kernel seem interesting as it could be used on "midas" to disable the MMU and caches |
59 359 Kurtis Hanna
| "Galaxy S 2 - I9100":https://redmine.replicant.us/projects/replicant/wiki/GalaxyS2I9100 | Signed, see "emulating-exynos-4210-bootrom-in-qemu.html":https://fredericb.info/2018/03/emulating-exynos-4210-bootrom-in-qemu.html | downstream u-boot:
60 351 Denis 'GNUtoo' Carikli
* "Sekilsgs2/i9100-uboot":https://github.com/Sekilsgs2/i9100-uboot
61 1 Denis 'GNUtoo' Carikli
* "Talustus/i9100-uboot":https://github.com/Talustus/i9100-uboot
62 359 Kurtis Hanna
* "onny/i9100-uboot":https://git.project-insanity.org/onny/uboot-i9100
63
* "TALUAtGitHub/i9100-uboot":https://github.com/TALUAtGitHub/i9100-uboot
64 353 Denis 'GNUtoo' Carikli
* "uboot-bootloader-true-multiboot-t1680898":https://forum.xda-developers.com/galaxy-s2/general/uboot-bootloader-true-multiboot-t1680898
65 350 Denis 'GNUtoo' Carikli
upstream u-boot for devices with same SoC: "origen":https://gitlab.denx.de/u-boot/u-boot/blob/master/configs/origen_defconfig "smdkv310":https://gitlab.denx.de/u-boot/u-boot/blob/master/configs/smdkv310_defconfig "s5pc210":https://gitlab.denx.de/u-boot/u-boot/blob/master/configs/s5pc210_universal_defconfig "trats":https://gitlab.denx.de/u-boot/u-boot/blob/master/configs/trats_defconfig | * "xda post about i9100-uboot":https://forum.xda-developers.com/galaxy-s2/general/uboot-bootloader-true-multiboot-t1680898 
66 352 Denis 'GNUtoo' Carikli
* How do the downstream u-boot boot (After BL1? As kernel?)
67 334 Kurtis Hanna
* Are there other u-boots? (look on common git hosting providers) | ? |
68 253 Kurtis Hanna
| "Galaxy SIII - I9300":https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9300 |/7. * The first stage is signed.
69 1 Denis 'GNUtoo' Carikli
* The stock first stage checks the second stage signatures.
70 338 Kurtis Hanna
* A signed first stage that doesn't enforce subsequent signatures exists but it's nonfree and non-redistributable|/4. "downstream u-boot for the second stage":https://github.com/fourkbomb/u-boot. This was "submitted upstream":http://u-boot.10912.n7.nabble.com/PATCH-0-7-Exynos4412-SPL-support-td341181.html but it broke the "Odroid U3":https://gitlab.denx.de/u-boot/u-boot/blob/master/configs/odroid_defconfig, so the code was probably not merged because of that.
71
* TODO: Make sure it works on the "Odroid U3":https://gitlab.denx.de/u-boot/u-boot/blob/master/configs/odroid_defconfig and resubmit upstream |/4. * That u-boot version is meant to be used in combination with a nonfree and non-redistributable first stage bootloader.
72 278 Kurtis Hanna
* This combination doesn't load the nonfree TrustZone OS
73 253 Kurtis Hanna
* Replicant 9 can run on devices with this bootloader, but the current Replicant 6 kernel expects a TrustZone OS to work. |/7. * We need to find a way to completely replace the first bootloader stage (BL1) as the one that is used to run u-boot is nonfree and non-redistributable. 
74 245 Denis 'GNUtoo' Carikli
* More details on that issue can be found in the [[Exynos4_Bootrom]] wiki page. |
75 253 Kurtis Hanna
| "Galaxy SIII 4G - I9305":https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9305 |
76
| "Galaxy Note 2 - N7100":https://redmine.replicant.us/projects/replicant/wiki/GalaxyNote2N7100 |
77 285 Kurtis Hanna
| "Galaxy Note 2 4G - N7105":https://redmine.replicant.us/projects/replicant/wiki/GalaxyNote2N7105 |
78 361 Kurtis Hanna
|/2.Tablet |/2.Samsung | "Galaxy Note 8.0 - N51XX":https://redmine.replicant.us/projects/replicant/wiki/GalaxyNote80N51xx | ? |/2. Has the same System On a Chip (SOC) as the Galaxy SIII and Note 2, the Exynos4412, but slightly modified u-boot might need to be written. Testing needed. |
79
| "Galaxy Note 10.1 - N8000":https://redmine.replicant.us/issues/1946 | "SD Card Boot Touch Point":http://forum.gsmhosting.com/vbb/f609/need-sdc-boot-tp-n8000-1921507/ |
80 272 Kurtis Hanna
| Camera | Samsung | "Galaxy Camera 2 - EK-GC200":https://en.wikipedia.org/wiki/Samsung_Galaxy_Camera_2 | ? | "First Exynos4412 Samsung device to get u-boot support":https://www.xda-developers.com/samsung-galaxy-camera-gets-open-source-bootloader/ in 2012 |
81 254 Kurtis Hanna
| Smartphone | Google and Samsung | "Galaxy Nexus - I9250":https://redmine.replicant.us/projects/replicant/wiki/GalaxyNexusI9250 | | "downstream u-boot for the second stage":http://ksyslabs.org/ukernels/gnex_uboot/ | |
82 231 Kurtis Hanna
| Smartphone | LG | "Optimus Black":https://redmine.replicant.us/projects/replicant/wiki/OptimusBlack |/5. unsigned | "upstream u-boot":https://git.denx.de/?p=u-boot.git;a=blob;f=configs/sniper_defconfig | no display(no driver), very few peripherals but enough to be usable | |
83 138 Denis 'GNUtoo' Carikli
| Tablet | Amazon | Kindle Fire (first generation) | "upstream u-boot":https://git.denx.de/?p=u-boot.git;a=blob;f=configs/kc1_defconfig | | |
84 139 Denis 'GNUtoo' Carikli
|/3. Smartphone |/3. | GTA04 A3 |/3. "downstream u-boot and xloader":http://projects.goldelico.com/p/gta04-uboot/  |/3. |/3. |
85 137 Denis 'GNUtoo' Carikli
| GTA04 A4 |
86
| GTA04 A5 |
87 345 Denis 'GNUtoo' Carikli
| Smartphone | Nokia | N900 | The bootloader is signed | "Upstream u-boot":https://gitlab.denx.de/u-boot/u-boot/raw/master/configs/nokia_rx51_defconfig | * Xloader which is the first stage bootloader is signed and loads a nonfree second stage bootloader which is called NOLO. | * The upstream u-boot is to be installed in the kenrel partition and runs instead of Linux. A similar implementation could also be used on midas to disable caches and the MMU and have generic images |
88 121 Denis 'GNUtoo' Carikli
89 1 Denis 'GNUtoo' Carikli
h2. See also
90
91
* [[Google Summer of Code 2018]]
92 12 Denis 'GNUtoo' Carikli
93 379 Denis 'GNUtoo' Carikli
h1. GNU/Linux components
94 19 Denis 'GNUtoo' Carikli
95 182 Denis 'GNUtoo' Carikli
h2. Modem support
96 1 Denis 'GNUtoo' Carikli
97 183 Denis 'GNUtoo' Carikli
|_. Protocols |_. Implmentation |_. comments |
98 190 Denis 'GNUtoo' Carikli
| QMI | Android <-> RIL <-> libqmi-ril to be completed <-> libqmi | |
99 184 Denis 'GNUtoo' Carikli
|/2. * QMI
100 1 Denis 'GNUtoo' Carikli
* AT
101 190 Denis 'GNUtoo' Carikli
* Other | Android <-> RIL <-> libraries to be written | 
102 226 Denis 'GNUtoo' Carikli
| "android_frameworks_opt_telephony_ril_ofono":https://github.com/scintill/android_frameworks_opt_telephony_ril_ofono + ofono + ofono backend (AT, QMI, etc) | * Using ofono would enable us to share more effort with upstream GNU/Linux and support many other protocol like AT for the GTA04 or qmi-ril for the Galaxy SIII 4G (I9305) or the Galaxy Note II 4G (N7105)
103 228 Denis 'GNUtoo' Carikli
* According to the "README":https://github.com/scintill/android_frameworks_opt_telephony_ril_ofono/blob/master/README.md, it has already been tested with most of Replicant 6 code but on a smartphones not yet supported by Replicant. Calls, Audio, SMS, etc are knwon to work.
104 281 Kurtis Hanna
* "BuildRilWrapper.java":https://github.com/scintill/android_frameworks_opt_telephony_ril_ofono/blob/master/build/java/net/scintill/ril_ofono/BuildRilWrapper.java seems to use introspection to automatically generate the API between the Framework Java RIL and itself (which replaces rild) (See the "official documentation":https://source.android.com/devices/tech/connect/ril for background information on the Android architecture)
105 282 Kurtis Hanna
* Replicant and oFono based Java RIL "video presentation":https://redmine.replicant.us/projects/replicant/wiki/ContributorsMeetingJuly2019#Presentations |
106 198 Denis 'GNUtoo' Carikli
|/5. samsung-ipc | Ofono (rilmodem backend/driver) <-> rild <-> libsamsung-ril <-> libsamsung-ipc | * Might be usable for GNU/Linux distributions with "libhybris":https://en.wikipedia.org/wiki/Hybris_%28software%29
107 1 Denis 'GNUtoo' Carikli
* Could be usable for testing Replicant as ofono could run on the host computer and the rild socket could be exported with adb
108 197 Denis 'GNUtoo' Carikli
* Some forks exist: check if they still have interesting patches
109 281 Kurtis Hanna
* https://github.com/rilmodem/ofono|
110 347 Denis 'GNUtoo' Carikli
| Android <-> rild <-> libsamsung-ril <-> libsamsung-ipc | * Currently in use in Replicant
111
* Well integrated with Android
112
* Potentially usable by other distributions
113
* No known way to support different modems protocols in the same Replicant image with that |
114 189 Denis 'GNUtoo' Carikli
| Android <-> Ofono <-> libsamsung-ipc | * "An ofono fork with libsamsung-ipc support is available":https://github.com/fourkbomb/ofono
115 346 Denis 'GNUtoo' Carikli
"Patches":https://lists.ofono.org/pipermail/ofono/2012-September/013777.html to add that upstream were "refused":https://lists.ofono.org/pipermail/ofono/2012-September/013778.html because upstream didn't want to make the project become GPLv3 (libsamsung-ipc was GPLv3 at the time) but now libsamsung-ipc has been relicensed to GPLv2+
116
* Could be used to have generic a Replicant image supporting many devices with very different modems protocols (like libsamsung-ipc or QMI based ones) and have ofono do the modem detection |
117 185 Denis 'GNUtoo' Carikli
|
118 197 Denis 'GNUtoo' Carikli
| FSO <-> libsamsung-ipc | * Probably not easily usable in Replicant
119 194 Denis 'GNUtoo' Carikli
* Is FSO still actively maintained?
120 193 Denis 'GNUtoo' Carikli
* Was used by SHR and potentially other GNU/Linux distributions supporting the Openmoko GTA04 smartphones |
121 182 Denis 'GNUtoo' Carikli
122
h2. Upstream userspace hardware support libraries
123
124
|_. Usage |_. Replicant |_. GNU/Linux |_. comments |
125
| Bluetooth stack | BlueDroid | Bluez | |
126
| GPS hardware support | ? | gpsd | |
127
128 16 Denis 'GNUtoo' Carikli
129 20 Denis 'GNUtoo' Carikli
h2. Upstream non-hardware specific userspace
130 18 Denis 'GNUtoo' Carikli
131
|_. Usage |_. Replicant |_. GNU/Linux |_. comments |
132 151 Denis 'GNUtoo' Carikli
| Unix command line tools | ? | * Busybox
133
* Coreutils | * Busybox already has Android specific code in it but no Android.mk 
134
* Busybox build is very similar to Linux, and Linux can be built by Android |
135 44 Denis 'GNUtoo' Carikli
136 354 Denis 'GNUtoo' Carikli
h2. MTP
137
138 355 Denis 'GNUtoo' Carikli
TODO: 
139
* look at https://github.com/viveris/uMTP-Responder to see if it can be integrated in Android. It is known to work with the upstream kernel.
140
* Also compare with other implementation, including the Android one.
141 354 Denis 'GNUtoo' Carikli
142 229 Denis 'GNUtoo' Carikli
h2. libc
143
144
|_. Feature |_. Advantages |_. Disadvantages |_. sustainability |
145
| glibc + libhybris | * You just need an Android.mk to compile GNU/Linux software | * You need to link the Android part that need bionic functions to libhybris | TODO: Evaluate how close to bionic is libhybris |
146
| bionic | Android default | * You spend lot of time trying to run GNU/Linux debug tools like evtest on Android:
147
* Parabola cannot be used on old kenrels (FATAL: kernel too old)
148
* GuiX and libreCMC might not have the package and might need tweaking to be recompiled with an old glibc and kernel headers
149
* TODO: try crosstool-ng
150 230 Denis 'GNUtoo' Carikli
* Most of the other GNU/Linux distributions are not FSDG compliant or do not support ARM
151
* The software might not work on Android due to missing bionic functions like versionsort(...) |
152 229 Denis 'GNUtoo' Carikli
153 44 Denis 'GNUtoo' Carikli
h2. Other projects interested in using upstream Linux and/or contributing to it
154
155 339 Kurtis Hanna
h3. PostmarketOS
156
"pmOS wiki: upstream kernel":https://wiki.postmarketos.org/wiki/The_Mainline_Kernel
157
"pmOS wiki: i9305 with upstream kernel":https://wiki.postmarketos.org/wiki/Samsung_Galaxy_SIII_LTE_(samsung-i9305)#Mainline_Kernel
158
159 340 Kurtis Hanna
h3. O-DROID
160
161
h3. osmocomBB
162
163
h3. Mali
164
165
h3. LineageOS
166
167
h3. oFono
168
169
h3. Parabola
170 116 Denis 'GNUtoo' Carikli
171 380 Denis 'GNUtoo' Carikli
h1. GNU/Linux distributions
172 318 Denis 'GNUtoo' Carikli
173 320 Denis 'GNUtoo' Carikli
h2. Halium
174
175 318 Denis 'GNUtoo' Carikli
Some GNU/Linux distributions like Plasma Mobile, LuneOS, Ubuntu Touch use libhybris through the "Halium project":https://halium.org/ to reuse proprietary Android libraries
176 1 Denis 'GNUtoo' Carikli
177 323 Denis 'GNUtoo' Carikli
h2. Mer
178
179 324 Denis 'GNUtoo' Carikli
* Mer uses ofono for handling the modem
180
* For OpenGL it's not clear if they use nonfree drivers. It would be worth looking into it. Their stack seem to be able to use free implementations as well as nonfree implementations.
181 323 Denis 'GNUtoo' Carikli
182
See the "Mer architecture":https://wiki.merproject.org/wiki/Architecture for more details.
183
184 320 Denis 'GNUtoo' Carikli
h2. PostmarketOS
185
186 322 Denis 'GNUtoo' Carikli
"PostmaketOS":https://postmarketos.org/ is probably not using libhybris at all and is instead working with upstream and probably doesn't depend on nonfree libraries
187 320 Denis 'GNUtoo' Carikli
188
h2. Replicant strategies
189
190 381 Denis 'GNUtoo' Carikli
Replicant is currently involved with upstream GNU/Linux, but it would probably be a good idea to collaborate more with  distributions that don't depend on libhybris.
191 318 Denis 'GNUtoo' Carikli
192 378 Denis 'GNUtoo' Carikli
h1. Android distributions
193 1 Denis 'GNUtoo' Carikli
194 384 Denis 'GNUtoo' Carikli
h2. AOSP
195
196
AOSP doesn't support many devices, but it seem to support some devboards. 
197
198
The advantage is that in general devboards are well supported by upstream kernels.
199
200 385 Denis 'GNUtoo' Carikli
Supported devboards[1]?:
201 384 Denis 'GNUtoo' Carikli
| Devboard | Freedom issues | Comments |
202
| Beagleboard-X15 | No free GPU driver | Well supported by GNU/Linux, free bootloader |
203
| Cuttlefish emulator | ? | ? |
204 1 Denis 'GNUtoo' Carikli
| Other | ? | ? |
205 385 Denis 'GNUtoo' Carikli
206
The official documentation also "mentions some devboards":https://source.android.com/setup/build/devices .
207 384 Denis 'GNUtoo' Carikli
208
fn1. Some of the devboards in this page are probably supported: https://wiki.linaro.org/AOSP#AOSP_Dev_Board_Reference_Information
209
210 150 Denis 'GNUtoo' Carikli
h2. LineageOS
211 141 Denis 'GNUtoo' Carikli
212 327 Denis 'GNUtoo' Carikli
See "device-support-requirements.md":https://github.com/LineageOS/charter/blob/master/device-support-requirements.md for more information on LineageOS expectations.
213 120 Denis 'GNUtoo' Carikli
214 327 Denis 'GNUtoo' Carikli
Replicant has "a script":https://git.replicant.us/replicant/vendor_replicant-scripts/tree/research that is able to parse the "LineageOS wiki data":https://github.com/LineageOS/lineage_wiki . That can be useful to find information on devices supported by LineageOS.
215 326 Denis 'GNUtoo' Carikli
216 325 Denis 'GNUtoo' Carikli
The "devices supported by LineageOS 16":https://wiki.lineageos.org/devices/ have either:
217
* A Qualcomm SOC with an integrated modem inside (MSM*) for many devices
218
* A Qualcomm SOC without a modem inside (APQ*) for many devices
219 1 Denis 'GNUtoo' Carikli
* A HiSilicon Kirin 970 SOCs for devices like:
220 326 Denis 'GNUtoo' Carikli
** The "Huawei Honor View 10":https://wiki.lineageos.org/devices/berkeley
221 325 Denis 'GNUtoo' Carikli
** The "Huawei P20 Pro":https://wiki.lineageos.org/devices/charlotte
222
* A Samsung Exynos 7580 SOC for the following device
223 328 Denis 'GNUtoo' Carikli
** "Galaxy S5 Neo":https://wiki.lineageos.org/devices/s5neolte (Smartphone): It has shared memory between the modem and the SOC
224 120 Denis 'GNUtoo' Carikli
225 1 Denis 'GNUtoo' Carikli
It may be because they rely on nonfree software to support devices, which has not been ported to Android 9, or may be because they need more time to add devices with other SOCs like exynos.
226 141 Denis 'GNUtoo' Carikli
227 388 Denis 'GNUtoo' Carikli
h2. CustomROMs
228
229
CustomROMs seem to be a space for unofficial port of LineageOS. The idea is probably to develop the port until they manage to meet LineageOS's "device-support-requirements.md":https://github.com/LineageOS/charter/blob/master/device-support-requirements.md . When the requirements are met, they are probably included in LineageOS directly.
230
231
Interesting ports:
232
* The Galaxy SIII (GT-I9300) is being ported to more recent LineageOS versions. There is "a thread on the collaboration with Replicant":https://github.com/CustomROMs/android_local_manifests_i9300/issues/1 in github. The person/people doing the port seem to alternate between an upstream kernel and a older kernel based on the vendor code depending on the amount of work required to finish the port and/or the difficulties encountered. As we are also using a kernel based on upstream Linux we collaborate on that part by reusing each other work when applicable.
233
234 374 Denis 'GNUtoo' Carikli
h2. DivestOS Mobile
235
236
This distribution is based on LineageOS. While they seem to reuse nonfree software to make the hardware work, they spent some time cleaning up LineageOS code itself.
237
238
For instance it contains patches to remove privacy issues and nonfree software included in CyanogenMod or LineageOS.
239
240 375 Denis 'GNUtoo' Carikli
As we need to do that too in Replicant as long as we use LineageOS as base, it would be interesting to collaborate more with DivestOS on that part.
241
242 374 Denis 'GNUtoo' Carikli
Web site:
243
*https*: https://divestos.org/
244
*Onion*: http://6sdlxbqgcxdbkvysoir2qvqqs5ro3fxgyl3phvuphcdyklv7rg57jhid.onion
245
246 376 Denis 'GNUtoo' Carikli
h2. Fairphone
247
248
As October 2020, they are porting the Fairphone 2 to Android 9. However to do that, they are using 3.4 kernel and not any upstream kernels.
249
250
In addition, they don't seem very interested in free software bootloaders, and the Fiarphone 1 and 2 use Qualcomm System On a Chip.
251
252
However they are probably interested in free software libraries to make the port to newer Android versions easier.
253
254 382 Denis 'GNUtoo' Carikli
h2. Android x86
255
256
At the time of writing, the most recent images are RC images for Android 9, but there are branches for Android 10.
257
258
As they use (mostly?) upstream kernels, they sometimes have interesting code.
259
260
*Source code*: https://git.osdn.net/view?a=project_list;pf=android-x86
261 383 Denis 'GNUtoo' Carikli
*Manifest*: git://git.osdn.net/gitroot/android-x86/manifest.git
262 382 Denis 'GNUtoo' Carikli
263
Branches[1]: 
264
265
| Branch | Android version |
266
| q-x86 | 10.0 |
267
| pie-x86 | 9.0 |
268
| oreo-x86 | 8.1 |
269
| nougat-x86 | 7.1 |
270
| marshmallow-x86 | 6.0 |
271
| lollipop-x86 | 5.1 |
272
| kitkat-x86 | 4.4 |
273
| jb-x86 | 4.3 |
274
| ics-x86 | 4.0 |
275
| honeycomb-x86 | 3.2 |
276
| gingerbread-x86 | 2.3 |
277
| froyo-x86 | 2.2 |
278
| eclair-x86 | 2.1 |
279
| donut-x86 | 1.6 |
280
| cupcake-x86 | 1.5 |
281
 
282
fn1. https://www.android-x86.org/source.html
283
284 150 Denis 'GNUtoo' Carikli
h2. AOSP and LineageOS
285 141 Denis 'GNUtoo' Carikli
286
| Feature | AOSP | LineageOS |
287
| Code quality | Better than LineageOS | |
288 142 Denis 'GNUtoo' Carikli
| Documentation | Better than LineageOS | |
289 141 Denis 'GNUtoo' Carikli
| root | Not sure if supported or not | Supported |
290 200 Denis 'GNUtoo' Carikli
| Minor release versioning | supported with Git tags | Not supported.
291 202 Denis 'GNUtoo' Carikli
For instance frameworks/native has no LineageOS tags (only cm-1x tags) and has no other branch for lineage OS 16.0 than the lineage-16.0 branch, as the other branches name are for other things. This was confirmed after running 'git fetch github' in frameworks/native to fetch the other branches that are not fetched by repo by default.
292 200 Denis 'GNUtoo' Carikli
Despite that, some code was even merged in after the lineage-16.0 release:
293
<pre>
294
commit 22abc3cf4077644463a2dc1c59a5a74e9518ea16
295
Merge: 9e96d54 8a6b6c3
296
Date:   Sat Jul 13 18:57:45 2019 +0200
297
298
    Merge remote-tracking branch 'aosp/pie-gsi' into lineage-16.0-pie-gsi
299
</pre> |
300 141 Denis 'GNUtoo' Carikli
| GUI features for developers
301
* Advanced reboot | ? | Supported |
302 386 Denis 'GNUtoo' Carikli
| Integrated kernel builds | Unsupported | Supported | 
303 155 Denis 'GNUtoo' Carikli
304 306 Denis 'GNUtoo' Carikli
h2. Building a collaboration with other Android distributions
305
306
Given that:
307
* Replicant doesn't want to support devices that have more freedom issues than the ones currently supported.
308
* Many other Android distributions probably don't the same goals with the freedom of the devices they support.
309
* Replicant 9 is based on upstream Linux and will have to maintain its userspace libraries.
310
* Some users may still want to support devices that have more freedom issues than the ones supported by Replicant.
311
312
It could be a good idea to share the maintenance of the code used to make Replicant 9 with other distributions.
313
314 155 Denis 'GNUtoo' Carikli
h2. Design decisions
315
316 256 Kurtis Hanna
Some decisions have been taken by upstream projects, for instance the the Android Open Source Project (AOSP) is pushing device manufacturers to use "signed bootloaders":https://source.android.com/security/verifiedboot/device-state#root-of-trust and not give the users the ability to replace those bootloaders. Therefor it is best to revisit such decisions and decide whether or not to implement a given feature.
317 1 Denis 'GNUtoo' Carikli
318 210 Denis 'GNUtoo' Carikli
h3. Various
319
320 1 Denis 'GNUtoo' Carikli
| Feature | Advantages | Disadvantages |
321
| adb and root at boot | Easier to debug:
322
* We get the logs at boot
323
* May be able to diagnose non-booting devices (partition not mountable, etc) | Way less secure:
324
* Vulnerable to "Juice_Jacking":https://en.wikipedia.org/wiki/
325
* Vulnerable to an attacker that just connect an usb cable to a running phone
326
* Breaks the user's expectation of security (lock screen etc) |
327 210 Denis 'GNUtoo' Carikli
328 377 Denis 'GNUtoo' Carikli
We can get both: we can enable users to get logs at boot while avoiding any security issues. 
329
330
To do that we can keep disable adb and root disabled at boot, and enable users to add it back by editing the boot.img or recovery images. We have a tutorial for that in the [[AddingADBRootToAnImage]] page and we are working on script to automate it even more.
331
332 210 Denis 'GNUtoo' Carikli
h3. root filesystem related
333
334
|_. Feature |_. Advantages |_. Disadvantages |_. sustainability |
335
| System as root | * The kernel size can be bigger
336
* You have to hardcode the root partition in the cmdline or use PARTLABEL which might be a security issue: if a microSD has a partition named SYSTEM, the kernel may boot on it instead | having an initramfs adds some flexibility:
337
* Selecting partitions can potentially be more  flexible | |
338
| System as root + dm-verity + "dm-init":https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/device-mapper/dm-init.txt | * The kernel size can be bigger
339
* The partition selection is flexible and secure  | | |
340
| read-only /system | * more secure and more easily understandable by users and developers | * need to ship in replicant user-scripts or add them to vendor/ | |
341 160 Denis 'GNUtoo' Carikli
342
h3. Gatekeeper HAL backend
343
344 209 Denis 'GNUtoo' Carikli
*Background information*: Gatekeeper is a daemon that is used to store passwords and other secrets.
345
346 1 Denis 'GNUtoo' Carikli
| Backend used | Advantages | Disadvantages |
347 161 Denis 'GNUtoo' Carikli
| simple userspace implementation | * Fast to do
348 213 Denis 'GNUtoo' Carikli
* Simple to understand 
349
* Good enough for most use cases| |
350 164 Denis 'GNUtoo' Carikli
| kernel keyring (man 7 keyrings) | * Secure
351 294 Kurtis Hanna
* The Linux kernel is well known and updated regularly
352 215 Denis 'GNUtoo' Carikli
* Some users are already used to the userspace/kernel security model
353
* Probably fun to implement, can learn how t implement Android daemons and how to use the keyring along the way |
354 1 Denis 'GNUtoo' Carikli
| Free software Trusted Execution Environment (TEE) | * Android does it | * Require access to TrustZone, which doesn't work for all SOCs
355 294 Kurtis Hanna
* Unfamiliar to users and developers (it's supposed to tick in suspend, knowledge about TrustZone is less spread than Linux, etc)
356 214 Denis 'GNUtoo' Carikli
* Probably requires to port a TrustZone OS to every SOC or phone 
357 294 Kurtis Hanna
* The Linux kernel is well known and updated regularly |
358 165 Denis 'GNUtoo' Carikli
| Proprietary software Trusted Execution Environment (TEE) | None: we really want to get rid of it if possible | 
359 160 Denis 'GNUtoo' Carikli
Cannot be trusted:
360
* Not free software
361
* Not under the user control |
362 203 Denis 'GNUtoo' Carikli
363
h3. Handling dynamic major/minor /dev/ nodes
364
365 219 Denis 'GNUtoo' Carikli
*Background information*: We can manage to avoid this use case for now.
366 207 Denis 'GNUtoo' Carikli
367 203 Denis 'GNUtoo' Carikli
| Backend used | Advantages | Disadvantages | sustainability |
368 205 Denis 'GNUtoo' Carikli
| Android default + Upstream Linux | | * does not work by default, probably impossible to make it work as-is |
369 204 Denis 'GNUtoo' Carikli
| Android default + Upstream Linux + very dirty userspace scripts | * Minimal changes | * Not robust
370
* Might eat up resources
371
* Already implemented cleanly in mdev | |
372
| Android default + hacked drivers to use fixed major/minor | * Minimal changes in Linux
373
* No changes required on Android side | * Require to change userspace software (libsamsung-ipc) | * Not upstreamable in Linux |
374 294 Kurtis Hanna
| devtmpfs + hacked Android init | * Minimal changes if upstreamed
375
* Init is hard to debug | * Complex to do as debugging at this stage is complicated | * Need to be upstreamed in Android |
376 1 Denis 'GNUtoo' Carikli
| Stock Andrdroid init + mdev (busybox) | * Bad integration in the Android build system | * Changes are minimal | * Android build system integration need to be upstreamed or maintained |
377 219 Denis 'GNUtoo' Carikli
378
h3. Firmware loading
379
380
| Backend used | Advantages | Disadvantages | sustainability |
381
| system/core/init/firmware_handler.cpp | * Stock Android implementation | None | Already upstream in Android |
382
| Something else | None | The stock Android implementation is good enough and firmware loading is trivial anyway | Not upstream in Android |
383 220 Denis 'GNUtoo' Carikli
384 305 dl lud
h3. Embeddable web engine
385 296 Denis 'GNUtoo' Carikli
386 299 dl lud
The Android API for embedding a web engine is WebView.
387 1 Denis 'GNUtoo' Carikli
388
| Project | Comments |
389 305 dl lud
| "AOSP WebView API implemented with Chromium":https://developer.android.com/reference/android/webkit/WebView | * Built from Chromium compiled for WebView
390 1 Denis 'GNUtoo' Carikli
* Latest additions to the API seem more and more tied to Chromium (e.g. getWebViewRenderProcess, getWebChromeClient) | 
391 305 dl lud
| Old AOSP WebView API implemented with WebKit | * Not used anymore, since Android 4.4
392
* Does not implement the current WebView API |
393 299 dl lud
| "GeckoView":https://mozilla.github.io/geckoview/ | * Not the same API as WebView 
394
* Could be used to implement WebView
395
* Would need to be modified to expose more features from Gecko (e.g. zoom) while others are straightforward |
396 300 dl lud
| "Qt WebEngine":https://doc.qt.io/qt-5/qtwebengine-index.html | * Not the same API (C++ instead of Java)
397 299 dl lud
* Probably the smallest subset of Chromium available |
398 304 Denis 'GNUtoo' Carikli
| "Wine Internet Explorer implementation":https://wiki.winehq.org/Gecko | * Uses Gecko under the hood
399 296 Denis 'GNUtoo' Carikli
* Might be interesting to look at how they did it |
400
401 312 Denis 'GNUtoo' Carikli
h1. Web engine backend
402 296 Denis 'GNUtoo' Carikli
403 313 Denis 'GNUtoo' Carikli
We have an issue with webview (bug #1780):
404
* Using a recent webview based on chromium would create freedom issues as we don't know the license of chromium
405
* Using and old webview based on webkit would bring back many security issues
406
407
To solve that we need to find a solution that depends on a good upstream as we are not going to write a web browser engine ourselves.
408
409 314 Denis 'GNUtoo' Carikli
h2. Upstream web browser engine comparison
410
411
This lists upstream projects that are not forks tracking another upstream project.
412 313 Denis 'GNUtoo' Carikli
413 298 Denis 'GNUtoo' Carikli
| Project | Comments |
414 296 Denis 'GNUtoo' Carikli
| Gecko | * Clear licensing
415 315 Denis 'GNUtoo' Carikli
* Friendly upstream: The tor-browser project works with Mozilla to upstream privacy features in Firefox. So we could probably work with them as well too. |
416 1 Denis 'GNUtoo' Carikli
| Chromium | * Unclear licensing 
417 315 Denis 'GNUtoo' Carikli
* Google has goals for Chromium that are directly opposed to our goals (tracking, linked to google)
418
* Probably unfriendly upstream because of the opposed goals |
419 1 Denis 'GNUtoo' Carikli
| Webkit | ? |
420 315 Denis 'GNUtoo' Carikli
421
h2. Forked web browser engine comparison
422
423
TODO: Add various chromium versions here.
424 220 Denis 'GNUtoo' Carikli
425 317 Denis 'GNUtoo' Carikli
h2. How and if to implement a webview compatible API
426
427
TODO
428
429 307 Denis 'GNUtoo' Carikli
h1. Tools and build systems
430
431
Replicant has an issue with licensing (bug #1973) where we don't know under which license is Replicant. This due to the fact that the Android build system doesn't use a package manager during the build, and so it doesn't have license definition for each repositories.
432
433
A good way to fix that and also gain the ability to natively build GNU/Linux components like MESA or ofono would be to use a build system that use a package during at least during the build.
434
435
Some other communities have issues that do or could also benefit from that:
436
* GNU/Linux distributions need to package Android tools which are built with the custom Android build system
437 309 Denis 'GNUtoo' Carikli
* Some distributions mixes GNU/Linux and Android
438 1 Denis 'GNUtoo' Carikli
439 310 Denis 'GNUtoo' Carikli
h2. Projects
440 308 Denis 'GNUtoo' Carikli
441 309 Denis 'GNUtoo' Carikli
|_. Project |_. use case |_. Comments |
442 396 Denis 'GNUtoo' Carikli
| Android | - Build images
443 395 Denis 'GNUtoo' Carikli
- Build the Android NDK and SDK
444 398 Denis 'GNUtoo' Carikli
- Build the Android tools | - Wrapping build systems (like autotools, cmake, etc) is way too primitive:
445 395 Denis 'GNUtoo' Carikli
-- In LineageOS (not AOSP) The kernel is wrapped with .mk files, but the downside is that it runs make inside Linux source each time it needs to compile something
446
-- In AOSP there is no infrastructure for building software with other build systems, still mesa is built in it, but not the kernel |
447 397 Denis 'GNUtoo' Carikli
| Archlinux | - Build and package Android tools(Fastboot, adb, etc) | - relies on a "fragile script":https://git.archlinux.org/svntogit/community.git/tree/android-tools/trunk/generate_build.rb
448 395 Denis 'GNUtoo' Carikli
- The package for Android tools is self contained and doesn't have its dependencies (like liblog, libcutils, etc) splited in other packages | 
449 392 Denis 'GNUtoo' Carikli
| Debian | | relies on "custom Makefiles":https://salsa.debian.org/android-tools-team/android-tools/tree/master/debian/makefiles |
450 395 Denis 'GNUtoo' Carikli
| [[GuixBuildSystem|Guix]] | - Build android tools 
451
                             - Build the android ndk | Findings:
452
                                                       - Guix uses "android-make-stub":https://github.com/daym/android-make-stub.git to wrap Android.mk 
453
                                                       - We have real packaging of dependencies, however not all dependencies are exported, most are though
454
                                                       - The Android build system is wrapper in a ndk-android-build-system function
455
                                                       - The package definition needs very light and straigtforward patching. See [[GuixBuildSystem|Guix]] for more details. |
456 309 Denis 'GNUtoo' Carikli
| "The GNU/Linux distribution of quectel-modems":https://osmocom.org/projects/quectel-modems | Mix an Android kernel with GNU/Linux userspace | |
457 316 Denis 'GNUtoo' Carikli
| "AsteroidOS":https://github.com/AsteroidOS/asteroid/blob/master/prepare-build.sh#L68 | Mix an Android kernel with GNU/Linux userspace | |
458 1 Denis 'GNUtoo' Carikli
| "openembedded-android":https://github.com/anguslees/openembedded-android | Build the Android NDK? | strongly outdated version of openembedded |