Project

General

Profile

GenericReplicant60Build » History » Version 6

Denis 'GNUtoo' Carikli, 10/20/2019 08:56 PM

1 2 Denis 'GNUtoo' Carikli
h1. Build Replicant 6.0
2 1 Denis 'GNUtoo' Carikli
3 2 Denis 'GNUtoo' Carikli
This page explains how to build Replicant 6.0 for supported devices.
4 1 Denis 'GNUtoo' Carikli
5
h2. Prerequisites
6
7
Before building, you must make sure that:
8 6 Denis 'GNUtoo' Carikli
* You have installed the build dependencies: [[Replicant60BuildDependenciesInstallation|Replicant 6.0 build dependencies installation]]
9 1 Denis 'GNUtoo' Carikli
* You have downloaded Replicant 6.0 sources: [[ReplicantSourceCode]]
10
* Your sources are up to date: [[ReplicantSourceCode#DownloadingUpdating-the-source-code|Downloading/Updating the source from the repos]]
11
* Your terminal is running in the directory where the sources were downloaded
12
 
13
h2. Warning
14
15
*Do not build as root, always build as user.*
16
17
See the [[BuildTips|build tips]] if you are facing issues.
18
19 4 Denis 'GNUtoo' Carikli
h2. Before building
20
21
* On Debian stretch, building the toolchain will fail. See [[Replicant60BuildTips#usrbinsed-usrbinmkdir-usrbinmkdir-No-such-file-or-directory]] for how to workaround that and make the build succeed.
22
23 1 Denis 'GNUtoo' Carikli
h2. Building
24
25
All of the following build commands need to be run in the source tree root folder.
26
27 5 Denis 'GNUtoo' Carikli
h3. Building the toolchain
28
29
First, the toolchain needs to be built for replicant 6. To do that *open a new shell* and run the following command:
30 1 Denis 'GNUtoo' Carikli
<pre>
31
./vendor/replicant/build-toolchain
32
</pre>
33
34 5 Denis 'GNUtoo' Carikli
h2. Building a Replicant image for a device
35 1 Denis 'GNUtoo' Carikli
36 5 Denis 'GNUtoo' Carikli
Once the toolchain has been built, we can now *open a new shell* and prepare it for building a Replicant image for a device. To prepare the current shell, run the following command:
37 1 Denis 'GNUtoo' Carikli
38
<pre>
39
. build/envsetup.sh
40
</pre>
41
42
43 2 Denis 'GNUtoo' Carikli
You will then need select the device you want to build for.
44
45
To do that, you can use the following table to find the command you need to type to select the device you want to build for:
46
47
|_. Command |_. Device(s) |
48
| lunch replicant_i9100-userdebug |  Galaxy S 2 (I9100) |
49
| lunch replicant_i9300-userdebug | Galaxy S 3 (I9300) |
50
| lunch replicant_i9305-userdebug | Galaxy S 3 4G (I9305) |
51
| lunch replicant_n7000-userdebug | Galaxy Note (N7000) |
52
| lunch replicant_n7100-userdebug | Galaxy Note 2 (N7100) |
53
| lunch replicant_maguro-userdebug | Galaxy Nexus (I9250) |
54
|/2. lunch replicant_espresso3g-userdebug | Galaxy Tab 2 7.0 (P3100) | 
55
| Galaxy Tab 2 10.1 (P5100) |
56
|/2. lunch replicant_espressowifi-userdebug | Galaxy Tab 2 7.0 Wi-Fi (P3110) | 
57
| Galaxy Tab 2 10.1 Wi-Fi (P5110) |
58
| lunch replicant_n5100-userdebug | Galaxy Note 8.0 (N5100) |
59
| lunch replicant_n5110-userdebug | Galaxy Note 8.0 Wi-Fi (N5110) |
60
61
For instance to build for the Galaxy S3 (I9300) you need to type the following command:
62 1 Denis 'GNUtoo' Carikli
<pre>
63 2 Denis 'GNUtoo' Carikli
lunch replicant_i9300-userdebug
64
</pre>
65
66
When this is done you can start the build:
67
<pre>
68 1 Denis 'GNUtoo' Carikli
parallel_tasks=$(echo "$(grep 'processor' /proc/cpuinfo | wc -l ) + 1" | bc)
69
make -j$parallel_tasks bacon
70
</pre>
71
72
The @-jn@ argument indicates the number of parallel tasks during the build. You can remove it from the command line to have only one task at a time.
73
@$parallel_tasks@ holds an optimized number of parallel tasks for your hardware. You may want to reduce this number if e.g. the computer runs out of RAM during the build.
74
75 2 Denis 'GNUtoo' Carikli
Finally, you will need to sign the resulting images for replicant 6.
76 1 Denis 'GNUtoo' Carikli
77 2 Denis 'GNUtoo' Carikli
To do that, you can use the following table to find the command you need to type sign the images for the device you are building for:
78
79
|_. Command |_. Device(s) |
80
| ./vendor/replicant/sign-build i9100 |  Galaxy S 2 (I9100) |
81
| ./vendor/replicant/sign-build i9300 | Galaxy S 3 (I9300) |
82
| ./vendor/replicant/sign-build i9305 | Galaxy S 3 4G (I9305) |
83
| ./vendor/replicant/sign-build n7000 | Galaxy Note (N7000) |
84
| ./vendor/replicant/sign-build n7100 | Galaxy Note 2 (N7100) |
85
| ./vendor/replicant/sign-build maguro | Galaxy Nexus (I9250) |
86
|/2. ./vendor/replicant/sign-build espresso3g | Galaxy Tab 2 7.0 (P3100) | 
87
| Galaxy Tab 2 10.1 (P5100) |
88
|/2. ./vendor/replicant/sign-build espressowifi | Galaxy Tab 2 7.0 Wi-Fi (P3110) | 
89
| Galaxy Tab 2 10.1 Wi-Fi (P5110) |
90
| ./vendor/replicant/sign-build n5100 | Galaxy Note 8.0 (N5100) |
91
| ./vendor/replicant/sign-build n5110 | Galaxy Note 8.0 Wi-Fi (N5110) |
92
93
For instance for the Galaxy S 3 (I9300) you need to type the following command:
94 1 Denis 'GNUtoo' Carikli
<pre>
95 2 Denis 'GNUtoo' Carikli
./vendor/replicant/sign-build i9300
96 1 Denis 'GNUtoo' Carikli
</pre>
97
98
The first time you run the script, it will ask you a few questions that are needed to generate the necessary signing keys.
99
100
h2. Output files
101
102 3 Denis 'GNUtoo' Carikli
For the built host tools, the produced files are at: @out/host/linux-x86/bin/@
103
104
For the built target images, you can use the following table to find the directory that has the produced files:
105
106
|_. Output directory |_. Device(s) |
107
| out/dist/i9100/ |  Galaxy S 2 (I9100) |
108
| out/dist/i9300/ | Galaxy S 3 (I9300) |
109
| out/dist/i9305/ | Galaxy S 3 4G (I9305) |
110
| out/dist/n7000/ | Galaxy Note (N7000) |
111
| out/dist/n7100/ | Galaxy Note 2 (N7100) |
112
| out/dist/maguro/ | Galaxy Nexus (I9250) |
113
|/2. out/dist/espresso3g/ | Galaxy Tab 2 7.0 (P3100) | 
114
| Galaxy Tab 2 10.1 (P5100) |
115
|/2. out/dist/espressowifi/ | Galaxy Tab 2 7.0 Wi-Fi (P3110) | 
116
| Galaxy Tab 2 10.1 Wi-Fi (P5110) |
117
| out/dist/n5100/ | Galaxy Note 8.0 (N5100) |
118
| out/dist/n5110/ | Galaxy Note 8.0 Wi-Fi (N5110) |
119
120
For instance, for the Galaxy S 3 (I9300), the built target images are in @out/dist/i9300/@