Skip to content

Commit

Permalink
Merge pull request #16 from ublue-os/enable-xbox
Browse files Browse the repository at this point in the history
feat: add xbox controller kmods
  • Loading branch information
bsherman authored May 31, 2023
2 parents b21dd76 + f2fec1b commit 7783128
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 59 deletions.
23 changes: 15 additions & 8 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,28 @@ FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS builder

COPY build*.sh /tmp
COPY certs /tmp/certs
COPY ublue-os-akmods-key.spec /tmp/ublue-os-akmods-key/ublue-os-akmods-key.spec
COPY ublue-os-akmods-addons.spec /tmp/ublue-os-akmods-addons/ublue-os-akmods-addons.spec

ADD https://negativo17.org/repos/fedora-steam.repo \
/tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-steam.repo

RUN /tmp/build-prep.sh

RUN /tmp/build-ublue-os-akmods-key.sh
RUN /tmp/build-ublue-os-akmods-addons.sh

RUN /tmp/build-kmod-v4l2loopback.sh
RUN /tmp/build-kmod-wl.sh
RUN /tmp/build-kmod-xone.sh
RUN /tmp/build-kmod-xpadneo.sh

RUN mkdir -p /var/cache/rpms/{kmods,ublue-os}
RUN cp /tmp/ublue-os-akmods-addons/rpmbuild/RPMS/noarch/ublue-os-akmods-addons*.rpm \
/var/cache/rpms/ublue-os/
RUN for RPM in $(find /var/cache/akmods/ -type f -name \*.rpm); do \
cp "${RPM}" /var/cache/rpms/kmods/; \
done

RUN mkdir /var/cache/rpms && \
for RPM in $(find /var/cache/akmods/ -type f -name \*.rpm); do \
echo ${RPM}; \
cp "${RPM}" /var/cache/rpms/; \
done && \
cp /tmp/ublue-os-akmods-key/rpmbuild/RPMS/noarch/ublue-os-akmods-key*.rpm /var/cache/rpms/
RUN find /var/cache/rpms

FROM scratch

Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,30 @@ A layer for adding extra kernel modules to your image. Use for better hardware s
Add this to your Containerfile to install all the RPM packages, replacing `RELEASE` with either `37` or `38`:

