From 1d71f874cfa39e49ecc2a6b228ed6d35a0b5b1c3 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sat, 16 Sep 2023 07:58:48 -0500 Subject: [PATCH] gasket-driver: Install Coral EdgeTPU driver The *gasket-driver* container installs the `gasket` and `apex` kernel modules, which provide the driver for the Google Coral EdgeTPU AI accellerator module. The container image must be built ahead of time, of course, and contains modules built for a specific Fedora kernel version. The udev rule has two purposes: to set the permissions on the device node so that any user on the system can access it, and to "tag" the device so that systemd will generate a `.device` unit for it. The latter allows other units (e.g. Frigate) to express a `Requires=` and `After=` dependency on the device unit, so that they do not start until the driver is loaded. --- 65-apex.rules | 1 + gasket-driver.container | 17 +++++++++++++++++ gasket-driver.yaml | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 65-apex.rules create mode 100644 gasket-driver.container create mode 100644 gasket-driver.yaml diff --git a/65-apex.rules b/65-apex.rules new file mode 100644 index 0000000..3fcc896 --- /dev/null +++ b/65-apex.rules @@ -0,0 +1 @@ +SUBSYSTEM=="apex", MODE="0666", TAG+="systemd" diff --git a/gasket-driver.container b/gasket-driver.container new file mode 100644 index 0000000..3883f64 --- /dev/null +++ b/gasket-driver.container @@ -0,0 +1,17 @@ +[Unit] +Description=Install the gasket/apex kernel modules +Wants=network-online.target +After=network-online.target + +[Container] +Image=git.pyrocufflink.net/containerimages/gasket-driver:%v +PodmanArgs=--privileged + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStop=/usr/sbin/rmmod apex +ExecStop=/usr/sbin/rmmod gasket + +[Install] +WantedBy=multi-user.target diff --git a/gasket-driver.yaml b/gasket-driver.yaml new file mode 100644 index 0000000..c2823d1 --- /dev/null +++ b/gasket-driver.yaml @@ -0,0 +1,19 @@ +variant: fcos +version: 1.4.0 + +storage: + files: + - path: /etc/containers/systemd/gasket-driver.container + mode: 0644 + contents: + local: gasket-driver.container + - path: /etc/udev/rules.d/65-apex.rules + mode: 0644 + contents: + local: 65-apex.rules + +systemd: + units: + - name: gasket-driver.service + enabled: true +