From de40ff3e545c6a23ca4c338bf37b8c1112fbd0a3 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Fri, 2 May 2014 16:09:49 -0500 Subject: [PATCH] kmod/core: check for needed kernel config options Yes, this is ugly. There's a much cleaner way to do this for an in-tree module, but this is the only way I know how to do it here. --- kmod/core/Makefile | 2 -- kmod/core/core.c | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kmod/core/Makefile b/kmod/core/Makefile index 44e88c7..a47b7af 100644 --- a/kmod/core/Makefile +++ b/kmod/core/Makefile @@ -19,7 +19,5 @@ clean: # kbuild rules -ifdef CONFIG_HAVE_FENTRY obj-m := kpatch.o kpatch-y := core.o -endif diff --git a/kmod/core/core.c b/kmod/core/core.c index 9f9ddd3..2e18f9b 100644 --- a/kmod/core/core.c +++ b/kmod/core/core.c @@ -44,6 +44,13 @@ #include #include "kpatch.h" +#if !defined(CONFIG_FUNCTION_TRACER) || \ + !defined(CONFIG_HAVE_FENTRY) || \ + !defined(CONFIG_MODULES) || \ + !defined(CONFIG_SYSFS) +#error "CONFIG_FUNCTION_TRACER, CONFIG_HAVE_FENTRY, CONFIG_MODULES, and CONFIG_SYSFS kernel config options are required" +#endif + #define KPATCH_HASH_BITS 8 static DEFINE_HASHTABLE(kpatch_func_hash, KPATCH_HASH_BITS);