---
layout: post
tile: Linux kernel notes I 
date: 2015-06-26
tags:
    - linux
## Make sure to change these
published: true
sitemap: true
---

Notes and bookmarks I’ve gathered by doing the [Eyduptula
challenge](http://eudyptula-challenge.org/)

Must read
---------

-   [Linux Loadable Kernel Module
    HOWTO](http://tldp.org/HOWTO/Module-HOWTO/)
-   [Linux Kernel Newbies -
    KernelBuild](http://kernelnewbies.org/KernelBuild)
-   Documentation/SubmittingPatches in the Linux source tree
-   Documentation/CodingStyle
-   Documentation/email-clients.txt

Grab yourself a copy of the mainline kernel repository

    git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Build steps
-----------

*.config* CONFIG\_LOCALVERSION\_AUTO=y

    make localmodconfig
    make silentoldconfig
    make menuconfig
    make -j4 all
    make modules_install
    make install

Make a patch
------------

    SRCTREE= linux
    MYFILE= drivers/net/mydriver.c
    cp $MYFILE $MYFILE.orig
    vi $MYFILE # make your change
    cd ..
    diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch

Multiple files

    MYSRC= /dev/linux
    tar xvzf linux-3.19.tar.gz
    mv linux-3.19 linux-3.19-vanilla
    diff -uprN linux-3.19-vanilla/Documentation/dontdiff \
      linux-3.19-vanilla $MYSRC > /tmp/patch

Check your patches with the patch style checker `scripts/checkpatch.pl`