Merge branch 'builtin-clean'
Support in-tree builtin module building. These commits add support for compiling the SPL module as a built-in kernel module by copying the module code into the kernel source tree. Here's the procedure: - Create your kernel configuration (`.config` file) as usual. This has to be done first so that SPL's configure script is able to detect kernel features correctly. - Run `make prepare scripts` inside the kernel source tree. - Run `./configure --enable-linux-builtin --with-linux=/usr/src/linux-...` inside the SPL directory. - Run `./copy-builtin /usr/src/linux-...` inside the SPL directory. - In the kernel source tree, enable the `CONFIG_SPL` option (e.g. using `make menuconfig`). - Build the kernel as usual. SPL module parameters can be set at boot time using the following syntax on the kernel command line: `spl.parameter_name=parameter_value`. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue zfsonlinux/zfs#851
This commit is contained in:
commit
744038069d
70
Makefile.in
70
Makefile.in
|
@ -845,20 +845,18 @@ uninstall-am:
|
||||||
|
|
||||||
|
|
||||||
srpm-modules:
|
srpm-modules:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
|
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
|
||||||
|
|
||||||
srpm-utils:
|
srpm-utils:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
|
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
|
||||||
|
|
||||||
srpm: srpm-modules srpm-utils
|
srpm: srpm-modules srpm-utils
|
||||||
|
|
||||||
rpm-modules: srpm-modules
|
rpm-modules: srpm-modules
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
|
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
|
||||||
|
|
||||||
rpm-utils: srpm-utils
|
rpm-utils: srpm-utils
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
|
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
|
||||||
|
|
||||||
rpm-modules: srpm-modules
|
|
||||||
|
|
||||||
rpm: rpm-modules rpm-utils
|
rpm: rpm-modules rpm-utils
|
||||||
|
|
||||||
|
@ -936,22 +934,22 @@ deb-local:
|
||||||
fi)
|
fi)
|
||||||
|
|
||||||
deb-modules: deb-local rpm-modules
|
deb-modules: deb-local rpm-modules
|
||||||
name=${PACKAGE}-modules; \
|
@CONFIG_KERNEL_TRUE@ name=${PACKAGE}-modules; \
|
||||||
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
@CONFIG_KERNEL_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
||||||
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
@CONFIG_KERNEL_TRUE@ release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
||||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
@CONFIG_KERNEL_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
||||||
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
|
@CONFIG_KERNEL_TRUE@ pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
|
||||||
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
@CONFIG_KERNEL_TRUE@ pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
||||||
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
|
@CONFIG_KERNEL_TRUE@ fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
|
||||||
$(RM) $$pkg1 $$pkg2
|
@CONFIG_KERNEL_TRUE@ $(RM) $$pkg1 $$pkg2
|
||||||
|
|
||||||
deb-utils: deb-local rpm-utils
|
deb-utils: deb-local rpm-utils
|
||||||
name=${PACKAGE}; \
|
@CONFIG_USER_TRUE@ name=${PACKAGE}; \
|
||||||
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
@CONFIG_USER_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
||||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
@CONFIG_USER_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
||||||
pkg1=$${name}-$${version}.$${arch}.rpm; \
|
@CONFIG_USER_TRUE@ pkg1=$${name}-$${version}.$${arch}.rpm; \
|
||||||
fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
|
@CONFIG_USER_TRUE@ fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
|
||||||
$(RM) $$pkg1
|
@CONFIG_USER_TRUE@ $(RM) $$pkg1
|
||||||
|
|
||||||
deb: deb-modules deb-utils
|
deb: deb-modules deb-utils
|
||||||
|
|
||||||
|
@ -965,22 +963,22 @@ tgz-local:
|
||||||
fi)
|
fi)
|
||||||
|
|
||||||
tgz-modules: tgz-local rpm-modules
|
tgz-modules: tgz-local rpm-modules
|
||||||
name=${PACKAGE}-modules; \
|
@CONFIG_KERNEL_TRUE@ name=${PACKAGE}-modules; \
|
||||||
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
@CONFIG_KERNEL_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
||||||
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
@CONFIG_KERNEL_TRUE@ release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
||||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
@CONFIG_KERNEL_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
||||||
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
|
@CONFIG_KERNEL_TRUE@ pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
|
||||||
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
@CONFIG_KERNEL_TRUE@ pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
||||||
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
|
@CONFIG_KERNEL_TRUE@ fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
|
||||||
$(RM) $$pkg1 $$pkg2
|
@CONFIG_KERNEL_TRUE@ $(RM) $$pkg1 $$pkg2
|
||||||
|
|
||||||
tgz-utils: tgz-local rpm-utils
|
tgz-utils: tgz-local rpm-utils
|
||||||
name=${PACKAGE}; \
|
@CONFIG_USER_TRUE@ name=${PACKAGE}; \
|
||||||
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
@CONFIG_USER_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
||||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
@CONFIG_USER_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
||||||
pkg1=$${name}-$${version}.$${arch}.rpm; \
|
@CONFIG_USER_TRUE@ pkg1=$${name}-$${version}.$${arch}.rpm; \
|
||||||
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \
|
@CONFIG_USER_TRUE@ fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \
|
||||||
$(RM) $$pkg1
|
@CONFIG_USER_TRUE@ $(RM) $$pkg1
|
||||||
|
|
||||||
tgz: tgz-modules tgz-utils
|
tgz: tgz-modules tgz-utils
|
||||||
|
|
||||||
|
@ -993,10 +991,10 @@ sarch-utils:
|
||||||
sarch: sarch-modules sarch-utils
|
sarch: sarch-modules sarch-utils
|
||||||
|
|
||||||
arch-modules:
|
arch-modules:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common
|
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common
|
||||||
|
|
||||||
arch-utils:
|
arch-utils:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common
|
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common
|
||||||
|
|
||||||
arch: arch-modules arch-utils
|
arch: arch-modules arch-utils
|
||||||
|
|
||||||
|
|
|
@ -11,5 +11,11 @@ To build packages for your distribution:
|
||||||
$ ./configure
|
$ ./configure
|
||||||
$ make pkg
|
$ make pkg
|
||||||
|
|
||||||
|
To copy the kernel code inside your kernel source tree for builtin
|
||||||
|
compilation:
|
||||||
|
|
||||||
|
$ ./configure --enable-linux-builtin --with-linux=/usr/src/linux-...
|
||||||
|
$ ./copy-builtin /usr/src/linux-...
|
||||||
|
|
||||||
Full documentation for building, configuring, and using the SPL can
|
Full documentation for building, configuring, and using the SPL can
|
||||||
be found at: <http://zfsonlinux.org>
|
be found at: <http://zfsonlinux.org>
|
||||||
|
|
|
@ -13,10 +13,14 @@ sarch-utils:
|
||||||
sarch: sarch-modules sarch-utils
|
sarch: sarch-modules sarch-utils
|
||||||
|
|
||||||
arch-modules:
|
arch-modules:
|
||||||
|
if CONFIG_KERNEL
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common
|
||||||
|
endif
|
||||||
|
|
||||||
arch-utils:
|
arch-utils:
|
||||||
|
if CONFIG_USER
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common
|
||||||
|
endif
|
||||||
|
|
||||||
arch: arch-modules arch-utils
|
arch: arch-modules arch-utils
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ deb-local:
|
||||||
fi)
|
fi)
|
||||||
|
|
||||||
deb-modules: deb-local rpm-modules
|
deb-modules: deb-local rpm-modules
|
||||||
|
if CONFIG_KERNEL
|
||||||
name=${PACKAGE}-modules; \
|
name=${PACKAGE}-modules; \
|
||||||
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
||||||
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
||||||
|
@ -37,13 +38,16 @@ deb-modules: deb-local rpm-modules
|
||||||
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
||||||
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
|
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
|
||||||
$(RM) $$pkg1 $$pkg2
|
$(RM) $$pkg1 $$pkg2
|
||||||
|
endif
|
||||||
|
|
||||||
deb-utils: deb-local rpm-utils
|
deb-utils: deb-local rpm-utils
|
||||||
|
if CONFIG_USER
|
||||||
name=${PACKAGE}; \
|
name=${PACKAGE}; \
|
||||||
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
||||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
||||||
pkg1=$${name}-$${version}.$${arch}.rpm; \
|
pkg1=$${name}-$${version}.$${arch}.rpm; \
|
||||||
fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
|
fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
|
||||||
$(RM) $$pkg1
|
$(RM) $$pkg1
|
||||||
|
endif
|
||||||
|
|
||||||
deb: deb-modules deb-utils
|
deb: deb-modules deb-utils
|
||||||
|
|
|
@ -7,20 +7,26 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
srpm-modules:
|
srpm-modules:
|
||||||
|
if CONFIG_KERNEL
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
|
||||||
|
endif
|
||||||
|
|
||||||
srpm-utils:
|
srpm-utils:
|
||||||
|
if CONFIG_USER
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
|
||||||
|
endif
|
||||||
|
|
||||||
srpm: srpm-modules srpm-utils
|
srpm: srpm-modules srpm-utils
|
||||||
|
|
||||||
rpm-modules: srpm-modules
|
rpm-modules: srpm-modules
|
||||||
|
if CONFIG_KERNEL
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
|
||||||
|
endif
|
||||||
|
|
||||||
rpm-utils: srpm-utils
|
rpm-utils: srpm-utils
|
||||||
|
if CONFIG_USER
|
||||||
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
|
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
|
||||||
|
endif
|
||||||
rpm-modules: srpm-modules
|
|
||||||
|
|
||||||
rpm: rpm-modules rpm-utils
|
rpm: rpm-modules rpm-utils
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
|
||||||
SPL_AC_DEBUG_LOG
|
SPL_AC_DEBUG_LOG
|
||||||
SPL_AC_DEBUG_KMEM
|
SPL_AC_DEBUG_KMEM
|
||||||
SPL_AC_DEBUG_KMEM_TRACKING
|
SPL_AC_DEBUG_KMEM_TRACKING
|
||||||
|
SPL_AC_TEST_MODULE
|
||||||
SPL_AC_ATOMIC_SPINLOCK
|
SPL_AC_ATOMIC_SPINLOCK
|
||||||
SPL_AC_TYPE_ATOMIC64_CMPXCHG
|
SPL_AC_TYPE_ATOMIC64_CMPXCHG
|
||||||
SPL_AC_TYPE_ATOMIC64_XCHG
|
SPL_AC_TYPE_ATOMIC64_XCHG
|
||||||
|
@ -94,7 +95,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
|
||||||
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
|
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
|
||||||
modpost=$LINUX/scripts/Makefile.modpost
|
modpost=$LINUX/scripts/Makefile.modpost
|
||||||
AC_MSG_CHECKING([kernel file name for module symbols])
|
AC_MSG_CHECKING([kernel file name for module symbols])
|
||||||
if test -f "$modpost"; then
|
if test "x$enable_linux_builtin" != xyes -a -f "$modpost"; then
|
||||||
if grep -q Modules.symvers $modpost; then
|
if grep -q Modules.symvers $modpost; then
|
||||||
LINUX_SYMBOLS=Modules.symvers
|
LINUX_SYMBOLS=Modules.symvers
|
||||||
else
|
else
|
||||||
|
@ -136,7 +137,7 @@ AC_DEFUN([SPL_AC_KERNEL], [
|
||||||
sourcelink=$(readlink -f "$headersdir")
|
sourcelink=$(readlink -f "$headersdir")
|
||||||
else
|
else
|
||||||
sourcelink=$(ls -1d /usr/src/kernels/* \
|
sourcelink=$(ls -1d /usr/src/kernels/* \
|
||||||
/usr/src/linux-* \
|
/usr/src/linux-* \
|
||||||
2>/dev/null | grep -v obj | tail -1)
|
2>/dev/null | grep -v obj | tail -1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -196,7 +197,13 @@ AC_DEFUN([SPL_AC_KERNEL], [
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([Not found])
|
AC_MSG_RESULT([Not found])
|
||||||
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
|
if test "x$enable_linux_builtin" != xyes; then
|
||||||
|
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** Cannot find UTS_RELEASE definition.
|
||||||
|
*** Please run 'make prepare' inside the kernel source tree.])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_RESULT([$kernsrcver])
|
AC_MSG_RESULT([$kernsrcver])
|
||||||
|
@ -439,34 +446,38 @@ AC_DEFUN([SPL_AC_LICENSE], [
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([SPL_AC_CONFIG], [
|
AC_DEFUN([SPL_AC_CONFIG], [
|
||||||
SPL_CONFIG=all
|
SPL_CONFIG=all
|
||||||
AC_ARG_WITH([config],
|
AC_ARG_WITH([config],
|
||||||
AS_HELP_STRING([--with-config=CONFIG],
|
AS_HELP_STRING([--with-config=CONFIG],
|
||||||
[Config file 'kernel|user|all|srpm']),
|
[Config file 'kernel|user|all|srpm']),
|
||||||
[SPL_CONFIG="$withval"])
|
[SPL_CONFIG="$withval"])
|
||||||
|
AC_ARG_ENABLE([linux-builtin],
|
||||||
|
[AC_HELP_STRING([--enable-linux-builtin],
|
||||||
|
[Configure for builtin in-tree kernel modules @<:@default=no@:>@])],
|
||||||
|
[],
|
||||||
|
[enable_linux_builtin=no])
|
||||||
|
|
||||||
AC_MSG_CHECKING([spl config])
|
AC_MSG_CHECKING([spl config])
|
||||||
AC_MSG_RESULT([$SPL_CONFIG]);
|
AC_MSG_RESULT([$SPL_CONFIG]);
|
||||||
AC_SUBST(SPL_CONFIG)
|
AC_SUBST(SPL_CONFIG)
|
||||||
|
|
||||||
case "$SPL_CONFIG" in
|
case "$SPL_CONFIG" in
|
||||||
kernel) SPL_AC_CONFIG_KERNEL ;;
|
kernel) SPL_AC_CONFIG_KERNEL ;;
|
||||||
user) SPL_AC_CONFIG_USER ;;
|
user) SPL_AC_CONFIG_USER ;;
|
||||||
all) SPL_AC_CONFIG_KERNEL
|
all) SPL_AC_CONFIG_KERNEL
|
||||||
SPL_AC_CONFIG_USER ;;
|
SPL_AC_CONFIG_USER ;;
|
||||||
srpm) ;;
|
srpm) ;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_RESULT([Error!])
|
AC_MSG_RESULT([Error!])
|
||||||
AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
|
AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
|
||||||
user kernel|user|all|srpm]) ;;
|
user kernel|user|all|srpm]) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AM_CONDITIONAL([CONFIG_USER],
|
AM_CONDITIONAL([CONFIG_USER],
|
||||||
[test "$SPL_CONFIG" = user] ||
|
[test "$SPL_CONFIG" = user -o "$SPL_CONFIG" = all])
|
||||||
[test "$SPL_CONFIG" = all])
|
AM_CONDITIONAL([CONFIG_KERNEL],
|
||||||
AM_CONDITIONAL([CONFIG_KERNEL],
|
[test "$SPL_CONFIG" = kernel -o "$SPL_CONFIG" = all] &&
|
||||||
[test "$SPL_CONFIG" = kernel] ||
|
[test "x$enable_linux_builtin" != xyes ])
|
||||||
[test "$SPL_CONFIG" = all])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -620,12 +631,14 @@ dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
|
AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
|
||||||
m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
|
m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
|
||||||
rm -Rf build && mkdir -p build
|
rm -Rf build && mkdir -p build && touch build/conftest.mod.c
|
||||||
echo "obj-m := conftest.o" >build/Makefile
|
echo "obj-m := conftest.o" >build/Makefile
|
||||||
|
modpost_flag=''
|
||||||
|
test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
|
||||||
AS_IF(
|
AS_IF(
|
||||||
[AC_TRY_COMMAND(cp conftest.c build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
|
[AC_TRY_COMMAND(cp conftest.c build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
|
||||||
[$4],
|
[$4],
|
||||||
[_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
|
[_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
|
||||||
)
|
)
|
||||||
rm -Rf build
|
rm -Rf build
|
||||||
])
|
])
|
||||||
|
@ -665,8 +678,7 @@ dnl #
|
||||||
dnl # SPL_CHECK_SYMBOL_EXPORT
|
dnl # SPL_CHECK_SYMBOL_EXPORT
|
||||||
dnl # check symbol exported or not
|
dnl # check symbol exported or not
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
|
AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], [
|
||||||
[AC_MSG_CHECKING([whether symbol $1 is exported])
|
|
||||||
grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
|
grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
|
||||||
$LINUX_OBJ/Module*.symvers 2>/dev/null
|
$LINUX_OBJ/Module*.symvers 2>/dev/null
|
||||||
rc=$?
|
rc=$?
|
||||||
|
@ -676,24 +688,42 @@ AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
|
||||||
grep -q -E "EXPORT_SYMBOL.*($1)" \
|
grep -q -E "EXPORT_SYMBOL.*($1)" \
|
||||||
"$LINUX_OBJ/$file" 2>/dev/null
|
"$LINUX_OBJ/$file" 2>/dev/null
|
||||||
rc=$?
|
rc=$?
|
||||||
if test $rc -eq 0; then
|
if test $rc -eq 0; then
|
||||||
export=1
|
export=1
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if test $export -eq 0; then
|
if test $export -eq 0; then :
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
$4
|
$4
|
||||||
else
|
else :
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
$3
|
$3
|
||||||
fi
|
fi
|
||||||
else
|
else :
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
$3
|
$3
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # SPL_LINUX_TRY_COMPILE_SYMBOL
|
||||||
|
dnl # like SPL_LINUX_TRY_COMPILE, except SPL_CHECK_SYMBOL_EXPORT
|
||||||
|
dnl # is called if not compiling for builtin
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([SPL_LINUX_TRY_COMPILE_SYMBOL], [
|
||||||
|
SPL_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1])
|
||||||
|
if test $rc -ne 0; then :
|
||||||
|
$6
|
||||||
|
else
|
||||||
|
if test "x$enable_linux_builtin" != xyes; then
|
||||||
|
SPL_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1])
|
||||||
|
fi
|
||||||
|
if test $rc -ne 0; then :
|
||||||
|
$6
|
||||||
|
else :
|
||||||
|
$5
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # SPL_CHECK_SYMBOL_HEADER
|
dnl # SPL_CHECK_SYMBOL_HEADER
|
||||||
dnl # check if a symbol prototype is defined in listed headers.
|
dnl # check if a symbol prototype is defined in listed headers.
|
||||||
|
@ -704,10 +734,10 @@ AC_DEFUN([SPL_CHECK_SYMBOL_HEADER], [
|
||||||
for file in $3; do
|
for file in $3; do
|
||||||
grep -q "$2" "$LINUX/$file" 2>/dev/null
|
grep -q "$2" "$LINUX/$file" 2>/dev/null
|
||||||
rc=$?
|
rc=$?
|
||||||
if test $rc -eq 0; then
|
if test $rc -eq 0; then
|
||||||
header=1
|
header=1
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if test $header -eq 0; then
|
if test $header -eq 0; then
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
|
@ -738,6 +768,25 @@ AC_DEFUN([SPL_CHECK_HEADER],
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # Basic toolchain sanity check.
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([SPL_AC_TEST_MODULE],
|
||||||
|
[AC_MSG_CHECKING([whether modules can be built])
|
||||||
|
SPL_LINUX_TRY_COMPILE([],[],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
if test "x$enable_linux_builtin" != xyes; then
|
||||||
|
AC_MSG_ERROR([*** Unable to build an empty module.])
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([
|
||||||
|
*** Unable to build an empty module.
|
||||||
|
*** Please run 'make scripts' inside the kernel source tree.])
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # Use the atomic implemenation based on global spinlocks. This
|
dnl # Use the atomic implemenation based on global spinlocks. This
|
||||||
dnl # should only be needed by 32-bit kernels which do not provide
|
dnl # should only be needed by 32-bit kernels which do not provide
|
||||||
|
@ -959,10 +1008,18 @@ AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
|
||||||
dnl #
|
dnl #
|
||||||
dnl # Custom SPL patch may export this system it is not required
|
dnl # Custom SPL patch may export this system it is not required
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_TASK_CURR], [
|
AC_DEFUN([SPL_AC_TASK_CURR],
|
||||||
SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
|
[AC_MSG_CHECKING([whether task_curr() is available])
|
||||||
[AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[])
|
#include <linux/sched.h>
|
||||||
|
], [
|
||||||
|
task_curr(NULL);
|
||||||
|
], [task_curr], [kernel/sched.c], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1028,13 +1085,15 @@ dnl # 2.6.18 API change, check whether device_create() is available.
|
||||||
dnl # Device_create() was introduced in 2.6.18 and depricated
|
dnl # Device_create() was introduced in 2.6.18 and depricated
|
||||||
dnl # class_device_create() which was fully removed in 2.6.26.
|
dnl # class_device_create() which was fully removed in 2.6.26.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_DEVICE_CREATE], [
|
AC_DEFUN([SPL_AC_DEVICE_CREATE],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether device_create() is available])
|
||||||
[device_create],
|
SPL_CHECK_SYMBOL_EXPORT([device_create], [drivers/base/core.c], [
|
||||||
[drivers/base/core.c],
|
AC_MSG_RESULT(yes)
|
||||||
[AC_DEFINE(HAVE_DEVICE_CREATE, 1,
|
AC_DEFINE(HAVE_DEVICE_CREATE, 1,
|
||||||
[device_create() is available])],
|
[device_create() is available])
|
||||||
[])
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1064,25 +1123,37 @@ dnl # 2.6.13 API change, check whether class_device_create() is available.
|
||||||
dnl # Class_device_create() was introduced in 2.6.13 and depricated
|
dnl # Class_device_create() was introduced in 2.6.13 and depricated
|
||||||
dnl # class_simple_device_add() which was fully removed in 2.6.13.
|
dnl # class_simple_device_add() which was fully removed in 2.6.13.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
|
AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether class_device_create() is available])
|
||||||
[class_device_create],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[drivers/base/class.c],
|
#include <linux/device.h>
|
||||||
[AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
|
], [
|
||||||
[class_device_create() is available])],
|
class_device_create(NULL, NULL, 0, NULL, NULL);
|
||||||
[])
|
], [class_device_create], [drivers/base/class.c], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
|
||||||
|
[class_device_create() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.26 API change, set_normalized_timespec() is exported.
|
dnl # 2.6.26 API change, set_normalized_timespec() is exported.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
|
AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether set_normalized_timespec() is available as export])
|
||||||
[set_normalized_timespec],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[kernel/time.c],
|
#include <linux/time.h>
|
||||||
[AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
|
], [
|
||||||
[set_normalized_timespec() is available as export])],
|
set_normalized_timespec(NULL, 0, 0);
|
||||||
[])
|
], [set_normalized_timespec], [kernel/time.c], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
|
||||||
|
[set_normalized_timespec() is available as export])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1232,13 +1303,19 @@ dnl # 2.6.9 API change,
|
||||||
dnl # check whether 'monotonic_clock()' is available it may
|
dnl # check whether 'monotonic_clock()' is available it may
|
||||||
dnl # be available for some archs but not others.
|
dnl # be available for some archs but not others.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
|
AC_DEFUN([SPL_AC_MONOTONIC_CLOCK],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether monotonic_clock() is available])
|
||||||
[monotonic_clock],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/timex.h>
|
||||||
[AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
|
], [
|
||||||
[monotonic_clock() is available])],
|
monotonic_clock();
|
||||||
[])
|
], [monotonic_clock], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
|
||||||
|
[monotonic_clock() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1352,13 +1429,19 @@ dnl #
|
||||||
dnl # 2.6.18 API change,
|
dnl # 2.6.18 API change,
|
||||||
dnl # kallsyms_lookup_name no longer exported
|
dnl # kallsyms_lookup_name no longer exported
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
|
AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether kallsyms_lookup_name() is available])
|
||||||
[kallsyms_lookup_name],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/kallsyms.h>
|
||||||
[AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
|
], [
|
||||||
[kallsyms_lookup_name() is available])],
|
kallsyms_lookup_name(NULL);
|
||||||
[])
|
], [kallsyms_lookup_name], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
|
||||||
|
[kallsyms_lookup_name() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1368,13 +1451,15 @@ dnl # custom kernel with the *-spl-export-symbols.patch which will export
|
||||||
dnl # these symbols for use. If your already rolling a custom kernel for
|
dnl # these symbols for use. If your already rolling a custom kernel for
|
||||||
dnl # your environment this is recommended.
|
dnl # your environment this is recommended.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
|
AC_DEFUN([SPL_AC_GET_VMALLOC_INFO],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether get_vmalloc_info() is available])
|
||||||
[get_vmalloc_info],
|
SPL_CHECK_SYMBOL_EXPORT([get_vmalloc_info], [], [
|
||||||
[],
|
AC_MSG_RESULT(yes)
|
||||||
[AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
|
AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
|
||||||
[get_vmalloc_info() is available])],
|
[get_vmalloc_info() is available])
|
||||||
[])
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1396,7 +1481,7 @@ AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
|
||||||
rc=$?
|
rc=$?
|
||||||
if test $rc -eq 0; then
|
if test $rc -eq 0; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
|
AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
|
@ -1409,13 +1494,19 @@ dnl # custom kernel with the *-spl-export-symbols.patch which will export
|
||||||
dnl # these symbols for use. If your already rolling a custom kernel for
|
dnl # these symbols for use. If your already rolling a custom kernel for
|
||||||
dnl # your environment this is recommended.
|
dnl # your environment this is recommended.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
|
AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether first_online_pgdat() is available])
|
||||||
[first_online_pgdat],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/mmzone.h>
|
||||||
[AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
|
], [
|
||||||
[first_online_pgdat() is available])],
|
first_online_pgdat();
|
||||||
[])
|
], [first_online_pgdat], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
|
||||||
|
[first_online_pgdat() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1425,13 +1516,19 @@ dnl # custom kernel with the *-spl-export-symbols.patch which will export
|
||||||
dnl # these symbols for use. If your already rolling a custom kernel for
|
dnl # these symbols for use. If your already rolling a custom kernel for
|
||||||
dnl # your environment this is recommended.
|
dnl # your environment this is recommended.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
|
AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether next_online_pgdat() is available])
|
||||||
[next_online_pgdat],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/mmzone.h>
|
||||||
[AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
|
], [
|
||||||
[next_online_pgdat() is available])],
|
next_online_pgdat(NULL);
|
||||||
[])
|
], [next_online_pgdat], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
|
||||||
|
[next_online_pgdat() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1441,26 +1538,35 @@ dnl # custom kernel with the *-spl-export-symbols.patch which will export
|
||||||
dnl # these symbols for use. If your already rolling a custom kernel for
|
dnl # these symbols for use. If your already rolling a custom kernel for
|
||||||
dnl # your environment this is recommended.
|
dnl # your environment this is recommended.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_NEXT_ZONE], [
|
AC_DEFUN([SPL_AC_NEXT_ZONE],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether next_zone() is available])
|
||||||
[next_zone],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/mmzone.h>
|
||||||
[AC_DEFINE(HAVE_NEXT_ZONE, 1,
|
], [
|
||||||
[next_zone() is available])],
|
next_zone(NULL);
|
||||||
[])
|
], [next_zone], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_NEXT_ZONE, 1, [next_zone() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.17 API change,
|
dnl # 2.6.17 API change,
|
||||||
dnl # See SPL_AC_PGDAT_HELPERS for details.
|
dnl # See SPL_AC_PGDAT_HELPERS for details.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_PGDAT_LIST], [
|
AC_DEFUN([SPL_AC_PGDAT_LIST],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether pgdat_list is available])
|
||||||
[pgdat_list],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/topology.h>
|
||||||
[AC_DEFINE(HAVE_PGDAT_LIST, 1,
|
pg_data_t *tmp = pgdat_list;
|
||||||
[pgdat_list is available])],
|
], [], [pgdat_list], [], [
|
||||||
[])
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_PGDAT_LIST, 1, [pgdat_list is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1652,12 +1758,18 @@ AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
|
||||||
AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
|
AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
|
||||||
[get_zone_counts() is needed])
|
[get_zone_counts() is needed])
|
||||||
|
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
AC_MSG_CHECKING([whether get_zone_counts() is available])
|
||||||
[get_zone_counts],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/mmzone.h>
|
||||||
[AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
|
], [
|
||||||
[get_zone_counts() is available])],
|
get_zone_counts(NULL, NULL, NULL);
|
||||||
[])
|
], [get_zone_counts], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
|
||||||
|
[get_zone_counts() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -1665,25 +1777,37 @@ dnl #
|
||||||
dnl # 2.6.27 API change,
|
dnl # 2.6.27 API change,
|
||||||
dnl # The user_path_dir() replaces __user_walk()
|
dnl # The user_path_dir() replaces __user_walk()
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_USER_PATH_DIR], [
|
AC_DEFUN([SPL_AC_USER_PATH_DIR],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether user_path_dir() is available])
|
||||||
[user_path_at],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/fcntl.h>
|
||||||
[AC_DEFINE(HAVE_USER_PATH_DIR, 1,
|
#include <linux/namei.h>
|
||||||
[user_path_dir() is available])],
|
], [
|
||||||
[])
|
user_path_dir(NULL, NULL);
|
||||||
|
], [user_path_at], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_USER_PATH_DIR, 1, [user_path_dir() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # Symbol available in RHEL kernels not in stock kernels.
|
dnl # Symbol available in RHEL kernels not in stock kernels.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_SET_FS_PWD], [
|
AC_DEFUN([SPL_AC_SET_FS_PWD],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether set_fs_pwd() is available])
|
||||||
[set_fs_pwd],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/spinlock.h>
|
||||||
[AC_DEFINE(HAVE_SET_FS_PWD, 1,
|
#include <linux/fs_struct.h>
|
||||||
[set_fs_pwd() is available])],
|
], [
|
||||||
[])
|
(void) set_fs_pwd;
|
||||||
|
], [set_fs_pwd], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1791,26 +1915,37 @@ AC_DEFUN([SPL_AC_CRED_STRUCT], [
|
||||||
dnl #
|
dnl #
|
||||||
dnl # Custom SPL patch may export this symbol.
|
dnl # Custom SPL patch may export this symbol.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
|
AC_DEFUN([SPL_AC_GROUPS_SEARCH],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether groups_search() is available])
|
||||||
[groups_search],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/cred.h>
|
||||||
[AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
|
], [
|
||||||
[groups_search() is available])],
|
groups_search(NULL, 0);
|
||||||
[])
|
], [groups_search], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_GROUPS_SEARCH, 1, [groups_search() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.x API change,
|
dnl # 2.6.x API change,
|
||||||
dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
|
dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
|
AC_DEFUN([SPL_AC_PUT_TASK_STRUCT],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether __put_task_struct() is available])
|
||||||
[__put_task_struct],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/sched.h>
|
||||||
[AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
|
], [
|
||||||
[__put_task_struct() is available])],
|
__put_task_struct(NULL);
|
||||||
[])
|
], [__put_task_struct], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
|
||||||
|
[__put_task_struct() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1836,25 +1971,36 @@ dnl #
|
||||||
dnl # 2.6.x API change,
|
dnl # 2.6.x API change,
|
||||||
dnl # kvasprintf() function added.
|
dnl # kvasprintf() function added.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_KVASPRINTF], [
|
AC_DEFUN([SPL_AC_KVASPRINTF],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether kvasprintf() is available])
|
||||||
[kvasprintf],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/kernel.h>
|
||||||
[AC_DEFINE(HAVE_KVASPRINTF, 1,
|
], [
|
||||||
[kvasprintf() is available])],
|
kvasprintf(0, NULL, *((va_list*)NULL));
|
||||||
[])
|
], [kvasprintf], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_KVASPRINTF, 1, [kvasprintf() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # 2.6.29 API change,
|
dnl # 2.6.29 API change,
|
||||||
dnl # vfs_fsync() funcation added, prior to this use file_fsync().
|
dnl # vfs_fsync() funcation added, prior to this use file_fsync().
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_VFS_FSYNC], [
|
AC_DEFUN([SPL_AC_VFS_FSYNC],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether vfs_fsync() is available])
|
||||||
[vfs_fsync],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[fs/sync.c],
|
#include <linux/fs.h>
|
||||||
[AC_DEFINE(HAVE_VFS_FSYNC, 1, [vfs_fsync() is available])],
|
], [
|
||||||
[])
|
(void) vfs_fsync;
|
||||||
|
], [vfs_fsync], [fs/sync.c], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_VFS_FSYNC, 1, [vfs_fsync() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1882,13 +2028,18 @@ dnl # condition. The fixed version is exported as a symbol. The race
|
||||||
dnl # condition is fixed by acquiring sem->wait_lock, so we must not
|
dnl # condition is fixed by acquiring sem->wait_lock, so we must not
|
||||||
dnl # call that version while holding sem->wait_lock.
|
dnl # call that version while holding sem->wait_lock.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED], [
|
AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether rwsem_is_locked() acquires sem->wait_lock])
|
||||||
[rwsem_is_locked],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[lib/rwsem-spinlock.c],
|
#include <linux/rwsem.h>
|
||||||
[AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
|
int rwsem_is_locked(struct rw_semaphore *sem) { return 0; }
|
||||||
[rwsem_is_locked() acquires sem->wait_lock])],
|
], [], [rwsem_is_locked], [lib/rwsem-spinlock.c], [
|
||||||
[])
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
|
||||||
|
[rwsem_is_locked() acquires sem->wait_lock])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1905,18 +2056,31 @@ dnl # of these functions are exported invalidate_inodes() can be
|
||||||
dnl # safely used.
|
dnl # safely used.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
|
AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
AC_MSG_CHECKING([whether invalidate_inodes() is available])
|
||||||
[invalidate_inodes],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[],
|
#include <linux/fs.h>
|
||||||
[AC_DEFINE(HAVE_INVALIDATE_INODES, 1,
|
], [
|
||||||
[invalidate_inodes() is available])],
|
invalidate_inodes;
|
||||||
[])
|
], [invalidate_inodes], [], [
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
AC_MSG_RESULT(yes)
|
||||||
[invalidate_inodes_check],
|
AC_DEFINE(HAVE_INVALIDATE_INODES, 1,
|
||||||
[],
|
[invalidate_inodes() is available])
|
||||||
[AC_DEFINE(HAVE_INVALIDATE_INODES_CHECK, 1,
|
], [
|
||||||
[invalidate_inodes_check() is available])],
|
AC_MSG_RESULT(no)
|
||||||
[])
|
])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([whether invalidate_inodes_check() is available])
|
||||||
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
|
#include <linux/fs.h>
|
||||||
|
], [
|
||||||
|
invalidate_inodes_check(NULL, 0);
|
||||||
|
], [invalidate_inodes_check], [], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_INVALIDATE_INODES_CHECK, 1,
|
||||||
|
[invalidate_inodes_check() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1955,13 +2119,19 @@ dnl # There currently exists no exposed API to partially shrink the dcache.
|
||||||
dnl # The expected mechanism to shrink the cache is a registered shrinker
|
dnl # The expected mechanism to shrink the cache is a registered shrinker
|
||||||
dnl # which is called during memory pressure.
|
dnl # which is called during memory pressure.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_SHRINK_DCACHE_MEMORY], [
|
AC_DEFUN([SPL_AC_SHRINK_DCACHE_MEMORY],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether shrink_dcache_memory() is available])
|
||||||
[shrink_dcache_memory],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[fs/dcache.c],
|
#include <linux/dcache.h>
|
||||||
[AC_DEFINE(HAVE_SHRINK_DCACHE_MEMORY, 1,
|
], [
|
||||||
[shrink_dcache_memory() is available])],
|
shrink_dcache_memory(0, 0);
|
||||||
[])
|
], [shrink_dcache_memory], [fs/dcache.c], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_SHRINK_DCACHE_MEMORY, 1,
|
||||||
|
[shrink_dcache_memory() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -1970,13 +2140,19 @@ dnl # There currently exists no exposed API to partially shrink the icache.
|
||||||
dnl # The expected mechanism to shrink the cache is a registered shrinker
|
dnl # The expected mechanism to shrink the cache is a registered shrinker
|
||||||
dnl # which is called during memory pressure.
|
dnl # which is called during memory pressure.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY], [
|
AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether shrink_icache_memory() is available])
|
||||||
[shrink_icache_memory],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[fs/inode.c],
|
#include <linux/dcache.h>
|
||||||
[AC_DEFINE(HAVE_SHRINK_ICACHE_MEMORY, 1,
|
], [
|
||||||
[shrink_icache_memory() is available])],
|
shrink_icache_memory(0, 0);
|
||||||
[])
|
], [shrink_icache_memory], [fs/inode.c], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_SHRINK_ICACHE_MEMORY, 1,
|
||||||
|
[shrink_icache_memory() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -2002,13 +2178,19 @@ dnl # The kern_path_parent() symbol is no longer exported by the kernel.
|
||||||
dnl # However, it remains the prefered interface and since we still have
|
dnl # However, it remains the prefered interface and since we still have
|
||||||
dnl # access to the prototype we dynamically lookup the required address.
|
dnl # access to the prototype we dynamically lookup the required address.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([SPL_AC_KERN_PATH_PARENT_SYMBOL], [
|
AC_DEFUN([SPL_AC_KERN_PATH_PARENT_SYMBOL],
|
||||||
SPL_CHECK_SYMBOL_EXPORT(
|
[AC_MSG_CHECKING([whether kern_path_parent() is available])
|
||||||
[kern_path_parent],
|
SPL_LINUX_TRY_COMPILE_SYMBOL([
|
||||||
[fs/namei.c],
|
#include <linux/namei.h>
|
||||||
[AC_DEFINE(HAVE_KERN_PATH_PARENT_SYMBOL, 1,
|
], [
|
||||||
[kern_path_parent() is available])],
|
kern_path_parent(NULL, NULL);
|
||||||
[])
|
], [kern_path_parent], [fs/namei.c], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_KERN_PATH_PARENT_SYMBOL, 1,
|
||||||
|
[kern_path_parent() is available])
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
|
|
|
@ -22,6 +22,7 @@ tgz-local:
|
||||||
fi)
|
fi)
|
||||||
|
|
||||||
tgz-modules: tgz-local rpm-modules
|
tgz-modules: tgz-local rpm-modules
|
||||||
|
if CONFIG_KERNEL
|
||||||
name=${PACKAGE}-modules; \
|
name=${PACKAGE}-modules; \
|
||||||
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
||||||
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
|
||||||
|
@ -30,13 +31,16 @@ tgz-modules: tgz-local rpm-modules
|
||||||
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
|
||||||
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
|
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
|
||||||
$(RM) $$pkg1 $$pkg2
|
$(RM) $$pkg1 $$pkg2
|
||||||
|
endif
|
||||||
|
|
||||||
tgz-utils: tgz-local rpm-utils
|
tgz-utils: tgz-local rpm-utils
|
||||||
|
if CONFIG_USER
|
||||||
name=${PACKAGE}; \
|
name=${PACKAGE}; \
|
||||||
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
|
||||||
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
|
||||||
pkg1=$${name}-$${version}.$${arch}.rpm; \
|
pkg1=$${name}-$${version}.$${arch}.rpm; \
|
||||||
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \
|
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \
|
||||||
$(RM) $$pkg1
|
$(RM) $$pkg1
|
||||||
|
endif
|
||||||
|
|
||||||
tgz: tgz-modules tgz-utils
|
tgz: tgz-modules tgz-utils
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "usage: $0 <kernel source tree>" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$#" -eq 1 ] || usage
|
||||||
|
KERNEL_DIR="$(readlink --canonicalize-existing "$1")"
|
||||||
|
|
||||||
|
MODULES=()
|
||||||
|
for MODULE_DIR in module/*
|
||||||
|
do
|
||||||
|
[ -d "$MODULE_DIR" ] || continue
|
||||||
|
MODULES+=("${MODULE_DIR##*/}")
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! [ -e 'spl_config.h' ]
|
||||||
|
then
|
||||||
|
echo >&2
|
||||||
|
echo " $0: you did not run configure, or you're not in the SPL source directory." >&2
|
||||||
|
echo " $0: run configure with --with-linux=$KERNEL_DIR and --enable-linux-builtin." >&2
|
||||||
|
echo >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
make clean || true
|
||||||
|
|
||||||
|
rm -rf "$KERNEL_DIR/include/spl" "$KERNEL_DIR/spl"
|
||||||
|
cp --recursive include "$KERNEL_DIR/include/spl"
|
||||||
|
cp --recursive module "$KERNEL_DIR/spl"
|
||||||
|
cp spl_config.h "$KERNEL_DIR/"
|
||||||
|
|
||||||
|
adjust_obj_paths()
|
||||||
|
{
|
||||||
|
local FILE="$1"
|
||||||
|
local LINE OBJPATH
|
||||||
|
|
||||||
|
while IFS='' read -r LINE
|
||||||
|
do
|
||||||
|
OBJPATH="${LINE#\$(MODULE)-objs += }"
|
||||||
|
if [ "$OBJPATH" = "$LINE" ]
|
||||||
|
then
|
||||||
|
echo "$LINE"
|
||||||
|
else
|
||||||
|
echo "\$(MODULE)-objs += ${OBJPATH##*/}"
|
||||||
|
fi
|
||||||
|
done < "$FILE" > "$FILE.new"
|
||||||
|
mv "$FILE.new" "$FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
for MODULE in "${MODULES[@]}"
|
||||||
|
do
|
||||||
|
adjust_obj_paths "$KERNEL_DIR/spl/$MODULE/Makefile"
|
||||||
|
done
|
||||||
|
|
||||||
|
cat > "$KERNEL_DIR/spl/Kconfig" <<"EOF"
|
||||||
|
config SPL
|
||||||
|
tristate "Solaris Porting Layer (SPL)"
|
||||||
|
help
|
||||||
|
This is the SPL library from the ZFS On Linux project.
|
||||||
|
|
||||||
|
See http://zfsonlinux.org/
|
||||||
|
|
||||||
|
To compile this library as a module, choose M here.
|
||||||
|
|
||||||
|
If unsure, say N.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
{
|
||||||
|
cat <<-"EOF"
|
||||||
|
SPL_MODULE_CFLAGS = -I$(srctree)/include/spl
|
||||||
|
SPL_MODULE_CFLAGS += -include $(srctree)/spl_config.h
|
||||||
|
export SPL_MODULE_CFLAGS
|
||||||
|
|
||||||
|
obj-$(CONFIG_SPL) :=
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for MODULE in "${MODULES[@]}"
|
||||||
|
do
|
||||||
|
echo 'obj-$(CONFIG_SPL) += ' "$MODULE/"
|
||||||
|
done
|
||||||
|
} > "$KERNEL_DIR/spl/Kbuild"
|
||||||
|
|
||||||
|
add_after()
|
||||||
|
{
|
||||||
|
local FILE="$1"
|
||||||
|
local MARKER="$2"
|
||||||
|
local NEW="$3"
|
||||||
|
local LINE
|
||||||
|
|
||||||
|
while IFS='' read -r LINE
|
||||||
|
do
|
||||||
|
echo "$LINE"
|
||||||
|
|
||||||
|
if [ -n "$MARKER" -a "$LINE" = "$MARKER" ]
|
||||||
|
then
|
||||||
|
echo "$NEW"
|
||||||
|
MARKER=''
|
||||||
|
if IFS='' read -r LINE
|
||||||
|
then
|
||||||
|
[ "$LINE" != "$NEW" ] && echo "$LINE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$FILE" > "$FILE.new"
|
||||||
|
|
||||||
|
mv "$FILE.new" "$FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
add_after "$KERNEL_DIR/Kconfig" 'source "arch/$SRCARCH/Kconfig"' 'source "spl/Kconfig"'
|
||||||
|
# We must take care to build SPL before ZFS, else module initialization order will be wrong
|
||||||
|
sed -i 's#kernel/ mm/ fs/#kernel/ mm/ spl/ fs/#' "$KERNEL_DIR/Makefile"
|
||||||
|
|
||||||
|
echo >&2
|
||||||
|
echo " $0: done." >&2
|
||||||
|
echo " $0: now you can build the kernel with SPL support." >&2
|
||||||
|
echo " $0: make sure you enable SPL support (CONFIG_SPL) before building." >&2
|
||||||
|
echo >&2
|
||||||
|
|
|
@ -3,8 +3,12 @@ subdir-m += splat
|
||||||
|
|
||||||
INSTALL=/usr/bin/install
|
INSTALL=/usr/bin/install
|
||||||
|
|
||||||
|
SPL_MODULE_CFLAGS = -I@abs_top_srcdir@/include
|
||||||
|
SPL_MODULE_CFLAGS += -include @abs_top_builddir@/spl_config.h
|
||||||
|
export SPL_MODULE_CFLAGS
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
|
$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ CONFIG_SPL=m $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@# Only cleanup the kernel build directories when CONFIG_KERNEL
|
@# Only cleanup the kernel build directories when CONFIG_KERNEL
|
||||||
|
|
|
@ -1,29 +1,27 @@
|
||||||
# Makefile.in for spl kernel module
|
# Makefile.in for spl kernel module
|
||||||
|
|
||||||
MODULES := spl
|
MODULE := spl
|
||||||
EXTRA_CFLAGS = @KERNELCPPFLAGS@
|
EXTRA_CFLAGS = $(SPL_MODULE_CFLAGS) @KERNELCPPFLAGS@
|
||||||
EXTRA_CFLAGS += -I@abs_top_srcdir@/include
|
|
||||||
EXTRA_CFLAGS += -include @abs_top_builddir@/spl_config.h
|
|
||||||
|
|
||||||
# Solaris porting layer module
|
# Solaris porting layer module
|
||||||
obj-m := spl.o
|
obj-$(CONFIG_SPL) := $(MODULE).o
|
||||||
|
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-debug.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-debug.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-proc.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-proc.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-kmem.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-kmem.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-thread.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-thread.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-taskq.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-taskq.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-rwlock.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-rwlock.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-vnode.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-vnode.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-err.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-err.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-time.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-time.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-kobj.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-kobj.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-generic.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-generic.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-atomic.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-atomic.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-mutex.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-mutex.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-kstat.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-kstat.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-condvar.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-condvar.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-xdr.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-xdr.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-cred.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-cred.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-tsd.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-tsd.o
|
||||||
spl-objs += @top_srcdir@/module/spl/spl-zlib.o
|
$(MODULE)-objs += @top_srcdir@/module/spl/spl-zlib.o
|
||||||
|
|
|
@ -546,11 +546,29 @@ hostid_exec(void)
|
||||||
uint32_t
|
uint32_t
|
||||||
zone_get_hostid(void *zone)
|
zone_get_hostid(void *zone)
|
||||||
{
|
{
|
||||||
|
static int first = 1;
|
||||||
unsigned long hostid;
|
unsigned long hostid;
|
||||||
|
int rc;
|
||||||
|
|
||||||
/* Only the global zone is supported */
|
/* Only the global zone is supported */
|
||||||
ASSERT(zone == NULL);
|
ASSERT(zone == NULL);
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
first = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the hostid if it was not passed as a module parameter.
|
||||||
|
* Try reading the /etc/hostid file directly, and then fall
|
||||||
|
* back to calling the /usr/bin/hostid utility.
|
||||||
|
*/
|
||||||
|
if ((spl_hostid == HW_INVALID_HOSTID) &&
|
||||||
|
(rc = hostid_read()) && (rc = hostid_exec()))
|
||||||
|
return HW_INVALID_HOSTID;
|
||||||
|
|
||||||
|
printk(KERN_NOTICE "SPL: using hostid 0x%08x\n",
|
||||||
|
(unsigned int) spl_hostid);
|
||||||
|
}
|
||||||
|
|
||||||
if (ddi_strtoul(hw_serial, NULL, HW_HOSTID_LEN-1, &hostid) != 0)
|
if (ddi_strtoul(hw_serial, NULL, HW_HOSTID_LEN-1, &hostid) != 0)
|
||||||
return HW_INVALID_HOSTID;
|
return HW_INVALID_HOSTID;
|
||||||
|
|
||||||
|
@ -632,16 +650,6 @@ __init spl_init(void)
|
||||||
if ((rc = spl_zlib_init()))
|
if ((rc = spl_zlib_init()))
|
||||||
SGOTO(out9, rc);
|
SGOTO(out9, rc);
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the hostid if it was not passed as a module parameter. Try
|
|
||||||
* reading the /etc/hostid file directly, and then fall back to calling
|
|
||||||
* the /usr/bin/hostid utility.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (spl_hostid == HW_INVALID_HOSTID
|
|
||||||
&& (rc = hostid_read()) && (rc = hostid_exec()))
|
|
||||||
SGOTO(out10, rc = -EADDRNOTAVAIL);
|
|
||||||
|
|
||||||
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
|
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
|
||||||
if ((rc = set_kallsyms_lookup_name()))
|
if ((rc = set_kallsyms_lookup_name()))
|
||||||
SGOTO(out10, rc = -EADDRNOTAVAIL);
|
SGOTO(out10, rc = -EADDRNOTAVAIL);
|
||||||
|
@ -653,9 +661,8 @@ __init spl_init(void)
|
||||||
if ((rc = spl_vn_init_kallsyms_lookup()))
|
if ((rc = spl_vn_init_kallsyms_lookup()))
|
||||||
SGOTO(out10, rc);
|
SGOTO(out10, rc);
|
||||||
|
|
||||||
printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s, using hostid "
|
printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION,
|
||||||
"0x%08x\n", SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR,
|
SPL_META_RELEASE, SPL_DEBUG_STR);
|
||||||
(unsigned int) spl_hostid);
|
|
||||||
SRETURN(rc);
|
SRETURN(rc);
|
||||||
out10:
|
out10:
|
||||||
spl_zlib_fini();
|
spl_zlib_fini();
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
* unavailable we provide a standard mutex.
|
* unavailable we provide a standard mutex.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HAVE_MUTEX_OWNER
|
#if !defined(HAVE_MUTEX_OWNER) || !defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES)
|
||||||
#ifdef HAVE_TASK_CURR
|
#ifdef HAVE_TASK_CURR
|
||||||
/*
|
/*
|
||||||
* mutex_spin_max = { 0, -1, 1-MAX_INT }
|
* mutex_spin_max = { 0, -1, 1-MAX_INT }
|
||||||
|
|
|
@ -1,27 +1,25 @@
|
||||||
# Makefile.in for splat kernel module
|
# Makefile.in for splat kernel module
|
||||||
|
|
||||||
MODULES := splat
|
MODULE := splat
|
||||||
EXTRA_CFLAGS = @KERNELCPPFLAGS@
|
EXTRA_CFLAGS = $(SPL_MODULE_CFLAGS) @KERNELCPPFLAGS@
|
||||||
EXTRA_CFLAGS += -I@abs_top_srcdir@/include
|
|
||||||
EXTRA_CFLAGS += -include @abs_top_builddir@/spl_config.h
|
|
||||||
|
|
||||||
# Solaris Porting LAyer Tests
|
# Solaris Porting LAyer Tests
|
||||||
obj-m := splat.o
|
obj-$(CONFIG_SPL) := $(MODULE).o
|
||||||
|
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-ctl.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-ctl.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-kmem.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-kmem.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-taskq.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-taskq.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-random.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-random.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-mutex.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-mutex.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-condvar.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-condvar.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-thread.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-thread.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-rwlock.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-rwlock.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-time.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-time.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-vnode.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-vnode.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-kobj.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-kobj.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-atomic.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-atomic.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-list.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-list.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-generic.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-generic.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-cred.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-cred.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-zlib.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-zlib.o
|
||||||
splat-objs += @top_srcdir@/module/splat/splat-linux.o
|
$(MODULE)-objs += @top_srcdir@/module/splat/splat-linux.o
|
||||||
|
|
|
@ -210,7 +210,7 @@
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
#undef HAVE_SYS_TYPES_H
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
/* task_curr() exported */
|
/* task_curr() is available */
|
||||||
#undef HAVE_TASK_CURR
|
#undef HAVE_TASK_CURR
|
||||||
|
|
||||||
/* timespec_sub() is available */
|
/* timespec_sub() is available */
|
||||||
|
|
Loading…
Reference in New Issue