forked from google/gasket-driver
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gasket-kmod.spec
53 lines (40 loc) · 2.17 KB
/
gasket-kmod.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%if 0%{?fedora}
%global buildforkernels akmod
%global debug_package %{nil}
%endif
Name: gasket-kmod
Version: {{{ git_dir_version }}}
Release: 1%{?dist}
Summary: The Coral Gasket Driver allows usage of the Coral EdgeTPU on Linux systems
License: GPLv2
URL: https://github.com/KyleGospo/gasket-dkms/
Source: %{url}/archive/refs/heads/main.tar.gz
BuildRequires: kmodtool
%{expand:%(kmodtool --target %{_target_cpu} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%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; and Apex: The EdgeTPU v1.
%prep
# error out if there was something wrong with kmodtool
%{?kmodtool_check}
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
%setup -q -c gasket-dkms-main/src
find . -type f -name '*.c' -exec sed -i "s/#VERSION#/%{version}/" {} \+
for kernel_version in %{?kernel_versions} ; do
cp -a gasket-dkms-main/src _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions} ; do
make V=1 %{?_smp_mflags} -C ${kernel_version##*___} M=${PWD}/_kmod_build_${kernel_version%%___*} VERSION=v%{version} modules
done
%install
for kernel_version in %{?kernel_versions}; do
mkdir -p %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
install -D -m 755 _kmod_build_${kernel_version%%___*}/gasket.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
chmod a+x %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/gasket.ko
install -D -m 755 _kmod_build_${kernel_version%%___*}/apex.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
chmod a+x %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/apex.ko
done
%{?akmod_install}
%changelog
{{{ git_dir_changelog }}}