-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
Showing
10 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# uinput extension | ||
|
||
## Installation | ||
|
||
See [Installing Extensions](https://github.com/siderolabs/extensions#installing-extensions). | ||
|
||
## Usage | ||
|
||
Enable the `uinput` module in Talos machine config. | ||
|
||
```yaml | ||
machine: | ||
kernel: | ||
modules: | ||
- name: uinput | ||
``` | ||
## Verifiying | ||
You can verify the modules are enabled by the `/proc/modules` where it _should_ show the module is live. | ||
|
||
For example: | ||
|
||
``` | ||
❯ talosctl -n 192.168.42.15 read /proc/modules | ||
uinput 24576 - - Live 0xffffffffc0414000 | ||
``` | ||
|
||
In addition, the `/dev/uinput` device should be present. | ||
|
||
For example: | ||
|
||
``` | ||
❯ talosctl -n 192.168.42.15 ls /dev/uinput' | ||
NODE NAME | ||
192.168.42.15 uinput | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
modules.order | ||
modules.builtin | ||
modules.builtin.modinfo | ||
kernel/drivers/input/misc/uinput.ko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: v1alpha1 | ||
metadata: | ||
name: uinput | ||
version: "$VERSION" | ||
author: Judah Rand | ||
description: | | ||
This system extension provides the uinput kernel module built against a specific Talos version. | ||
This kernel module makes it possible to emulate input devices from userspace. By writing to | ||
/dev/uinput (or /dev/input/uinput) device, a process can create a virtual input device with | ||
specific capabilities. Once this virtual device is created, the process can send events through it, | ||
that will be delivered to userspace and in-kernel consumers. | ||
compatibility: | ||
talos: | ||
version: ">= v1.4.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: uinput | ||
variant: scratch | ||
shell: /toolchain/bin/bash | ||
dependencies: | ||
- stage: base | ||
# The pkgs version for a particular release of Talos as defined in | ||
# https://github.com/siderolabs/talos/blob/<talos version>/pkg/machinery/gendata/data/pkgs | ||
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/kernel:{{ .BUILD_ARG_PKGS }}" | ||
steps: | ||
- prepare: | ||
- | | ||
sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml | ||
- install: | ||
- | | ||
export KERNELRELEASE=$(find /lib/modules -type d -name "*-talos" -exec basename {} \+) | ||
mkdir -p /rootfs | ||
xargs -a /pkg/files/modules.txt -I {} install -D /lib/modules/${KERNELRELEASE}/{} /rootfs/lib/modules/${KERNELRELEASE}/{} | ||
depmod -b /rootfs ${KERNELRELEASE} | ||
- test: | ||
- | | ||
# https://www.kernel.org/doc/html/v4.15/admin-guide/module-signing.html#signed-modules-and-stripping | ||
find /rootfs/lib/modules -name '*.ko' -exec grep -FL '~Module signature appended~' {} \+ | ||
- | | ||
mkdir -p /extensions-validator-rootfs | ||
cp -r /rootfs/ /extensions-validator-rootfs/rootfs | ||
cp /pkg/manifest.yaml /extensions-validator-rootfs/manifest.yaml | ||
/extensions-validator validate --rootfs=/extensions-validator-rootfs --pkg-name="${PKG_NAME}" | ||
finalize: | ||
- from: /rootfs | ||
to: /rootfs | ||
- from: /pkg/manifest.yaml | ||
to: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VERSION: "{{ .BUILD_ARG_TAG }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters