Skip to content

Commit

Permalink
zfs-kmod-2.0.0-r1.ebuild to incorporate
Browse files Browse the repository at this point in the history
openzfs/zfs#11309 and allow
building against rt-sources
  • Loading branch information
rugubara committed Dec 22, 2020
1 parent e800408 commit 4c01539
Show file tree
Hide file tree
Showing 3 changed files with 243 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sys-fs/zfs-kmod/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
AUX rm-rw_semaphore.wait_lock-config-check.patch 1983 BLAKE2B d359d0290931be19ee30073a15e348ada575e0192281bfaed2c3147e4c3e545351fe0b7ff888d47ac4107f5e9926e5b56fda870775dcd04fceb38b24ce29210f SHA512 67d74d82ebe46b1638c0bcbbe814372d435830f53f7d2a0c59c0edf17b4de32b7ef6cbf19b5a6828cc772740fde7a2ddc365ef6748bf2ea1e8e04f8478dfc0af
DIST zfs-2.0.0.tar.gz 12989903 BLAKE2B 2961b97aa6736af9b4a2bc968d1488f49ec0c0fd7bb22b6bc015047239279efd2d48f8d7c593f9b467ac9d40f99d67363ab551bdfaf1dd71335c37c48c759875 SHA512 2706ae1aa54b882b272502e7a46e57ff41f9db9b123e8cd5dafbdd7f61975d05538167016f943804145d22aa018a1f11c884f692dc3992b28c24eac08112650f
EBUILD zfs-kmod-2.0.0-r1.ebuild 4336 BLAKE2B 013860135009ec933778a18f6d93cd4f368f723fa55c190e4b840873769638592b5bb92f84eaec59ee56e73b9cb2ca003449efff8b39c82675890935740fca6c SHA512 8f8e91f6f14e67fee682a35c2e6bd2983b62d928097086902e3c252f38ad2e16995510b208b34c8d0894efd80081e8d3c1ffa40d729c2cd96a58c0e6406066e6
EBUILD zfs-kmod-9999.ebuild 4113 BLAKE2B f42f666d8f9b1a91d7f44ee34ac7699a25c2a16e4c5843f780c65b651b81099260d27249b02a4e506eb945b57b0b140cc3b1881bce2de2ddee82d414e6d0b5c0 SHA512 84f7985ff480a3dbfddd9044ba600392d1f394c7749c80ff1cdb01232c6304a876be84eac39a8622645d38aeed4eefc8380eed8f3517aa7461941ef5db414f13
66 changes: 66 additions & 0 deletions sys-fs/zfs-kmod/files/rm-rw_semaphore.wait_lock-config-check.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From 99e1ac03846880675b9d7a7ca475a1410426a4d6 Mon Sep 17 00:00:00 2001
From: Orivej Desh <[email protected]>
Date: Tue, 8 Dec 2020 02:21:01 +0000
Subject: [PATCH] Delete rw_semaphore.wait_lock configure check

Last use of wait_lock was removed in "Linux 5.3 compat: retire
rw_tryupgrade()" (e7a99dab2b065ac2f8736a65d1b226d21754d771).

Fixes the issue reported in
https://github.com/openzfs/zfs/issues/11097#issuecomment-714532367

Signed-off-by: Orivej Desh <[email protected]>
---
config/kernel-rwsem.m4 | 28 ----------------------------
1 file changed, 28 deletions(-)

diff --git a/config/kernel-rwsem.m4 b/config/kernel-rwsem.m4
index 824f4a3ffd4..d3a64a8efa1 100644
--- a/config/kernel-rwsem.m4
+++ b/config/kernel-rwsem.m4
@@ -1,29 +1,3 @@
-dnl #
-dnl # 3.1 API Change
-dnl #
-dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
-dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
-dnl #
-AC_DEFUN([ZFS_AC_KERNEL_SRC_RWSEM_SPINLOCK_IS_RAW], [
- ZFS_LINUX_TEST_SRC([rwsem_spinlock_is_raw], [
- #include <linux/rwsem.h>
- ],[
- struct rw_semaphore dummy_semaphore __attribute__ ((unused));
- raw_spinlock_t dummy_lock __attribute__ ((unused)) =
- __RAW_SPIN_LOCK_INITIALIZER(dummy_lock);
- dummy_semaphore.wait_lock = dummy_lock;
- ])
-])
-
-AC_DEFUN([ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW], [
- AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
- ZFS_LINUX_TEST_RESULT([rwsem_spinlock_is_raw], [
- AC_MSG_RESULT(yes)
- ],[
- ZFS_LINUX_TEST_ERROR([rwsem_spinlock_is_raw])
- ])
-])
-
dnl #
dnl # 3.16 API Change
dnl #
@@ -76,13 +50,11 @@ AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT], [
])

AC_DEFUN([ZFS_AC_KERNEL_SRC_RWSEM], [
- ZFS_AC_KERNEL_SRC_RWSEM_SPINLOCK_IS_RAW
ZFS_AC_KERNEL_SRC_RWSEM_ACTIVITY
ZFS_AC_KERNEL_SRC_RWSEM_ATOMIC_LONG_COUNT
])

