Initial commit

This commit is contained in:
2025-08-06 15:27:54 -05:00
commit 80088e46c8
4 changed files with 115 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
/BUILD/
/BUILDROOT/
/RPMS/
/SOURCES/
/SRPMS/
*.tar.gz

View File

@@ -0,0 +1,28 @@
From 73e2c845360e543a2d3cf85d7a8a0f68688903fe Mon Sep 17 00:00:00 2001
From: "Dustin C. Hatch" <dustin@hatch.name>
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

View File

@@ -0,0 +1,30 @@
From 5c44ecd24c80b15a32381148ecb923a6ed313f89 Mon Sep 17 00:00:00 2001
From: Gergely Szell <sethyx@gmail.com>
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 <linux/vmalloc.h>
#if __has_include(<linux/dma-buf.h>)
+#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(<linux/dma-buf.h>) */
#include "gasket_constants.h"
#include "gasket_core.h"
--
2.50.1

51
gasket-driver.spec Normal file
View File

@@ -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 <dustin@hatch.name> [0.0.git5815ee3-1]
- Initial package