Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Linux Kernel - Let's contribute

Linux Kernel - Let's contribute

Slides of the talk I did at LinuxWochen Wien 2014.
This talk will give you a quick introduction to Linux kernel development. During the talk we will explore some options of contribution, including random configurations, stable-testing, RC-testing and actual coding! By the end of the talk we will post a basic patch to the developers as well.

Levente Kurusa

May 10, 2014
Tweet

More Decks by Levente Kurusa

Other Decks in Programming

Transcript

  1. Let's contribute!
    Levente Kurusa
    Presented by
    Fedora Project Hungary

    Licensed under CC-BY-SA
    Linux Kernel

    View Slide

  2. Topics
    1. Quick introduction
    2. Random configurations
    3. Kernel testing
    a. Stable kernels
    b. RC kernels
    4. Checkpatch patches

    View Slide

  3. Quick introduction

    View Slide

  4. Linux powers the world!
    Servers! The cloud! Desktop? Maybe this year?
    Open source contribution is always a big plus
    when it comes to job search!
    Linux is cool!
    Why not?
    Why?

    View Slide

  5. 86% say Linux advanced their career
    93% of HR will recruit a Linux pro next year
    75% already received a call this year!
    Interesting projects!
    Greater pay check! (+10% this year)
    Some statistics

    View Slide

  6. First steps
    Fetch the Linux kernel source code
    For random configurations: linux-next
    http://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
    For stable testing: linux-stable
    http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
    For Rcs, simply clone down Linus' tree
    http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

    View Slide

  7. Eudyptula Challenge
    http://eudyptula-challenge.org/
    Series of programming tasks
    Hard, but fun!

    View Slide

  8. Linux-next
    The current state of the kernel
    Merged together by Stephen Rothwell
    An excellent opportunity to start
    Default configurations are tested

    View Slide

  9. Linux-stable
    Collection of important patches to old
    kernel release
    Backports needed!
    Maintained by Greg KH and others
    Documentation/stable_kernel_rules.txt

    View Slide

  10. Random
    configurations

    View Slide

  11. Randomized configurations of the kernel
    Often have a lot of problems
    GCC warnings
    GCC errors
    kconfig errors/warnings
    They sometimes don't even boot
    Extremely useful!
    What are randconfigs?

    View Slide

  12. $ make randconfig
    Completely nonsense config!
    Try to build it:
    $ make -j`nproc`
    Your first randconfig

    View Slide

  13. Possible errors
    Undeclared functions
    Kconfig circular dependencies
    Boot failure
    Test in emulator!

    View Slide

  14. Kernel
    testing

    View Slide

  15. Run the latest kernel
    Quite easy!
    $ make defconfig
    $ make localmodconfig
    $ make -j`nproc`
    # make headers_install
    # make install
    # reboot

    View Slide

  16. Actual testing
    If you test linux-stable
    ... and things break: Report it!
    ... if nothing breaks: Break it!
    (repeat)
    If you test linux-next
    ... it's risky to try on your computer

    View Slide

  17. Actual testing
    I use my own tiny project.
    LATTE – Linux Automatic Testing Tool for Expert
    (https://github.com/levex/latte)
    Emulators are great.
    Benchmarks are also fun.
    perf

    View Slide

  18. perf
    # perf list
    # perf record
    # perf report
    # perf stat -e

    View Slide

  19. Sending your
    first patch

    Also known as: Checkpatch patches

    View Slide

  20. Checkpatch?
    scripts/checkpatch.pl
    Checks for common errors in the patch
    ... and files with the --file switch
    Not just coding style, but bugs as well!

    View Slide

  21. Getting maintainers
    scripts/get_maintainer.pl
    Gives you a list of maintainers for that
    particular patch or file
    ... or you can manually browse through
    the MAINTAINERS file

    View Slide

  22. Creating the patch
    $ git reset --hard HEAD
    [work...]
    $ git diff
    [review work...]
    $ git commit -as
    $ git format-patch -1
    … and then the hardest part

    View Slide

  23. Sending it
    9 out of 10 will fail this step
    git send-email
    Thunderbird and such can do it as well, but
    it's hard to configure them properly.

    View Slide

  24. People on LKML are grumpy!
    Don't be afraid to ask
    RTFM
    Summary

    View Slide

  25. Any questions?
    Licensed under CC-BY-SA

    @ilevex
    Contact:

    View Slide