Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
- {name: "gentoo/stage3", tag: "latest"}
- {name: "opensuse/tumbleweed", tag: "latest", variant: "-default", url: "registry.opensuse.org/"}
- {name: "opensuse/leap", tag: "15.6", variant: "-default", url: "registry.opensuse.org/"}
- {name: "oraclelinux", tag: "10", uek: "ol10_UEKR8"}
- {name: "oraclelinux", tag: "9", uek: "ol9_UEKR8", gcc: "gcc-toolset-14"}
- {name: "oraclelinux", tag: "8", uek: "ol8_UEKR7", gcc: "gcc-toolset-11"}
- {name: "ubuntu", tag: "25.04"}
- {name: "ubuntu", tag: "24.04"}
- {name: "ubuntu", tag: "22.04"}
Expand All @@ -46,21 +49,33 @@ jobs:
image: ${{ matrix.distro.url }}${{ matrix.distro.name }}:${{ matrix.distro.tag }}

steps:
- name: Install git for checkout action
if: contains(matrix.distro.name, 'opensuse')
- name: Checkout
if: matrix.distro.name == 'opensuse/leap' && matrix.distro.tag == '15.6'
# openSUSE Leap 15.6 does not have tar in the base image
run: |
zypper --non-interactive install git

zypper --non-interactive install tar gzip
- uses: actions/checkout@v5

- name: Install dependencies for Red Hat based distributions
if: matrix.distro.name == 'almalinux' || matrix.distro.name == 'centos' || matrix.distro.name == 'fedora'
# Relax crypto policies on Fedora 43+ to allow RSA signatures
# Relax crypto policies to allow RSA signatures
run: |
dnf install -y gawk diffutils elfutils-libelf gcc kernel kernel-devel make openssl patch crypto-policies-scripts
update-crypto-policies --set LEGACY
make install-redhat

- name: Install dependencies for Oracle Linux
if: matrix.distro.name == 'oraclelinux'
# Relax crypto policies to allow RSA signatures
run: |
dnf config-manager --set-enabled ${{ matrix.distro.uek }}
dnf install -y gawk diffutils elfutils-libelf gcc kernel-uek kernel-uek-devel make openssl patch crypto-policies-scripts
update-crypto-policies --set LEGACY
make install-redhat
if [ -n "${{ matrix.distro.gcc }}" ]; then
echo "build_environment=\"/opt/rh/${{ matrix.distro.gcc }}/enable\"" >> /etc/dkms/framework.conf.d/uek.conf
fi

- name: Install Alpine dependencies
if: matrix.distro.name == 'alpine'
run: |
Expand Down
21 changes: 21 additions & 0 deletions dkms.8.in
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,27 @@ Run no more than this number of jobs in parallel.
.B compress_gzip_opts, compress_xz_opts, compress_zstd_opts
Control how modules are compressed. By default, the highest available level of compression is used.
.TP
.B build_environment
If the directive is set to any non null-value, when building modules, the exported variables that are in the file will be imported into the DKMS shell with the
.B source
command.

Can be used to specify a custom
.B gcc
installed in a custom path; and the variable
.B $kernelver
can be used inside the environment file to represent the target kernel version. Some examples:

Define a custom script to point to a specific GCC (
.B export CC=/opt/gcc12/bin/gcc
):
.B build_environment="/opt/gcc12/env"

Enable the software collection
.B gcc-toolset-11
and use it for building an UEK kernel on Oracle Linux:
.B build_environment="/opt/rh/gcc-toolset-11/enable"
.TP
.B post_transaction
If the directive is set to any non null-value, the content of the directive will be executed with any command that change the content of the kernel modules folder, that is
.B dkms autoinstall, dkms install
Expand Down
10 changes: 7 additions & 3 deletions dkms.in
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ show_deprecation_warnings=0
# All of the variables not related to signing we will accept from framework.conf.
readonly dkms_framework_nonsigning_variables="source_tree dkms_tree install_tree tmp_location
verbose symlink_modules autoinstall_all_kernels modprobe_on_install parallel_jobs
compress_gzip_opts compress_xz_opts compress_zstd_opts
post_transaction"
compress_gzip_opts compress_xz_opts compress_zstd_opts build_environment post_transaction"
# All of the signing related variables we will accept from framework.conf.
readonly dkms_framework_signing_variables="sign_file mok_signing_key mok_certificate"

Expand Down Expand Up @@ -1474,6 +1473,12 @@ do_build()
fi
fi

# Source build environment file if specified
if [[ -n "$build_environment" && -f "$build_environment" ]]; then
# shellcheck disable=SC1090
source <( (source "$build_environment" &>/dev/null; export -p) )
fi

# Check for missing BUILD_DEPENDS
bd_missing=
# shellcheck disable=SC2153
Expand Down Expand Up @@ -3302,7 +3307,6 @@ addon_modules_dir="${ADDON_MODULES_DIR}"
# Source in configuration not related to signing
read_framework_conf "$dkms_framework_nonsigning_variables"


# Clear out command line argument variables
module=""
module_version=""
Expand Down
5 changes: 5 additions & 0 deletions dkms_framework.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
# compress_xz_opts="--check=crc32 --lzma2=dict=1MiB -6"
# compress_zstd_opts="-q --rm -T0 -3"

# Path to a file containing environment variables to be sourced by DKMS.
# This file will be sourced for the build command. $kernelver can be used in
# the environment file to represent the target kernel version.
# build_environment=""

# Command to run at the end of every DKMS transaction, for example after a new
# kernel has been installed on the system and all modules have been successfully
# built and installed.
Expand Down
2 changes: 1 addition & 1 deletion run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ distro_sign_file_candidates=
distro_modsigkey=/var/lib/dkms/mok.key
distro_modsigcert=/var/lib/dkms/mok.pub
case "${os_id}" in
centos | fedora | rhel | ovm | almalinux)
centos | fedora | rhel | ovm | almalinux | ol)
expected_dest_loc=extra
mod_compression_ext=.xz
;;
Expand Down