mirror of
https://github.com/versity/scoutfs.git
synced 2026-06-01 01:06:21 +00:00
Make it easier to build scoutfs.ko
We were duplicating the make args a few times so make a little ARGS variable. Default to the /lib/modules/$(uname -r) installed kernel source if SK_KSRC isn't set. And only try a sparse build that can fail if we can execute the sparse command. Signed-off-by: Zach Brown <zab@versity.com> Reviewed-by: Mark Fasheh <mfasheh@versity.com>
This commit is contained in:
@@ -1,38 +1,24 @@
|
||||
ALL: module
|
||||
|
||||
#
|
||||
# SK_KSRC points to the kernel header build dir to build against.
|
||||
# On a running machine this could be /lib/modules/$(uname -r)/build with
|
||||
# the right kernel-headers package installed. I tend to build on other
|
||||
# hosts so I extract the kernel-headers package for the target machine's
|
||||
# kernel in a dir somehere.
|
||||
#
|
||||
# sparse is critical for avoiding endian mistakes. It should just work
|
||||
# if the sparse package is installed.
|
||||
#
|
||||
# but sometimes kernel-headers are broken. For example, the
|
||||
# rhel 3.10.0-327.el7.x86_64 kernel needs the following patch.
|
||||
# We'll try to have a git tree with fixed headers.
|
||||
#
|
||||
#
|
||||
# diff --git a/include/linux/rh_kabi.h b/include/linux/rh_kabi.h
|
||||
# index 1767770..0a8e5f3 100644
|
||||
# --- a/include/linux/rh_kabi.h
|
||||
# +++ b/include/linux/rh_kabi.h
|
||||
# @@ -73,7 +73,6 @@
|
||||
# struct { \
|
||||
# _orig; \
|
||||
# } __UNIQUE_ID(rh_kabi_hide); \
|
||||
# - __RH_KABI_CHECK_SIZE_ALIGN(_orig, _new); \
|
||||
# }
|
||||
#
|
||||
# #define _RH_KABI_REPLACE_UNSAFE(_orig, _new) _new
|
||||
# default to building against the installed source for the running kernel
|
||||
ifeq ($(SK_KSRC),)
|
||||
SK_KSRC := $(shell echo /lib/modules/`uname -r`/build)
|
||||
endif
|
||||
|
||||
# fail if sparse fails if we find it
|
||||
ifeq ($(shell sparse && echo found),found)
|
||||
SP =
|
||||
else
|
||||
SP = @:
|
||||
endif
|
||||
|
||||
ARGS := CONFIG_SCOUTFS_FS=m -C $(SK_KSRC) M=$(CURDIR)/src
|
||||
|
||||
all: module
|
||||
|
||||
module:
|
||||
make CONFIG_SCOUTFS_FS=m -C $(SK_KSRC) M=$(CURDIR)/src
|
||||
make C=2 CF="-D__CHECK_ENDIAN__" CONFIG_SCOUTFS_FS=m -C $(SK_KSRC) M=$(CURDIR)/src
|
||||
make $(ARGS)
|
||||
$(SP) make C=2 CF="-D__CHECK_ENDIAN__" $(ARGS)
|
||||
|
||||
clean:
|
||||
make CONFIG_SCOUTFS_FS=m -C $(SK_KSRC) M=$(CURDIR)/src clean
|
||||
make $(ARGS) clean
|
||||
|
||||
Reference in New Issue
Block a user