mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Merge branch 'builtin-clean'
Support in-tree builtin module building.
These commits add support for compiling the ZFS 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 ZFS'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 ZFS directory.
  - Run `./copy-builtin /usr/src/linux-...` inside the ZFS directory.
  - In the kernel source tree, enable the `CONFIG_ZFS` option (e.g. using
    `make menuconfig`). Note that this option depends on `CONFIG_SPL`
    (see zfsonlinux/spl@744038069d).
  - Build the kernel as usual.
ZFS module parameters can be set at boot time using the following syntax
on the kernel command line: `zfs.parameter_name=parameter_value`.
Note that you also need to rebuild the userspace tools (see
zfsonlinux/zfs@f09398cec6).
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #851
			
			
This commit is contained in:
		
						commit
						4ab8a725ce
					
				
							
								
								
									
										80
									
								
								Makefile.in
									
									
									
									
									
								
							
							
						
						
									
										80
									
								
								Makefile.in
									
									
									
									
									
								
							| @ -904,20 +904,18 @@ uninstall-am: | |||||||
| 	tags tags-recursive uninstall uninstall-am | 	tags tags-recursive uninstall 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 | ||||||
| 
 | 
 | ||||||
| @ -995,25 +993,25 @@ 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=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
 | @CONFIG_KERNEL_TRUE@	version=${ZFS_META_VERSION}-${ZFS_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=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
 | @CONFIG_USER_TRUE@	version=${ZFS_META_VERSION}-${ZFS_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; \
 | ||||||
| 	pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
 | @CONFIG_USER_TRUE@	pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
 | ||||||
| 	pkg3=$${name}-test-$${version}.$${arch}.rpm; \
 | @CONFIG_USER_TRUE@	pkg3=$${name}-test-$${version}.$${arch}.rpm; \
 | ||||||
| 	pkg4=$${name}-dracut-$${version}.$${arch}.rpm; \
 | @CONFIG_USER_TRUE@	pkg4=$${name}-dracut-$${version}.$${arch}.rpm; \
 | ||||||
| 	fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \
 | @CONFIG_USER_TRUE@	fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \ | ||||||
| 	$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4 | @CONFIG_USER_TRUE@	$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4 | ||||||
| 
 | 
 | ||||||
| deb: deb-modules deb-utils | deb: deb-modules deb-utils | ||||||
| tgz-local: | tgz-local: | ||||||
| @ -1026,24 +1024,24 @@ 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=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
 | @CONFIG_KERNEL_TRUE@	version=${ZFS_META_VERSION}-${ZFS_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=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
 | @CONFIG_USER_TRUE@	version=${ZFS_META_VERSION}-${ZFS_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; \
 | ||||||
| 	pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
 | @CONFIG_USER_TRUE@	pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
 | ||||||
| 	pkg3=$${name}-test-$${version}.$${arch}.rpm; \
 | @CONFIG_USER_TRUE@	pkg3=$${name}-test-$${version}.$${arch}.rpm; \
 | ||||||
| 	fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2 $$pkg3; \
 | @CONFIG_USER_TRUE@	fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2 $$pkg3; \ | ||||||
| 	$(RM) $$pkg1 $$pkg2 $$pkg3 | @CONFIG_USER_TRUE@	$(RM) $$pkg1 $$pkg2 $$pkg3 | ||||||
| 
 | 
 | ||||||
| tgz: tgz-modules tgz-utils | tgz: tgz-modules tgz-utils | ||||||
| 
 | 
 | ||||||
| @ -1056,10 +1054,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 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -7,5 +7,11 @@ and ZVOL with a ZFS Posix Layer (ZPL) on the way! | |||||||
|     $ ./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 ZFS can be | Full documentation for building, configuring, and using ZFS can be | ||||||
| found at: <http://zfsonlinux.org> | 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 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -15,6 +15,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=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \ | 	version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \ | ||||||
| 	release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \ | 	release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \ | ||||||
| @ -23,8 +24,10 @@ 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=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \ | 	version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \ | ||||||
| 	arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ | 	arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ | ||||||
| @ -34,5 +37,6 @@ deb-utils: deb-local rpm-utils | |||||||
| 	pkg4=$${name}-dracut-$${version}.$${arch}.rpm; \ | 	pkg4=$${name}-dracut-$${version}.$${arch}.rpm; \ | ||||||
| 	fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \ | 	fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \ | ||||||
| 	$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4 | 	$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4 | ||||||
|  | endif | ||||||
| 
 | 
 | ||||||
| deb: deb-modules deb-utils | deb: deb-modules deb-utils | ||||||
|  | |||||||
| @ -5,11 +5,17 @@ dnl # exported by the kernel.  This is a trivial helper function but | |||||||
| dnl # using it significantly simplifies the code surrounding setting | dnl # using it significantly simplifies the code surrounding setting | ||||||
| dnl # up and tearing down the bdi structure. | dnl # up and tearing down the bdi structure. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER], [ | AC_DEFUN([ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether bdi_setup_and_register() is available]) | ||||||
| 		[bdi_setup_and_register], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[mm/backing-dev.c], | 		#include <linux/backing-dev.h> | ||||||
| 		[AC_DEFINE(HAVE_BDI_SETUP_AND_REGISTER, 1, | 	], [ | ||||||
| 		[bdi_setup_and_register() is available])], | 		bdi_setup_and_register(NULL, NULL, 0); | ||||||
| 		[]) | 	], [bdi_setup_and_register], [mm/backing-dev.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_BDI_SETUP_AND_REGISTER, 1, | ||||||
|  | 		          [bdi_setup_and_register() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -3,11 +3,17 @@ dnl # 2.6.38 API change | |||||||
| dnl # open_bdev_exclusive() changed to blkdev_get_by_path() | dnl # open_bdev_exclusive() changed to blkdev_get_by_path() | ||||||
| dnl # close_bdev_exclusive() changed to blkdev_put() | dnl # close_bdev_exclusive() changed to blkdev_put() | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [ | AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether blkdev_get_by_path() is available]) | ||||||
| 		[blkdev_get_by_path], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[fs/block_dev.c], | 		#include <linux/fs.h> | ||||||
| 		[AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH, 1, | 	], [ | ||||||
| 		[blkdev_get_by_path() is available])], | 		blkdev_get_by_path(NULL, 0, NULL); | ||||||
| 		[]) | 	], [blkdev_get_by_path], [fs/block_dev.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH, 1, | ||||||
|  | 		          [blkdev_get_by_path() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -2,11 +2,17 @@ dnl # | |||||||
| dnl # 2.6.28 API change | dnl # 2.6.28 API change | ||||||
| dnl # Added check_disk_size_change() helper function. | dnl # Added check_disk_size_change() helper function. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE], [ | AC_DEFUN([ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether check_disk_size_change() is available]) | ||||||
| 		[check_disk_size_change], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[fs/block_dev.c], | 		#include <linux/fs.h> | ||||||
| 		[AC_DEFINE(HAVE_CHECK_DISK_SIZE_CHANGE, 1, | 	], [ | ||||||
| 		[check_disk_size_change() is available])], | 		check_disk_size_change(NULL, NULL); | ||||||
| 		[]) | 	], [check_disk_size_change], [fs/block_dev.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_CHECK_DISK_SIZE_CHANGE, 1, | ||||||
|  | 		          [check_disk_size_change() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -19,11 +19,16 @@ dnl # Therefore, to ensure we have the correct API we only allow the | |||||||
| dnl # clear_inode() compatibility code to be defined iff the evict_inode() | dnl # clear_inode() compatibility code to be defined iff the evict_inode() | ||||||
| dnl # functionality is also detected. | dnl # functionality is also detected. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_CLEAR_INODE], [ | AC_DEFUN([ZFS_AC_KERNEL_CLEAR_INODE], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether clear_inode() is available]) | ||||||
| 		[clear_inode], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[fs/inode.c], | 		#include <linux/fs.h> | ||||||
| 		[AC_DEFINE(HAVE_CLEAR_INODE, 1, | 	], [ | ||||||
| 		[clear_inode() is available])], | 		clear_inode(NULL); | ||||||
| 		[]) | 	], [clear_inode], [fs/inode.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_CLEAR_INODE, 1, [clear_inode() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -2,11 +2,16 @@ dnl # | |||||||
| dnl # 3.4.0 API change | dnl # 3.4.0 API change | ||||||
| dnl # Added d_make_root() to replace previous d_alloc_root() function. | dnl # Added d_make_root() to replace previous d_alloc_root() function. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_D_MAKE_ROOT], [ | AC_DEFUN([ZFS_AC_KERNEL_D_MAKE_ROOT], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether d_make_root() is available]) | ||||||
| 		[d_make_root], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[fs/dcache.c], | 		#include <linux/dcache.h> | ||||||
| 		[AC_DEFINE(HAVE_D_MAKE_ROOT, 1, | 	], [ | ||||||
| 		[d_make_root() is available])], | 		d_make_root(NULL); | ||||||
| 		[]) | 	], [d_make_root], [fs/dcache.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_D_MAKE_ROOT, 1, [d_make_root() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -2,11 +2,17 @@ dnl # | |||||||
| dnl # 2.6.28 API change | dnl # 2.6.28 API change | ||||||
| dnl # Added d_obtain_alias() helper function. | dnl # Added d_obtain_alias() helper function. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS], [ | AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether d_obtain_alias() is available]) | ||||||
| 		[d_obtain_alias], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[fs/dcache.c], | 		#include <linux/dcache.h> | ||||||
| 		[AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1, | 	], [ | ||||||
| 		[d_obtain_alias() is available])], | 		d_obtain_alias(NULL); | ||||||
| 		[]) | 	], [d_obtain_alias], [fs/dcache.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1, | ||||||
|  | 		          [d_obtain_alias() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -1,11 +1,17 @@ | |||||||
| dnl # | dnl # | ||||||
| dnl # 2.6.34 API change | dnl # 2.6.34 API change | ||||||
| dnl # Verify the get_gendisk() symbol is exported. | dnl # Verify the get_gendisk() symbol is available. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_GET_GENDISK], [ | AC_DEFUN([ZFS_AC_KERNEL_GET_GENDISK], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether get_gendisk() is available]) | ||||||
| 		[get_gendisk], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[block/genhd.c], | 		#include <linux/genhd.h> | ||||||
| 		[AC_DEFINE(HAVE_GET_GENDISK, 1, [get_gendisk() is available])], | 	], [ | ||||||
| 		[]) | 		get_gendisk(0, NULL); | ||||||
|  | 	], [get_gendisk], [block/genhd.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_GET_GENDISK, 1, [get_gendisk() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -2,11 +2,17 @@ dnl # | |||||||
| dnl # 2.6.28 API change | dnl # 2.6.28 API change | ||||||
| dnl # Added insert_inode_locked() helper function. | dnl # Added insert_inode_locked() helper function. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_INSERT_INODE_LOCKED], [ | AC_DEFUN([ZFS_AC_KERNEL_INSERT_INODE_LOCKED], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether insert_inode_locked() is available]) | ||||||
| 		[insert_inode_locked], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[fs/inode.c], | 		#include <linux/fs.h> | ||||||
| 		[AC_DEFINE(HAVE_INSERT_INODE_LOCKED, 1, | 	], [ | ||||||
| 		[insert_inode_locked() is available])], | 		insert_inode_locked(NULL); | ||||||
| 		[]) | 	], [insert_inode_locked], [fs/inode.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_INSERT_INODE_LOCKED, 1, | ||||||
|  | 		          [insert_inode_locked() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -5,11 +5,16 @@ dnl # in the file_system_type structure.  When using the new | |||||||
| dnl # interface the caller must now use the mount_nodev() helper. | dnl # interface the caller must now use the mount_nodev() helper. | ||||||
| dnl # This updated callback and helper no longer pass the vfsmount. | dnl # This updated callback and helper no longer pass the vfsmount. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_MOUNT_NODEV], [ | AC_DEFUN([ZFS_AC_KERNEL_MOUNT_NODEV], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether mount_nodev() is available]) | ||||||
| 		[mount_nodev], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[fs/super.c], | 		#include <linux/fs.h> | ||||||
| 		[AC_DEFINE(HAVE_MOUNT_NODEV, 1, | 	], [ | ||||||
| 		[mount_nodev() is available])], | 		mount_nodev(NULL, 0, NULL, NULL); | ||||||
| 		[]) | 	], [mount_nodev], [fs/super.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_MOUNT_NODEV, 1, [mount_nodev() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -2,11 +2,17 @@ dnl # | |||||||
| dnl # 2.6.28 API change | dnl # 2.6.28 API change | ||||||
| dnl # open/close_bdev_excl() renamed to open/close_bdev_exclusive() | dnl # open/close_bdev_excl() renamed to open/close_bdev_exclusive() | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE], [ | AC_DEFUN([ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether open_bdev_exclusive() is available]) | ||||||
| 		[open_bdev_exclusive], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[fs/block_dev.c], | 		#include <linux/fs.h> | ||||||
| 		[AC_DEFINE(HAVE_OPEN_BDEV_EXCLUSIVE, 1, | 	], [ | ||||||
| 		[open_bdev_exclusive() is available])], | 		open_bdev_exclusive(NULL, 0, NULL); | ||||||
| 		[]) | 	], [open_bdev_exclusive], [fs/block_dev.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_OPEN_BDEV_EXCLUSIVE, 1, | ||||||
|  | 		          [open_bdev_exclusive() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -2,11 +2,17 @@ dnl # | |||||||
| dnl # 2.6.35 API change | dnl # 2.6.35 API change | ||||||
| dnl # Added truncate_setsize() helper function. | dnl # Added truncate_setsize() helper function. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_SETSIZE], [ | AC_DEFUN([ZFS_AC_KERNEL_TRUNCATE_SETSIZE], | ||||||
| 	ZFS_CHECK_SYMBOL_EXPORT( | 	[AC_MSG_CHECKING([whether truncate_setsize() is available]) | ||||||
| 		[truncate_setsize], | 	ZFS_LINUX_TRY_COMPILE_SYMBOL([ | ||||||
| 		[mm/truncate.c], | 		#include <linux/mm.h> | ||||||
| 		[AC_DEFINE(HAVE_TRUNCATE_SETSIZE, 1, | 	], [ | ||||||
| 		[truncate_setsize() is available])], | 		truncate_setsize(NULL, 0); | ||||||
| 		[]) | 	], [truncate_setsize], [mm/truncate.c], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_TRUNCATE_SETSIZE, 1, | ||||||
|  | 		          [truncate_setsize() is available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ dnl # | |||||||
| AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ | AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ | ||||||
| 	ZFS_AC_KERNEL | 	ZFS_AC_KERNEL | ||||||
| 	ZFS_AC_SPL | 	ZFS_AC_SPL | ||||||
|  | 	ZFS_AC_TEST_MODULE | ||||||
| 	ZFS_AC_KERNEL_CONFIG | 	ZFS_AC_KERNEL_CONFIG | ||||||
| 	ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS | 	ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS | ||||||
| 	ZFS_AC_KERNEL_TYPE_FMODE_T | 	ZFS_AC_KERNEL_TYPE_FMODE_T | ||||||
| @ -86,7 +87,7 @@ dnl # | |||||||
| AC_DEFUN([ZFS_AC_MODULE_SYMVERS], [ | AC_DEFUN([ZFS_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]) | ||||||
| 	AS_IF([test -f "$modpost"], [ | 	AS_IF([test "x$enable_linux_builtin" != xyes -a -f "$modpost"], [ | ||||||
| 		AS_IF([grep -q Modules.symvers $modpost], [ | 		AS_IF([grep -q Modules.symvers $modpost], [ | ||||||
| 			LINUX_SYMBOLS=Modules.symvers | 			LINUX_SYMBOLS=Modules.symvers | ||||||
| 		], [ | 		], [ | ||||||
| @ -158,7 +159,7 @@ AC_DEFUN([ZFS_AC_KERNEL], [ | |||||||
| 		], [test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}], [ | 		], [test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}], [ | ||||||
| 			kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu} | 			kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu} | ||||||
| 		], [test -d ${kernelsrc}-obj/${target_cpu}/default], [ | 		], [test -d ${kernelsrc}-obj/${target_cpu}/default], [ | ||||||
| 		        kernelbuild=${kernelsrc}-obj/${target_cpu}/default | 			kernelbuild=${kernelsrc}-obj/${target_cpu}/default | ||||||
| 		], [test -d `dirname ${kernelsrc}`/build-${target_cpu}], [ | 		], [test -d `dirname ${kernelsrc}`/build-${target_cpu}], [ | ||||||
| 			kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu} | 			kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu} | ||||||
| 		], [ | 		], [ | ||||||
| @ -191,7 +192,13 @@ AC_DEFUN([ZFS_AC_KERNEL], [ | |||||||
| 		]) | 		]) | ||||||
| 	], [ | 	], [ | ||||||
| 		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 | ||||||
| 	]) | 	]) | ||||||
| 
 | 
 | ||||||
| 	AC_MSG_RESULT([$kernsrcver]) | 	AC_MSG_RESULT([$kernsrcver]) | ||||||
| @ -312,6 +319,25 @@ AC_DEFUN([ZFS_AC_SPL], [ | |||||||
| 	ZFS_AC_SPL_MODULE_SYMVERS | 	ZFS_AC_SPL_MODULE_SYMVERS | ||||||
| ]) | ]) | ||||||
| 
 | 
 | ||||||
|  | dnl # | ||||||
|  | dnl # Basic toolchain sanity check. | ||||||
|  | dnl # | ||||||
|  | AC_DEFUN([ZFS_AC_TEST_MODULE], | ||||||
|  | 	[AC_MSG_CHECKING([whether modules can be built]) | ||||||
|  | 	ZFS_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 # Certain kernel build options are not supported.  These must be | dnl # Certain kernel build options are not supported.  These must be | ||||||
| dnl # detected at configure time and cause a build failure.  Otherwise | dnl # detected at configure time and cause a build failure.  Otherwise | ||||||
| @ -418,10 +444,12 @@ dnl # ZFS_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE | |||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [ | AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [ | ||||||
| 	m4_ifvaln([$1], [ZFS_LINUX_CONFTEST([$1])]) | 	m4_ifvaln([$1], [ZFS_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])] | ||||||
| 	) | 	) | ||||||
| @ -463,30 +491,48 @@ dnl # | |||||||
| dnl # ZFS_CHECK_SYMBOL_EXPORT | dnl # ZFS_CHECK_SYMBOL_EXPORT | ||||||
| dnl # check symbol exported or not | dnl # check symbol exported or not | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], | AC_DEFUN([ZFS_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/$LINUX_SYMBOLS 2>/dev/null | 		$LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null | ||||||
| 	rc=$? | 	rc=$? | ||||||
| 	AS_IF([test $rc -ne 0], [ | 	if test $rc -ne 0; then | ||||||
| 		export=0 | 		export=0 | ||||||
| 		for file in $2; do | 		for file in $2; do | ||||||
| 			grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX/$file" 2>/dev/null | 			grep -q -E "EXPORT_SYMBOL.*($1)" \ | ||||||
|  | 				"$LINUX/$file" 2>/dev/null | ||||||
| 			rc=$? | 			rc=$? | ||||||
| 			AS_IF([test $rc -eq 0], [ | 			if test $rc -eq 0; then | ||||||
| 				export=1 | 				export=1 | ||||||
| 				break; | 				break; | ||||||
| 			]) | 			fi | ||||||
| 		done | 		done | ||||||
| 		AS_IF([test $export -eq 0], [ | 		if test $export -eq 0; then : | ||||||
| 			AC_MSG_RESULT([no]) |  | ||||||
| 			$4 | 			$4 | ||||||
| 		], [ | 		else : | ||||||
| 			AC_MSG_RESULT([yes]) |  | ||||||
| 			$3 | 			$3 | ||||||
| 		]) | 		fi | ||||||
| 	], [ | 	else : | ||||||
| 		AC_MSG_RESULT([yes]) |  | ||||||
| 		$3 | 		$3 | ||||||
| 	]) | 	fi | ||||||
|  | ]) | ||||||
|  | 
 | ||||||
