summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2025-01-05 01:18:37 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2025-01-06 11:53:44 +0100
commitfad1d3192c26fae8423907c9de6af2fe2b03dea6 (patch)
tree4f38cd7d235f8fc15f04045ab92e9ba01c01dde3 /package
parentd7452d1a846d5e419f3907819f45e2e0c1cecff2 (diff)
package: Port zfs package
This still lacks some init scripts to reassemble pools and for other tasks. For now, I just do: | disks=$(blkid | sed -n 's,^/dev/\(sd[a-z]\): .* TYPE="crypto_LUKS".*,\1,p') | for disk in $disks; do | [ -b /dev/mapper/$disk ] || cryptsetup luksOpen \ | --key-file=/etc/mykeyfile /dev/$disk $disk | done | zpool import -a Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'package')
-rw-r--r--package/zfs/Makefile70
-rw-r--r--package/zfs/patches/0001-Support-for-cross-compiling-kernel-modules.patch53
2 files changed, 123 insertions, 0 deletions
diff --git a/package/zfs/Makefile b/package/zfs/Makefile
new file mode 100644
index 000000000..0e3db6392
--- /dev/null
+++ b/package/zfs/Makefile
@@ -0,0 +1,70 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(ADK_TOPDIR)/rules.mk
+
+PKG_NAME:= zfs
+PKG_VERSION:= 2.2.6
+PKG_RELEASE:= 1
+PKG_HASH:= c92e02103ac5dd77bf01d7209eabdca55c7b3356aa747bb2357ec4222652a2a7
+PKG_DESCR:= Advanced file system and volume manager
+PKG_SECTION:= sys/fs
+PKG_DEPENDS:= libcurl
+PKG_URL:= https://openzfs.org
+PKG_SITES:= https://github.com/openzfs/zfs/releases/download/${PKG_NAME}-${PKG_VERSION}/
+DISTFILES:= $(PKG_NAME)-$(PKG_VERSION).tar.gz
+
+PKG_SUBPKGS:= ZFS ZFS_TESTS
+PKGSS_ZFS_TESTS:= bash
+PKGSC_ZFS_TESTS:= base/tests
+PKGSD_ZFS_TESTS:= OpenZFS testsuite
+
+include $(ADK_TOPDIR)/mk/package.mk
+include $(ADK_TOPDIR)/mk/$(ADK_TARGET_OS)-ver.mk
+include ${ADK_TOPDIR}/mk/kernel-vars.mk
+
+$(eval $(call PKG_template,ZFS,zfs,$(PKG_VERSION)-$(PKG_RELEASE),$(PKG_DEPENDS),$(PKG_DESCR),$(PKG_SECTION)))
+$(eval $(call PKG_template,ZFS_TESTS,zfs-tests,$(PKG_VERSION)-$(PKG_RELEASE),$(PKGSS_ZFS_TESTS),$(PKGSD_ZFS_TESTS),$(PKGSC_ZFS_TESTS)))
+
+AUTOTOOL_STYLE:= autoreconf
+CONFIGURE_ARGS+= --with-linux=${LINUX_DIR} --without-python
+CONFIGURE_ENV+= KERNEL_CC="${TARGET_CC}" \
+ KERNEL_CROSS_COMPILE="${TARGET_CROSS}" \
+ KERNEL_ARCH="${ADK_TARGET_KARCH}"
+
+zfs-install:
+ $(INSTALL_DIR) $(IDIR_ZFS)/sbin
+ $(INSTALL_BIN) $(WRKINST)/sbin/mount.zfs $(IDIR_ZFS)/sbin
+ $(INSTALL_DIR) $(IDIR_ZFS)/etc/zfs/zed.d
+ $(CP) $(WRKINST)/etc/zfs/zed.d/* $(IDIR_ZFS)/etc/zfs/zed.d
+ $(CP) $(WRKINST)/etc/zfs/zfs-functions $(IDIR_ZFS)/etc/zfs
+ $(INSTALL_DIR) $(IDIR_ZFS)/etc/zfs/zpool.d
+ $(CP) $(WRKINST)/etc/zfs/zpool.d/* $(IDIR_ZFS)/etc/zfs/zpool.d
+ $(INSTALL_DIR) $(IDIR_ZFS)/lib/modules/${KERNEL_VERSION}/
+ $(CP) $(WRKINST)/lib/modules/${KERNEL_VERSION}/extra/{zfs,spl}.ko \
+ $(IDIR_ZFS)/lib/modules/${KERNEL_VERSION}/
+ $(INSTALL_DIR) $(IDIR_ZFS)/etc/modules.d/
+ printf "spl\nzfs\n" >$(IDIR_ZFS)/etc/modules.d/2-zfs
+ $(INSTALL_DIR) $(IDIR_ZFS)/usr/bin
+ $(INSTALL_BIN) $(WRKINST)/usr/bin/* $(IDIR_ZFS)/usr/bin
+ $(INSTALL_DIR) $(IDIR_ZFS)/usr/sbin
+ $(INSTALL_BIN) $(WRKINST)/usr/sbin/* $(IDIR_ZFS)/usr/sbin
+ $(INSTALL_DIR) $(IDIR_ZFS)/usr/libexec/zfs/zed.d
+ $(INSTALL_BIN) $(WRKINST)/usr/libexec/zfs/zed.d/* \
+ $(IDIR_ZFS)/usr/libexec/zfs/zed.d/
+ $(INSTALL_DIR) $(IDIR_ZFS)/usr/libexec/zfs/zpool.d
+ $(INSTALL_BIN) $(WRKINST)/usr/libexec/zfs/zpool.d/* \
+ $(IDIR_ZFS)/usr/libexec/zfs/zpool.d/
+ $(INSTALL_BIN) $(WRKINST)/usr/libexec/zfs/zpool_influxdb \
+ $(IDIR_ZFS)/usr/libexec/zfs/
+ $(INSTALL_DIR) $(IDIR_ZFS)/usr/lib
+ $(CP) $(WRKINST)/usr/lib/*.so* $(IDIR_ZFS)/usr/lib/
+
+zfs-tests-install:
+ $(INSTALL_DIR) $(IDIR_ZFS_TESTS)/usr/share
+ $(CP) $(WRKINST)/usr/share/zfs $(IDIR_ZFS_TESTS)/usr/share/
+
+# XXX: use /usr/share/initramfs-tools for custom init scripts
+# or just the files in root/etc/{conf,init}.d
+
+include $(ADK_TOPDIR)/mk/pkg-bottom.mk
diff --git a/package/zfs/patches/0001-Support-for-cross-compiling-kernel-modules.patch b/package/zfs/patches/0001-Support-for-cross-compiling-kernel-modules.patch
new file mode 100644
index 000000000..b20c3ecf6
--- /dev/null
+++ b/package/zfs/patches/0001-Support-for-cross-compiling-kernel-modules.patch
@@ -0,0 +1,53 @@
+From 1d566bf169297faba7afbe59df151ac479b234d5 Mon Sep 17 00:00:00 2001
+From: Phil Sutter <phil@nwl.cc>
+Date: Fri, 3 Jan 2025 16:30:24 +0100
+Subject: [PATCH] Support for cross-compiling kernel modules
+
+In order to correctly cross-compile, one has to pass ARCH and
+CROSS_COMPILE make flags to kernel module build calls. Facilitate this
+in the same way as for custom CC flag by recognizing KERNEL_-prefixed
+configure environment variables of same name.
+
+Signed-off-by: Phil Sutter <phil@nwl.cc>
+---
+ config/kernel.m4 | 5 +++++
+ module/Makefile.in | 2 ++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/config/kernel.m4 b/config/kernel.m4
+index 173c78a2a561a..c0a8355945dce 100644
+--- a/config/kernel.m4
++++ b/config/kernel.m4
+@@ -663,11 +663,16 @@ AC_DEFUN([ZFS_LINUX_COMPILE], [
+ building kernel modules])
+ AC_ARG_VAR([KERNEL_LLVM], [Binary option to
+ build kernel modules with LLVM/CLANG toolchain])
++ AC_ARG_VAR([KERNEL_CROSS_COMPILE], [Cross compile prefix
++ for kernel module builds])
++ AC_ARG_VAR([KERNEL_ARCH], [Architecture to build kernel modules for])
+ AC_TRY_COMMAND([
+ KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6"
+ make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC}
+ ${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM}
+ CONFIG_MODULES=y CFLAGS_MODULE=-DCONFIG_MODULES
++ ${KERNEL_CROSS_COMPILE:+CROSS_COMPILE=$KERNEL_CROSS_COMPILE}
++ ${KERNEL_ARCH:+ARCH=$KERNEL_ARCH}
+ -C $LINUX_OBJ $ARCH_UM M=$PWD/$1 >$1/build.log 2>&1])
+ AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4])
+ ])
+diff --git a/module/Makefile.in b/module/Makefile.in
+index b6338430e8125..b6e3c8e88ccac 100644
+--- a/module/Makefile.in
++++ b/module/Makefile.in
+@@ -54,6 +54,8 @@ FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
+ list='$(SUBDIR_TARGETS)'; for td in $$list; do $(MAKE) -C $$td; done
+ $(MAKE) -C @LINUX_OBJ@ $(if @KERNEL_CC@,CC=@KERNEL_CC@) \
+ $(if @KERNEL_LD@,LD=@KERNEL_LD@) $(if @KERNEL_LLVM@,LLVM=@KERNEL_LLVM@) \
++ $(if @KERNEL_CROSS_COMPILE@,CROSS_COMPILE=@KERNEL_CROSS_COMPILE@) \
++ $(if @KERNEL_ARCH@,ARCH=@KERNEL_ARCH@) \
+ M="$$PWD" @KERNEL_MAKE@ CONFIG_ZFS=m modules
+
+ modules-FreeBSD:
+--
+2.43.0
+