1. subscribe lkml by sending the following message in plain text to majordomo@vger.kernel.org: FAQ:
For beginning kernel hackers:
Linux Weekly News:
insightful commentary on kernel development:
内核直通车:
3. coding style
Documentation/CodingStyle
缩进,switch语句,空格,花括号,行的长度,命名规则,注释等等风格
...
4. comments
describe what and why your code is doing, not how it is doing it.
important notes are often prefixed with "XXX:", and bugs are often prefixed with "FIXME:"
self-generating documentation: Documentation/kernel-doc-nano-HOWTO.txt
- #make htmldocs
- #make psdocs
5. i hate typedef as kernel community, yeah!
never do:
- #ifdef CONFIG_FOO
- foo();
- #endif
but do:
- #ifdef CONFIG_FOO
- static int foo(void)
- {
- /*..*/
- }
- #else
- static inline int foo(void) {}
- #endif /* CONFIG_FOO */
6. structure initializers
- struct foo my_foo = {
- .a = INITIAL_A,
- .b = INITIAL_B,
- }
7. use indent to format source according to given rules. default is GNU coding style, if wanna follow the linux kernel style:
- indent -kr -i8 -ts8 -sob -l80 -ss -bs -ps1
the script scripts/Lindent automatically invokes indent with the desired options.
8. in the root of the kernel source tree:
CREDITS: kernel hackers with significant contributions
MAINTAINERS: the maintainer for a specific driver or subsystem
9. bug report
REPORTING-BUGS Documentation/oops-tracing.txt
(1) 很好的描述问题,最好告诉别人如何复现问题
(2) 可以将问题发给对应的maintainer,或者lkml
10. patches
create:
- diff -urN linux-x.y.z/ linux/ > my-patch
-
diff -u linux-x.y.z/some/file linux/some/file > my-patch
git a perfect tool!
- patch -p1 < ../my-patch
- diffstat -p1 my-patch
submit:
the subject line of the email containing the patch is of the form "[PATCH] brief description", the body of the email describes in technical detail the changes your patch makes and the rationale behind them.
阅读(2211) | 评论(0) | 转发(0) |