|  | dnl # | ||||||
|  | dnl # ZFS_LINUX_TRY_COMPILE_SYMBOL | ||||||
|  | dnl # like ZFS_LINUX_TRY_COMPILE, except ZFS_CHECK_SYMBOL_EXPORT | ||||||
|  | dnl # is called if not compiling for builtin | ||||||
|  | dnl # | ||||||
|  | AC_DEFUN([ZFS_LINUX_TRY_COMPILE_SYMBOL], [ | ||||||
|  | 	ZFS_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 | ||||||
|  | 			ZFS_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1]) | ||||||
|  | 		fi | ||||||
|  | 		if test $rc -ne 0; then : | ||||||
|  | 			$6 | ||||||
|  | 		else : | ||||||
|  | 			$5 | ||||||
|  | 		fi | ||||||
|  | 	fi | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -1,18 +1,24 @@ | |||||||
| 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 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -8,6 +8,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=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \ | 	version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \ | ||||||
| 	release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \ | 	release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \ | ||||||
| @ -16,8 +17,10 @@ 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=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \ | 	version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \ | ||||||
| 	arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ | 	arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ | ||||||
| @ -26,5 +29,6 @@ tgz-utils: tgz-local rpm-utils | |||||||
| 	pkg3=$${name}-test-$${version}.$${arch}.rpm; \ | 	pkg3=$${name}-test-$${version}.$${arch}.rpm; \ | ||||||
| 	fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2 $$pkg3; \ | 	fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2 $$pkg3; \ | ||||||
| 	$(RM) $$pkg1 $$pkg2 $$pkg3 | 	$(RM) $$pkg1 $$pkg2 $$pkg3 | ||||||
|  | endif | ||||||
| 
 | 
 | ||||||
| tgz: tgz-modules tgz-utils | tgz: tgz-modules tgz-utils | ||||||
|  | |||||||
| @ -73,6 +73,11 @@ AC_DEFUN([ZFS_AC_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']), | ||||||
| 		[ZFS_CONFIG="$withval"]) | 		[ZFS_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([zfs config]) | 	AC_MSG_CHECKING([zfs config]) | ||||||
| 	AC_MSG_RESULT([$ZFS_CONFIG]); | 	AC_MSG_RESULT([$ZFS_CONFIG]); | ||||||
| @ -93,11 +98,10 @@ AC_DEFUN([ZFS_AC_CONFIG], [ | |||||||
| 	esac | 	esac | ||||||
| 
 | 
 | ||||||
| 	AM_CONDITIONAL([CONFIG_USER], | 	AM_CONDITIONAL([CONFIG_USER], | ||||||
| 	               [test "$ZFS_CONFIG" = user] || | 		       [test "$ZFS_CONFIG" = user -o "$ZFS_CONFIG" = all]) | ||||||
| 	               [test "$ZFS_CONFIG" = all]) |  | ||||||
| 	AM_CONDITIONAL([CONFIG_KERNEL], | 	AM_CONDITIONAL([CONFIG_KERNEL], | ||||||
| 	               [test "$ZFS_CONFIG" = kernel] || | 		       [test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] && | ||||||
| 	               [test "$ZFS_CONFIG" = all]) | 		       [test "x$enable_linux_builtin" != xyes ]) | ||||||
| ]) | ]) | ||||||
| 
 | 
 | ||||||
| dnl # | dnl # | ||||||
|  | |||||||
							
								
								
									
										121
									
								
								copy-builtin
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										121
									
								
								copy-builtin
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,121 @@ | |||||||
|  | #!/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 'zfs_config.h' ] | ||||||
|  | then | ||||||
|  | 	echo >&2 | ||||||
|  | 	echo "    $0: you did not run configure, or you're not in the ZFS 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/zfs" "$KERNEL_DIR/fs/zfs" | ||||||
|  | cp --recursive include "$KERNEL_DIR/include/zfs" | ||||||
|  | cp --recursive module "$KERNEL_DIR/fs/zfs" | ||||||
|  | cp zfs_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/fs/zfs/$MODULE/Makefile" | ||||||
|  | done | ||||||
|  | 
 | ||||||
|  | cat > "$KERNEL_DIR/fs/zfs/Kconfig" <<"EOF" | ||||||
|  | config ZFS | ||||||
|  | 	tristate "ZFS" | ||||||
|  | 	depends on SPL | ||||||
|  | 	help | ||||||
|  | 	  This is the ZFS filesystem from the ZFS On Linux project. | ||||||
|  | 
 | ||||||
|  | 	  See http://zfsonlinux.org/ | ||||||
|  | 
 | ||||||
|  | 	  To compile this file system support as a module, choose M here. | ||||||
|  | 
 | ||||||