COPY --from=ghcr.io/ublue-os/akmods:RELEASE /rpms/ /tmp/rpms
RUN rpm-ostree install /tmp/rpms/*.rpm
RUN rpm-ostree install /tmp/rpms/ublue-os/*.rpm
RUN rpm-ostree install /tmp/rpms/kmods/*.rpm

This example shows:
1. copying all the rpms from the akmods image
2. installing the ublue specific RPM, providing any extra repos and the akmod signing key
3. installing the kmods RPMs, providing the actual kmods built in this repo

The rpmfusion and extra repos provide dependencies which are required by the kmods RPMs.

It is also required that rpmfusion repos are installed and available to provide dependencies for these kmod RPMs.

# Features

Feel free to PR more kmod build scripts into this repo!

- ublue-os-akmods-key - installs our kmods signing key; install and import to allow SecureBoot systems to use these kmods
- ublue-os-akmods-addons - installs extra repos and our kmods signing key; install and import to allow SecureBoot systems to use these kmods
- [v4l2loopback](https://github.com/umlaeute/v4l2loopback) - allows creating "virtual video devices"
- [broadcom-wl](https://github.com/rpmfusion/broadcom-wl/) - support for some legacy broadcom wifi devices
- [wl (broadcom)](https://github.com/rpmfusion/broadcom-wl/) - support for some legacy broadcom wifi devices
- [xone](https://github.com/medusalix/xone) - xbox one controller USB wired/RF driver (akmod from [negativo17 steam repo](https://negativo17.org/steam/)
- [xpadneo](https://github.com/atar-axis/xpadneo) - xbox one controller bluetooth driver (akmod from [negativo17 steam repo](https://negativo17.org/steam/)

# Adding kmods

If you have a kmod you want to contribute send a pull request by adding a script using [build-kmod-v4l2loopback.sh](https://github.com/ublue-os/akmods/blob/main/build-kmod-v4l2loopback.sh) as an example.
If you have a kmod you want to contribute send a pull request by adding a script using [build-kmod-wl.sh](https://github.com/ublue-os/akmods/blob/main/build-kmod-wl.sh) as an example.

# Verification

Expand Down
2 changes: 1 addition & 1 deletion build-kmod-v4l2loopback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ RELEASE="$(rpm -E '%fedora')"
### BUILD v4l2loopbak (succeed or fail-fast with debug output)
rpm-ostree install \
akmod-v4l2loopback-*.fc${RELEASE}.${ARCH}
akmods --force --kernels "${KERNEL}" --kmod "v4l2loopback"
akmods --force --kernels "${KERNEL}" --kmod v4l2loopback
modinfo /usr/lib/modules/${KERNEL}/extra/v4l2loopback/v4l2loopback.ko.xz > /dev/null \
|| (find /var/cache/akmods/v4l2loopback/ -name \*.log -print -exec cat {} \; && exit 1)
20 changes: 20 additions & 0 deletions build-kmod-xone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -oeux pipefail


cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-steam.repo /etc/yum.repos.d/

ARCH="$(rpm -E '%_arch')"
KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')"
RELEASE="$(rpm -E '%fedora')"


### BUILD xone (succeed or fail-fast with debug output)
rpm-ostree install \
akmod-xone-*.fc${RELEASE}.${ARCH}
akmods --force --kernels "${KERNEL}" --kmod xone
modinfo /usr/lib/modules/${KERNEL}/extra/xone/xone-{dongle,gip-chatpad,gip-gamepad,gip-guitar,gip-headset,gip,wired}.ko.xz > /dev/null \
|| (find /var/cache/akmods/xone/ -name \*.log -print -exec cat {} \; && exit 1)

rm -f /etc/yum.repos.d/fedora-steam.repo
20 changes: 20 additions & 0 deletions build-kmod-xpadneo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -oeux pipefail


cp /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-steam.repo /etc/yum.repos.d/

ARCH="$(rpm -E '%_arch')"
KERNEL="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')"
RELEASE="$(rpm -E '%fedora')"


### BUILD xpadneo (succeed or fail-fast with debug output)
rpm-ostree install \
akmod-xpadneo-*.fc${RELEASE}.${ARCH}
akmods --force --kernels "${KERNEL}" --kmod xpadneo
modinfo /usr/lib/modules/${KERNEL}/extra/xpadneo/hid-xpadneo.ko.xz > /dev/null \
|| (find /var/cache/akmods/xpadneo/ -name \*.log -print -exec cat {} \; && exit 1)

rm -f /etc/yum.repos.d/fedora-steam.repo
13 changes: 13 additions & 0 deletions build-ublue-os-akmods-addons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -oeux pipefail


### BUILD UBLUE AKMODS-ADDONS RPM
#sed -i "s@gpgcheck=0@gpgcheck=1@" /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/negativo17-fedora-steam.repo

install -D /etc/pki/akmods/certs/public_key.der /tmp/ublue-os-akmods-addons/rpmbuild/SOURCES/public_key.der
rpmbuild -ba \
--define '_topdir /tmp/ublue-os-akmods-addons/rpmbuild' \
--define '%_tmppath %{_topdir}/tmp' \
/tmp/ublue-os-akmods-addons/ublue-os-akmods-addons.spec
12 changes: 0 additions & 12 deletions build-ublue-os-akmods-key.sh

This file was deleted.

43 changes: 43 additions & 0 deletions ublue-os-akmods-addons.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Name: ublue-os-akmods-addons
Version: 0.2
Release: 1%{?dist}
Summary: Signing key and repos for ublue os akmods

License: MIT
URL: https://github.com/ublue-os/akmods

BuildArch: noarch
Supplements: mokutil policycoreutils

Source0: public_key.der
Source1: negativo17-fedora-steam.repo

%description
Adds the signing key for importing with mokutil to enable secure boot for kernel modules and repo files required to install akmod dependencies.

%prep
%setup -q -c -T


%build
# Have different name for *.der in case kmodgenca is needed for creating more keys
install -Dm0644 %{SOURCE0} %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/pki/akmods/certs/akmods-ublue.der
install -Dm0644 %{SOURCE1} %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/negativo17-fedora-steam.repo

sed -i 's@enabled=1@enabled=0@g' %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/negativo17-fedora-steam.repo

install -Dm0644 %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/pki/akmods/certs/akmods-ublue.der %{buildroot}%{_sysconfdir}/pki/akmods/certs/akmods-ublue.der
install -Dm0644 %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/negativo17-fedora-steam.repo %{buildroot}%{_sysconfdir}/yum.repos.d/negativo17-fedora-steam.repo

%files
%attr(0644,root,root) %{_datadir}/ublue-os/%{_sysconfdir}/pki/akmods/certs/akmods-ublue.der
%attr(0644,root,root) %{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/negativo17-fedora-steam.repo
%attr(0644,root,root) %{_sysconfdir}/pki/akmods/certs/akmods-ublue.der
%attr(0644,root,root) %{_sysconfdir}/yum.repos.d/negativo17-fedora-steam.repo

%changelog
* Tue May 30 2023 Benjamin Sherman <[email protected]> - 0.2
- Add negativo17 fedora-steam repo to enable xbox controllers

* Fri May 18 2023 David Hoell - 0.1
- Add key for enrolling ublue kernel modules for secure boot
33 changes: 0 additions & 33 deletions ublue-os-akmods-key.spec

This file was deleted.

0 comments on commit 7783128

Please sign in to comment.