commit 80088e46c8af101bd5ab560b8a016abcd2363334 Author: Dustin C. Hatch Date: Wed Aug 6 15:27:54 2025 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2ff549 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/BUILD/ +/BUILDROOT/ +/RPMS/ +/SOURCES/ +/SRPMS/ +*.tar.gz diff --git a/0001-core-Omit-no_llseek-reference.patch b/0001-core-Omit-no_llseek-reference.patch new file mode 100644 index 0000000..a0bc707 --- /dev/null +++ b/0001-core-Omit-no_llseek-reference.patch @@ -0,0 +1,28 @@ +From 73e2c845360e543a2d3cf85d7a8a0f68688903fe Mon Sep 17 00:00:00 2001 +From: "Dustin C. Hatch" +Date: Wed, 6 Aug 2025 15:25:15 -0500 +Subject: [PATCH 1/2] core: Omit no_llseek reference + +Linux removed the `no_llseek` symbol in 6.12. Before that, it was +defined as `NULL` and unused. +--- + src/gasket_core.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/gasket_core.c b/src/gasket_core.c +index b1c2726..5402e2a 100644 +--- a/src/gasket_core.c ++++ b/src/gasket_core.c +@@ -1373,7 +1373,9 @@ static long gasket_ioctl(struct file *filp, uint cmd, ulong arg) + /* File operations for all Gasket devices. */ + static const struct file_operations gasket_file_ops = { + .owner = THIS_MODULE, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) + .llseek = no_llseek, ++#endif + .mmap = gasket_mmap, + .open = gasket_open, + .release = gasket_release, +-- +2.50.1 + diff --git a/0002-Update-gasket_page_table.c-Fix-MODULE_IMPORT_NS.patch b/0002-Update-gasket_page_table.c-Fix-MODULE_IMPORT_NS.patch new file mode 100644 index 0000000..e3e74e2 --- /dev/null +++ b/0002-Update-gasket_page_table.c-Fix-MODULE_IMPORT_NS.patch @@ -0,0 +1,30 @@ +From 5c44ecd24c80b15a32381148ecb923a6ed313f89 Mon Sep 17 00:00:00 2001 +From: Gergely Szell +Date: Sun, 20 Jul 2025 10:03:55 +0200 +Subject: [PATCH 2/2] Update gasket_page_table.c: Fix MODULE_IMPORT_NS + +--- + src/gasket_page_table.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/gasket_page_table.c b/src/gasket_page_table.c +index c9067cb..1c4705e 100644 +--- a/src/gasket_page_table.c ++++ b/src/gasket_page_table.c +@@ -54,8 +54,12 @@ + #include + + #if __has_include() ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0) + MODULE_IMPORT_NS(DMA_BUF); +-#endif ++#else ++MODULE_IMPORT_NS("DMA_BUF"); ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0) */ ++#endif /* __has_include() */ + + #include "gasket_constants.h" + #include "gasket_core.h" +-- +2.50.1 + diff --git a/gasket-driver.spec b/gasket-driver.spec new file mode 100644 index 0000000..4958504 --- /dev/null +++ b/gasket-driver.spec @@ -0,0 +1,51 @@ +%global git_revision 5815ee3 +%global git_revision_full 5815ee3908a46a415aac616ac7b9aedcb98a504c + +%global kernel_ver %(rpm -q --qf %{VERSION}-%{RELEASE} kernel-devel) + +%define _debugsource_template %{nil} + +Name: gasket-driver +Version: 0.0.git%{git_revision} +Release: 1 +Summary: The Coral Gasket Driver allows usage of the Coral EdgeTPU on Linux systems + +License: GPL-2.0 +URL: https://github.com/google/gasket-driver/ +Source0: %{name}-%{git_revision_full}.tar.gz +Patch0: 0001-core-Omit-no_llseek-reference.patch +Patch1: 0002-Update-gasket_page_table.c-Fix-MODULE_IMPORT_NS.patch + +BuildRequires: kernel-devel +Requires: kernel-core == %{kernel_ver} +Requires(post): kmod + +%description +The Coral Gasket Driver allows usage of the Coral EdgeTPU on Linux systems. The driver contains two modules: + + Gasket: Gasket (Google ASIC Software, Kernel Extensions, and Tools) is a top level driver for lightweight communication with Google ASICs. + Apex: Apex refers to the EdgeTPU v1 + + +%prep +%autosetup -n %{name}-%{git_revision_full} -p1 + + +%build +make -C /usr/src/kernels/%{kernel_ver}.%{_arch} M=${PWD}/src modules + + +%install +make -C /usr/src/kernels/%{kernel_ver}.%{_arch} M=${PWD}/src INSTALL_MOD_PATH="${RPM_BUILD_ROOT}" DEPMOD=true modules_install + +%post +depmod -a %{kernel_ver}.%{_arch} + + +%files +/lib/modules/%{kernel_ver}.%{_arch}/updates/*.ko + + +%changelog +* Wed Aug 06 2025 Dustin C. Hatch [0.0.git5815ee3-1] +- Initial package