# kmod RPM spec file for 9P transport module with vsock support %define kmod_name 9pnet_fd-vsock %define kmod_driver_version 1.0 %define kmod_rpm_release 1 # Disable debug package generation %global debug_package %{nil} Name: kmod-%{kmod_name} Version: %{kmod_driver_version} Release: %{kmod_rpm_release}%{?dist} Summary: 9P transport kernel module with vsock support Group: System Environment/Kernel License: GPLv3 URL: https://github.com/redbeam/v9fs-vsock Source0: v9fs-vsock-%{version}.tar.gz BuildRequires: kernel-devel BuildRequires: redhat-rpm-config %if 0%{?rhel} >= 8 BuildRequires: elfutils-libelf-devel %endif # Meta-package requires kernel-specific subpackage Requires: kmod-%{kmod_name}-module %description This is a meta-package that automatically installs the 9P transport kernel module matching your currently installed kernel. The 9P transport module provides vsock support, enabling mounting 9P filesystems over VM sockets (vsock) for efficient communication between virtual machines and their hosts, or between containers and hosts. Mount syntax: mount -t 9p -o trans=vsock /mnt/point Install this package to get the appropriate kernel module for your system. # Generate kernel-specific subpackage %{expand:%( kver=$(ls /usr/src/kernels/ 2>/dev/null | grep -v '^\.' | head -n1) # Strip dist tag and arch from kernel version for package naming kver_short=$(echo "$kver" | sed 's/\.[^.]*\.[^.]*$//') cat < /dev/null 2>&1 || : %%postun -n kmod-%{kmod_name}-${kver_short} /sbin/depmod -a ${kver} > /dev/null 2>&1 || : %%files -n kmod-%{kmod_name}-${kver_short} %%defattr(-,root,root,-) /lib/modules/${kver}/extra/%{kmod_name}/ EOF )} %prep %setup -q -n v9fs-vsock-%{version} %build # Detect the installed kernel version kver=$(ls /usr/src/kernels/ 2>/dev/null | grep -v '^\.' | head -n1) kmod_kernel_dir="/usr/src/kernels/${kver}" echo "Building for kernel: ${kver}" echo "Kernel headers at: ${kmod_kernel_dir}" # Choose the correct source directory based on distro %if 0%{?fedora} echo "Fedora build - using linux/ sources" srcdir=linux %else echo "RHEL/EL build - using rhel/ sources" srcdir=rhel %endif # Build the module %{__make} %{?_smp_mflags} -C "$kmod_kernel_dir" \ M="${PWD}/$srcdir/net/9p" \ CONFIG_NET_9P=m \ CONFIG_NET_9P_FD=m \ CONFIG_NET_9P_VSOCK=y \ modules %install # Detect the installed kernel version kver=$(ls /usr/src/kernels/ 2>/dev/null | grep -v '^\.' | head -n1) kmod_kernel_dir="/usr/src/kernels/${kver}" echo "Installing modules for kernel: ${kver}" # Choose the correct source directory based on distro %if 0%{?fedora} srcdir=linux %else srcdir=rhel %endif # Install the module %{__make} -C "$kmod_kernel_dir" \ M="${PWD}/$srcdir/net/9p" \ INSTALL_MOD_PATH=%{buildroot} \ INSTALL_MOD_DIR=extra/%{kmod_name} \ CONFIG_NET_9P=m \ CONFIG_NET_9P_FD=m \ CONFIG_NET_9P_VSOCK=y \ modules_install # Remove unwanted files find %{buildroot} -name "*.cmd" -delete find %{buildroot} -name ".*.d" -delete rm -f %{buildroot}/lib/modules/${kver}/modules.* # Sign modules if signing is configured %if 0%{?rhel} >= 8 for module in $(find %{buildroot}/lib/modules/${kver} -type f -name \*.ko 2>/dev/null); do %{__strip} --strip-debug "$module" done %endif %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %doc README.md %license LICENSE %changelog * Thu May 7 2026 Matus Skvarla - 1.0-1 - Initial kmod package for 9P vsock transport - Adds vsock transport support to 9pnet_fd module - Enables mounting 9P filesystems over VM sockets