AC_DEFUN([ZFS_AC_KERNEL_RWSEM], [
- ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW
ZFS_AC_KERNEL_RWSEM_ACTIVITY
ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT
])


174 changes: 174 additions & 0 deletions sys-fs/zfs-kmod/zfs-kmod-2.0.0-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools flag-o-matic linux-mod toolchain-funcs

DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
HOMEPAGE="https://github.com/openzfs/zfs"

if [[ ${PV} == "9999" ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
else
MY_PV="2.0.0"
SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
KEYWORDS="~amd64 ~arm64 ~ppc64"
S="${WORKDIR}/zfs-${PV%_rc?}"
ZFS_KERNEL_COMPAT="5.9"
fi

LICENSE="CDDL MIT debug? ( GPL-2+ )"
SLOT="0"
IUSE="custom-cflags debug +rootfs"

DEPEND=""

RDEPEND="${DEPEND}
!sys-kernel/spl
"

BDEPEND="
dev-lang/perl
virtual/awk
"

RESTRICT="debug? ( strip ) test"

DOCS=( AUTHORS COPYRIGHT META README.md )
PATCHES=(
"${FILESDIR}/rm-rw_semaphore.wait_lock-config-check.patch"
)

pkg_setup() {
CONFIG_CHECK="
!DEBUG_LOCK_ALLOC
EFI_PARTITION
MODULES
!PAX_KERNEXEC_PLUGIN_METHOD_OR
!TRIM_UNUSED_KSYMS
ZLIB_DEFLATE
ZLIB_INFLATE
"

use debug && CONFIG_CHECK="${CONFIG_CHECK}
FRAME_POINTER
DEBUG_INFO
!DEBUG_INFO_REDUCED
"

use rootfs && \
CONFIG_CHECK="${CONFIG_CHECK}
BLK_DEV_INITRD
DEVTMPFS
"

kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"

if [[ ${PV} != "9999" ]]; then
local kv_major_max kv_minor_max zcompat
zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
kv_major_max="${zcompat%%.*}"
zcompat="${zcompat#*.}"
kv_minor_max="${zcompat%%.*}"
kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
"Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"

fi

kernel_is -ge 3 10 || die "Linux 3.10 or newer required"

linux-mod_pkg_setup
}

src_prepare() {
default
eautoreconf
# Set module revision number
sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
}

src_configure() {
set_arch_to_kernel

use custom-cflags || strip-flags

filter-ldflags -Wl,*

local myconf=(
CROSS_COMPILE="${CHOST}-"
HOSTCC="$(tc-getBUILD_CC)"
--bindir="${EPREFIX}/bin"
--sbindir="${EPREFIX}/sbin"
--with-config=kernel
--with-linux="${KV_DIR}"
--with-linux-obj="${KV_OUT_DIR}"
$(use_enable debug)
)

econf "${myconf[@]}"
}

src_compile() {
set_arch_to_kernel

myemakeargs=(
CROSS_COMPILE="${CHOST}-"
HOSTCC="$(tc-getBUILD_CC)"
V=1
)

emake "${myemakeargs[@]}"
}

src_install() {
set_arch_to_kernel

myemakeargs+=(
DEPMOD="/bin/true"
DESTDIR="${D}"
INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
)

emake "${myemakeargs[@]}" install

einstalldocs
}

pkg_postinst() {
linux-mod_pkg_postinst

# Remove old modules
if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then
ewarn "${PN} now installs modules in ${EROOT}/lib/modules/${KV_FULL}/extra/zfs"
ewarn "Old modules were detected in ${EROOT}/lib/modules/${KV_FULL}/addon/zfs"
ewarn "Automatically removing old modules to avoid problems."
rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
rmdir --ignore-fail-on-non-empty "${EROOT}/lib/modules/${KV_FULL}/addon"
fi

if use x86 || use arm; then
ewarn "32-bit kernels will likely require increasing vmalloc to"
ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
fi

ewarn "This version of OpenZFS includes support for new feature flags"
ewarn "that are incompatible with previous versions. GRUB2 support for"
ewarn "/boot with the new feature flags is not yet available."
ewarn "Do *NOT* upgrade root pools to use the new feature flags."
ewarn "Any new pools will be created with the new feature flags by default"
ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
ewarn "create a newpool that is backward compatible wih GRUB2, use "
ewarn
ewarn "zpool create -d -o feature@async_destroy=enabled "
ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
ewarn " -o feature@spacemap_histogram=enabled"
ewarn " -o feature@enabled_txg=enabled "
ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
ewarn " ..."
ewarn
ewarn "GRUB2 support will be updated as soon as either the GRUB2"
ewarn "developers do a tag or the Gentoo developers find time to backport"
ewarn "support from GRUB2 HEAD."
}

0 comments on commit 4c01539

Please sign in to comment.