Skip to content

Commit d33d428

Browse files
judahrandfrezbo
authored andcommitted
feat: add uinput driver extension
Adds an extension to enable the `uinput` kernel module which makes it possible to emulate input devices from userspace. Signed-off-by: Judah Rand <[email protected]> Signed-off-by: Noel Georgi <[email protected]>
1 parent 4563de5 commit d33d428

File tree

10 files changed

+99
-3
lines changed

10 files changed

+99
-3
lines changed

.kres.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ spec:
3838
- stargz-snapshotter
3939
- tailscale
4040
- thunderbolt
41+
- uinput
4142
- usb-modem-drivers
4243
- util-linux-tools
4344
- v4l-uvc-drivers
@@ -59,7 +60,7 @@ spec:
5960
- name: EXTENSIONS_IMAGE_REF
6061
defaultValue: $(REGISTRY_AND_USERNAME)/extensions:$(TAG)
6162
- name: PKGS
62-
defaultValue: v1.8.0-alpha.0-52-g4fd2541
63+
defaultValue: v1.8.0-alpha.0-54-g4ce5bc6
6364
- name: PKGS_PREFIX
6465
defaultValue: ghcr.io/siderolabs
6566
useBldrPkgTagResolver: true

MAINTAINERS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ If the field is marked as `Needs Maintainer`, it means that the package is curre
4848
| stargz-snapshotter | Sidero Labs | NA |
4949
| tailscale | Beau Trepp | [btrepp](https://github.com/btrepp) |
5050
| thunderbolt | Igor Rzegocki | [ajgon](https://github.com/ajgon) |
51+
| uinput | Judah Rand | [judahrand](https://github.com/judahrand) |
5152
| usb-modem-drivers | Sidero Labs | NA |
5253
| util-linux-tools | Sidero Labs | NA |
5354
| v4l-uvc-drivers | Jacob McSwain | [USA-RedDragon](https://github.com/USA-RedDragon) |

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2024-08-29T14:13:04Z by kres b5ca957.
3+
# Generated on 2024-08-30T11:52:57Z by kres b5ca957.
44

55
# common variables
66

@@ -48,7 +48,7 @@ COMMON_ARGS += --build-arg=PKGS_PREFIX="$(PKGS_PREFIX)"
4848
# extra variables
4949

5050
EXTENSIONS_IMAGE_REF ?= $(REGISTRY_AND_USERNAME)/extensions:$(TAG)
51-
PKGS ?= v1.8.0-alpha.0-52-g4fd2541
51+
PKGS ?= v1.8.0-alpha.0-54-g4ce5bc6
5252
PKGS_PREFIX ?= ghcr.io/siderolabs
5353

5454
# targets defines all the available targets
@@ -89,6 +89,7 @@ TARGETS += spin
8989
TARGETS += stargz-snapshotter
9090
TARGETS += tailscale
9191
TARGETS += thunderbolt
92+
TARGETS += uinput
9293
TARGETS += usb-modem-drivers
9394
TARGETS += util-linux-tools
9495
TARGETS += v4l-uvc-drivers

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ cosign verify --certificate-identity-regexp '@siderolabs\.com$' --certificate-oi
7373
| [mei](drivers/mei/) | [ghcr.io/siderolabs/mei](https://github.com/siderolabs/extensions/pkgs/container/mei) | Driver for Intel Management Engine | `talos version` |
7474
| [nvidia](nvidia-gpu/nvidia-modules/) | [ghcr.io/siderolabs/nvidia-open-gpu-kernel-modules](https://github.com/siderolabs/extensions/pkgs/container/nvidia-open-gpu-kernel-modules) | NVIDIA OSS Driver | `nvidia driver upstream version`-`talos version` |
7575
| [thunderbolt](drivers/thunderbolt/) | [ghcr.io/siderolabs/thunderbolt](https://github.com/siderolabs/extensions/pkgs/container/thunderbolt) | Thunderbolt drivers | `talos version` |
76+
| [uinput](drivers/uinput/) | [ghcr.io/siderolabs/uinput](https://github.com/siderolabs/extensions/pkgs/container/uinput) | uinput drivers | `talos version` |
7677
| [usb-modem](drivers/usb-modem/) | [ghcr.io/siderolabs/usb-modem-drivers](https://github.com/siderolabs/extensions/pkgs/container/usb-modem-drivers) | USB Modem drivers | `talos version` |
7778
| [v4l-uvc](drivers/v4l-uvc/) | [ghcr.io/siderolabs/v4l-uvc-drivers](https://github.com/siderolabs/extensions/pkgs/container/v4l-uvc-drivers) | USB Video Class (Webcam) drivers | `talos version` |
7879

drivers/uinput/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# uinput extension
2+
3+
## Installation
4+
5+
See [Installing Extensions](https://github.com/siderolabs/extensions#installing-extensions).
6+
7+
## Usage
8+
9+
Enable the `uinput` module in Talos machine config.
10+
11+
```yaml
12+
machine:
13+
kernel:
14+
modules:
15+
- name: uinput
16+
```
17+
18+
## Verifiying
19+
20+
You can verify the modules are enabled by the `/proc/modules` where it _should_ show the module is live.
21+
22+
For example:
23+
24+
```
25+
❯ talosctl -n 192.168.42.15 read /proc/modules
26+
uinput 24576 - - Live 0xffffffffc0414000
27+
```
28+
29+
In addition, the `/dev/uinput` device should be present.
30+
31+
For example:
32+
33+
```
34+
❯ talosctl -n 192.168.42.15 ls /dev/uinput'
35+
NODE NAME
36+
192.168.42.15 uinput
37+
```

drivers/uinput/files/modules.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
modules.order
2+
modules.builtin
3+
modules.builtin.modinfo
4+
kernel/drivers/input/misc/uinput.ko

drivers/uinput/manifest.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: v1alpha1
2+
metadata:
3+
name: uinput
4+
version: "$VERSION"
5+
author: Judah Rand
6+
description: |
7+
This system extension provides the uinput kernel module built against a specific Talos version.
8+
This kernel module makes it possible to emulate input devices from userspace. By writing to
9+
/dev/uinput (or /dev/input/uinput) device, a process can create a virtual input device with
10+
specific capabilities. Once this virtual device is created, the process can send events through it,
11+
that will be delivered to userspace and in-kernel consumers.
12+
compatibility:
13+
talos:
14+
version: ">= v1.4.5"

drivers/uinput/pkg.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: uinput
2+
variant: scratch
3+
shell: /toolchain/bin/bash
4+
dependencies:
5+
- stage: base
6+
# The pkgs version for a particular release of Talos as defined in
7+
# https://github.com/siderolabs/talos/blob/<talos version>/pkg/machinery/gendata/data/pkgs
8+
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/kernel:{{ .BUILD_ARG_PKGS }}"
9+
steps:
10+
- prepare:
11+
- |
12+
sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml
13+
- install:
14+
- |
15+
export KERNELRELEASE=$(find /lib/modules -type d -name "*-talos" -exec basename {} \+)
16+
17+
mkdir -p /rootfs
18+
19+
xargs -a /pkg/files/modules.txt -I {} install -D /lib/modules/${KERNELRELEASE}/{} /rootfs/lib/modules/${KERNELRELEASE}/{}
20+
depmod -b /rootfs ${KERNELRELEASE}
21+
- test:
22+
- |
23+
# https://www.kernel.org/doc/html/v4.15/admin-guide/module-signing.html#signed-modules-and-stripping
24+
find /rootfs/lib/modules -name '*.ko' -exec grep -FL '~Module signature appended~' {} \+
25+
- |
26+
mkdir -p /extensions-validator-rootfs
27+
cp -r /rootfs/ /extensions-validator-rootfs/rootfs
28+
cp /pkg/manifest.yaml /extensions-validator-rootfs/manifest.yaml
29+
/extensions-validator validate --rootfs=/extensions-validator-rootfs --pkg-name="${PKG_NAME}"
30+
finalize:
31+
- from: /rootfs
32+
to: /rootfs
33+
- from: /pkg/manifest.yaml
34+
to: /

drivers/uinput/vars.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERSION: "{{ .BUILD_ARG_TAG }}"

reproducibility/pkg.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ dependencies:
4848

4949
# thunderbolt can be ignored from reproducibility test since it's kernel modules copied from pkgs
5050
# - stage: thunderbolt
51+
# uinput can be ignored from reproducibility test since it's kernel modules copied from pkgs
52+
# - stage: uinput
5153
# usb-modem-drivers can be ignored from reproducibility test since it's kernel modules copied from pkgs
5254
# - stage: usb-modem-drivers
5355

0 commit comments

Comments
 (0)