Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Merge branch 'builtin-clean'
Browse files Browse the repository at this point in the history
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 <[email protected]>
Issue openzfs/zfs#851
  • Loading branch information
behlendorf committed Jul 26, 2012
2 parents e8267ac + a9f2397 commit 7440380
Show file tree
Hide file tree
Showing 15 changed files with 6,695 additions and 3,113 deletions.
70 changes: 34 additions & 36 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -845,20 +845,18 @@ uninstall-am:


srpm-modules:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common

srpm-utils:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common

srpm: srpm-modules srpm-utils

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
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common

rpm-modules: srpm-modules
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common

rpm: rpm-modules rpm-utils

Expand Down Expand Up @@ -936,22 +934,22 @@ deb-local:
fi)

deb-modules: deb-local rpm-modules
name=${PACKAGE}-modules; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
$(RM) $$pkg1 $$pkg2
@CONFIG_KERNEL_TRUE@ name=${PACKAGE}-modules; \
@CONFIG_KERNEL_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
@CONFIG_KERNEL_TRUE@ release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
@CONFIG_KERNEL_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
@CONFIG_KERNEL_TRUE@ pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
@CONFIG_KERNEL_TRUE@ pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
@CONFIG_KERNEL_TRUE@ fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
@CONFIG_KERNEL_TRUE@ $(RM) $$pkg1 $$pkg2

deb-utils: deb-local rpm-utils
name=${PACKAGE}; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
$(RM) $$pkg1
@CONFIG_USER_TRUE@ name=${PACKAGE}; \
@CONFIG_USER_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
@CONFIG_USER_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
@CONFIG_USER_TRUE@ pkg1=$${name}-$${version}.$${arch}.rpm; \
@CONFIG_USER_TRUE@ fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
@CONFIG_USER_TRUE@ $(RM) $$pkg1

deb: deb-modules deb-utils

Expand All @@ -965,22 +963,22 @@ tgz-local:
fi)

tgz-modules: tgz-local rpm-modules
name=${PACKAGE}-modules; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
$(RM) $$pkg1 $$pkg2
@CONFIG_KERNEL_TRUE@ name=${PACKAGE}-modules; \
@CONFIG_KERNEL_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
@CONFIG_KERNEL_TRUE@ release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
@CONFIG_KERNEL_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
@CONFIG_KERNEL_TRUE@ pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
@CONFIG_KERNEL_TRUE@ pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
@CONFIG_KERNEL_TRUE@ fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
@CONFIG_KERNEL_TRUE@ $(RM) $$pkg1 $$pkg2

tgz-utils: tgz-local rpm-utils
name=${PACKAGE}; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \
$(RM) $$pkg1
@CONFIG_USER_TRUE@ name=${PACKAGE}; \
@CONFIG_USER_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
@CONFIG_USER_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
@CONFIG_USER_TRUE@ pkg1=$${name}-$${version}.$${arch}.rpm; \
@CONFIG_USER_TRUE@ fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \
@CONFIG_USER_TRUE@ $(RM) $$pkg1

tgz: tgz-modules tgz-utils

Expand All @@ -993,10 +991,10 @@ sarch-utils:
sarch: sarch-modules sarch-utils

arch-modules:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common

arch-utils:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common

arch: arch-modules arch-utils

Expand Down
6 changes: 6 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@ To build packages for your distribution:
$ ./configure
$ 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
be found at: <http://zfsonlinux.org>
4 changes: 4 additions & 0 deletions config/arch.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ sarch-utils:
sarch: sarch-modules sarch-utils

arch-modules:
if CONFIG_KERNEL
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common
endif

arch-utils:
if CONFIG_USER
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common
endif

arch: arch-modules arch-utils

Expand Down
4 changes: 4 additions & 0 deletions config/deb.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ deb-local:
fi)

deb-modules: deb-local rpm-modules
if CONFIG_KERNEL
name=${PACKAGE}-modules; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
Expand All @@ -37,13 +38,16 @@ deb-modules: deb-local rpm-modules
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
$(RM) $$pkg1 $$pkg2
endif

deb-utils: deb-local rpm-utils
if CONFIG_USER
name=${PACKAGE}; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
$(RM) $$pkg1
endif

deb: deb-modules deb-utils
10 changes: 8 additions & 2 deletions config/rpm.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@
###############################################################################

srpm-modules:
if CONFIG_KERNEL
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
endif

srpm-utils:
if CONFIG_USER
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
endif

srpm: srpm-modules srpm-utils

rpm-modules: srpm-modules
if CONFIG_KERNEL
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
endif

rpm-utils: srpm-utils
if CONFIG_USER
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common

rpm-modules: srpm-modules
endif

rpm: rpm-modules rpm-utils

Expand Down
Loading

0 comments on commit 7440380

Please sign in to comment.