Various fixes
CI / inputs (push) Canceled after 0s
CI / module (archlinux:latest) (push) Canceled after 0s
CI / module (debian:12) (push) Canceled after 0s
CI / module (debian:13) (push) Canceled after 0s
CI / module (fedora:43) (push) Canceled after 0s
CI / module (fedora:latest) (push) Canceled after 0s
CI / module (ubuntu:22.04) (push) Canceled after 0s
CI / module (ubuntu:24.04) (push) Canceled after 0s
CI / module (ubuntu:26.04) (push) Canceled after 0s
CI / package (archlinux:latest) (push) Canceled after 0s
CI / package (debian:12) (push) Canceled after 0s
CI / package (debian:13) (push) Canceled after 0s
CI / package (fedora:43) (push) Canceled after 0s
CI / package (fedora:latest) (push) Canceled after 0s
CI / package (ubuntu:22.04) (push) Canceled after 0s
CI / package (ubuntu:24.04) (push) Canceled after 0s
CI / package (ubuntu:26.04) (push) Canceled after 0s

Cloeses #54 #151 #44 #29 #171 #56 #92
This commit is contained in:
Zagitta committed 2026-10-26 20:17:54 +01:00
1 parent 09305c468f
commit 6081407b31
12 files changed
+199 -49

No files matched your search

+20 -9
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# Build the module against the distribution kernel headers of this
# container, with warnings as errors. Run from the repository root.
# Build the module against every set of distribution kernel headers this
# container offers, with warnings as errors. Run from the repository root.
set -eu
. /etc/os-release
case "$ID" in
@@ -10,20 +10,31 @@ debian)
apt-get install -qy --no-install-recommends make gcc linux-headers-amd64 ;;
ubuntu)
apt-get update -q
apt-get install -qy --no-install-recommends make gcc linux-headers-generic ;;
apt-get install -qy --no-install-recommends make gcc linux-headers-generic
# The hardware enablement kernel, where the release has one.
apt-get install -qy --no-install-recommends "linux-headers-generic-hwe-$VERSION_ID" || :
# Its headers do not pull in the gcc it was built with.
apt-get install -qy --no-install-recommends $(grep -h '^CONFIG_CC_VERSION_TEXT=' \
/usr/src/linux-headers-*/.config | grep -o 'gcc-[0-9]*' | sort -u) ;;
fedora)
dnf install -qy make gcc kernel-devel ;;
arch)
pacman -Syu --noconfirm --needed make gcc linux-headers ;;
pacman -Syu --noconfirm --needed make gcc linux-headers linux-lts-headers ;;
*)
echo "unknown distribution: $ID" >&2
exit 1 ;;
esac
# The same headers can show up under more than one of these paths.
built=
for kdir in /usr/src/linux-headers-*-amd64 /usr/src/linux-headers-*-generic \
/usr/src/kernels/* /usr/lib/modules/*/build; do
[ -f "$kdir/Makefile" ] && break
[ -f "$kdir/Makefile" ] || continue
kdir=$(realpath "$kdir")
case " $built " in *" $kdir "*) continue ;; esac
echo "Building against $kdir"
make -C kernel/gpu_unlock KDIR="$kdir" clean
make -C kernel/gpu_unlock KDIR="$kdir" KCFLAGS=-Werror
test -f kernel/gpu_unlock/gpu_unlock.ko
built="$built $kdir"
done
[ -f "$kdir/Makefile" ] || { echo "no kernel headers found" >&2; exit 1; }
echo "Building against $kdir"
make -C kernel/gpu_unlock KDIR="$kdir" KCFLAGS=-Werror
test -f kernel/gpu_unlock/gpu_unlock.ko
[ -n "$built" ] || { echo "no kernel headers found" >&2; exit 1; }
+26 -25
View File
@@ -13,8 +13,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# The pinned NVIDIA/CachyOS inputs (about 340 MB) are fetched once per
# manifest change into .inputs and shared by every job through the cache.
# The pinned NVIDIA inputs are fetched once per change of the list in
# fetch_artifacts.py into .inputs and shared by every job through the cache.
jobs:
inputs:
runs-on: ubuntu-24.04
@@ -24,28 +24,12 @@ jobs:
uses: actions/cache@v4
with:
path: .inputs
key: inputs-${{ hashFiles('firmware/artifacts-*.json') }}
key: inputs-${{ hashFiles('firmware/fetch_artifacts.py') }}
- if: steps.cache.outputs.cache-hit != 'true'
run: make inputs INPUTS=.inputs
- name: Verify the inputs
run: python3 firmware/fetch_artifacts.py --offline .inputs
# With the generated firmware the tests also run the whole unlock against
# mocked hardware, not only the components.
test:
needs: inputs
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- run: sudo apt-get update -q && sudo apt-get install -qy zstd
- uses: actions/cache/restore@v4
with:
path: .inputs
key: inputs-${{ hashFiles('firmware/artifacts-*.json') }}
fail-on-cache-miss: true
- run: make firmware INPUTS=.inputs ASSETS="$RUNNER_TEMP/assets"
- run: make test ASSETS="$RUNNER_TEMP/assets"
module:
name: module (${{ matrix.image }})
runs-on: ubuntu-24.04
@@ -54,15 +38,21 @@ jobs:
fail-fast: false
matrix:
include:
- image: debian:12 # 6.1
- image: debian:12 # 6.1
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git
- image: ubuntu:24.04 # 6.8
- image: debian:13 # 6.12
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git
- image: debian:13 # 6.12
- image: ubuntu:22.04 # 5.15, 6.8 HWE
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git
- image: fedora:latest
- image: ubuntu:24.04 # 6.8, 7.0 HWE
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git
- image: ubuntu:26.04 # 7.0
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git
- image: fedora:43 # 7.2
setup: dnf install -qy git
- image: archlinux:latest
- image: fedora:latest # 7.2
setup: dnf install -qy git
- image: archlinux:latest # 7.2, 6.18 LTS
setup: pacman -Syu --noconfirm --needed git
steps:
# Without git the checkout is a GitHub archive, which leaves out
@@ -80,8 +70,18 @@ jobs:
fail-fast: false
matrix:
include:
- image: debian:12
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git make xz-utils zstd
- image: debian:13
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git make xz-utils zstd
- image: ubuntu:22.04
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git make xz-utils zstd
- image: ubuntu:24.04
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git make xz-utils zstd
- image: ubuntu:26.04
setup: apt-get update -q && apt-get install -qy --no-install-recommends ca-certificates git make xz-utils zstd
- image: fedora:43
setup: dnf install -qy git make xz zstd rpm-build dnf-plugins-core
- image: fedora:latest
setup: dnf install -qy git make xz zstd rpm-build dnf-plugins-core
- image: archlinux:latest
@@ -94,6 +94,7 @@ jobs:
- uses: actions/cache/restore@v4
with:
path: .inputs
key: inputs-${{ hashFiles('firmware/artifacts-*.json') }}
key: inputs-${{ hashFiles('firmware/fetch_artifacts.py') }}
fail-on-cache-miss: true
- run: INPUTS=.inputs sh .github/ci/package.sh
- run: sh tests/packaging/install.sh
+14 -3
View File
@@ -29,7 +29,8 @@ DEBS := $(foreach p,dkms firmware,$(DEBDIR)/gpu-unlock-$(p)_$(VERSION)_all.de
.PHONY: all dist inputs firmware assets install-dkms install-firmware \
install-mkinitcpio install-initramfs-tools install-dracut \
install-licenses arch deb rpm install install-arch install-deb install-rpm
install-licenses arch deb rpm install install-arch install-deb install-rpm \
test-module test-packages
all:
@@ -70,7 +71,7 @@ install-firmware:
install -Dm644 $(ASSETS)/NVIDIA-LICENSE $(DESTDIR)$(LICENSEDIR)/gpu-unlock-firmware/NVIDIA-LICENSE
install -Dm644 firmware/NOTICE.md $(DESTDIR)$(LICENSEDIR)/gpu-unlock-firmware/NOTICE.md
# One file per initramfs generator: include gpu_unlock and its firmware in
# Per initramfs generator: include gpu_unlock and its firmware in
# the image so it runs before an nvidia module loaded from the initramfs.
install-mkinitcpio:
install -Dm644 packaging/boot/mkinitcpio.conf $(DESTDIR)/etc/mkinitcpio.conf.d/zz-gpu-unlock.conf
@@ -78,6 +79,8 @@ install-mkinitcpio:
install-initramfs-tools:
install -Dm644 packaging/boot/initramfs-tools.conf \
$(DESTDIR)/usr/share/initramfs-tools/modules.d/gpu-unlock.conf
install -Dm755 packaging/boot/initramfs-tools-init-top \
$(DESTDIR)/usr/share/initramfs-tools/scripts/init-top/gpu-unlock
install-dracut:
install -Dm644 packaging/boot/dracut.conf $(DESTDIR)/usr/lib/dracut/dracut.conf.d/gpu-unlock.conf
@@ -137,4 +140,12 @@ install-rpm:
sudo dnf install -y rpm-build
sudo dnf builddep -y packaging/rpm/gpu-unlock.spec
$(MAKE) rpm
sudo dnf install -y $(RPMDIR)/RPMS/noarch/gpu-unlock-*-$(VERSION)-*.noarch.rpm
sudo dnf install -y $(RPMDIR)/RPMS/noarch/gpu-unlock-*-$(VERSION)-*.noarch.rpm
# Build the module, or build, install and remove the packages, in a
# container of each distribution.
test-module:
tests/docker.sh module
test-packages:
INPUTS=$(INPUTS) tests/docker.sh package
+1
View File
@@ -1,3 +1,4 @@
usr/src
usr/share/initramfs-tools
usr/lib/dracut
usr/share/doc/gpu-unlock
+1 -1
View File
@@ -17,4 +17,4 @@ override_dh_auto_build:
override_dh_auto_install:
$(MAKE) DESTDIR=$(CURDIR)/debian/tmp ASSETS="$(ASSETS)" \
install-dkms install-firmware install-initramfs-tools
install-dkms install-firmware install-initramfs-tools install-dracut
+10
View File
@@ -5,7 +5,12 @@
* FLR so the stock driver starts from a clean, halted GSP. After resume from
* suspend it runs again on the card nvidia has suspended, before nvidia resumes it.
*/
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
#include <linux/aperture.h>
#else
#include <linux/fb.h>
#endif
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/firmware.h>
@@ -1390,7 +1395,12 @@ static int unlock_transaction_reset(struct unlock_transaction_work *work)
* does nothing on a card without one. After resume nvidia-drm already has.
*/
if (!work->resume) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
ret = aperture_remove_conflicting_pci_devices(work->pdev, "gpu_unlock");
#else
/* Before 6.0 the fbdev helper does the same. */
ret = remove_conflicting_pci_framebuffers(work->pdev, "gpu_unlock");
#endif
if (ret)
return GU_RESULT(ret);
}
+1 -1
View File
@@ -50,7 +50,7 @@ package_gpu-unlock-dkms() {
replaces=('gpu-unlock-mkinitcpio')
install=gpu-unlock.install
cd $pkgbase
make DESTDIR="$pkgdir" install-dkms install-mkinitcpio
make DESTDIR="$pkgdir" install-dkms install-mkinitcpio install-dracut
make DESTDIR="$pkgdir" PKG=$pkgname install-licenses
}
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
# Load gpu_unlock before init-top/udev starts the coldplug, which would
# load nvidia for the card first; modules.d only loads it after that. It
# does nothing unless gpu_unlock.targets= is on the kernel command line.
PREREQ=""
prereqs() { echo "$PREREQ"; }
case $1 in
prereqs) prereqs; exit 0 ;;
esac
modprobe -q gpu_unlock || true
+15 -10
View File
@@ -4,13 +4,18 @@
# before any nvidia loaded from the root filesystem. Named to be read after
# every other drop-in. It does nothing unless gpu_unlock.targets= is on the
# kernel command line.
[[ ${MODULES@a} == *a* ]] || read -ra MODULES <<<"$MODULES"
_gu_modules=()
for _gu_module in "${MODULES[@]}"; do
[[ ${_gu_module%\?} == gpu_unlock ]] && continue
[[ ${_gu_module%\?} == nvidia ]] && _gu_modules+=(gpu_unlock?)
_gu_modules+=("$_gu_module")
done
[[ " ${_gu_modules[*]} " == *' gpu_unlock? '* ]] || _gu_modules+=(gpu_unlock?)
MODULES=("${_gu_modules[@]}")
unset _gu_modules _gu_module
# The name is plain, not gpu_unlock?: the systemd hook copies MODULES as is
# into modules-load.d, which does not know the ?. A kernel without a build
# of the module gets nothing, so its image still builds.
if modinfo -k "$KERNELVERSION" gpu_unlock &>/dev/null; then
[[ ${MODULES@a} == *a* ]] || read -ra MODULES <<<"$MODULES"
_gu_modules=()
for _gu_module in "${MODULES[@]}"; do
[[ ${_gu_module%\?} == gpu_unlock ]] && continue
[[ ${_gu_module%\?} == nvidia ]] && _gu_modules+=(gpu_unlock)
_gu_modules+=("$_gu_module")
done
[[ " ${_gu_modules[*]} " == *' gpu_unlock '* ]] || _gu_modules+=(gpu_unlock)
MODULES=("${_gu_modules[@]}")
unset _gu_modules _gu_module
fi
+56
View File
@@ -0,0 +1,56 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# Run a CI job of the working tree in a fresh container of each
# distribution: "module" builds the module against the distribution
# kernels, "package" builds, installs and removes the native packages.
# Run from the repository root; the arguments after the job pick the
# images, all of them by default.
set -eu
job=${1:?usage: tests/docker.sh module|package [image...]}
shift
INPUTS=${INPUTS:-$HOME/.cache/gpu-unlock/inputs}
mounts=
if [ "$job" = package ]; then
make inputs INPUTS="$INPUTS"
mounts="-v $(realpath "$INPUTS"):/inputs:ro"
fi
commit=$(packaging/snapshot.sh)
[ $# -gt 0 ] || set -- debian:12 debian:13 ubuntu:22.04 ubuntu:24.04 \
ubuntu:26.04 fedora:43 fedora:latest archlinux:latest
# The same setup as the CI jobs. The job runs on a clone so that nothing
# in the checkout ends up owned by root.
script='
. /etc/os-release
case "$ID" in
debian|ubuntu)
apt-get update -q
apt-get install -qy --no-install-recommends ca-certificates git make xz-utils zstd ;;
fedora)
dnf install -qy git make xz zstd rpm-build dnf-plugins-core ;;
arch)
pacman -Syu --noconfirm --needed base-devel git zstd ;;
esac
git config --global --add safe.directory "*"
git clone -q --shared /src /work
cd /work
git checkout -q "$1"
case "$2" in
module)
sh .github/ci/module.sh ;;
package)
cp -r /inputs /tmp/inputs
INPUTS=/tmp/inputs sh .github/ci/package.sh
sh tests/packaging/install.sh ;;
esac
'
failed=
for image; do
echo "==> $image"
# shellcheck disable=SC2086
docker run --rm -v "$PWD:/src:ro" $mounts "$image" \
sh -euc "$script" sh "$commit" "$job" || failed="$failed $image"
done
[ -z "$failed" ] || { echo "failed:$failed" >&2; exit 1; }
echo "$job passed on all images"
+3
View File
@@ -0,0 +1,3 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
#define LINUX_VERSION_CODE KERNEL_VERSION(6, 0, 0)
+42
View File
@@ -0,0 +1,42 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# Install the packages .github/ci/package.sh built, check what they put on
# disk, then remove them again. Run as root from the repository root.
set -eu
version=$(cat VERSION)
src=/usr/src/gpu-unlock-$version
fw=/usr/lib/firmware/gpu-unlock/610.43.03
dracut=/usr/lib/dracut/dracut.conf.d/gpu-unlock.conf
. /etc/os-release
case "$ID" in
debian|ubuntu)
install="apt-get install -qy --no-install-recommends ./build/deb/*.deb"
remove="apt-get purge -qy"
boot=/usr/share/initramfs-tools/scripts/init-top/gpu-unlock ;;
fedora)
install="dnf install -qy build/rpm/RPMS/noarch/*.rpm"
remove="dnf remove -qy"
boot=$dracut ;;
arch)
install="pacman -U --noconfirm packaging/arch/*.pkg.tar.zst"
remove="pacman -Rns --noconfirm"
boot=/etc/mkinitcpio.conf.d/zz-gpu-unlock.conf ;;
*)
echo "unknown distribution: $ID" >&2
exit 1 ;;
esac
$install
test -f "$src/dkms.conf"
test -f "$src/main.c"
test -f "$fw/gsp_ga10x.bin"
test -f "$fw/booter_load_ga102.bin"
test -f "$dracut"
test -f "$boot"
$remove gpu-unlock-dkms gpu-unlock-firmware
test ! -e "$src"
test ! -e "$fw"
test ! -e "$dracut"
test ! -e "$boot"
echo "packages install and remove cleanly"