Subject: zfs module for linux-edge

From: Steve Woodward <[email-masked]>
Date: Tue, 24 Sep 2024 20:53:01 -1000

Hello,

I have been trying to build a zfs module for the linux-edge kernel. I have
hardware that is not supported by linux-lts. I get the following error:
make[5]: *** No rule to make target
'/home/user/abuild/aports/main
/zfs-edge/src/zfs-2.2.6/6.11.0-0-edge/
module/os/linux/spl/spl-atomic.o', needed by '/home/user/abuild/aports/
main/zfs-edge/src/zfs-2.2.6/6.11.0-0-edge/module/spl.o'.  Stop.
zfs-lts does build successfully.

This is the process that I use:
abuild-keygen -a -i
mkdir abuild
cd abuild
git clone https://gitlab.alpinelinux.org/alpine/aports
cd aports/main/linux-headers
vi APKBUILD
  Edit this line:
    pkgver=6.11
abuild clean
abuild deps
abuild fetch
abuild checksum
abuild
doas vi /etc/apk/repositories
  Add this line:
    /home/user/packages/main/
doas apk update
doas apk add linux-headers
cd ../../community/linux-edge
abuild deps
doas rm -rf /lib/modules/firmware/nvidia
doas apk fix
abuild fetch
abuild
cd ../../main
cp -av zfs-lts zfs-edge
cd zfs-edge
vi APKBUILD
  Edit these lines:
    _flavor=${FLAVOR:-edge}
    _kver=6.11.0
  Comment out these lines:
    # for custom kernels set $FLAVOR
    # case $CARCH in
    #     x86|x86_64|aarch64) _extra_flavors="virt";;
    # esac
  Edit this line:
    local _kapkbuild="$startdir"/../../edge/linux-$_flavor-/APKBUILD
abuild deps
abuild fetch
apk list -I > zfs-edge-apk.list
abuild -K 2>&1 | tee zfs-edge-build.log
 make[5]: *** No rule to make target
 '/home/user/abuild/aports/main/zfs-edge/src/zfs-2.2.6/6.11.0-0-edge/
 module/os/linux/spl/spl-atomic.o', needed by '/home/user/abuild/aports/
 main/zfs-edge/src/zfs-2.2.6/6.11.0-0-edge/module/spl.o'.  Stop.
find src > zfs-edge-src.list
cd ../zfs-lts
abuild deps
apk list -I > zfs-lts-apk.list
abuild -K 2>&1 | tee zfs-lts-build.log
find src > zfs-lts-src.list
 zfs-lts builds successfully

uname for the running kernel:
Linux h1.lan.local 6.11.0-0-edge #1-Alpine SMP PREEMPT_DYNAMIC Tue, 17
Sep 2024 17:36:45 +0000 x86_64 Linux

I have posted the build logs for zfs-edge and zfs-lts, lists of
installed packages, and lists of files in the src directories to:
zfs-edge-apk.list  https://pastebin.com/LEkjvrmU
zfs-edge-build.log  https://pastebin.com/MhSxnr4r
zfs-edge-src.list  1/2  https://pastebin.com/BCYv1C69
zfs-edge-src.list  2/2  https://pastebin.com/8VggZt3h
zfs-lts-apk.list  https://pastebin.com/s1kLrC5H
zfs-lts-build.log  https://pastebin.com/dhMCEhye
zfs-lts-src.list  1/3  https://pastebin.com/2RUkHuny
zfs-lts-src.list  2/3  https://pastebin.com/5E5HPcuV
zfs-lts-src.list  3/3  https://pastebin.com/XbB4DR8E

Thanks

---

From: "Sertonix" <[email-masked]>
Date: Wed, 25 Sep 2024 13:20:30 +0000

>     local _kapkbuild="$startdir"/../../edge/linux-$_flavor-/APKBUILD

Could you try if it works if you add these 2 lines?

The first line is copied from https://github.com/openzfs/zfs/commit/f2f4ada240e3560faa721082c4a62dcb0cce0115

@@ -79,6 +79,7 @@ build() {
 			--with-config=kernel \
 			--with-linux=/usr/src/linux-headers-$kabi
 
+		cp -lR ../module/* module/
 		make
 		)
 	done
@@ -88,6 +89,7 @@ package() {
 	local flavor= kabi=
 	for flavor in $_flavor $_extra_flavors; do
 		kabi="$_kver-$_krel-$flavor"
+		mkdir -p "$pkgdir"/usr/share/zfs
 		(cd $kabi && make DESTDIR="$pkgdir" install)
 	done
 }

---

From: Steve Woodward <[email-masked]>
Date: Wed, 25 Sep 2024 06:14:13 -1000

That worked. Thank you!