|
| 1 | +Contributing to Unikraft |
| 2 | +======================= |
| 3 | + |
| 4 | +First of all, welcome to Unikraft! We are happy that you are interested |
| 5 | +in contributing to this project. Unikraft is mailing-list driven, |
| 6 | +meaning that you should submit your patches to |
| 7 | +<[email protected]> and CC the corresponding library |
| 8 | +maintainer(s). |
| 9 | + |
| 10 | +We basically follow the patch submission procedure from the [Xen |
| 11 | +project](https://wiki.xenproject.org/wiki/Submitting_Xen_Project_Patches). |
| 12 | +Unikraft uses the `staging` and `master` branch principle, |
| 13 | +too. Releases are marked with tags. We highly recommend you use |
| 14 | +[`git`](http://git-scm.com/), `git format-patch`, and `git send-email` |
| 15 | +because these tools ensure the correct formatting of your |
| 16 | +patches. E-Mail clients often do some sophisticated reformatting of |
| 17 | +the e-mail body which usually break your patches. |
| 18 | + |
| 19 | +Make sure that you tested your changes on various setups before |
| 20 | +sending us the patch. Try several different configuration options (in particular |
| 21 | +multiple architectures and platforms) and library combinations. During |
| 22 | +development, disable `OPTIMIZE_DEADELIM` |
| 23 | +(Build Options -> Drop unused functions and data) |
| 24 | +so that all of your code is covered by the compiler and linker. |
| 25 | + |
| 26 | + |
| 27 | +Coding Style |
| 28 | +------------ |
| 29 | + |
| 30 | +The coding style is documented in `CODING_STYLE.md`. Please have a |
| 31 | +look there before committing. |
| 32 | + |
| 33 | + |
| 34 | +Commit message |
| 35 | +-------------- |
| 36 | + |
| 37 | +In order to simplify reading and searching the patch history, please |
| 38 | +use the following format for the short commit message: |
| 39 | + |
| 40 | + [selector]/[component name]: [Your short message] |
| 41 | + |
| 42 | +Where `[selector]` can be one of the following: |
| 43 | + |
| 44 | +* `arch`: Patch for the architecture code in `arch/`, |
| 45 | + `[component]` is the architecture (e.g, `x86`) |
| 46 | + applies also for corresponding headers in `include/uk/arch/` |
| 47 | +* `plat`: Patch for one of the platform libraries in `plat/`, |
| 48 | + `[component]` is the platform (e.g, `linuxu`). This |
| 49 | + applies also for corresponding headers in `include/uk/plat/` |
| 50 | +* `include`: Changes to general Unikraft headers in `include/`, `include/uk` |
| 51 | +* `lib`: Patch for one of the Unikraft base libraries (not external) in `lib/`, |
| 52 | + `[component]` is the library name without lib prefix (e.g, `fdt`) |
| 53 | +* `doc`: Changes to the documentation in `doc/`, |
| 54 | + `[component]` is the corresponding guide (e.g., `developers`) |
| 55 | +* `build`: Changes to build system or generic configurations, |
| 56 | + `[component]` is optional |
| 57 | + |
| 58 | +If no `[selector]` applies, define your own and cross your fingers that the |
| 59 | +reviewer(s) do(es) not complain. |
| 60 | + |
| 61 | +Sometimes a single change required multiple commit identifiers. In general this |
| 62 | +should be avoided by splitting a patch into multiple ones. But for the rare |
| 63 | +case use a comma separated list of identifiers and/or use an asterisk for |
| 64 | +`[component]` (according to the sense). For instance: |
| 65 | + |
| 66 | + lib/nolibc, plat/xen: Add support for foobar |
| 67 | + |
| 68 | + arch/*: Add spinlocks |
| 69 | + |
| 70 | +The short message part should start with a capital and be formulated in simple |
| 71 | +present. |
| 72 | + |
| 73 | +The actual subject line of the patch email should be prefixed with `[PATCH]`. |
| 74 | +Re-submissions append a version number: For instance `[PATCH v2]`. |
| 75 | +`git format-patch` and `git send-email` are you friends. ;-) |
| 76 | + |
| 77 | +The long message part is pretty free form but should be used to |
| 78 | +explain the reasons for the patch, what has been changed and why. It |
| 79 | +is important to provide enough information to allow reviewers and other |
| 80 | +developers to understand the patch's purpose. |
| 81 | + |
| 82 | +### Signing off |
| 83 | + |
| 84 | +Please note that all patch that you send out __must__ __be__ |
| 85 | +__signed__ __off__. This is required so that you certify that you |
| 86 | +submitted the patch under the [Developer's Certificate of |
| 87 | +Origin](https://www.kernel.org/doc/html/latest/process/submitting-patches.html#developer-s-certificate-of-origin-1-1). |
| 88 | + |
| 89 | +Signing off is done by adding the following line after the long commit message: |
| 90 | + `Signed-off-by: [your name] <[your email]>` |
| 91 | +You can also use the `--signoff` or `-s` parameter of `git commit` when |
| 92 | +creating commit messages. |
| 93 | + |
| 94 | + Developer's Certificate of Origin 1.1 |
| 95 | + |
| 96 | + By making a contribution to this project, I certify that: |
| 97 | + (a) The contribution was created in whole or in part by me and I |
| 98 | + have the right to submit it under the open source license |
| 99 | + indicated in the file; or |
| 100 | + |
| 101 | + (b) The contribution is based upon previous work that, to the best |
| 102 | + of my knowledge, is covered under an appropriate open source |
| 103 | + license and I have the right under that license to submit that |
| 104 | + work with modifications, whether created in whole or in part |
| 105 | + by me, under the same open source license (unless I am |
| 106 | + permitted to submit under a different license), as indicated |
| 107 | + in the file; or |
| 108 | + |
| 109 | + (c) The contribution was provided directly to me by some other |
| 110 | + person who certified (a), (b) or (c) and I have not modified |
| 111 | + it. |
| 112 | + |
| 113 | + (d) I understand and agree that this project and the contribution |
| 114 | + are public and that a record of the contribution (including all |
| 115 | + personal information I submit with it, including my sign-off) is |
| 116 | + maintained indefinitely and may be redistributed consistent with |
| 117 | + this project or the open source license(s) involved. |
| 118 | + |
| 119 | +### Patch for a Repository other than `unikraft/unikraft.git` |
| 120 | + |
| 121 | +Since we use the same mailing list also for repositories of external libraries |
| 122 | +(e.g., `newlib`, `lwip`), a subject prefix has to be added for those. Use the |
| 123 | +name of the library repository name in capital letters. For example, for |
| 124 | +`unikraft/libs/lwip.git` use `LWIP`. |
| 125 | + |
| 126 | +### Examples of subject lines: |
| 127 | +- A patch for the Xen platform library: |
| 128 | + `[PATCH] plat/xen: Add support for ARM64` |
| 129 | +- A patch for libukboot: |
| 130 | + `[PATCH] lib/ukboot: Shutdown system after main() returns` |
| 131 | +- A patch for the external library newlib: |
| 132 | + `[PATCH NEWLIB] Implement glue for pthread_create()` |
| 133 | + |
| 134 | +### Example of a commit message |
| 135 | + |
| 136 | + [PATCH] lib/ukdebug: Add new trondle calls |
| 137 | + |
| 138 | + Add some new trondle calls to the foobar interface to support |
| 139 | + the new zot feature. |
| 140 | + |
| 141 | + Signed-off-by: Joe Smith <[email protected]> |
| 142 | + |
| 143 | + |
| 144 | +Maintainers |
| 145 | +----------- |
| 146 | + |
| 147 | +Maintainers are listed in the `MAINTAINERS.md` file which you can find in the |
| 148 | +base folder. Each external library should have its own `MAINTAINERS` file. |
0 commit comments