upstream: This gadget snap reuses the pc snap from here
interfaces:
system-files:
request-type: auto-connection
reasoning: In order to run certain workloads on nvidia tegra platforms, we need certain device nodes present on the system. For example, in order to use the hardware encoders/decoders on an NX platform with nvidia’s gstreamer plugins, we need /dev/v4l2-nvdec and /dev/v4l2-nvenc on the system. This is handled on Classic using udev rules with the following lines:
KERNEL=="15480000.nvdec", DRIVER=="tegra-nvdec", ACTION=="bind", RUN+="/bin/mknod -m 666 /dev/v4l2-nvdec c 1 3"
KERNEL=="154c0000.nvenc", DRIVER=="tegra-nvenc", ACTION=="bind", RUN+="/bin/mknod -m 666 /dev/v4l2-nvenc c 1 3"
We would like to do the same on Core by auto-connecting the system-files interface inside the gadget snap and copying the necessary udev rules to /etc/udev/rules.d using an install and post-refresh hook.
Hi @sebwey, apologies for the delay in getting to this request - from your description this seems reasonable but to grant it we need a bit more information - can you please include the complete system-files plug definition which the snap is using as I can’t see it in the linked snapcraft.yaml? Thanks
Here is the snapcraft.yaml that I used for testing the udev rules:
name: tegra
version: '22-0.1'
type: gadget
base: core22
summary: Gadget for Nvidia Tegra devices
description: |
This gadget enables Nvidia AGX Orin and Orin Nano/NX to work with Ubuntu Core.
confinement: devmode
grade: stable
package-repositories:
- type: apt
ppa: ubuntu-tegra/updates
architectures:
- build-on: [arm64]
build-for: [arm64]
plugs:
system-files:
write:
- /etc/udev/rules.d
# Min version to support shim 15.7 and min-size
assumes:
- snapd2.60.1
parts:
boot-assets:
plugin: dump
source: .
stage-snaps:
- pc/22/stable
override-build: |
# We need to install directly in the project dir as snapcraft checks there
# for gadget.yaml instead of looking first at the prime folder.
install -m 644 "$CRAFT_PART_INSTALL"/meta.pc/gadget.yaml "$CRAFT_PROJECT_DIR"/gadget.yaml
craftctl default
udev-rules:
plugin: nil
stage-packages:
- nvidia-tegra-drivers-36
stage:
- etc/udev/rules.d
And here is the install hook that I’m intending to use to install the rules: