DeveloperGuide » History » Version 62
Wolfgang Wiedmeyer, 05/05/2017 03:34 PM
a word
1 | 31 | Paul Kocialkowski | h1. Developer guide |
---|---|---|---|
2 | 1 | Paul Kocialkowski | |
3 | 15 | Paul Kocialkowski | {{>toc}} |
4 | |||
5 | 3 | Paul Kocialkowski | h2. Prerequisites |
6 | |||
7 | 8 | Paul Kocialkowski | Developing on Replicant isn't much harder than developing on any other free software project as it doesn't require specific knowledge. In fact, you'll probably learn a lot along the way regarding how hardware works, how the Android system is composed, how the kernel works, etc, but you don't need to know all of this to start. However a basic set of skills is required, among which: |
8 | 3 | Paul Kocialkowski | * C language programming skills and the ability to understand other languages such as C++ and Java |
9 | * Makefile skills (no need to know every detail about it, a general idea of how Makefiles work is enough) |
||
10 | 52 | Wolfgang Wiedmeyer | * Git skills (basically, how to commit changes, send them to our repos, dealing with branches without making a mess, etc) |
11 | 53 | Wolfgang Wiedmeyer | You can find some documentation about Git at: https://git-scm.com/documentation |
12 | 3 | Paul Kocialkowski | |
13 | If you think you can cope with the requirements, then developing on Replicant should cause you no particular issue. |
||
14 | |||
15 | 26 | Paul Kocialkowski | h3. Notes on writing free software replacements |
16 | 3 | Paul Kocialkowski | |
17 | 1 | Paul Kocialkowski | Writing free software replacements for non-free components may require more skills depending on what you're trying to achieve, though there may be people with the adequate knowledge to help you and from whom you will likely learn a lot. |
18 | 40 | Wolfgang Wiedmeyer | |
19 | 59 | Wolfgang Wiedmeyer | The [[Index#Replicant-porting-guides|porting guides]] provide instructions for porting a new device to Replicant. |
20 | |||
21 | Have a look at the [[Tasks]] page and feel free to [[Index#Contact|ask around]] for help to get started. |
||
22 | 50 | Wolfgang Wiedmeyer | |
23 | 40 | Wolfgang Wiedmeyer | h2. Code hosting and submitting patches |
24 | |||
25 | 44 | Wolfgang Wiedmeyer | Replicant's source code is hosted at "git.replicant.us":https://git.replicant.us/replicant. If you plan to regularly contribute to Replicant and if you don't yet have a code hosting provider that satisfies your needs, you are welcome to host your Replicant-related projects there under your own username, You only need to [[People#Active-developers|contact one of Replicant's developers]] and ask for an account. Please include in your request the name, username and Email address that should be used for creating your account. |
26 | 40 | Wolfgang Wiedmeyer | |
27 | 53 | Wolfgang Wiedmeyer | Replicant currently doesn't accept merge requests. There are two ways to get your patches included: You can either send them to the "mailing list":https://lists.osuosl.org/mailman/listinfo/replicant or open an issue on the "issue tracker":/projects/replicant/issues and attach the patches to the issue. Replicant developers will then review your changes. |
28 | 40 | Wolfgang Wiedmeyer | |
29 | See the Git documentation for "creating a patch":https://git-scm.com/docs/git-format-patch. Patches can be send with "@git send-email@":https://git-scm.com/docs/git-send-email. If it's too much hassle for you to set up @git send-email@, sending the patches with your favorite mail client should be fine, too. |
||
30 | 3 | Paul Kocialkowski | |
31 | 1 | Paul Kocialkowski | h2. Repositories |
32 | |||
33 | When working with Replicant repos, make sure to avoid breaking things. For instance, if you push a commit introducing a compilation error, it will break the whole build process. |
||
34 | It is better to create separate branches (that are not used by the official manifest branches) when your work is still in progress. |
||
35 | Creating branches that add debug infos on a particular topic is usually a good idea since it will save you time next time you want to debug the same component. |
||
36 | |||
37 | 60 | Wolfgang Wiedmeyer | [[LineageMirror]] details the setup of the LineageOS mirror. Below are the instructions for repos in the Replicant group. |
38 | |||
39 | 1 | Paul Kocialkowski | h3. When creating a repository |
40 | |||
41 | In order to keep repo naming consistent, please name repositories by their name on the tree, replacing the @/@ by @_@. |
||
42 | 43 | Wolfgang Wiedmeyer | For instance, when forking the LineageOS repo: @android_device_samsung_crespo@, rename it to @device_samsung_crespo@ on the Replicant repos. |
43 | 1 | Paul Kocialkowski | This creates a more consistent way of naming repositories and makes it easier when pushing: just look at the location in the source tree and replace @/@ by @_@. |
44 | |||
45 | h3. When creating a branch |
||
46 | |||
47 | 43 | Wolfgang Wiedmeyer | Official Replicant branches are named the following way: |
48 | 1 | Paul Kocialkowski | * The @replicant-@ prefix |
49 | * The Replicant version |
||
50 | |||
51 | Such as: @replicant-2.3@ This should be used on the projects repositories as well as the manifest repository. |
||
52 | Any other branch should be considered as Work In Progress (WIP) and thus not be part of any official branch of the manifest. |
||
53 | |||
54 | There is although one exception, with the @master@ branch, that can be used by any project and be in any manifest given that the code held in the @master@ branch will work on any Replicant version. |
||
55 | 2 | Paul Kocialkowski | |
56 | h2. Upstreaming work |
||
57 | |||
58 | It is generally a good idea to send some changes back to upstream, assuming that they will benefit from it as well. |
||
59 | |||
60 | When it is about the replacement of a non-free component present in the upstream systems, make sure that your replacement is reliable and complete. |
||
61 | Contact the interested developers on the upstream projects before attempting to send your replacement. |
||
62 | |||
63 | 39 | Wolfgang Wiedmeyer | h3. LineageOS |
64 | 2 | Paul Kocialkowski | |
65 | 39 | Wolfgang Wiedmeyer | The LineageOS team uses Gerrit to manage patch submissions. The process to get your patch included in LineageOS repos is explained on their wiki: "Gerrit":http://wiki.lineageos.org/usinggerrit-howto.html#submitting-to-gerrit |
66 | 3 | Paul Kocialkowski | |
67 | 39 | Wolfgang Wiedmeyer | You can also push directly using git using the following scheme (untested): |
68 | 11 | Paul Kocialkowski | <pre> |
69 | 39 | Wolfgang Wiedmeyer | git push ssh://<sshusername>@review.lineageos.org:29418/LineageOS/<projectname> HEAD:refs/for/<branchname> |
70 | 11 | Paul Kocialkowski | </pre> |
71 | |||
72 | 25 | Paul Kocialkowski | h3. AOSP |
73 | |||
74 | 43 | Wolfgang Wiedmeyer | The Android Open Source Project uses Gerrit to manage patch submissions. Some information about submitting patches to AOSP is available: https://source.android.com/source/submit-patches.html |
75 | 25 | Paul Kocialkowski | |
76 | You can push to AOSP's review using: |
||
77 | <pre> |
||
78 | git push https://android-review.googlesource.com/platform/system/core HEAD:refs/for/master |
||
79 | </pre> |
||
80 | |||
81 | 3 | Paul Kocialkowski | h2. Writing free software replacements |
82 | |||
83 | Here are some tips that may help you achieving a free software replacement for a specific component (some may be more or less relevant regarding the nature of what the component does): |
||
84 | 43 | Wolfgang Wiedmeyer | * Look for interested people from other projects: LineageOS people are constantly fighting with non-free blobs and are sometimes happy to help replacing one. |
85 | 6 | Paul Kocialkowski | * Use tools such as @strings@, @objdump@ and @radare2@ against the non-free binary to have a better idea of how things work. (*Make sure this is legal where you live!*) |
86 | 3 | Paul Kocialkowski | * Try to make the non-free binary as verbose as possible by enabling all the possible debug options on the config file or such. |
87 | * Run the program in @strace@ and analyze the trace to understand what the program does. |
||
88 | 1 | Paul Kocialkowski | * Add verbose debug prints in the concerned kernel driver (with @printk@ and show them via the @dmesg@ tool). |
89 | 6 | Paul Kocialkowski | * Read the corresponding kernel driver: you can sometimes learn a lot by reading comments or headers. |
90 | 3 | Paul Kocialkowski | * Collect data out of the kernel driver (via debug prints) and out of the non-free binary (via debug prints on the upper-layer). |
91 | * If there is a mathematical algorithm involved, force the values returned by the kernel to the non-free binary and analyze how it reacts, for instance with spreadsheet software. |
||
92 | 17 | Paul Kocialkowski | * If you're directly dealing with a hardware component, try to find a datasheet for the chip, it may hold precious details. In the best case, you may also be able to find a reference software implementation! |
93 | 4 | Paul Kocialkowski | |
94 | 14 | Paul Kocialkowski | h2. Wiki guidelines |
95 | |||
96 | 34 | Paul Kocialkowski | In order the keep the wiki simple and consistent, a few guidelines must be followed when editing. |
97 | 1 | Paul Kocialkowski | |
98 | 34 | Paul Kocialkowski | Regarding the content: |
99 | * Only Replicant-specific topics should be covered by the wiki: there is no point in writing usage guides for generic Android aspects, such as the user interface. |
||
100 | * The content on each page should *only* be relevant to the latest Replicant version: make sure to update the content with newer Replicant versions. |
||
101 | * Substantial changes must be discussed before modifying the wiki. |
||
102 | 49 | Wolfgang Wiedmeyer | * A comment should be added in the comment field at the bottom that shortly describes the change. |
103 | 53 | Wolfgang Wiedmeyer | * Make use of the wiki formatting possibilities: "quick reference":/help/wiki_syntax.html and "detailed syntax overview":/help/wiki_syntax_detailed.html |
104 | 49 | Wolfgang Wiedmeyer | By using @[[Index]]@, it's possible to link to the start page of the wiki. |
105 | 34 | Paul Kocialkowski | |
106 | Regarding the writing style: |
||
107 | * Every page in the wiki has to be written in correct English, we do not aim to provide information in any other language. |
||
108 | 49 | Wolfgang Wiedmeyer | * Addressing readers directly should be avoided when possible: Instead, what is described should always be the subject of sentences. |
109 | 35 | Paul Kocialkowski | * Links to pages should be incorporated in text (Instructions to [[ToolsInstallation#ADB|install ADB]] shouldn't be: Instructions to install ADB: [[ToolsInstallation#ADB]]). |
110 | 34 | Paul Kocialkowski | |
111 | Regarding the naming of pages: |
||
112 | * Pages must be named in a consistent manner ([[NexusSI902xFirmwares]] is not to be called [[FirmwaresOnTheI902xNexusS]]). |
||
113 | * Common prefixes and suffixes should be used for naming new pages ([[BuildDependenciesInstallation]] is not to be called [[InstallationOfBuildDependencies]]). |
||
114 | 37 | Paul Kocialkowski | * Page and section names should always be named using nouns, not verbs, either active or not ([[DeveloperGuide]] is not to be called [[DevelopingGuide]]). |
115 | 36 | Paul Kocialkowski | * Page titles shouldn't contain space or any delimiter character (such as - or_) but use upper-case characters as word delimiters ([[BuildDependenciesInstallation]] is not to be called [[Build_dependencies_installation]]). |
116 | * Page titles *as shown on the page* should use lower-case when upper-case is not needed, even if the page name uses upper-case as word delimiters. |
||
117 | 34 | Paul Kocialkowski | |
118 | Regarding the naming of devices: |
||
119 | * Devices should be named after their model number and codename, without mention of the manufacturer. |
||
120 | * Common device naming conventions should be followed consistently (the @Galaxy S 3 (I9300)@ is not to be called @Samsung S3 GT-I9300@ or @Galaxy S III@). |
||
121 | 14 | Paul Kocialkowski | |
122 | 16 | Paul Kocialkowski | h2. Commonly-used terminology |
123 | |||
124 | In order to keep everything clear and consistent, we use the following terms with a precise meaning in mind: |
||
125 | * *Driver*: Software that is part of the *kernel* (builtin or as a module) and deals with communicating with the hardware |
||
126 | * *Hardware Abstraction Layer (HAL)*: Software that runs in *user-space* and deals with communicating with the hardware (usually through a kernel driver) |
||
127 | * *module*: Android HALs are also often called modules, so we may referrer to e.g. the @audio HAL@ as the @audio module@ |
||
128 | * *blob*: Proprietary HAL |
||
129 | 23 | Paul Kocialkowski | * *firmware*: Software that does not run on the main processor (the CPU) but rather in a separate chip (e.g. the Wi-Fi firmwares runs on the Wi-Fi chip) |
130 | 16 | Paul Kocialkowski | |
131 | 33 | Paul Kocialkowski | h2. New images release |
132 | 1 | Paul Kocialkowski | |
133 | 33 | Paul Kocialkowski | # Modify the changelog in the vendor files: |
134 | <pre> |
||
135 | 54 | Wolfgang Wiedmeyer | cd path/to/replicant-6.0/vendor/replicant |
136 | 33 | Paul Kocialkowski | edit CHANGELOG.mkdn |
137 | git add CHANGELOG.mkdn |
||
138 | 54 | Wolfgang Wiedmeyer | git commit -sS -m "Replicant 6.0 0001 images release" |
139 | git push git@git.replicant.us:replicant/vendor_replicant.git replicant-6.0 |
||
140 | 33 | Paul Kocialkowski | </pre> |
141 | 58 | Wolfgang Wiedmeyer | # Increment the release in the "release scripts":https://git.replicant.us/replicant/release-scripts (and the AOSP release tag if necessary): |
142 | 33 | Paul Kocialkowski | <pre> |
143 | cd path/to/release-scripts |
||
144 | 58 | Wolfgang Wiedmeyer | edit releasevars.sh |
145 | git add releasevars.sh |
||
146 | 1 | Paul Kocialkowski | git commit -sS -m "Replicant 6.0 0001 images release" |
147 | git push git@git.replicant.us:replicant/release-scripts.git replicant-6.0 |
||
148 | 58 | Wolfgang Wiedmeyer | </pre> |
149 | # In the manifest repo, merge the replicant-6.0-dev branch into the replicant-6.0 branch and increment the release in the manifest: |
||
150 | <pre> |
||
151 | cd path/to/manifest |
||
152 | git checkout replicant-6.0 |
||
153 | git merge replicant-6.0-dev |
||
154 | edit default.xml |
||
155 | git add default.xml |
||
156 | git commit -sS -m "Replicant 6.0 0001 images release" |
||
157 | git push git@git.replicant.us:replicant/manifest.git replicant-6.0 |
||
158 | 33 | Paul Kocialkowski | </pre> |
159 | # Tag the manifest: |
||
160 | 1 | Paul Kocialkowski | <pre> |
161 | 61 | Wolfgang Wiedmeyer | git tag -u 5816A24C10757FC4 replicant-6.0-0001 -m "Replicant 6.0 0001 images release" |
162 | 33 | Paul Kocialkowski | git push git@git.replicant.us:replicant/manifest.git replicant-6.0-0001 |
163 | </pre> |
||
164 | 61 | Wolfgang Wiedmeyer | # Tag all the repositories with the release tag script: |
165 | <pre> |
||
166 | path/to/release-scripts/releasetag.sh path/to/replicant-6.0 |
||
167 | </pre> |
||
168 | 56 | Wolfgang Wiedmeyer | # Update prebuilts and start the build (in a newly opened shell with the Replicant keys and certificates installed): |
169 | <pre> |
||
170 | path/to/release-scripts/releasebuild.sh path/to/replicant-6.0 |
||
171 | </pre> |
||
172 | 33 | Paul Kocialkowski | # Release the images with the release script: |
173 | <pre> |
||
174 | 55 | Wolfgang Wiedmeyer | rm -rf path/to/images/replicant-6.0/0001 |
175 | 54 | Wolfgang Wiedmeyer | mkdir -p path/to/images/replicant-6.0/0001 |
176 | path/to/release-scripts/release.sh path/to/replicant-6.0 path/to/images/replicant-6.0/0001 |
||
177 | 1 | Paul Kocialkowski | </pre> |
178 | 33 | Paul Kocialkowski | # Sign the binaries with the release script: |
179 | <pre> |
||
180 | 54 | Wolfgang Wiedmeyer | path/to/release-scripts/release.sh path/to/replicant-6.0 path/to/images/replicant-6.0/0001 signatures |
181 | 1 | Paul Kocialkowski | </pre> |
182 | 33 | Paul Kocialkowski | # Compress the release files |
183 | <pre> |
||
184 | 54 | Wolfgang Wiedmeyer | cd path/to/images/replicant-6.0 |
185 | tar -cjf 0001.tar.bz2 0001 |
||
186 | 1 | Paul Kocialkowski | </pre> |
187 | 33 | Paul Kocialkowski | # Upload the release to OSUOSL: |
188 | <pre> |
||
189 | 1 | Paul Kocialkowski | scp 0001.tar.bz2 replicant@ftp-osl.osuosl.org:/home/replicant/data/images/replicant-6.0/ |
190 | 54 | Wolfgang Wiedmeyer | </pre> |
191 | 1 | Paul Kocialkowski | # Unpack the release on OSUOSL, ensure permissions are correct |
192 | 33 | Paul Kocialkowski | # Update [[ReplicantImages]] with the release |
193 | # Update each device's page with the release |
||
194 | # Update [[ReplicantStatus]] with the latest status |
||
195 | 62 | Wolfgang Wiedmeyer | # Verify if other wiki pages need to be updated due to changes introduced by the release (e.g. [[Index#Replicant-build|build pages]] or [[ToolsInstallation]]) |
196 | 33 | Paul Kocialkowski | # Announce the release on the blog |
197 | # Update the release on the website and IRC topic |
||
198 | 5 | Paul Kocialkowski | |
199 | 33 | Paul Kocialkowski | h2. New device documentation |
200 | 22 | Paul Kocialkowski | |
201 | 19 | Paul Kocialkowski | 1. Create the device main page, following the naming guidelines applied to other devices (e.g. the Samsung Galaxy S II GT-I9100 is called *Galaxy S 2 (I9100)* and its page is [[GalaxyS2I9100]]) |
202 | 13 | Paul Kocialkowski | 2. Create all the related sub-pages (build guide, install guide and firmwares list at least), following the naming guidelines applied to other devices (e.g. [[GalaxyS2I9100Build]], [[GalaxyS2I9100Installation]] and [[GalaxyS2I9100Firmwares]]) |
203 | 5 | Paul Kocialkowski | 3. Link the sub-pages to the main page in the index |
204 | 4. Update the [[ReplicantStatus]] page of the wiki with the current status of the device |
||
205 | 47 | Wolfgang Wiedmeyer | 5. Modify the [[Index]] page of the wiki and add the new device in the following sections: |
206 | * [[Index#Replicant-status|Replicant status]] |
||
207 | * [[Index#Replicant-installation|Replicant installation]] |
||
208 | * [[Index#Replicant-build|Replicant build]] |
||
209 | * [[Index#Supported-devices|Supported devices]] |
||
210 | 24 | Paul Kocialkowski | |
211 | 43 | Wolfgang Wiedmeyer | 6. Add new issues categories to the Replicant project Redmine |