Skip to content

Commit

Permalink
feat: add binfmt_misc
Browse files Browse the repository at this point in the history
Add binfmt-misc kernel support.

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
  • Loading branch information
sergelogvinov authored and smira committed Sep 19, 2023
1 parent 336397b commit 46a3004
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ space = $(empty) $(empty)
TARGETS = \
amdgpu-firmware \
amd-ucode \
binfmt-misc \
bnx2-bnx2x \
btrfs \
chelsio-drivers \
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ All system extensions provided by Sidero Labs can be found in the [ghcr.io regis
| [thunderbolt](drivers/thunderbolt/) | [ghcr.io/siderolabs/thunderbolt](https://github.com/siderolabs/extensions/pkgs/container/thunderbolt) | Thunderbolt drivers | `talos version` |
| [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` |

### Miscellaneous

| Name | Image | Description | Version Format |
| ------------------------------- | ------------------------------------------------------------------------------------------------- | ---------------------------------- | ------------------ |
| [binfmt-misc](modules/binfmt-misc) | [ghcr.io/siderolabs/binfmt-misc](https://github.com/siderolabs/extensions/pkgs/container/binfmt-misc) | Miscellaneous Binary Format | `talos version` |

### Network

| Name | Image | Description | Version Format |
Expand Down
6 changes: 6 additions & 0 deletions hack/release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ AMD GPU firmware is now shipped as a system extension.
title = "BTRFS"
description = """\
BTRFS drivers is now supported as Talos System Extension.
"""

[notes.binfmt_misc]
title = "binfmt_misc"
description = """\
`binfmt_misc` Linux module extension is now supported as Talos System Extension.
"""

[notes.zfs]
Expand Down
17 changes: 17 additions & 0 deletions misc/binfmt-misc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# binfmt_misc

Miscellaneous Binary Format is a capability of the Linux kernel that allows arbitrary executable file formats to be recognized and passed to certain user space applications, such as emulators and virtual machines.

## Installation

Add the extension to your machine config and enable the modules.

```yaml
machine:
install:
extensions:
- image: ghcr.io/siderolabs/binfmt-misc:<VERSION>
kernel:
modules:
- name: binfmt_misc
```
4 changes: 4 additions & 0 deletions misc/binfmt-misc/files/modules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
modules.order
modules.builtin
modules.builtin.modinfo
kernel/fs/binfmt_misc.ko
10 changes: 10 additions & 0 deletions misc/binfmt-misc/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v1alpha1
metadata:
name: binfmt-misc
version: "$VERSION"
author: Serge Logvinov
description: |
This system extension provides kernel module driver for binfmt-misc built against a specific Talos version.
compatibility:
talos:
version: ">= v1.5.0"
29 changes: 29 additions & 0 deletions misc/binfmt-misc/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: binfmt-misc
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: "{{ .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~' {} \+
finalize:
- from: /rootfs
to: /rootfs
- from: /pkg/manifest.yaml
to: /
1 change: 1 addition & 0 deletions misc/binfmt-misc/vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION: "{{ .BUILD_ARG_TAG }}"

0 comments on commit 46a3004

Please sign in to comment.