diff --git a/README.md b/README.md index 49a5e1e..f18d117 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,13 @@ Compile kpatch: make -Install kpatch to /usr/local: +OPTIONAL: Install kpatch to /usr/local: sudo make install +Alternatively, the kpatch and kpatch-build scripts can be run directly from the +git tree. + Quick start ----------- @@ -51,10 +54,6 @@ Quick start kernel on any distribution, the "kpatch-build" command currently only works on Fedora.* -Load the kpatch core module: - - sudo insmod /usr/local/lib/modules/$(uname -r)/kpatch/kpatch.ko - Make a source patch against the kernel tree: # from a kernel git tree: @@ -67,7 +66,7 @@ Build the patch module: This outputs a patch module named `kpatch-foo.ko` in the current directory. Now apply it to the running kernel: - sudo insmod kpatch-foo.ko + sudo kpatch load kpatch-foo.ko Done! The kernel is now patched. diff --git a/kpatch/kpatch b/kpatch/kpatch index 370d66c..ce3dc04 100755 --- a/kpatch/kpatch +++ b/kpatch/kpatch @@ -26,6 +26,7 @@ KERNELRELEASE="$(uname -r)" SYSDIR="/usr/lib/kpatch/$KERNELRELEASE" USERDIR="/var/lib/kpatch/$KERNELRELEASE" +SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" usage () { echo "usage: kpatch []" >&2 @@ -72,6 +73,9 @@ find_module () { } find_core_module() { + COREMOD="$SCRIPTDIR"/../kmod/core/kpatch.ko + [[ -f "$COREMOD" ]] && return + COREMOD="/usr/local/lib/modules/$(uname -r)/kpatch/kpatch.ko" [[ -f "$COREMOD" ]] && return