diff --git a/README.md b/README.md index 5554b36..abd170b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Linux Kernel Module Cheat -Run one command, get a QEMU Buildroot BusyBox virtual machine built from source with several minimal Linux kernel 4.14 module development example tutorials with GDB and KGDB step debugging and minimal educational hardware models. Limited GEM5 full system support. "Tested" in x86, ARM and MIPS guests, Ubuntu 17.10 host. +Run one command, get a QEMU Buildroot BusyBox virtual machine built from source with several minimal Linux kernel 4.15 module development example tutorials with GDB and KGDB step debugging and minimal educational hardware models. Limited GEM5 full system support. "Tested" in x86, ARM and MIPS guests, Ubuntu 17.10 host. ![](screenshot.png) diff --git a/configure b/configure index 916354f..9a36102 100755 --- a/configure +++ b/configure @@ -48,6 +48,10 @@ EOF exit 0 } +# Without this started failing in kernel 4.15 with: +# Makefile:932: *** "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel". Stop. +pkgs="$pkgs libelf-dev" + sudo apt-get update $y # Building SDL for QEMU in Buildroot was rejected upstream because it adds many dependencies: # https://patchwork.ozlabs.org/patch/770684/ diff --git a/kernel_module/timer.c b/kernel_module/timer.c index b96b94a..5e6e4b8 100644 --- a/kernel_module/timer.c +++ b/kernel_module/timer.c @@ -1,4 +1,6 @@ /* +Print the jiffies every second. + Timers are callbacks that run when an interrupt happens, from the interrupt context itself. Therefore they produce more accurate timing than thread scheduling, which is more complex, @@ -15,12 +17,12 @@ See also: #include #include -static void callback(unsigned long data); +static void callback(struct timer_list *data); static unsigned long onesec; -DEFINE_TIMER(mytimer, callback, 0, 0); +DEFINE_TIMER(mytimer, callback); -static void callback(unsigned long data) +static void callback(struct timer_list *data) { pr_info("%u\n", (unsigned)jiffies); mod_timer(&mytimer, jiffies + onesec); diff --git a/linux b/linux index d4160b4..225d02d 160000 --- a/linux +++ b/linux @@ -1 +1 @@ -Subproject commit d4160b40c586e36c77600bf2a71ee00fc0a3e8a7 +Subproject commit 225d02dc63dd537b3c84abcbdcad2d81b8ec7f03 diff --git a/maintainers.md b/maintainers.md index 4188e7b..ab9c481 100644 --- a/maintainers.md +++ b/maintainers.md @@ -2,21 +2,22 @@ ## How to update the Linux kernel? -If you don't care about educational patches: - - cd linux - git fetch - git checkout master - -If you do: - last_mainline_revision=v4.14 - git rebase --onto master $last_mainline_revision - -Then rebuild the kernel: - + next_mainline_revision=v4.15 + cd linux + git remote add up git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git + git fetch up + git rebase --onto "$next_mainline_revision" "$last_mainline_revision" ./build -t linux-reconfigure +Create and push a tag to make things saner: + + git checkout -b "lkmc-${next_mainline_revision}" + git remote set-url origin git@github.com:cirosantilli/linux.git + git push --follow-tag + +and update the README! + Now, all you kernel modules may break, although they are usually trivial breaks of things moving around headers or to sub-structs. The userland, however, should simply not break, as Linus enforces strict backwards compatibility of userland interfaces.