|
| 1 | +# OpenCloudos Kernel Development Guide |
| 2 | + |
| 3 | +> The purpose of this document is: |
| 4 | +> |
| 5 | +> - Ensure that kernel code development and rounds comply with community license requirements. |
| 6 | +> - Ensure that the coding style and code quality meet the quality requirements of the kernel Upstream Linus library. |
| 7 | +> - As the upstream kernel of the industry partner, OC KERNEL will provide the downstream partner with a forward-only kernel tree and provide the downstream partner feature selection flexibility. |
| 8 | +
|
| 9 | +## 1-Branching Strategy |
| 10 | + |
| 11 | +Branch names and usage processes |
| 12 | + |
| 13 | +- the code composition of master: LTS + upstream backport features + SIG opensource features + bugfix。 |
| 14 | +- Each feature is formed into independent branches based on the master, and merged into the merge master after meeting the feature integration requirements and testing. |
| 15 | +- The master branch is merged into Tencent's internal code tree, where the features are merged into the LTS/XX stable branch and opened to downstream users. |
| 16 | +- The stable branch of the OC kernel is in the lts/directory, and only accepts bugfix that does not affect Kabi stability. |
| 17 | +- Master and stable branch forward-only, force push is not allowed. |
| 18 | + |
| 19 | +## 2-Kernel Default Configuration |
| 20 | + |
| 21 | +`make occonfig` Provide kernel default configuration. |
| 22 | +`make noocconfig` The OC-specific configuration item is deleted in the current configuration as a build test case of the OC kernel. |
| 23 | + |
| 24 | +## 3-Kernel Feature Development Requirements |
| 25 | + |
| 26 | +In order to better track the whole process (self-developed) kernel feature development without increasing the burden on development students, the kernel features required to be added to the OC kernel must meet the following requirements : |
| 27 | + |
| 28 | +- Clearly describe the problem that the feature is trying to solve ; |
| 29 | + |
| 30 | +- The design solution used to solve this problem ; |
| 31 | + |
| 32 | +- Usage and practical effects of features ; |
| 33 | + |
| 34 | +- This feature must provide a CONFIG_ Compilation switch for mode ; |
| 35 | + |
| 36 | +- Provide cmdline switch or sysctl runtime switch or provide code in a modular manner (optional) ; |
| 37 | + |
| 38 | +- The impact of characteristics on KABI integrated into the kernel ; |
| 39 | + |
| 40 | +- The features have passed those functional and performance tests. The specified testing requirements are listed below . |
| 41 | + |
| 42 | +- The submission team must be responsible for the functionality, performance, and bugs of the submitted code. Code must be reviewed. |
| 43 | + |
| 44 | +- The person in charge of feature submission needs to `signed-off`, and the reviewer needs to add `Reviewed-by:`or `Acked-by: ` |
| 45 | + |
| 46 | +- If there are tests, please sign the test results, such as : |
| 47 | + |
| 48 | + ``` |
| 49 | + Tested-by: Desheng <deshengwu@Tencent 腾讯> |
| 50 | + ``` |
| 51 | + |
| 52 | +## 4-Commit Specification Requirements |
| 53 | + |
| 54 | +1. When submitting self-developed features(commit log),require to include `Reviewed-by` or `Acked-by`。 |
| 55 | + |
| 56 | +2. When turning on the characteristics of other code trees, it is necessary to act as an independent branch and: |
| 57 | + |
| 58 | + - Maintain the original upstream commit quantity and order |
| 59 | + |
| 60 | + - Keep the original commit author |
| 61 | + |
| 62 | + - Add `Signed-off-by` of the person who took the turn: (recommended to use `git cherry-pick -s`) |
| 63 | + |
| 64 | + - The solution to the round conflict should be indicated in the commit log:`Conflicts:<refactored some_function_foo ... >` |
| 65 | + |
| 66 | + - On the first line of the commit log, indicate the commit IDs of other code trees, such as |
| 67 | + |
| 68 | + ```text |
| 69 | + commit 7548bf8c17d84607c106bd45d81834afd95a2edb upstream/openvz/openeuler |
| 70 | + ``` |
| 71 | + |
| 72 | + or |
| 73 | + |
| 74 | + ```text |
| 75 | + Upstream commit 8ebcc62c738f68688ee7c6fec2efe5bc6d3d7e60 |
| 76 | + ``` |
| 77 | +
|
| 78 | +## 5-Tag/Version Specification |
| 79 | +
|
| 80 | +Currently in use TAG: |
| 81 | +
|
| 82 | +- 4.14.105-19-0015 |
| 83 | +- 5.4.119-19-0009.1 |
| 84 | +
|
| 85 | +## 6-Characterization Testing Requirements |
| 86 | +
|
| 87 | +Each new kernel feature integration requires passing the following tests and providing a test report: |
| 88 | +
|
| 89 | +1. The checkpatch.pl and each config compilation for each commit: |
| 90 | + |
| 91 | + - The newly added kernel config needs to be closed and compiled in the kernel/configs/nooc.config file ; |
| 92 | + |
| 93 | + - As an upstream kernel code, downstream users may have different requirements for using OC Kernel. In ARM and X86, in addition to the default `default`, `noocconfig`, `occonfig` must be built and passed, they must also compile and pass the default `defconfig`, `allyesconfig`, `allmodconfig`in the code tree. |
| 94 | + |
| 95 | + - **The minimum requirement is not to addbuild error/warning.** A self testing method is as follows: |
| 96 | + |
| 97 | + ```bash |
| 98 | + make allmodconfig modules all -s ; make allyesconfig noocconfig all -s |
| 99 | + ``` |
| 100 | +
|
| 101 | +2. The recommendations for kernel benchmark self-testing under each config are as follows: |
| 102 | + |
| 103 | + ```bash |
| 104 | + make occonfig kvmconfig bzImage -s -j 32 && qemu -kernel arch/x86/boot/bzImage --nographic -m 4g -smp 4 --enable-kvm ... |
| 105 | + ``` |
| 106 | + |
| 107 | +3. Provide test cases for features, such as kunit/kselftest or other use cases |
| 108 | + |
| 109 | +4. Pass basic kernel testing |
| 110 | + a. LTP related testing does not increase failure. |
| 111 | + b. Stress-ng testing - if it can be covered. |
| 112 | + |
| 113 | +5. Gcov or kcov code coverage>90% when executing tests. |
| 114 | + (gcov's data collection method [Using gcov with the Linux kernel](https://www.kernel.org/doc/html/latest/dev-tools/gcov.html) ) |
| 115 | + |
| 116 | +Written by:alexsshi 2023-02-17 |
| 117 | + |
| 118 | +reference: |
| 119 | + |
| 120 | +1. [Kernel Documentation](https://www.kernel.org/doc/html/latest/index.html#id6) |
| 121 | +2. [Submitting patches: the essential guide to getting your code into the kernel](https://www.kernel.org/doc/html/latest/process/submitting-patches.html) |
0 commit comments