Write and submit your first kernel patch

Source: Internet
Author: User
Write and submit your first Linux kernel patch

1. Create your own branch

Git branch Test

 

2. Switch to Branch

Git checkout Test

 

3. Check the encoding Style

Cjok @ Ubuntu :~ /Git-work/Linux $./scripts/checkpatch. pl -- file -- terse Drivers/staging/Media/go7007/s2250-board.c

Drivers/staging/Media/go7007/s2250-board.c: 107: Error: That open brace {shocould be on the previous line

Total: 1 errors, 0 warnings, 698 lines checked

 

4. Modify bugs

Cjok @ Ubuntu :~ /Git-work/Linux $
VI Drivers/staging/Media/go7007/s2250-board.c + 107

 

5. view the modified location

Cjok @ Ubuntu :~ /Git-work/Linux $ git diff

Diff -- gita/Drivers/staging/Media/go7007/s2250-board.c B/Drivers/staging/Media/

Index e7736a9... 2017d391 100644

--- A/Drivers/staging/Media/go7007/s2250-board.c

++ B/Drivers/staging/Media/go7007/s2250-board.c

@-103,8 + 103,7 @ static u16vid_regs_fp [] = {

};

 

/* Pal specific values */

-Static 16vid_regs_fp_pal [] =

-{

+ Static 16vid_regs_fp_pal [] = {

0x120, 0x017,

0x121, 0xd22,

0x122, 0x122,

 

6. Compile the modified directory to prevent new errors during modification.

Make M = Drivers/staging/Media/go7007/

 

7. Submit the patch

Cjok @ Ubuntu :~ /Git-work/Linux $ git commit-

[Test-cjok a041001] staging: Media: go7007: Fixed coding style issue

1 files changed, 1 insertions (+), 2 deletions (-)

8. view patch information

Cjok @ Ubuntu :~ /Git-work/Linux $ git show -- pretty = full

Commita04100141fc3708ce19cb4a3228506d675fd3776

Author: cjok <cjok.liao@gmail.com>

Commit: cjok <cjok.liao@gmail.com>

 

Staging: Media: go7007: Fixed coding style issue

Fixed a coding style issue

 

Diff -- gita/Drivers/staging/Media/go7007/s2250-board.c B/Drivers/staging/Media/

Index e7736a9... 2017d391 100644

--- A/Drivers/staging/Media/go7007/s2250-board.c

++ B/Drivers/staging/Media/go7007/s2250-board.c

@-103,8 + 103,7 @ static u16vid_regs_fp [] = {

};

 

/* Pal specific values */

-Static 16vid_regs_fp_pal [] =

-{

+ Static 16vid_regs_fp_pal [] = {

0x120, 0x017,

0x121, 0xd22,

0x122, 0x122,

 

9. format the patch.

Cjok @ Ubuntu :~ /Git-work/Linux $ git format-patch master .. test-cjok

0001-staging-media-go7007-fixed-coding-style-issue.patch

 

10. Check the patch encoding to prevent new errors.

Cjok @ Ubuntu :~ /Git-work/Linux $./scripts/checkpatch. pl0001-staging-media-go7007-fixed-coding-style-issue.patch

Total: 0 errors, 0 warnings, 9 lines checked

 

0001-staging-media-go7007-fixed-coding-style-issue.patchhas no obvious style problems and is ready for submission.

 

11. Get emails from maintainer and related personnel

Cjok @ Ubuntu :~ /Git-work/Linux $./scripts/get_maintainer.pl0001-staging-media-go7007-fixed-coding-style-issue.patch

Mauro Carvalho Chehab <mchehab@infradead.org> (maintainer: Media inputinfra..., commit_signer: 1/2 = 50%)

Greg kroah-Harman <gregkh@suse.de> (maintainer: staging subsystem, commit_signer: 1/2 = 50%)

Linux-media@vger.kernel.org (Open list: Media input infra ...)

The devel@driverdev.osuosl.org (openlist: staging subsystem)

Linux-kernel@vger.kernel.org (Open list)

 

12. Send email

Cjok @ Ubuntu :~ /Git-work/Linux $ git send-email -- To linux-media@vger.kernel.org -- CC cjok.liao@gmail.com0001-staging-media-go7007-fixed-coding-style-issue.patch

If the gitsend-Email tool is not installed, an error occurs. Download and install apt-Get install Git-Email msmtp.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.