Project

General

Profile

DeprecatedPortingToAndroid9 » History » Version 7

Denis 'GNUtoo' Carikli, 03/23/2021 11:24 PM

1 1 dl lud
h1. Porting Replicant to Android 9
2
3 6 dl lud
This page contains old build instructions for Replicant 9. The source code is kept to do regression testing. Active development has moved into [[PortingToAndroid11|Replicant 11]].
4 1 dl lud
5 7 Denis 'GNUtoo' Carikli
h2. Precautions
6
7
See [[RunningReplicant11]] before installing Replicant 9 on your device to not break it.
8
9 1 dl lud
h2. LineageOS 16 (Android 9)
10
11
h3. Repositories and changes for LineageOS 16
12
13 4 dl lud
* https://git.replicant.us/contrib/replicant-next/kernel_replicant_linux
14
* https://git.replicant.us/contrib/replicant-next/external_mesa3d
15 2 dl lud
* https://git.replicant.us/contrib/GNUtoo/android_build
16 4 dl lud
* https://git.replicant.us/contrib/replicant-next/device_samsung_i9305
17
* https://git.replicant.us/contrib/replicant-next/manifest
18
* https://git.replicant.us/contrib/replicant-next/vendor_lineage
19 1 dl lud
20
h3. Building LineageOS 16 version
21
22
h4. Source code
23
24
<pre>
25 5 Denis 'GNUtoo' Carikli
$ repo init -u https://git.replicant.us/contrib/replicant-next/manifest.git -b replicant-9-dev
26 1 dl lud
$ repo sync
27
</pre>
28
29
Alternatively a shallow copy of the source tree can be fetched in order to save on disk space:
30
31
<pre>
32 5 Denis 'GNUtoo' Carikli
$ repo init -u https://git.replicant.us/replicant-next/manifest.git -b replicant-9-dev --depth=1
33 1 dl lud
$ repo sync -c
34
</pre>
35
36
To `unshallow` a specific module:
37
38
<pre>
39
$ cd path/to/module
40
$ git fetch --unshallow <remote>
41
</pre>
42
43
h4. For Trisquel 8
44
45
<pre>
46
sudo apt-get install bc bison build-essential bsdmainutils ccache curl flex g++-multilib gcc-multilib gettext git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop python-mako pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
47
sudo apt-get install gcc-5-arm-linux-gnueabi
48
</pre>
49
50
h4. Launching the build
51
52
Follow the "i9300 manifest instructions:":https://github.com/CustomRoms/android_local_manifests_i9300
53
<pre>
54
$ subject='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
55
$ mkdir .android-certs
56
$ for x in releasekey platform shared media testkey; do \
57
  ./development/tools/make_key .android-certs/$x "$subject"; \
58
  done
59
$ parallel_tasks=$(echo "$(grep 'processor' /proc/cpuinfo | wc -l ) + 1" | bc)
60
$ source build/envsetup.sh
61
$ lunch lineage_i9305-eng
62
$ make -j${parallel_tasks} bacon
63
</pre>
64
65
The images can then be flashed with heimdall. They are then in:
66
<pre>
67
  out/target/product/i9305/obj/PACKAGING/target_files_intermediates/lineage_i9305-target_files-eng.replicant/IMAGES/
