After trial and error here is what worked for me. I built in Ubuntu.
Code
$ sudo apt-get update
$ sudo apt-get install gcc g++ gperf flex bison gawk help2man ncurses-dev make exuberant-ctags texinfo git bc libexpat-dev libxml2-dev libxml2-utils xsltproc python-dev python3-dev zlib1g-dev libssl-dev unzip autopoint libtool shtool automake pkg-config gettext
$ git clone https://github.com/LibreELEC/LibreELEC.tv.git
$ cd LibreELEC.tv
$ echo "CONFIG_ZFS=y" >> projects/Generic/linux/linux.x86_64.conf
$ echo "ADDITIONAL_PACKAGES+=\" zfs\"" >> projects/Generic/options
$ mkdir -p packages/filesystem/zfs
create instructions to build a zfs module
Code
PKG_NAME="zfs"
PKG_VERSION="2.3.0"
PKG_SHA256="6e8787eab55f24c6b9c317f3fe9b0da9a665eb34c31df88ff368d9a92e9356a6"
PKG_URL="https://github.com/openzfs/zfs/releases/download/zfs-${PKG_VERSION}/zfs-${PKG_VERSION}.tar.gz"
PKG_DESCRIPTION="ZFS filesystem support"
PKG_IS_KERNEL_PKG="yes"
PKG_DEPENDS_TARGET="toolchain linux libunwind zlib"
configure_target() {
cd $PKG_BUILD
KERNEL_DIR=$(kernel_path)
if [ ! -d "$KERNEL_DIR" ]; then
echo "Kernel directory not found: $KERNEL_DIR"
exit 1
fi
export KERNEL_CROSS_COMPILE=${TARGET_KERNEL_PREFIX}
export KERNEL_ARCH=${TARGET_KERNEL_ARCH}
./configure --host=$TARGET_NAME --prefix=/usr \
--with-linux="$KERNEL_DIR" \
--with-linux-obj="$KERNEL_DIR" \
--disable-static \
--enable-shared
}
make_target() {
make V=1 \
ARCH=${TARGET_KERNEL_ARCH} \
KSRC=$(kernel_path) \
CROSS_COMPILE=${TARGET_KERNEL_PREFIX} \
LDFLAGS="$LDFLAGS -lunwind -lz"
}
makeinstall_target() {
# Install ZFS kernel modules
mkdir -p ${INSTALL}/$(get_full_module_dir)/fs/${PKG_NAME}
cp $PKG_BUILD/module/*.ko ${INSTALL}/$(get_full_module_dir)/fs/${PKG_NAME}/
# Install user-space tools manually
mkdir -p ${INSTALL}/usr/sbin
cp $PKG_BUILD/.libs/zfs ${INSTALL}/usr/sbin/
cp $PKG_BUILD/.libs/zpool ${INSTALL}/usr/sbin/
cp $PKG_BUILD/.libs/zdb ${INSTALL}/usr/sbin/
cp $PKG_BUILD/.libs/zinject ${INSTALL}/usr/sbin/
cp $PKG_BUILD/.libs/zstream ${INSTALL}/usr/sbin/
cp $PKG_BUILD/.libs/ztest ${INSTALL}/usr/sbin/
cp $PKG_BUILD/.libs/zhack ${INSTALL}/usr/sbin/
cp $PKG_BUILD/.libs/zpool_influxdb ${INSTALL}/usr/sbin/
cp $PKG_BUILD/.libs/mount.zfs ${INSTALL}/usr/sbin/
cp $PKG_BUILD/.libs/zfs_ids_to_path ${INSTALL}/usr/sbin/
# Install shared libraries
mkdir -p ${INSTALL}/usr/lib
cp $PKG_BUILD/.libs/libzfs.so* ${INSTALL}/usr/lib/
cp $PKG_BUILD/.libs/libzfs_core.so* ${INSTALL}/usr/lib/
cp $PKG_BUILD/.libs/libnvpair.so* ${INSTALL}/usr/lib/
cp $PKG_BUILD/.libs/libuutil.so* ${INSTALL}/usr/lib/
cp $PKG_BUILD/.libs/libzpool.so* ${INSTALL}/usr/lib/
# Ensure ZFS loads on boot
mkdir -p ${INSTALL}/etc/modules-load.d
echo "zfs" > ${INSTALL}/etc/modules-load.d/zfs.conf
}
Display More
It's time to compile the build!
If it did not crash, proceed to installation. Insert installation USB flash drive (here as /dev/sda)
Code
$ cd target
$ gunzip LibreELEC-Generic.x86_64-13.0-devel-20250301013418-f3936e7.tar.img
$ sudo dd if=LibreELEC-Generic.x86_64-13.0-devel-20250301013418-f3936e7.tar of=/dev/sda bs=4M
Install as usual (Insert the flash drive into a computer that you want to run libreelec; Boot from it, Install LibreElec on another drive; Reboot)
At first launch, enable ssh . Then
$ ssh root@<ip.of.your.htpc>
at htpc
Code
$ modprobe zfs
$ zpool import -f <ZFS_8Tb> (i.e. name of your ZFS_drive)
$ zfs set mountpoint=/var/media/ZFS ZFS_8Tb
To make this ZFS drive visible among in the list of filesystems, folders and drives use Add button and point to /var/media/ZFS.
To automate the process so after reboot it will be there:
nano /storage/.config/autostart.sh