Skip to content

Commit

Permalink
ci: auto build package and create release
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaa-bbaa committed Jan 3, 2025
1 parent fb229bb commit 5902f48
Show file tree
Hide file tree
Showing 17 changed files with 332 additions and 71 deletions.
23 changes: 0 additions & 23 deletions .bumpversion.cfg

This file was deleted.

168 changes: 168 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Build

on:
workflow_dispatch:
push:

jobs:
packaging-debian:
runs-on: ubuntu-24.04
steps:
- name: Install Dependencies
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential devscripts dh-make dh-dkms dkms
- name: Checkout
uses: actions/checkout@v4
with:
path: i915-sriov-dkms
- name: Packaging
working-directory: i915-sriov-dkms
run: dpkg-buildpackage -tc
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: debain-package
path: "*.deb"

packaging-archlinux:
runs-on: ubuntu-24.04
container:
image: archlinux:base-devel
steps:
- name: Install Dependencies
run: |
pacman-key --init
pacman -Syu --noconfirm git dkms
- name: Checkout
uses: actions/checkout@v4
with:
path: i915-sriov-dkms
- name: Packaging
working-directory: i915-sriov-dkms
run: |
useradd -m user
sed -i 's/COMPRESSZST=.*/COMPRESSZST=(zstd -c -T0 --ultra -20 -)/' /etc/makepkg.conf
echo "user ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
chown -R user: .
sudo -u user makepkg -s
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: arch-package
path: "i915-sriov-dkms/*.pkg*"

test-ubuntu-noble:
runs-on: ubuntu-24.04
steps:
- name: Install Dependencies
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential linux-generic linux-headers-generic
- name: Checkout
uses: actions/checkout@v4
with:
path: i915-sriov-dkms
- name: Build Module
working-directory: i915-sriov-dkms
run: |
KERNEL_SOURCE_DIR=$(dpkg -L $(dpkg -s linux-headers-generic | grep "Depends: " | cut -d " " -f2) | grep -m 1 -Eo ".*/lib/modules/[^/]+/build")
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
sudo make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd)
test-ubuntu-oracular:
runs-on: ubuntu-24.04
container:
image: ubuntu:24.10
steps:
- name: Install Dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential linux-generic linux-headers-generic
- name: Checkout
uses: actions/checkout@v4
with:
path: i915-sriov-dkms
- name: Build Module
working-directory: i915-sriov-dkms
run: |
KERNEL_SOURCE_DIR=$(dpkg -L $(dpkg -s linux-headers-generic | grep "Depends: " | cut -d " " -f2) | grep -m 1 -Eo ".*/lib/modules/[^/]+/build")
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd)
test-proxmox:
runs-on: ubuntu-24.04
steps:
- name: Install Dependencies
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential
sudo sh -c "echo deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription >> /etc/apt/sources.list"
sudo apt-get --allow-insecure-repositories update
sudo DEBIAN_FRONTEND=noninteractive apt-get --allow-unauthenticated install -y proxmox-archive-keyring
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y proxmox-default-kernel proxmox-default-headers
- name: Checkout
uses: actions/checkout@v4
with:
path: i915-sriov-dkms
- name: Build Module
working-directory: i915-sriov-dkms
run: |
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")
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
sudo make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd)
test-archlinux:
runs-on: ubuntu-24.04
container:
image: archlinux:base-devel
steps:
- name: Install Dependencies
run: |
pacman-key --init
pacman -Syu --noconfirm linux linux-headers
- name: Checkout
uses: actions/checkout@v4
with:
path: i915-sriov-dkms
- name: Build Module
working-directory: i915-sriov-dkms
run: |
KERNEL_SOURCE_DIR=$(pacman -Qql linux-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build")
KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//')
sudo make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd)
release:
runs-on: ubuntu-24.04
needs: [packaging-debian, packaging-archlinux, test-ubuntu-noble, test-ubuntu-oracular, test-proxmox, test-archlinux]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
path: i915-sriov-dkms
- name: Check release created
working-directory: i915-sriov-dkms
run: |
VERSION=$(grep "^PACKAGE_VERSION" "dkms.conf" | grep -o "[0-9]*\.[0-9]*\.[0-9]*")
echo "VERSION=$VERSION" >> $GITHUB_ENV
git tag | grep $VERSION && echo "MAKE_RELEASE=0" > $GITHUB_ENV || echo "MAKE_RELEASE=1" >> $GITHUB_ENV
- name: Download artifacts
if: ${{ env.MAKE_RELEASE == 1 }}
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create Release
if: ${{ env.MAKE_RELEASE == 1 }}
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
name: ${{ env.VERSION }}
tag_name: ${{ env.VERSION }}
files: |
*.pkg*
*.deb
26 changes: 14 additions & 12 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# Maintainer: Xilin Wu <[email protected]>

