Project

General

Profile

DeveloperGuide » History » Version 15

Paul Kocialkowski, 11/12/2013 01:30 PM

1 1 Paul Kocialkowski
h1. Developer Guide
2
3 15 Paul Kocialkowski
{{>toc}}
4
5 1 Paul Kocialkowski
These are guidelines that should be followed when doing Replicant development.
6
7 3 Paul Kocialkowski
h2. Prerequisites
8
9 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:
10 3 Paul Kocialkowski
* C language programming skills and the ability to understand other languages such as C++ and Java
11
* Makefile skills (no need to know every detail about it, a general idea of how Makefiles work is enough)
12
* git skills (basically, how to commit changes, send them to our repos, dealing with branches without making a mess, etc)
13 9 Paul Kocialkowski
  You can find some documentation about git at: http://git-scm.com/documentation
14 3 Paul Kocialkowski
15
If you think you can cope with the requirements, then developing on Replicant should cause you no particular issue.
16
17
h3. Writing free software replacements
18
19
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.
20
21 1 Paul Kocialkowski
h2. Repositories
22
23
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.
24
It is better to create separate branches (that are not used by the official manifest branches) when your work is still in progress.
25
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.
26
27
h3. When creating a repository
28
29
In order to keep repo naming consistent, please name repositories by their name on the tree, replacing the @/@ by @_@.
30
For instance, when forking the CyanogenMod repo: @android_device_samsung_crespo@, rename it to @device_samsung_crespo@ on the Replicant repos.
31
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 @_@.
32
33
h3. When creating a branch
34
35
Official replicant branches are named the following way:
36
* The @replicant-@ prefix
37
* The Replicant version
38
39
Such as: @replicant-2.3@ This should be used on the projects repositories as well as the manifest repository.
40
Any other branch should be considered as Work In Progress (WIP) and thus not be part of any official branch of the manifest.
41
42
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.
43 2 Paul Kocialkowski
44
h2. Upstreaming work
45
46
It is generally a good idea to send some changes back to upstream, assuming that they will benefit from it as well.
47
48
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.
49
Contact the interested developers on the upstream projects before attempting to send your replacement.
50
51
h3. CyanogenMod
52
53 10 Paul Kocialkowski
The CyanogenMod team uses Gerrit to manage patch submissions. The process to get your patch included in CyanogenMod repos is explained on their wiki: "Gerrit":http://wiki.cyanogenmod.org/w/Gerrit
54 3 Paul Kocialkowski
55 11 Paul Kocialkowski
You can push directly using git using the following scheme:
56
<pre>
57
git push ssh://<sshusername>@review.cyanogenmod.org:29418/CyanogenMod/cm-kernel HEAD:refs/for/<branchname>
58
</pre>
59
60 3 Paul Kocialkowski
h2. Writing free software replacements
61
62
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):
63
* Look for interested people from other projects: CyanogenMod people are constantly fighting with non-free blobs and are sometimes happy to help replacing one.
64 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!*)
65 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.
66
* Run the program in @strace@ and analyze the trace to understand what the program does.
67 1 Paul Kocialkowski
* Add verbose debug prints in the concerned kernel driver (with @printk@ and show them via the @dmesg@ tool).
68 6 Paul Kocialkowski
* Read the corresponding kernel driver: you can sometimes learn a lot by reading comments or headers.
69 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).
70
* 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.
71 4 Paul Kocialkowski
72 14 Paul Kocialkowski
h2. Wiki guidelines
73
74
In order the keep the wiki simple and consistent, a few guidelines must be followed when editing:
75
76
* Every page in the wiki should be written in correct English, we do not aim to provide informations in any other language
77
* Only Replicant-specific topics should be covered: there is no point in writing usage guides for generic Android aspects, such as the user interface
78
* The content on each page must be relevant *only* to the latest Replicant version: make sure to update the content with newer Replicant versions
79
* Follow the devices naming convention (the @Galaxy S3@ is not to be called @Samsung S3@ or @Galaxy S III@)
80
* Name the pages in a consistent manner ([[NexusSFirmwares]] is not to be called [[FirmwaresOnTheNexusS]])
81
82 4 Paul Kocialkowski
h2. New images release guide
83
84
1. Modify vendor/replicant/CHANGELOG.mkdn, commit and push
85
2. Update prebuilts (FDroid, Terminal Emulator, etc)
86
3. Start the build
87
4. Run the release script and ensure everything is OK
88
5. Compress the release files
89
<pre>tar -cjf 0005.tar.bz2 0005</pre>
90
6. Upload the release to ftp-osl.osuosl.org
91
<pre>scp -v 0005.tar.bz2 replicant@ftp-osl.osuosl.org:/home/replicant/data/images/replicant-2.3/0005.tar.bz2</pre>
92
7. Unpack the release, fix permissions
93
8. Modify [[ReplicantImages]], last image on every devices page
94 12 Paul Kocialkowski
9. Update [[ReplicantStatus]] with the latest status
95
10. Announce the release on the blog, mailing list
96
11. Update the IRC topic
97 5 Paul Kocialkowski
98
h2. New device documentation guide
99
100
1. Create the device main page, following the naming guidelines applied to other devices (e.g. the Samsung Galaxy S II is called *Galaxy S2* and its page is [[GalaxyS2]])
101 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. [[GalaxyS2Build]], [[GalaxyS2Installation]] and [[GalaxyS2Firmwares]])
102
3. Link the sub-pages to the main page in the index
103 5 Paul Kocialkowski
4. Update the [[ReplicantStatus]] page of the wiki with the current status of the device
104
5. Modify the [[WikiStart]] page of the wiki and add the new device in the following sections:
105
* [[WikiStart#Replicant-status-on-phones|Replicant status on phones]]
106
* [[WikiStart#Installing-Replicant|Installing Replicant]]
107
* [[WikiStart#Building-Replicant|Building Replicant]]
108
* [[WikiStart#Technical-infos-on-the-devices|Technical infos on the devices]]
109
110 7 Paul Kocialkowski
7. Add new issues categories to the redmine Replicant project
111 5 Paul Kocialkowski
6. Add your device to the *Devices* and *Download* pages of the Blog