This shows you the differences between two versions of the page.
so2:upstream [2017/02/24 21:29] daniel.baluta created |
so2:upstream [2017/02/24 22:34] (current) daniel.baluta |
||
---|---|---|---|
Line 31: | Line 31: | ||
</code> | </code> | ||
+ | ==== git send-email ==== | ||
+ | $ sudo apt-get install git-email | ||
+ | # configure git-email, add this to your ~/.gitconfig | ||
+ | <code> | ||
+ | [sendemail] | ||
+ | smtpEncryption = tls | ||
+ | smtpServer = smtp.gmail.com | ||
+ | smtpUser = yourname@gmail.com | ||
+ | smtpServerPort = 587 | ||
+ | </code> | ||
+ | |||
+ | ==== Misc tools ==== | ||
+ | |||
+ | * coccinelle | ||
+ | |||
+ | <code> | ||
+ | $ sudo apt-get install coccinelle | ||
+ | </code> | ||
+ | |||
+ | * sparse | ||
+ | <code> | ||
+ | $ sudo apt install sparse | ||
+ | </code> | ||
+ | |||
+ | ===== Compilation ===== | ||
+ | |||
+ | We can use ''defconfig'' for getting a smaller kernel image. | ||
+ | |||
+ | <code> | ||
+ | $ make defconfig | ||
+ | $ make | ||
+ | $ make modules | ||
+ | </code> | ||
+ | |||
+ | === Selecting a module for compilation === | ||
+ | |||
+ | Use make menuconfig and in the GUI navigate to your module. For search we can use '/' as in vim. | ||
+ | |||
+ | === Compiling a module === | ||
+ | |||
+ | <code> | ||
+ | |||
+ | make path/file.o | ||
+ | |||
+ | </code> | ||
+ | |||
+ | <note important>Remember to always compile to code before submitting. Maintainers will get very angry if you break kernel.</note> | ||
+ | |||
+ | |||
+ | ===== Finding things to fix ===== | ||
+ | |||
+ | ==== scripts/checkpatch.pl ==== | ||
+ | |||
+ | This tools checks for coding style violations. Please keep in mind that: | ||
+ | * this tool can report false positives. Errors or warnings which are tolerated for old code in the kernel. | ||
+ | * except for ''drivers/staging'' directory most of the maintainers are reluctant to coding style fixes. | ||
+ | |||
+ | <code> | ||
+ | $ $ ./scripts/checkpatch.pl --strict -f drivers/staging/greybus/pwm.c | ||
+ | CHECK: Please don't use multiple blank lines | ||
+ | #28: FILE: drivers/staging/greybus/pwm.c:28: | ||
+ | + | ||
+ | + | ||
+ | </code> | ||
+ | Now edit ''drivers/staging/greybus/pwm.c'' and remove the extra blank line. | ||
+ | |||
+ | ==== Fix the code and submit the patch ==== | ||
+ | |||
+ | After you fix the code you can use git to see the difference between initial file version. | ||
+ | <code> | ||
+ | |||
+ | $ git diff | ||
+ | diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c | ||
+ | index c4bf329..ab72c9e 100644 | ||
+ | --- a/drivers/staging/greybus/pwm.c | ||
+ | +++ b/drivers/staging/greybus/pwm.c | ||
+ | @@ -25,7 +25,6 @@ struct gb_pwm_chip { | ||
+ | #define pwm_chip_to_gb_pwm_chip(chip) \ | ||
+ | container_of(chip, struct gb_pwm_chip, chip) | ||
+ | |||
+ | - | ||
+ | static int gb_pwm_count_operation(struct gb_pwm_chip *pwmc) | ||
+ | { | ||
+ | struct gb_pwm_count_response response; | ||
+ | |||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | |||
+ | $ git status | ||
+ | On branch staging-testing | ||
+ | Your branch is up-to-date with 'origin/staging-testing'. | ||
+ | Changes not staged for commit: | ||
+ | (use "git add <file>..." to update what will be committed) | ||
+ | (use "git checkout -- <file>..." to discard changes in working directory) | ||
+ | |||
+ | modified: drivers/staging/greybus/pwm.c | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ==== Create the commit ==== | ||
+ | Now it's time to create the commit, make sure you add a proper commit message: | ||
+ | |||
+ | <code> | ||
+ | $ git commit -s | ||
+ | |||
+ | greybus: pwm: Remove extra blank line | ||
+ | | ||
+ | This was reported by checkpatch.pl | ||
+ | | ||
+ | Signed-off-by: Daniel Baluta <daniel.baluta@gmail.com> | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ==== Create the patch ===== | ||
+ | |||
+ | <code> | ||
+ | |||
+ | $ git format-patch -1 | ||
+ | 0001-greybus-pwm-Remove-extra-blank-line.patch | ||
+ | |||
+ | </code> | ||
+ | |||
+ | |||
+ | ==== Where to send the patch ==== | ||
+ | |||
+ | <code> | ||
+ | |||
+ | $ ./scripts/get_maintainer.pl 0001-greybus-pwm-Remove-extra-blank-line.patch | ||
+ | M1 (maintainer:GREYBUS SUBSYSTEM) | ||
+ | M2 (maintainer:GREYBUS SUBSYSTEM) | ||
+ | M3 (maintainer:GREYBUS SUBSYSTEM) | ||
+ | L1 (open list:GREYBUS SUBSYSTEM) | ||
+ | L2 (open list:STAGING SUBSYSTEM) | ||
+ | L3 (open list) | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ==== Send the patch ==== | ||
+ | <code> | ||
+ | $ git send-email --to=<maintainer1> --to=<maintainer2> --cc=<list1> --cc=<list2> 0001-greybus-pwm-Remove-extra-blank-line.patch | ||
+ | </code> | ||
+ | |||
+ | ===== sparse ===== | ||
+ | |||
+ | * make C=1 path/to/file | ||
+ | |||
+ | |||
+ | ===== coccinelle ===== | ||
+ | |||
+ | * see [[https://www.kernel.org/doc/html/latest/dev-tools/coccinelle.html | Coccinelle documentation]] |