_pkgbase=i915-sriov-dkms
pkgname=i915-sriov-dkms-git
pkgname=i915-sriov-dkms
pkgver=2024.12.30
pkgrel=1
pkgdesc="Linux i915 module patched with SR-IOV support"
arch=('x86_64')
url="https://github.com/strongtz/i915-sriov-dkms"
license=('GPL2')
depends=('dkms')
license=('GPL-2.0-only')
makedepends=('git')
conflicts=("${_pkgbase}")
depends=('dkms')
conflicts=("${pkgname}-git")
backup=("etc/tmpfiles.d/i915-set-sriov-numvfs.conf")
install=${pkgname}.install
source=("git+https://github.com/strongtz/i915-sriov-dkms.git")
md5sums=('SKIP')
source=("git+https://github.com/strongtz/i915-sriov-dkms.git" "i915-set-sriov-numvfs.conf")
sha256sums=('SKIP'
'e85e4d4c97cb1f6e825c47ea5e3a9c18f10761714307985f67b58c8e55a1e2c2')

package() {
cd "$srcdir/$_pkgbase"
# Copy dkms.conf
install -Dm644 dkms.conf "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/dkms.conf
cd "$srcdir/$pkgname"

echo "* Copying module into /usr/src..."
install -dm755 "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
cp -r ${srcdir}/$_pkgbase/* "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
install -dm755 "${pkgdir}/usr/src/${pkgname}-${pkgver}"
cp -r ${srcdir}/$pkgname/{compat,config,drivers,include,Makefile,configure,dkms.conf} "${pkgdir}/usr/src/${pkgname}-${pkgver}"

cd "$srcdir"
install -Dm644 i915-set-sriov-numvfs.conf "${pkgdir}/etc/tmpfiles.d/i915-set-sriov-numvfs.conf"
}
64 changes: 36 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ This package is **highly experimental**, you should only use it when you know wh

You need to install this dkms module in **both host and guest!**

For Arch Linux users, it is available in AUR. [i915-sriov-dkms](https://aur.archlinux.org/packages/i915-sriov-dkms-git)

Tested kernel versions: 6.12.6-zen1/6.11.9-arch1/6.10.9-arch1/6.9.10-arch1/6.8.9-arch1 with ArchLinux


Expand All @@ -26,33 +24,24 @@ echo 2 > /sys/devices/pci0000:00/0000:00:02.0/sriov_numvfs

You can create up to 7 VFs on Intel UHD Graphics

## PVE Host Installation Steps (Tested Kernel 6.5 and 6.8)
1. Clone this repo
## Arch Linux Installation Steps (Tested Kernel 6.12.6-zen1)

For Arch Linux users, it is available in AUR. [i915-sriov-dkms](https://aur.archlinux.org/packages/i915-sriov-dkms)
You also can download the package from the [releases page](https://github.com/strongtz/i915-sriov-dkms/releases) and install it with `pacman -U`.

## PVE Host Installation Steps (Tested Kernel 6.8)
1. Install build tools: `apt install build-* dkms`
1. Install the kernel and headers for desired version: `apt install proxmox-headers-6.8.8-2-pve proxmox-kernel-6.8.8-2-pve` (for unsigned kernel).
1. Change into the root of the cloned repository and run `dkms add .`.
1. Execute the command `dkms install -m i915-sriov-dkms -v 2024.12.30 --force` or `dkms install -m i915-sriov-dkms -v $(cat VERSION) --force` for a version-independent command.
1. Install the kernel and headers for desired version: `apt install proxmox-headers-6.8 proxmox-kernel-6.8` (for unsigned kernel).
1. Download deb package from the [releases page](https://github.com/strongtz/i915-sriov-dkms/releases)`
1. Install the deb package with dpkg: `dpkg -i i915-sriov-dkms_2024.12.30_amd64.deb`
1. Once finished, the kernel commandline needs to be adjusted: `nano /etc/default/grub` and change `GRUB_CMDLINE_LINUX_DEFAULT` to `intel_iommu=on i915.enable_guc=3 i915.max_vfs=7`, or add to it if you have other arguments there already.
1. Update `grub` and `initramfs` by executing `update-grub` and `update-initramfs -u`
1. Optionally pin the kernel version and update the boot config via `proxmox-boot-tool`.
1. In order to enable the VFs, a `sysfs` attribute must be set. Install `sysfsutils`, then do `echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7" > /etc/sysfs.conf`, assuming your iGPU is on 00:02 bus. If not, use `lspci | grep VGA` to find the PCIe bus your iGPU is on.
1. Reboot the system.
1. When the system is back up again, you should see the number of VFs under 02:00.1 - 02:00.7. Again, assuming your iGPU is on 00:02 bus.
1. You can passthrough the VFs to LXCs or VMs. However, never touch the PF which is 02:00.0 under any circumstances.

## PVE Host Installation Steps (Tested Kernel 6.1 and 6.2)
1. Clone this repo
1. Install some tools. `apt install build-* dkms`
1. Go inside the repo, edit the `dkms.conf`file, change the `PACKAGE_NAME` to `i915-sriov-dkms`, and change the `PACKAGE_VERSION` to `6.1`. Save the file.
1. Move the entire content of the repository to `/usr/src/i915-sriov-dkms-6.1`. The folder name will be the DKMS package name.
1. Execute command `dkms install -m i915-sriov-dkms -v 6.1 --force`. `-m` argument denotes the package name, and it should be the same as the folder name which contains the package content. `-v` argument denotes the package version, which we have specified in the `dkms.conf` as `6.1`. `--force` argument will reinstall the module even if a module with same name has been already installed.
1. The kernel module should begin building.
1. Once finished, we need to make a few changes to the kernel commandline. `nano /etc/default/grub` and change `GRUB_CMDLINE_LINUX_DEFAULT` to 'intel_iommu=on i915.enable_guc=3 i915.max_vfs=7`, or add to it if you have other arguments there already.
1. Update `grub` and `initramfs` by executing `update-grub` and `update-initramfs -u`
1. In order to enable the VFs, we need to modify some variables in the `sysfs`. Install `sysfsutils`, then do `echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7" > /etc/sysfs.conf`, assuming your iGPU is on 00:02 bus. If not, use `lspci | grep VGA` to find the PCIe bus your iGPU is on.
1. Reboot the system.
1. When the system is back up again, you should see the number of VFs you specified show up under 02:00.1 - 02:00.7. Again, assuming your iGPU is on 00:02 bus.
1. You can passthrough the VFs to LXCs or VMs. However, never touch the PF which is 02:00.0 under any circumstances.

## Linux Guest Installation Steps (Tested Kernel 6.2)
We will need to run the same driver under Linux guests. We can repeat the steps for installing the driver. However, when modifying command line defaults, we use `i915.enable_guc=3` instead of `i915.enable_guc=3 i915.max_vfs=7`. Furthermore, we don't need to use `sysfsutils` to create any more VFs since we ARE using a VF.
Once that's done, update `grub` and `initramfs`, then reboot. Once the VM is back up again, do `dmesg | grep i915` to see if your VF is recognized by the kernel.
Expand All @@ -64,14 +53,33 @@ I've used Intel gfx version 4316 to get it working. Here's a link to download it

See also: https://github.com/strongtz/i915-sriov-dkms/issues/8#issuecomment-1567465036

## Manual Installation Steps
1. Install build tools: `apt install build-essential dkms git` / `pacman -S base-devel dkms git`.
1. Install the kernel and headers for desired version: `apt install linux-headers-$(uname -r)` / `pacman -S linux-headers`.
1. Clone the repository: `git clone https://github.com/strongtz/i915-sriov-dkms.git`.
1. Add the module to DKMS: `dkms add ./i915-sriov-dkms`.
1. Install the module with DKMS: `dkms install i915-sriov-dkms/2024.12.30`.
1. Once finished, the kernel commandline needs to be adjusted: `nano /etc/default/grub` and change `GRUB_CMDLINE_LINUX_DEFAULT` to `intel_iommu=on i915.enable_guc=3 i915.max_vfs=7`, or add to it if you have other arguments there already.
1. Update `grub` and `initramfs` by executing `update-grub` and `update-initramfs -u` / for Arch Linux `grub-mkconfig -o /boot/grub/grub.cfg` and `mkinitcpio -P`.
1. Optionally use `sysfsutils` to set the number of VFs on boot. Install `sysfsutils`, then do `echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7" > /etc/sysfs.conf`, assuming your iGPU is on 00:02 bus. If not, use `lspci | grep VGA` to find the PCIe bus your iGPU is on.
1. Reboot the system.

## Uninstallation
### dpkg
Remove the package with `dpkg -r i915-sriov-dkms`
### pacman
Remove the package with `pacman -R i915-sriov-dkms`
### Manual
Remove the dkms module with `dkms remove i915-sriov-dkms/2024.12.30`

# Credits

Major contributors to this repository are listed below.

* [@strongtz](https://github.com/strongtz) &emsp;_Create the initial dkms module_
* [@zhtengw](https://github.com/zhtengw) &emsp;_Rebase on the linux-intel-lts (v5.15, v6.1) , support for v6.1~v6.4, participation in 15+ issues_
* [@bbaa-bbaa](https://github.com/bbaa-bbaa) &emsp;_Rebase on the mainline-tracking linux/v6.12 branch, support for v6.8~v6.13, participation in 10+ issues_
* [@pasbec](https://github.com/pasbec) &emsp;_Major refactor to the repo, support for (v6.2, v6.5, v6.8), participation in 20+ issues_
* [@shenwii](https://github.com/shenwii) &emsp;_Support for (v6.7, v6.9)_
* [@MotherOfTheGracchi](https://github.com/MotherOfTheGracchi) &emsp;_Support for v6.5.3_
* [@michael-pptf](https://github.com/michael-pptf) &emsp;_Several updates to README.md, participation in 20+ issues_
* [@strongtz](https://github.com/strongtz) _Create the initial dkms module_
* [@zhtengw](https://github.com/zhtengw) _Rebase on the linux-intel-lts (v5.15, v6.1) , support for v6.1~v6.4, participation in 15+ issues_
* [@bbaa-bbaa](https://github.com/bbaa-bbaa) _Rebase on the mainline-tracking linux/v6.12 branch, support for v6.8~v6.13, participation in 10+ issues_
* [@pasbec](https://github.com/pasbec) _Major refactor to the repo, support for (v6.2, v6.5, v6.8), participation in 20+ issues_
* [@shenwii](https://github.com/shenwii) _Support for (v6.7, v6.9)_
* [@MotherOfTheGracchi](https://github.com/MotherOfTheGracchi) _Support for v6.5.3_
* [@michael-pptf](https://github.com/michael-pptf) _Several updates to README.md, participation in 20+ issues_
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

3 changes: 3 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ if [ "$KBUILD_MODULES" != "1" ]; then
fi

CONFIGURE_CFLAGS="$KBUILD_CPPFLAGS $KBUILD_CFLAGS $LINUXINCLUDE"
module_version=$(grep "^PACKAGE_VERSION" "$KBUILD_EXTMOD/dkms.conf" | grep -o "[0-9]*\.[0-9]*\.[0-9]*")

cat <<EOF > "$KBUILD_EXTMOD/include/config.h"
#include <linux/version.h>
#define DKMS_MODULE_VERSION "$module_version.sriov-6.12"
EOF

# conftest
for symbol_test in "$KBUILD_EXTMOD"/config/*.c
do
$CC $CONFIGURE_CFLAGS -c "$symbol_test" -o /dev/null > /dev/null 2>&1
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
i915-sriov-dkms (2024.12.30) UNRELEASED; urgency=medium

* 2024.12.30: backport missing pciids for ADL-N CPU

-- bbaa bbaa <[email protected]> Thu, 2 Jan 2025 17:37:04 +0800
15 changes: 15 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Source: i915-sriov-dkms
Section: kernel
Priority: optional
Maintainer: bbaa <[email protected]>
Rules-Requires-Root: no
Build-Depends:
debhelper-compat (= 13), dh-sequence-dkms
Standards-Version: 2024.12.30
Homepage: https://github.com/strongtz/i915-sriov-dkms

Package: i915-sriov-dkms
Architecture: amd64
Depends:
${misc:Depends}, build-essential
Description: Linux i915 driver (dkms module) with SR-IOV support
25 changes: 25 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/strongtz/i915-sriov-dkms
Upstream-Name: i915-sriov-dkms
Upstream-Contact: https://github.com/strongtz/i915-sriov-dkms/issues

Files:
*
Copyright:
Linus Torvalds and others
License: GPL-2.0
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
Comment:
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Loading

0 comments on commit 5902f48

Please sign in to comment.