From 4fda0c9616abe0929b68af3f13a3e1df12a8677e Mon Sep 17 00:00:00 2001 From: sharpenedblade Date: Sun, 2 Jun 2024 12:59:15 -0700 Subject: [PATCH] Package the linux-apfs-rw kernel module --- .github/workflows/build.yml | 2 + .github/workflows/copr-webhooks.yml | 2 + build-packages.sh | 2 +- linux-apfs-rw-kmod/linux-apfs-rw-kmod.spec | 66 ++++++++++++++++++++++ linux-apfs-rw/linux-apfs-rw.spec | 38 +++++++++++++ 5 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 linux-apfs-rw-kmod/linux-apfs-rw-kmod.spec create mode 100644 linux-apfs-rw/linux-apfs-rw.spec diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8babee6..3eb69c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,6 +42,8 @@ jobs: rust-nonempty/* rust-rust-ini0.20/* t2fanrd/* + linux-apfs-rw/* + linux-apfs-rw-kmod/* dir_names: "true" - name: "Increase Disk Space" diff --git a/.github/workflows/copr-webhooks.yml b/.github/workflows/copr-webhooks.yml index 55ba5ae..876d25a 100644 --- a/.github/workflows/copr-webhooks.yml +++ b/.github/workflows/copr-webhooks.yml @@ -13,6 +13,8 @@ on: - "rust-nonempty/*" - "rust-rust-ini0.20/*" - "t2fanrd/*" + - "linux-apfs-rw/*" + - "linux-apfs-rw-kmod/*" jobs: copr-webhook: diff --git a/build-packages.sh b/build-packages.sh index 07dafb5..d86008b 100755 --- a/build-packages.sh +++ b/build-packages.sh @@ -2,7 +2,7 @@ set -e if [ "$1" == "all" ]; then - packages=( "t2linux-config" "t2linux-audio" "rust-tiny-dfr" "kernel" "copr-sharpenedblade-t2linux-release" "rust-arraydeque" "rust-nonempty" "rust-rust-ini0.20" "t2fanrd" ) + packages=( "t2linux-config" "t2linux-audio" "rust-tiny-dfr" "kernel" "copr-sharpenedblade-t2linux-release" "rust-arraydeque" "rust-nonempty" "rust-rust-ini0.20" "t2fanrd" "linux-apfs-rw" "linux-apfs-rw-kmod" ) else packages=( "$@" ) fi diff --git a/linux-apfs-rw-kmod/linux-apfs-rw-kmod.spec b/linux-apfs-rw-kmod/linux-apfs-rw-kmod.spec new file mode 100644 index 0000000..10ea5f3 --- /dev/null +++ b/linux-apfs-rw-kmod/linux-apfs-rw-kmod.spec @@ -0,0 +1,66 @@ +%global debug_package %{nil} + +%global forgeurl https://github.com/linux-apfs/linux-apfs-rw +Version: 0.3.9 +%forgemeta + +%global buildforkernels akmod + +%define kmod_name apfs +%define src_name linux-apfs-rw + +Name: %{src_name}-kmod +Release: 1%{?dist} +Summary: APFS module for linux, with experimental write support +URL: %{forgeurl} +Source: %{forgesource} +License: GPL-2.0 + +BuildRequires: kmodtool + +%description +The Apple File System (APFS) is the copy-on-write filesystem currently used on +all Apple devices. This module provides a degree of experimental support on Linux. + +This module is the result of reverse engineering and testing has been limited. +If you make use of the write support, expect data corruption. Encryption is not +yet implemented even in read-only mode, and neither are fusion drives. + +# kmodtool does its magic here +%{expand:%(kmodtool --target %{_target_cpu} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } + +%prep + +# error out if there was something wrong with kmodtool +%{?kmodtool_check} + +# print kmodtool output for debugging purposes: +kmodtool --target %{_target_cpu} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null + +%forgeautosetup + +./genver.sh + +for kernel_version in %{?kernel_versions}; do + cp -a $PWD %{_builddir}/_kmod_build_${kernel_version%%___*} +done + +%build + +for kernel_version in %{?kernel_versions}; do + make modules %{?_smp_mflags} \ + -C ${kernel_version##*___} \ + M=%{_builddir}/_kmod_build_${kernel_version%%___*} +done + +%install + +for kernel_version in %{?kernel_versions}; do + install -m 755 -D \ + %{_builddir}/_kmod_build_${kernel_version%%___*}/apfs.ko \ + %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/apfs.ko +done + +%{?akmod_install} + +%changelog diff --git a/linux-apfs-rw/linux-apfs-rw.spec b/linux-apfs-rw/linux-apfs-rw.spec new file mode 100644 index 0000000..c9692e4 --- /dev/null +++ b/linux-apfs-rw/linux-apfs-rw.spec @@ -0,0 +1,38 @@ +%global debug_package %{nil} + +%global forgeurl https://github.com/linux-apfs/linux-apfs-rw +Version: 0.3.9 +%forgemeta + +Name: linux-apfs-rw +Release: 1%{?dist} +Summary: APFS module for linux, with experimental write support +URL: %{forgeurl} +Source: %{forgesource} +License: GPL-2.0 + +Provides: %{name}-kmod-common = %{version} +Requires: %{name}-kmod >= %{version} + +%description +The Apple File System (APFS) is the copy-on-write filesystem currently used on +all Apple devices. This module provides a degree of experimental support on Linux. + +This module is the result of reverse engineering and testing has been limited. +If you make use of the write support, expect data corruption. Encryption is not +yet implemented even in read-only mode, and neither are fusion drives. + +%prep + +%forgeautosetup + +%build + +%install + +%files + +%doc README.rst +%license LICENSE + +%changelog