logo

overlay

My own overlay for experimentations, use with caution, no support is provided
commit: c3590dde771888f8288a7c8acc433325989f1e43
parent: 9bc3798cecd9830f2952afad1a177d0ac6383c14
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 27 Sep 2020 22:37:39 +0200

sys-fs/zfs-kmod: Import from ::gentoo

Diffstat:

Asys-fs/zfs-kmod/Manifest1+
Asys-fs/zfs-kmod/files/0.8.4-powerpc_jmp_weak.patch48++++++++++++++++++++++++++++++++++++++++++++++++
Asys-fs/zfs-kmod/metadata.xml10++++++++++
Asys-fs/zfs-kmod/zfs-kmod-0.8.4-r1.ebuild183+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 242 insertions(+), 0 deletions(-)

diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest @@ -0,0 +1 @@ +DIST zfs-0.8.4.tar.gz 9285838 BLAKE2B 776bcd6dfab8825c07d315085e288b29bf543d6957325d5d566b7b78c04505dde9bd25eb6684cb4a1b6a657de8a4e1290d04d2b9079d26d6b834a70f1ec3b569 SHA512 9086dc6a6262dd93ca6ec43f1b4c2e5c804deba708c8a7460b8531aa4802b0bf8cac0917a1a00e6af2e96d4a21cd68b85e226bf571bd94041d0325c457106eb1 diff --git a/sys-fs/zfs-kmod/files/0.8.4-powerpc_jmp_weak.patch b/sys-fs/zfs-kmod/files/0.8.4-powerpc_jmp_weak.patch @@ -0,0 +1,48 @@ +From bd0efd1f062bfba5dd2d6b1fe30b6949f8e0a8ef Mon Sep 17 00:00:00 2001 +From: sterlingjensen <5555776+sterlingjensen@users.noreply.github.com> +Date: Mon, 24 Aug 2020 22:41:05 -0500 +Subject: [PATCH] Mark lua setjmp/longjmp for powerpc weak + +Linux already defines setjmp/longjmp for powerpc, which leads to +duplicate symbols in a statically linked build. + +Signed-off-by: Sterlng Jensen <sterlingjensen@users.noreply.github.com> +--- + module/lua/setjmp/setjmp_ppc.S | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/module/lua/setjmp/setjmp_ppc.S b/module/lua/setjmp/setjmp_ppc.S +index f787ef34913..72aa5d5ab5b 100644 +--- a/module/lua/setjmp/setjmp_ppc.S ++++ b/module/lua/setjmp/setjmp_ppc.S +@@ -56,7 +56,7 @@ + #define ENTRY(name) \ + .align 2 ; \ + .type name,@function; \ +- .globl name; \ ++ .weak name; \ + name: + + #else /* PPC64_ELF_ABI_v1 */ +@@ -65,8 +65,8 @@ name: + #define GLUE(a,b) XGLUE(a,b) + #define ENTRY(name) \ + .align 2 ; \ +- .globl name; \ +- .globl GLUE(.,name); \ ++ .weak name; \ ++ .weak GLUE(.,name); \ + .pushsection ".opd","aw"; \ + name: \ + .quad GLUE(.,name); \ +@@ -83,8 +83,8 @@ GLUE(.,name): + #define ENTRY(name) \ + .text; \ + .p2align 4; \ +- .globl name; \ +- .type name,@function; \ ++ .weak name; \ ++ .type name,@function; \ + name: + + #endif /* __powerpc64__ */ diff --git a/sys-fs/zfs-kmod/metadata.xml b/sys-fs/zfs-kmod/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <use> + <flag name="rootfs">Install zfs-shutdown script to support exporting a pool containing rootfs</flag> + </use> + <upstream> + <remote-id type="github">zfsonlinux/zfs</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-fs/zfs-kmod/zfs-kmod-0.8.4-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-0.8.4-r1.ebuild @@ -0,0 +1,183 @@ +# 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 + SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${PV}/zfs-${PV}.tar.gz" + KEYWORDS="amd64 arm64 ppc64" + S="${WORKDIR}/zfs-${PV}" + ZFS_KERNEL_COMPAT="5.6" +fi + +LICENSE="CDDL 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}/${PV}-powerpc_jmp_weak.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 + " + + if use arm64; then + kernel_is -ge 5 && CONFIG_CHECK="${CONFIG_CHECK} !PREEMPT" + fi + + 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" + + # 0.8.x requires at least 2.6.32 + kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required" + else + # git master requires at least 3.10 + kernel_is -ge 3 10 || die "Linux 3.10 or newer required" + fi + + linux-mod_pkg_setup +} + +src_prepare() { + default + + if [[ ${PV} == "9999" ]]; then + eautoreconf + else + # Set module revision number + sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release" + fi +} + +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) + ) + + CONFIG_SHELL="${EPREFIX}/bin/bash" 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." +}