Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept user specified spl and kernel source dir. #1874

Closed
wants to merge 1 commit into from

Conversation

FransUrbo
Copy link
Contributor

I've issued this patch several times, but this time I'd make it a simple one, not a combination of many fixes.

Having '/usr/src/spl-VERSION' hardcoded (and almost the only choice) is a BAD THING (tm). This patch will accept the values issues with a previous './configure --with-spl=... --with-spl-obj=...' and generate propper zfs-kmod.spec file that is usable without any softlinks or installs of spl before hand.

@behlendorf
Copy link
Contributor

Simple is good, and we have had multiple requests for this functionality. So many in fact that it was already added by commit 389cf73. You can set spl path when building the rpms by defining require_splver, require_spldir, and require_splobj as appropriate. Specifying a non-standard kernel location isn't, but that's less commonly requested since most people use a stock kernel.

Do you need to specifify the kernel and the spl? Because if it's just the spl we should use the existing infrastructure and add it in RPM_DEFINE_KMOD which is part of config/zfs-build.m4. The following is untested but should do what you need. It's also a little nicer because it doesn't result in a .spec file which is tied to a specific version of the spl.

-     RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"'
+     RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spl $(SPL)" --define "require_splobj $(SPLOBJ)"'

@FransUrbo
Copy link
Contributor Author

Does this work if I do (without the kernel or spl installed):

./autogen.sh ; \
./configure --with-linux=/usr/src/linux-3.12.0+scst+tf.1 \
    --with-linux-obj=/usr/src/linux-3.12.0+scst+tf.1 \
    --with-spl=/usr/src/spl \
    --with-spl-obj=/usr/src/spl && \
 make && \
 make deb

Last I tried (a week or so ago), it did NOT! As soon as the package started building, it would fail because it can't find either the kernel or the spl directory (hardcoded to /lib/modules/uname -r/build and /usr/src/spl-SPLVER).

[...]
Executing(%prep): /bin/sh -e /tmp/zfs-build-root-LBlTKzIG/TMP/rpm-tmp.94164
+ umask 022
+ cd /tmp/zfs-build-root-LBlTKzIG/BUILD
+ echo 'kmodtool error: Don'\''t know how to handle 3.12.0+scst+tf.1 -- /lib/modules/3.12.0+scst+tf.1/build/Makefile not found'
kmodtool error: Don't know how to handle 3.12.0+scst+tf.1 -- /lib/modules/3.12.0+scst+tf.1/build/Makefile not found
+ exit 2
error: Bad exit status from /tmp/zfs-build-root-LBlTKzIG/TMP/rpm-tmp.94164 (%prep)


RPM build errors:
    Bad exit status from /tmp/zfs-build-root-LBlTKzIG/TMP/rpm-tmp.94164 (%prep)
make[1]: *** [rpm-common] Error 1
make[1]: Leaving directory `/usr/src/tmp/zfs'
make: *** [rpm-kmod] Error 2
(CHROOT)# pushd /lib/modules/
/lib/modules /usr/src/tmp/zfs
(CHROOT)# mkdir 3.12.0+scst+tf.1
(CHROOT)# cd 3.12.0+scst+tf.1/
(CHROOT)# ln -s /usr/src/linux-3.12.0+scst+tf.1 build
(CHROOT)# popd
/usr/src/tmp/zfs
(CHROOT)# make deb
[...]
Executing(%build): /bin/sh -e /tmp/zfs-build-root-nPDIcLTw/TMP/rpm-tmp.85901
+ umask 022
+ cd /tmp/zfs-build-root-nPDIcLTw/BUILD
+ cd zfs-kmod-0.6.2
+ for kernel_version in 3.12.0+scst+tf.1___/lib/modules/3.12.0+scst+tf.1/build/
+ cd _kmod_build_3.12.0+scst+tf.1
+ CFLAGS='-O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'
+ export FFLAGS
++ '[' -e /lib/modules/3.12.0+scst+tf.1/source ']'
++ echo /lib/modules/3.12.0+scst+tf.1/build
+ ./configure --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i386-rpm-linux --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/usr/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/usr/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-config=kernel --with-linux=/lib/modules/3.12.0+scst+tf.1/build --with-linux-obj=/lib/modules/3.12.0+scst+tf.1/build --with-spl=/usr/src/spl-0.6.2 --with-spl-obj=/usr/src/spl-0.6.2/3.12.0+scst+tf.1 --disable-debug --disable-debug-dmu-tx
/tmp/zfs-build-root-nPDIcLTw/TMP/rpm-tmp.85901: line 29: ./configure: No such file or directory
error: Bad exit status from /tmp/zfs-build-root-nPDIcLTw/TMP/rpm-tmp.85901 (%build)


RPM build errors:
    Bad exit status from /tmp/zfs-build-root-nPDIcLTw/TMP/rpm-tmp.85901 (%build)
make[1]: *** [rpm-common] Error 1
make[1]: Leaving directory `/usr/src/tmp/zfs'
make: *** [rpm-kmod] Error 2
(CHROOT)# emacs rpm/generic/zfs-kmod.spec
[replace %configure with %_configure - we've had this discussion before and you refused that patch to]
(CHROOT)# make deb
[...]
checking kernel source directory... /lib/modules/3.12.0+scst+tf.1/build
checking kernel build directory... /lib/modules/3.12.0+scst+tf.1/build
checking kernel source version... 3.12.0+scst+tf.1
checking kernel file name for module symbols... Module.symvers
checking spl source directory... /usr/src/spl-0.6.2
configure: error:
        *** Please make sure the kmod spl devel package for your distribution
        *** is installed then try again.  If that fails you can specify the
        *** location of the spl source with the '--with-spl=PATH' option.
error: Bad exit status from /tmp/zfs-build-root-rCyvGYbo/TMP/rpm-tmp.78926 (%build)


RPM build errors:
    Bad exit status from /tmp/zfs-build-root-rCyvGYbo/TMP/rpm-tmp.78926 (%build)
make[1]: *** [rpm-common] Error 1
make[1]: Leaving directory `/usr/src/tmp/zfs'
make: *** [rpm-kmod] Error 2

That's what my patch is/was supposed to fix. The above transcript comes from an absolutly clean clone just now...

@FransUrbo
Copy link
Contributor Author

Please also note the following:

+ ./configure --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i386-rpm-linux --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/usr/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/usr/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-config=kernel --with-linux=/lib/modules/3.12.0+scst+tf.1/build --with-linux-obj=/lib/modules/3.12.0+scst+tf.1/build --with-spl=/usr/src/spl-0.6.2 --with-spl-obj=/usr/src/spl-0.6.2/3.12.0+scst+tf.1 --disable-debug --disable-debug-dmu-tx
/tmp/zfs-build-root-nPDIcLTw/TMP/rpm-tmp.85901: line 29: ./configure: No such file or directory
error: Bad exit status from /tmp/zfs-build-root-nPDIcLTw/TMP/rpm-tmp.85901 (%build)

There is no configure script in that directory. It is located in the ../%{module}-%{version}/ directory!

@behlendorf
Copy link
Contributor

I'll revisit this when I address the other packaging issues

@FransUrbo
Copy link
Contributor Author

@behlendorf I've rewritten the patch to use the same technic that we used for another of my pull requests....

@behlendorf
Copy link
Contributor

Thanks. I like this a lot better. Let me verify it doesn't accidentally break something and I'll merge it.

@behlendorf behlendorf closed this in 69c7bdb Jun 5, 2014
@behlendorf
Copy link
Contributor

@FransUrbo Thanks for helping me push this one over the finish line. It's been merged to master and will be in the next tag.

FransUrbo added a commit to FransUrbo/zfs that referenced this pull request Jun 6, 2014
… dracut...

Accept kernel source dir(s) specified by ./configure

This adds ability to set the location of the kernel via defines
when building from the spec files.  This is useful when building
against a kernel installed in a non-standard location.

Signed-off-by: Turbo Fredriksson <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#1874
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Jun 10, 2014
There are two common locations where udev and dracut components are
commonly installed.  When building packages using the 'make rpm|deb'
targets check those common locations and pass them to rpmbuild.  For
non-standard configurations these values can be provided by the
the following configure options:

  --with-udevdir=DIR      install udev helpers [default=check]
  --with-udevruledir=DIR  install udev rules [[UDEVDIR/rules.d]]
  --with-dracutdir=DIR    install dracut helpers [default=check]

When rebuilding using the source packages the per-distribution
default values specified in the spec file will be used.  This is
the preferred way to build packages for a distribution but the
ability to override the defaults is provided as a convenience.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#1874
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Jun 11, 2014
There are two common locations where udev and dracut components are
commonly installed.  When building packages using the 'make rpm|deb'
targets check those common locations and pass them to rpmbuild.  For
non-standard configurations these values can be provided by the
the following configure options:

  --with-udevdir=DIR      install udev helpers [default=check]
  --with-udevruledir=DIR  install udev rules [[UDEVDIR/rules.d]]
  --with-dracutdir=DIR    install dracut helpers [default=check]

When rebuilding using the source packages the per-distribution
default values specified in the spec file will be used.  This is
the preferred way to build packages for a distribution but the
ability to override the defaults is provided as a convenience.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#1874
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants