Skip to content

Commit b92e8ae

Browse files
committed
first commit
0 parents  commit b92e8ae

File tree

18 files changed

+766
-0
lines changed

18 files changed

+766
-0
lines changed

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
7+
jobs:
8+
packaging-debian:
9+
runs-on: ubuntu-24.04
10+
steps:
11+
- name: Install Dependencies
12+
run: |
13+
sudo apt-get update
14+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential devscripts dh-make dh-dkms dkms tree
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
path: usb_oc-dkms
19+
- name: Packaging
20+
working-directory: usb_oc-dkms
21+
run: |
22+
LATEST_VERSION=$(grep "^PACKAGE_VERSION" "dkms.conf" | sed 's/.*\?"\([^"]*\)".*/\1/')
23+
ln -s packaging/debian debian
24+
sed -i "s/###LATEST_VERSION###/$LATEST_VERSION/g" debian/control debian/changelog
25+
dpkg-buildpackage --build=binary --post-clean --unsigned-source --unsigned-changes
26+
- name: Upload artifact
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: debian-package
30+
path: "*.deb"
31+
32+
packaging-archlinux:
33+
runs-on: ubuntu-24.04
34+
container:
35+
image: archlinux:base-devel
36+
steps:
37+
- name: Install Dependencies
38+
run: |
39+
pacman-key --init
40+
pacman -Syu --noconfirm git dkms
41+
useradd -m user
42+
sed -i 's/COMPRESSZST=.*/COMPRESSZST=(zstd -c -T0 --ultra -22 -)/' /etc/makepkg.conf
43+
echo "user ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
with:
47+
path: usb_oc-dkms
48+
- name: Packaging
49+
working-directory: usb_oc-dkms/packaging/arch
50+
run: |
51+
chown -R user: .
52+
sudo -u user makepkg -s --noconfirm
53+
- name: Upload artifact
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: arch-package
57+
path: "usb_oc-dkms/packaging/arch/*.pkg*"
58+
59+
packaging-fedora:
60+
runs-on: ubuntu-24.04
61+
container:
62+
image: fedora:rawhide
63+
steps:
64+
- name: Install Dependencies
65+
run: |
66+
dnf install -y \
67+
https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-"$(rpm -E %fedora)".noarch.rpm \
68+
https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm
69+
dnf update -y
70+
dnf install -y fedpkg fedora-packager rpmdevtools ncurses-devel pesign \
71+
bpftool bc bison dwarves elfutils-devel flex gcc gcc-c++ gcc-plugin-devel \
72+
glibc-static hostname m4 make net-tools openssl openssl-devel perl-devel \
73+
perl-generators python3-devel which kernel-rpm-macros kernel kernel-devel kmodtool tree
74+
rpmdev-setuptree
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
with:
78+
path: usb_oc-dkms
79+
- name: Packaging
80+
working-directory: usb_oc-dkms/packaging/rpm
81+
run: |
82+
# 6.18.8-200.fc43.x86_64
83+
rpmbuild -ba usb_oc-kmod.spec --define "kernels $(uname -r)" --target $(uname -m)
84+
rpmbuild -bs usb_oc-kmod.spec --define "kernels $(uname -r)" --target $(uname -m)
85+
mock --enable-network -r fedora-rawhide-x86_64 --rebuild --resultdir=/tmp/mockbuild/ ~/rpmbuild/SRPMS/usb_oc-*.src.rpm
86+
- name: Upload artifact
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: arch-package
90+
path: "usb_oc-dkms/packaging/rpm/*.rpm*"
91+
92+
release:
93+
runs-on: ubuntu-24.04
94+
needs: [packaging-debian, packaging-archlinux]
95+
if: github.ref_type == 'tag'
96+
permissions:
97+
contents: write
98+
steps:
99+
- name: Download artifacts
100+
uses: actions/download-artifact@v4
101+
with:
102+
merge-multiple: true
103+
- name: Create Release
104+
uses: softprops/action-gh-release@v2
105+
with:
106+
files: |
107+
*.pkg*
108+
*.deb

.github/workflows/test.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Test
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- "**"
8+
tags-ignore:
9+
- "v[0-9]+.[0-9]+.[0-9]+"
10+
11+
jobs:
12+
test-proxmox-trixie:
13+
runs-on: ubuntu-24.04
14+
container:
15+
image: debian:trixie
16+
steps:
17+
- name: Install Dependencies
18+
run: |
19+
export DEBIAN_FRONTEND=noninteractive
20+
apt-get update
21+
apt-get install -y curl
22+
sh -c "echo deb http://download.proxmox.com/debian/pve trixie pve-no-subscription >> /etc/apt/sources.list"
23+
curl -o /etc/apt/trusted.gpg.d/proxmox-release-trixie.gpg https://enterprise.proxmox.com/debian/proxmox-release-trixie.gpg
24+
apt-get update
25+
apt-get install -y proxmox-archive-keyring
26+
apt-get upgrade -y
27+
apt-get install -y build-essential elfutils libelf-dev proxmox-default-kernel proxmox-default-headers
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
path: usb_oc-dkms
32+
- name: Build Module
33+
working-directory: usb_oc-dkms
34+
run: |
35+
KERNEL_SOURCE_DIR=$(dpkg -L $(dpkg -s $(dpkg -s proxmox-default-headers | grep "Depends: " | cut -d " " -f2) | grep "Depends: " | cut -d " " -f2) | grep -m 1 -Eo ".*/lib/modules/[^/]+/build")
36+
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
37+
make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd)
38+
39+
test-archlinux:
40+
runs-on: ubuntu-24.04
41+
container:
42+
image: archlinux:base-devel
43+
steps:
44+
- name: Install Dependencies
45+
run: |
46+
pacman-key --init
47+
pacman -Syu --noconfirm git linux linux-headers
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
with:
51+
path: usb_oc-dkms
52+
- name: Check Kernel Compatibility
53+
if: github.event_name != 'workflow_dispatch'
54+
id: check_kernel
55+
working-directory: usb_oc-dkms
56+
run: |
57+
KERNEL_SOURCE_DIR=$(pacman -Qql linux-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build")
58+
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
59+
echo "Detected kernel: $KERNELRELEASE"
60+
61+
REGEX=$(grep '^BUILD_EXCLUSIVE_KERNEL=' dkms.conf | cut -d'"' -f2)
62+
63+
if [[ ! "$KERNELRELEASE" =~ $REGEX ]]; then
64+
echo "Kernel $KERNELRELEASE not supported yet."
65+
echo "skip_build=true" >> $GITHUB_OUTPUT
66+
else
67+
echo "Kernel $KERNELRELEASE is supported."
68+
echo "skip_build=false" >> $GITHUB_OUTPUT
69+
fi
70+
- name: Build Module
71+
if: github.event_name == 'workflow_dispatch' || steps.check_kernel.outputs.skip_build == 'false'
72+
working-directory: usb_oc-dkms
73+
run: |
74+
KERNEL_SOURCE_DIR=$(pacman -Qql linux-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build")
75+
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
76+
sudo make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd)
77+
78+
test-archlinux-lts:
79+
runs-on: ubuntu-24.04
80+
container:
81+
image: archlinux:base-devel
82+
steps:
83+
- name: Install Dependencies
84+
run: |
85+
pacman-key --init
86+
pacman -Syu --noconfirm git linux-lts linux-lts-headers
87+
- name: Checkout
88+
uses: actions/checkout@v4
89+
with:
90+
path: usb_oc-dkms
91+
- name: Build Module
92+
working-directory: usb_oc-dkms
93+
run: |
94+
KERNEL_SOURCE_DIR=$(pacman -Qql linux-lts-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build")
95+
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
96+
sudo make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd)
97+
98+
test-archlinux-mainline:
99+
runs-on: ubuntu-24.04
100+
container:
101+
image: archlinux:base-devel
102+
steps:
103+
- name: Install Dependencies
104+
run: |
105+
pacman-key --init
106+
cat <<EOF >> /etc/pacman.conf
107+
[archlinuxcn]
108+
Server = https://repo.archlinuxcn.org/\$arch
109+
SigLevel = Never
110+
EOF
111+
pacman -Syu --noconfirm git linux-mainline linux-mainline-headers
112+
- name: Checkout
113+
uses: actions/checkout@v4
114+
with:
115+
path: usb_oc-dkms
116+
- name: Check Kernel Compatibility
117+
if: github.event_name != 'workflow_dispatch'
118+
id: check_kernel
119+
working-directory: usb_oc-dkms
120+
run: |
121+
KERNEL_SOURCE_DIR=$(pacman -Qql linux-mainline-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build")
122+
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
123+
echo "Detected kernel: $KERNELRELEASE"
124+
125+
REGEX=$(grep '^BUILD_EXCLUSIVE_KERNEL=' dkms.conf | cut -d'"' -f2)
126+
127+
if [[ ! "$KERNELRELEASE" =~ $REGEX ]]; then
128+
echo "Kernel $KERNELRELEASE not supported yet."
129+
echo "skip_build=true" >> $GITHUB_OUTPUT
130+
else
131+
echo "Kernel $KERNELRELEASE is supported."
132+
echo "skip_build=false" >> $GITHUB_OUTPUT
133+
fi
134+
- name: Build Module
135+
if: github.event_name == 'workflow_dispatch' || steps.check_kernel.outputs.skip_build == 'false'
136+
working-directory: usb_oc-dkms
137+
run: |
138+
KERNEL_SOURCE_DIR=$(pacman -Qql linux-mainline-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build")
139+
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
140+
sudo make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd)
141+
142+
# test-nixos:
143+
# runs-on: ubuntu-24.04
144+
# steps:
145+
# - name: "Install Nix"
146+
# uses: cachix/install-nix-action@v31.5.1
147+
# - name: Checkout
148+
# uses: actions/checkout@v4
149+
# with:
150+
# path: usb_oc-dkms
151+
# - name: Build i915-sriov kernel module for NixOS
152+
# working-directory: usb_oc-dkms
153+
# env:
154+
# GC_DONT_GC: "1"
155+
# run: |
156+
# nix --version
157+
# nix flake check

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Packages
2+
*.tar.zst
3+
*.deb
4+
/packaging/arch/source/
5+
/packaging/arch/src/
6+
/packaging/arch/pkg/

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#DKMS_MODULE_VERSION := "1.0"
2+
#DKMS_MODULE_ORIGIN_KERNEL := "6.19-rc8"
3+
#
4+
#LINUXINCLUDE := \
5+
# -I$(src)/include \
6+
# -I$(src)/include/uapi \
7+
# -I$(src)/include/trace \
8+
# $(LINUXINCLUDE) #\
9+
# #-include $(src)/include/config.h
10+
#
11+
#CONFIG_DRM_GPUSVM := y # we vendor our own copy of the GPUSVM module
12+
13+
#subdir-ccflags-y += \
14+
# -DDKMS_MODULE_VERSION='$(DKMS_MODULE_VERSION)' \
15+
# -DDKMS_MODULE_ORIGIN_KERNEL='$(DKMS_MODULE_ORIGIN_KERNEL)' \
16+
# -DDKMS_MODULE_SOURCE_DIR='$(abspath $(src))'
17+
18+
obj-m += src/
19+
#obj-m += compat/
20+
#obj-m += drivers/gpu/drm/i915/
21+
#obj-m += drivers/gpu/drm/xe/
22+
23+
.PHONY: default clean modules load unload install patch

dkms.conf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
PACKAGE_NAME="usb_oc"
2+
PACKAGE_VERSION="1.0"
3+
4+
BUILT_MODULE_NAME[0]="usb_oc"
5+
BUILT_MODULE_LOCATION[0]=src
6+
DEST_MODULE_LOCATION[0]=/extramodules
7+
8+
# BUILT_MODULE_NAME[1]="i915"
9+
# BUILT_MODULE_LOCATION[1]=drivers/gpu/drm/i915
10+
# DEST_MODULE_LOCATION[1]=/updates
11+
12+
# BUILT_MODULE_NAME[2]="kvmgt"
13+
# BUILT_MODULE_LOCATION[2]=drivers/gpu/drm/i915
14+
# DEST_MODULE_LOCATION[2]=/updates
15+
16+
# BUILT_MODULE_NAME[3]="xe"
17+
# BUILT_MODULE_LOCATION[3]=drivers/gpu/drm/xe
18+
# DEST_MODULE_LOCATION[3]=/updates
19+
20+
#MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
21+
22+
AUTOINSTALL=yes
23+
#BUILD_EXCLUSIVE_KERNEL="^6\.1[2-9]"

packaging/arch/PKGBUILD

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
_modulename=usb_oc
2+
pkgname=${_modulename}-dkms
3+
pkgver=1.0
4+
pkgrel=11
5+
pkgdesc="Kernel module for overclocking USB devices"
6+
arch=('any')
7+
url="https://github.com/p0358/usb_oc-dkms"
8+
license=("GPL-2.0-only")
9+
depends=("dkms")
10+
#makedepends=("dkms")
11+
#source=('https://github.com/hannesmann/gcadapter-oc-kmod/archive/v1.4.tar.gz'
12+
# 'dkms.conf')
13+
#sha256sums=('8333ee6aa10a63ebad55d36d743cc2c59878919e90b2075dba0446db6cceb625'
14+
# '8896209dd19cfd6f9a65b1cefc0828408765f068b8a8ad565cd5e57d7ea839c7')
15+
install=${pkgname}.install
16+
source=("source::git+file://$(realpath $(pwd)/../..)/.git")
17+
sha256sums=('SKIP')
18+
19+
#prepare() {
20+
# cd "$srcdir/$source"
21+
#}
22+
23+
package() {
24+
cd "$srcdir/source"
25+
26+
# Copy module into /usr/src
27+
#install -dm755 "${pkgdir}/usr/src/${pkgname}-${pkgver}-${pkgrel}"
28+
install -dm755 "${pkgdir}/usr/src/${_modulename}-${pkgver}"
29+
#cp -r {src,dkms.conf,Makefile} "${pkgdir}/usr/src/${pkgname}-${pkgver}-${pkgrel}" #Makefile
30+
cp -r {src,dkms.conf,Makefile} "${pkgdir}/usr/src/${_modulename}-${pkgver}" #Makefile
31+
32+
# Set name and version
33+
#sed -e "s/@PKGVER@/${pkgver}-${pkgrel}/" -i "${pkgdir}"/usr/src/${pkgname}-${pkgver}-${pkgrel}/dkms.conf
34+
sed -i -e "s|^PACKAGE_VERSION=.*|PACKAGE_VERSION=\"${pkgver}\"|" "${pkgdir}"/usr/src/${_modulename}-${pkgver}/dkms.conf
35+
sed -i -Ee "s|^MODULE_VERSION(\"[^\"]*\")\;|MODULE_VERSION\(\"${pkgver}\"\)\;|" "${pkgdir}"/usr/src/${_modulename}-${pkgver}/src/usb_oc.c
36+
}

packaging/arch/usb_oc-dkms.install

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
post_install() {
2+
echo "NOTE: The usb_oc kernel module needs manual setup."
3+
echo "Please refer to https://github.com/p0358/usb_oc-dkms/blob/master/README.md for instructions."
4+
}
5+
6+
post_remove() {
7+
echo "The usb_oc kernel module will be removed on reboot. Alternatively, use rmmod to unload it immediately."
8+
}

packaging/debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
usb-oc-dkms (###LATEST_VERSION###) UNRELEASED; urgency=low
2+
3+
* Initial release
4+
5+
-- p0358 <p0358@users.noreply.github.com> Mon, 12 Feb 2026 00:00:00 +0200

packaging/debian/control

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Source: usb-oc-dkms
2+
Section: kernel
3+
Priority: optional
4+
Maintainer: p0358 <p0358@users.noreply.github.com>
5+
Rules-Requires-Root: no
6+
Build-Depends:
7+
debhelper-compat (= 13), dh-sequence-dkms
8+
Standards-Version: 1.0
9+
Homepage: https://github.com/p0358/usb_oc-dkms
10+
11+
Package: usb-oc-dkms
12+
Architecture: amd64
13+
Depends:
14+
${misc:Depends}, build-essential
15+
Description: Kernel module for overclocking USB devices

0 commit comments

Comments
 (0)