68
</pre>
69
70
h4. Getting lastest changes
71
72
* The repositories are being constantly modified with git push --force as we are trying things out, and don't want to make the commits history look too dirty, so be sure to backup your local changes.
73
* Sometimes the manifest repository is also modified with git push --force. In that case the following commands will loose all the work you did locally but will make the repository consistent with upstream repositories again:
74
<pre>
75
$ rm -rf .repo/manifests/ # This enables me to force push and rebase the manifest repository as well
76 5 Denis 'GNUtoo' Carikli
$ repo init -u https://git.replicant.us/replicant-next/manifest.git -b replicant-9-dev
77 1 dl lud
$ repo sync --force-sync
78
</pre>
79
* The following command might also be necessary to make the state consistent with upstream repositories again, when the manifest history wasn't rewritten, but it will also loose all the work you did locally: 
80
<pre>
81
$ repo sync --force-sync
82
</pre>
83
84
h4. Install the images
85
86
<pre>
87
$ sudo heimdall flash --BOOT out/target/product/i9305/obj/PACKAGING/target_files_intermediates/lineage_i9305-target_files-eng.replicant/IMAGES/boot.img --USERDATA out/target/product/i9305/obj/PACKAGING/target_files_intermediates/lineage_i9305-target_files-eng.replicant/IMAGES/userdata.img --SYSTEM out/target/product/i9305/obj/PACKAGING/target_files_intermediates/lineage_i9305-target_files-eng.replicant/IMAGES/system.img 
88
</pre>
89
90
h4. Get adb
91
92
As the device IDs are the ones given by the Linux kernel, they are not in the adb udev rules, so for now it requires to run adb as root:
93
<pre>
94
$ sudo adb shell
95
* daemon not running; starting now at tcp:5037
96
* daemon started successfully
97
i9305:/ #                                 
98
$ sudo adb kill-server
99
$ adb shell
100
* daemon not running; starting now at tcp:5037
101
* daemon started successfully
102
error: no devices/emulators found
103
</pre>
104
So make sure to kill the adb-server and run it as root:
105
<pre>
106
$ adb kill-server
107
$ sudo adb shell
108
* daemon not running; starting now at tcp:5037
109
* daemon started successfully
110
i9305:/ # 
111
</pre>
112
113
h4. Booting
114
115
At some point during boot, the device goes into suspend, so you will need to press some buttons like the power or volume button to make the boot continue until the graphical interface.
116
117
You can also follow the boot progress with adb:
118
<pre>
119
adb logcat
120
adb logcat -b main
121
</pre>
122
123
Note that the device can go into suspend at any time, so adb might be interrupted. That looks like that:
124
First you get a shell
125
<pre>
126
$ sudo adb shell
127
i9305:/ #
128
</pre>
129
130
Then the connection is interrupted:
131
<pre>
132
$ adb shell
133
i9305:/ # [randomdev@fullyfreelaptop ]$                                                                                                     
134
</pre>
135
136
The effect with adb logcat is similar.
137
138
h3. Using SwiftShader instead of Mesa3D llvmpipe for software rendering
139
140
To use SwifShader you need a kernel that supports UDIV/SDIV emulation, you can checkout the branch GNUtoo/udiv-emulation for kernel/replicant/linux. After doing that that run the following commands to use SwiftShader:
141
142
<pre>
143
$ adb remount
144
$ adb shell
145
i9305:/ # rm vendor/lib/egl/libGLES_mesa.so # or move it somewhere safe meanwhile you test SwiftShader
146
i9305:/ # nano system/build.prop # set ro.hardware.hwcomposer=ranchu and ro.hardware.gralloc=default
147
$ adb reboot
148
</pre>
149
150
h2. AOSP 9
151
152
h3. Status with AOSP 9
153
154
* The Galaxy SIII 4G (i9305) boots (with graphics hacks) under AOSP9, without having to import nonfree libraries:
155
** The device boots until the lock screen
156
** The graphics work but are really slow as they have not been optimized
157
** Sometime the display content is corrupted
158
** The touchscreen works
159
* The kernel used is based on Linux 5.0-rc6 and has ~150 Android specific patches on top and some patches for the Galaxy SIII 4G (i9305) on top
160
161
h3.  Repositories and changes
162
 
163
* git://git.putti.eu/aosp/manifest_i9305.git
164
* git://git.putti.eu/aosp/kernel_i9305.git
165
* git://git.putti.eu/aosp/device_i9305.git
166
* git://git.putti.eu/aosp/external_mesa3d.git
167
* git://git.putti.eu/aosp/build_make.git
168
* git://git.putti.eu/aosp/core.git
169
170
h3. Building AOSP version
171
172
h4. Source code
173
174
First get the source code:
175
<pre>
176
$ repo init -u git://git.putti.eu/aosp/manifest_i9305.git -b android-9.0.0
177
</pre>
178
179
h4. For Trisquel 8
180
181
<pre>
182
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip bc python-mako gcc-5-arm-linux-gnueabi
183
</pre>
184
185
h4. Building it
186
187
Once this is done, see the device/putti/i9305/README.md for the build instructions.