|  | 	  If unsure, say N. | ||||||
|  | EOF | ||||||
|  | 
 | ||||||
|  | { | ||||||
|  | 	cat <<-"EOF" | ||||||
|  | 	ZFS_MODULE_CFLAGS  = -I$(srctree)/include/zfs -I$(srctree)/include/spl  | ||||||
|  | 	ZFS_MODULE_CFLAGS += -include $(srctree)/spl_config.h -include $(srctree)/zfs_config.h | ||||||
|  | 	export ZFS_MODULE_CFLAGS | ||||||
|  | 
 | ||||||
|  | 	obj-$(CONFIG_ZFS) := | ||||||
|  | 	EOF | ||||||
|  | 
 | ||||||
|  | 	for MODULE in "${MODULES[@]}" | ||||||
|  | 	do | ||||||
|  | 		echo 'obj-$(CONFIG_ZFS) += ' "$MODULE/" | ||||||
|  | 	done | ||||||
|  | } > "$KERNEL_DIR/fs/zfs/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/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"' | ||||||
|  | add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/' | ||||||
|  | 
 | ||||||
|  | echo >&2 | ||||||
|  | echo "    $0: done." >&2 | ||||||
|  | echo "    $0: now you can build the kernel with ZFS support." >&2 | ||||||
|  | echo "    $0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2 | ||||||
|  | echo >&2 | ||||||
| @ -608,27 +608,13 @@ libzfs_print_on_error(libzfs_handle_t *hdl, boolean_t printerr) | |||||||
| static int | static int | ||||||
| libzfs_module_loaded(const char *module) | libzfs_module_loaded(const char *module) | ||||||
| { | { | ||||||
| 	FILE *f; | 	const char path_prefix[] = "/sys/module/"; | ||||||
| 	int result = 0; | 	char path[256]; | ||||||
| 	char name[256]; |  | ||||||
| 
 | 
 | ||||||
| 	f = fopen("/proc/modules", "r"); | 	memcpy(path, path_prefix, sizeof(path_prefix) - 1); | ||||||
| 	if (f == NULL) | 	strcpy(path + sizeof(path_prefix) - 1, module); | ||||||
| 		return -1; |  | ||||||
| 
 | 
 | ||||||
| 	while (fgets(name, sizeof(name), f)) { | 	return (access(path, F_OK) == 0); | ||||||
| 		char *c = strchr(name, ' '); |  | ||||||
| 		if (!c) |  | ||||||
| 			continue; |  | ||||||
| 		*c = 0; |  | ||||||
| 		if (strcmp(module, name) == 0) { |  | ||||||
| 			result = 1; |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	fclose(f); |  | ||||||
| 
 |  | ||||||
| 	return result; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int | int | ||||||
|  | |||||||
| @ -5,6 +5,11 @@ subdir-m += zcommon | |||||||
| subdir-m += zfs | subdir-m += zfs | ||||||
| subdir-m += zpios | subdir-m += zpios | ||||||
| 
 | 
 | ||||||
|  | ZFS_MODULE_CFLAGS += -include @SPL_OBJ@/spl_config.h | ||||||
|  | ZFS_MODULE_CFLAGS += -include @abs_top_builddir@/zfs_config.h | ||||||
|  | ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@ | ||||||
|  | export ZFS_MODULE_CFLAGS | ||||||
|  | 
 | ||||||
| modules: | modules: | ||||||
| 	@# Make the exported SPL symbols available to these modules. | 	@# Make the exported SPL symbols available to these modules. | ||||||
| 	@# They may be in the root of SPL_OBJ when building against | 	@# They may be in the root of SPL_OBJ when building against | ||||||
| @ -21,7 +26,7 @@ modules: | |||||||
| 		"*** - @SPL_OBJ@/module/@SPL_SYMBOLS@\n"; \
 | 		"*** - @SPL_OBJ@/module/@SPL_SYMBOLS@\n"; \
 | ||||||
| 		exit 1; \
 | 		exit 1; \
 | ||||||
| 	fi | 	fi | ||||||
| 	$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@ | 	$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ CONFIG_ZFS=m $@ | ||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	@# Only cleanup the kernel build directories when CONFIG_KERNEL | 	@# Only cleanup the kernel build directories when CONFIG_KERNEL | ||||||
|  | |||||||
| @ -1,10 +1,7 @@ | |||||||
| MODULE := zavl | MODULE := zavl | ||||||
| 
 | 
 | ||||||
| EXTRA_CFLAGS  = @KERNELCPPFLAGS@ | EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ | ||||||
| EXTRA_CFLAGS += -include @SPL_OBJ@/spl_config.h |  | ||||||
| EXTRA_CFLAGS += -include @abs_top_builddir@/zfs_config.h |  | ||||||
| EXTRA_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@ |  | ||||||
| 
 | 
 | ||||||
| obj-m := $(MODULE).o | obj-$(CONFIG_ZFS) := $(MODULE).o | ||||||
| 
 | 
 | ||||||
| $(MODULE)-objs += @top_srcdir@/module/avl/avl.o | $(MODULE)-objs += @top_srcdir@/module/avl/avl.o | ||||||
|  | |||||||
| @ -1,11 +1,8 @@ | |||||||
| MODULE := znvpair | MODULE := znvpair | ||||||
| 
 | 
 | ||||||
| EXTRA_CFLAGS  = @KERNELCPPFLAGS@ | EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ | ||||||
| EXTRA_CFLAGS += -include @SPL_OBJ@/spl_config.h |  | ||||||
| EXTRA_CFLAGS += -include @abs_top_builddir@/zfs_config.h |  | ||||||
| EXTRA_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@ |  | ||||||
| 
 | 
 | ||||||
| obj-m := $(MODULE).o | obj-$(CONFIG_ZFS) := $(MODULE).o | ||||||
| 
 | 
 | ||||||
| $(MODULE)-objs += @top_srcdir@/module/nvpair/nvpair.o | $(MODULE)-objs += @top_srcdir@/module/nvpair/nvpair.o | ||||||
| $(MODULE)-objs += @top_srcdir@/module/nvpair/nvpair_alloc_spl.o | $(MODULE)-objs += @top_srcdir@/module/nvpair/nvpair_alloc_spl.o | ||||||
|  | |||||||
| @ -1,11 +1,8 @@ | |||||||
| MODULE := zunicode | MODULE := zunicode | ||||||
| 
 | 
 | ||||||
| EXTRA_CFLAGS  = @KERNELCPPFLAGS@ | EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ | ||||||
| EXTRA_CFLAGS += -include @SPL_OBJ@/spl_config.h |  | ||||||
| EXTRA_CFLAGS += -include @abs_top_builddir@/zfs_config.h |  | ||||||
| EXTRA_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@ |  | ||||||
| 
 | 
 | ||||||
| obj-m := $(MODULE).o | obj-$(CONFIG_ZFS) := $(MODULE).o | ||||||
| 
 | 
 | ||||||
| $(MODULE)-objs += @top_srcdir@/module/unicode/u8_textprep.o | $(MODULE)-objs += @top_srcdir@/module/unicode/u8_textprep.o | ||||||
| $(MODULE)-objs += @top_srcdir@/module/unicode/uconv.o | $(MODULE)-objs += @top_srcdir@/module/unicode/uconv.o | ||||||
|  | |||||||
| @ -1,11 +1,8 @@ | |||||||
| MODULE := zcommon | MODULE := zcommon | ||||||
| 
 | 
 | ||||||
| EXTRA_CFLAGS  = @KERNELCPPFLAGS@ | EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ | ||||||
| EXTRA_CFLAGS += -include @SPL_OBJ@/spl_config.h |  | ||||||
| EXTRA_CFLAGS += -include @abs_top_builddir@/zfs_config.h |  | ||||||
| EXTRA_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@ |  | ||||||
| 
 | 
 | ||||||
| obj-m := $(MODULE).o | obj-$(CONFIG_ZFS) := $(MODULE).o | ||||||
| 
 | 
 | ||||||
| $(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_deleg.o | $(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_deleg.o | ||||||
| $(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_prop.o | $(MODULE)-objs += @top_srcdir@/module/zcommon/zfs_prop.o | ||||||
|  | |||||||
| @ -1,11 +1,8 @@ | |||||||
| MODULE := zfs | MODULE := zfs | ||||||
| 
 | 
 | ||||||
| EXTRA_CFLAGS += @KERNELCPPFLAGS@ | EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ | ||||||
| EXTRA_CFLAGS += -include @SPL_OBJ@/spl_config.h |  | ||||||
| EXTRA_CFLAGS += -include @abs_top_builddir@/zfs_config.h |  | ||||||
| EXTRA_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@ |  | ||||||
| 
 | 
 | ||||||
| obj-m := $(MODULE).o | obj-$(CONFIG_ZFS) := $(MODULE).o | ||||||
| 
 | 
 | ||||||
| $(MODULE)-objs += @top_srcdir@/module/zfs/arc.o | $(MODULE)-objs += @top_srcdir@/module/zfs/arc.o | ||||||
| $(MODULE)-objs += @top_srcdir@/module/zfs/bplist.o | $(MODULE)-objs += @top_srcdir@/module/zfs/bplist.o | ||||||
|  | |||||||
| @ -1,10 +1,7 @@ | |||||||
| MODULE := zpios | MODULE := zpios | ||||||
| 
 | 
 | ||||||
| EXTRA_CFLAGS  = @KERNELCPPFLAGS@ | EXTRA_CFLAGS = $(ZFS_MODULE_CFLAGS) @KERNELCPPFLAGS@ | ||||||
| EXTRA_CFLAGS += -include @SPL_OBJ@/spl_config.h |  | ||||||
| EXTRA_CFLAGS += -include @abs_top_builddir@/zfs_config.h |  | ||||||
| EXTRA_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@ |  | ||||||
| 
 | 
 | ||||||
| obj-m := $(MODULE).o | obj-$(CONFIG_ZFS) := $(MODULE).o | ||||||
| 
 | 
 | ||||||
| $(MODULE)-objs += @top_srcdir@/module/zpios/pios.o | $(MODULE)-objs += @top_srcdir@/module/zpios/pios.o | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Brian Behlendorf
						Brian Behlendorf