Project

General

Profile

DeprecatedPortingToAndroid9 » History » Version 4

dl lud, 07/01/2020 03:10 PM
Update path from replicant-9 to replicant-next

1 1 dl lud
h1. Porting Replicant to Android 9
2
3
This page contains old build instructions for Replicant 9. The source code is kept to do regression testing. Active development has moved into [[PortingToAndroid10|Replicant 10]].
4
5
h2. LineageOS 16 (Android 9)
6
7
h3. Repositories and changes for LineageOS 16
8
9 4 dl lud
* https://git.replicant.us/contrib/replicant-next/kernel_replicant_linux
10
* https://git.replicant.us/contrib/replicant-next/external_mesa3d
11 2 dl lud
* https://git.replicant.us/contrib/GNUtoo/android_build
12 4 dl lud
* https://git.replicant.us/contrib/replicant-next/device_samsung_i9305
13
* https://git.replicant.us/contrib/replicant-next/manifest
14
* https://git.replicant.us/contrib/replicant-next/vendor_lineage
15 1 dl lud
16
h3. Building LineageOS 16 version
17
18
h4. Source code
19
20
<pre>
21 4 dl lud
$ repo init -u https://git.replicant.us/contrib/replicant-next/manifest.git -b replicant-9
22 1 dl lud
$ repo sync
23
</pre>
24
25
Alternatively a shallow copy of the source tree can be fetched in order to save on disk space:
26
27
<pre>
28 4 dl lud
$ repo init -u https://git.replicant.us/replicant-next/manifest.git -b replicant-9 --depth=1
29 1 dl lud
$ repo sync -c
30
</pre>
31
32
To `unshallow` a specific module:
33
34
<pre>
35
$ cd path/to/module
36
$ git fetch --unshallow <remote>
37
</pre>
38
39
h4. For Trisquel 8
40
41
<pre>
42
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
43
sudo apt-get install gcc-5-arm-linux-gnueabi
44
</pre>
45
46
h4. Launching the build
47
48
Follow the "i9300 manifest instructions:":https://github.com/CustomRoms/android_local_manifests_i9300
49
<pre>
50
$ subject='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
51
$ mkdir .android-certs
52
$ for x in releasekey platform shared media testkey; do \
53
  ./development/tools/make_key .android-certs/$x "$subject"; \
54
  done
55
$ parallel_tasks=$(echo "$(grep 'processor' /proc/cpuinfo | wc -l ) + 1" | bc)
56
$ source build/envsetup.sh
57
$ lunch lineage_i9305-eng
58
$ make -j${parallel_tasks} bacon
59
</pre>
60
61
The images can then be flashed with heimdall. They are then in:
62
<pre>
63
  out/target/product/i9305/obj/PACKAGING/target_files_intermediates/lineage_i9305-target_files-eng.replicant/IMAGES/
64
</pre>
65
66
h4. Getting lastest changes
67
68
* 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.
69
* 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:
70
<pre>
71
$ rm -rf .repo/manifests/ # This enables me to force push and rebase the manifest repository as well
72 4 dl lud
$ repo init -u https://git.replicant.us/replicant-next/manifest.git -b replicant-9
73 1 dl lud
$ repo sync --force-sync
74
</pre>
75
* 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: 
76
<pre>
77
$ repo sync --force-sync
78
</pre>
79
80
h4. Install the images
81
82
<pre>
83
$ 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 
84
</pre>
85
86
h4. Get adb
87
88
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:
89
<pre>
90
$ sudo adb shell
91
* daemon not running; starting now at tcp:5037
92
* daemon started successfully
93
i9305:/ #                                 
94
$ sudo adb kill-server
95
$ adb shell
96
* daemon not running; starting now at tcp:5037
97
* daemon started successfully
98
error: no devices/emulators found
99
</pre>
100
So make sure to kill the adb-server and run it as root:
101
<pre>
102
$ adb kill-server
103
$ sudo adb shell
104
* daemon not running; starting now at tcp:5037
105
* daemon started successfully
106
i9305:/ # 
107
</pre>
108
109
h4. Booting
110
111
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.
112
113
You can also follow the boot progress with adb:
114
<pre>
115
adb logcat
116
adb logcat -b main
117
</pre>
118
119
Note that the device can go into suspend at any time, so adb might be interrupted. That looks like that:
120
First you get a shell
121
<pre>
122
$ sudo adb shell
123
i9305:/ #
124
</pre>
125
126
Then the connection is interrupted:
127
<pre>
128
$ adb shell
129
i9305:/ # [randomdev@fullyfreelaptop ]$                                                                                                     
130
</pre>
131
132
The effect with adb logcat is similar.
133
134
h3. Using SwiftShader instead of Mesa3D llvmpipe for software rendering
135
136
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:
137
138
<pre>
139
$ adb remount
140
$ adb shell
141
i9305:/ # rm vendor/lib/egl/libGLES_mesa.so # or move it somewhere safe meanwhile you test SwiftShader
142
i9305:/ # nano system/build.prop # set ro.hardware.hwcomposer=ranchu and ro.hardware.gralloc=default
143
$ adb reboot
144
</pre>
145
146
h2. AOSP 9
147
148
h3. Status with AOSP 9
149
150
* The Galaxy SIII 4G (i9305) boots (with graphics hacks) under AOSP9, without having to import nonfree libraries:
151
** The device boots until the lock screen
152
** The graphics work but are really slow as they have not been optimized
153
** Sometime the display content is corrupted
154
** The touchscreen works
155
* 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
156
157
h3.  Repositories and changes
158
 
159
* git://git.putti.eu/aosp/manifest_i9305.git
160
* git://git.putti.eu/aosp/kernel_i9305.git
161
* git://git.putti.eu/aosp/device_i9305.git
162
* git://git.putti.eu/aosp/external_mesa3d.git
163
* git://git.putti.eu/aosp/build_make.git
164
* git://git.putti.eu/aosp/core.git
165
166
h3. Building AOSP version
167
168
h4. Source code
169
170
First get the source code:
171
<pre>
172
$ repo init -u git://git.putti.eu/aosp/manifest_i9305.git -b android-9.0.0
173
</pre>
174
175
h4. For Trisquel 8
176
177
<pre>
178
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
179
</pre>
180
181
h4. Building it
182
183
Once this is done, see the device/putti/i9305/README.md for the build instructions.