diff --git a/.github/workflows/build-kernel-deb.yml b/.github/workflows/build-kernel-deb.yml index e205a0d..73bf999 100644 --- a/.github/workflows/build-kernel-deb.yml +++ b/.github/workflows/build-kernel-deb.yml @@ -46,6 +46,10 @@ on: description: 'Advanced: extra config fragments applied on top of all of debian/config-available/ (e.g. intree:arch/arm64/configs/qcom_debug.config)' required: false default: '' + dkms: + description: 'Advanced: comma-separated out-of-tree DKMS modules to build and bundle, without the -dkms suffix (e.g. kgsl)' + required: false + default: '' debian-version-stub: description: 'Advanced: Debian version stub; the selected suite''s mapped suffix and a Daily-style trailing ~ are applied automatically' required: false @@ -121,6 +125,10 @@ on: description: 'Extra config fragments applied on top of all of debian/config-available/ (e.g. intree:arch/arm64/configs/qcom_debug.config)' type: string default: '' + dkms: + description: 'Comma-separated out-of-tree DKMS modules to build and bundle, without the -dkms suffix (e.g. kgsl)' + type: string + default: '' debian-revision: description: 'Debian revision component of the package version' type: string @@ -424,6 +432,7 @@ jobs: BINPKG_INPUT: ${{ inputs.binpkg || 'linux-image-qcom-next' }} KVER_EXTRA_INPUT: ${{ inputs.kver-extra }} KERNEL_CONFIG_INPUT: ${{ inputs.kernel-config }} + DKMS_INPUT: ${{ inputs.dkms }} DEBUG_BUILD_INPUT: ${{ inputs.debug-build }} run: | # No -x here: keep xtrace off for this step as it assembles the @@ -441,6 +450,7 @@ jobs: [[ -n "$LOCALVERSION" ]] && ARGS+=(--localversion "$LOCALVERSION") [[ -n "$KVER_EXTRA_INPUT" ]] && ARGS+=(--kver-extra "$KVER_EXTRA_INPUT") [[ -n "$KERNEL_CONFIG_INPUT" ]] && ARGS+=(--kernel-config "$KERNEL_CONFIG_INPUT") + [[ -n "$DKMS_INPUT" ]] && ARGS+=(--dkms "$DKMS_INPUT") [[ "$DEBUG_BUILD_INPUT" == "true" ]] && ARGS+=(--debug) docker run -i --rm \ diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 8d82e1b..e5aaf1c 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -9,7 +9,7 @@ name: daily # Matrix schema: ci/build-matrix.json # Each row with "type": "Daily" is expanded by ci/scripts/resolve-matrix.sh: # the "suites" array is flattened into one job per suite. All other fields -# (kernel_variant, srcpkg, binpkg, kernel_config, debian_revision, +# (kernel_variant, srcpkg, binpkg, kernel_config, dkms, debian_revision, # git_clone, branch_or_tag, ref_strategy) are passed through to # build-kernel-deb.yml as inputs. # @@ -105,7 +105,7 @@ jobs: # build: one parallel job per flat matrix entry. # # Each entry calls build-kernel-deb.yml as a reusable workflow. The full - # set of matrix fields (suite, srcpkg, binpkg, kernel_config, etc.) is + # set of matrix fields (suite, srcpkg, binpkg, kernel_config, dkms, etc.) is # threaded through as inputs. fail-fast is disabled so a failed trixie # build does not cancel the forky build. # --------------------------------------------------------------------------- @@ -127,6 +127,7 @@ jobs: srcpkg: ${{ matrix.srcpkg }} binpkg: ${{ matrix.binpkg }} kernel-config: ${{ matrix.kernel_config }} + dkms: ${{ matrix.dkms }} debian-revision: ${{ matrix.debian_revision }} localversion: ${{ matrix.localversion || '' }} kver-extra: ${{ matrix.kver_extra || '' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b478ec..5952eb1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -109,6 +109,7 @@ jobs: srcpkg: ${{ matrix.srcpkg }} binpkg: ${{ matrix.binpkg }} kernel-config: ${{ matrix.kernel_config }} + dkms: ${{ matrix.dkms }} debian-revision: ${{ matrix.debian_revision }} localversion: ${{ matrix.localversion || '' }} kver-extra: ${{ matrix.kver_extra || '' }} diff --git a/README.md b/README.md index 9f1e56c..6913cb3 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ The final Production matrix is conceptually: "srcpkg": "linux-qcom-next", "binpkg": "linux-image-qcom-next", "kernel_config": [], + "dkms": ["kgsl"], "debian_version_stub": "0qli", "debian_version_suffix": "~", "pkg_linux_qcom_ref": "qcom/debian/latest" @@ -75,6 +76,7 @@ The final Production matrix is conceptually: "srcpkg": "linux-qcom-next", "binpkg": "linux-image-qcom-next", "kernel_config": [], + "dkms": ["kgsl"], "debian_version_stub": "0qli", "debian_version_suffix": "", "pkg_linux_qcom_ref": "qcom/debian/latest", @@ -184,6 +186,7 @@ its own values for: | `srcpkg` | Debian source package name. | | `binpkg` | Kernel image metapackage name. | | `kernel_config` | Extra fragments applied on top of `debian/config-available/`, all of which is applied to every build, one per array element. A bare name selects `debian/config-available/.config`; an `intree:` entry names a fragment shipped by the kernel source, as a path relative to the kernel source root (e.g. `intree:arch/arm64/configs/qcom_debug.config`), so it stays versioned with the kernel it targets. Empty for variants that need nothing beyond `config-available/`; today it carries only `intree:` fragments. `resolve-matrix.sh` joins it into the comma-separated `kernel-config` workflow input. | +| `dkms` | Out-of-tree DKMS modules built against the packaged kernel and bundled into its image package, one per array element, named without the `-dkms` suffix (e.g. `kgsl` selects `kgsl-dkms`). `resolve-matrix.sh` joins it into the comma-separated `dkms` workflow input, which reaches `prepare-source.sh` as `--dkms`. | | `debian_version_stub` | Base Debian revision, shared by a variant's Daily and Release rows. Must not end in `~`; the suite suffix is derived, not stored here. | | `debian_version_suffix` | `~` for Daily rows, empty for Release rows. Documents the delivery-type half of the revision formula on the row itself; `resolve-matrix.sh` rejects a row where this disagrees with `type`, but derivation always computes this suffix from `type`, never reads this field. | | `localversion`, `kver_extra` | Optional version overrides forwarded to packaging. | @@ -425,6 +428,7 @@ The available inputs are: | `srcpkg` | `linux-qcom-next` | Advanced source package identity override. | | `binpkg` | `linux-image-qcom-next` | Advanced image metapackage identity override. | | `kernel-config` | Empty | Advanced extra fragments applied on top of all of `debian/config-available/`, e.g. `intree:arch/arm64/configs/qcom_debug.config`. | +| `dkms` | Empty | Advanced comma-separated out-of-tree DKMS modules to build and bundle, without the `-dkms` suffix, e.g. `kgsl`. | | `debian-version-stub` | `0qli` | Advanced Debian version stub. The selected suite's mapped suffix and a Daily-style trailing `~` are applied automatically; direct builds always use Daily semantics since they are build-only and non-promoting. | | `localversion` | Auto-derived | Advanced explicit `LOCALVERSION` override. | | `kver-extra` | Empty | Advanced kernel-release suffix. | diff --git a/ci/build-matrix.json b/ci/build-matrix.json index cbb8390..7e210cc 100644 --- a/ci/build-matrix.json +++ b/ci/build-matrix.json @@ -20,6 +20,9 @@ "srcpkg": "linux-qcom-next", "binpkg": "linux-image-qcom-next", "kernel_config": [], + "dkms": [ + "kgsl" + ], "debian_version_stub": "0qli", "debian_version_suffix": "~", "pkg_linux_qcom_ref": "qcom/debian/latest" @@ -38,6 +41,9 @@ "srcpkg": "linux-qcom-next", "binpkg": "linux-image-qcom-next", "kernel_config": [], + "dkms": [ + "kgsl" + ], "debian_version_stub": "0qli", "debian_version_suffix": "", "pkg_linux_qcom_ref": "qcom/debian/latest" @@ -59,6 +65,9 @@ "intree:arch/arm64/configs/qcom_debug.config", "intree:kernel/configs/debug.config" ], + "dkms": [ + "kgsl" + ], "debian_version_stub": "0qli", "debian_version_suffix": "~", "pkg_linux_qcom_ref": "qcom/debian/latest" @@ -80,6 +89,9 @@ "intree:arch/arm64/configs/qcom_debug.config", "intree:kernel/configs/debug.config" ], + "dkms": [ + "kgsl" + ], "debian_version_stub": "0qli", "debian_version_suffix": "", "pkg_linux_qcom_ref": "qcom/debian/latest" diff --git a/ci/scripts/resolve-matrix.sh b/ci/scripts/resolve-matrix.sh index c2f63be..cd943df 100755 --- a/ci/scripts/resolve-matrix.sh +++ b/ci/scripts/resolve-matrix.sh @@ -10,12 +10,14 @@ set -euo pipefail # kernel variant and delivery type (e.g. "trixie": "~bpo13+1"). # - "deliveries": the matrix rows. Each kernel_variant owns exactly one # Daily row and one Release row. A row declares every input needed by -# that delivery, including a debian_version_stub. Two fields are -# list-valued: suites, which is expanded into isolated legs, and -# kernel_config, which is one config fragment per element. A fragment is +# that delivery, including a debian_version_stub. Three fields are +# list-valued: suites, which is expanded into isolated legs; +# kernel_config, which is one config fragment per element; and dkms, +# which is one out-of-tree DKMS module per element. A fragment is # either a bare name from debian/config-available/ or an "intree:" entry # naming a path relative to the kernel source root -# (e.g. intree:arch/arm64/configs/qcom_debug.config). +# (e.g. intree:arch/arm64/configs/qcom_debug.config). A dkms entry is a +# module name without the -dkms suffix (e.g. kgsl). # # Each flattened leg's final debian_revision is derived from # debian_version_stub, suite_suffix_mapping[suite], and the delivery type via @@ -48,7 +50,8 @@ set -euo pipefail # and a suite-specific debian_revision (debian_version_stub and # debian_version_suffix are consumed and removed). kernel_config is joined # into the comma-separated string that build-kernel-deb.yml's kernel-config -# input and prepare-source.sh's --kernel-config expect. +# input and prepare-source.sh's --kernel-config expect, and dkms is joined +# the same way for the dkms input and prepare-source.sh's --dkms. # # Exit codes: # 0 Success, at least one entry emitted. @@ -138,6 +141,25 @@ validation_errors=$(jq -r ' else empty end; + # Each dkms entry names an out-of-tree module built against the kernel being + # packaged, given without the -dkms suffix (e.g. kgsl selects kgsl-dkms), so + # it must look like a Debian package name stem. + def dkms_valid: + if (.dkms | type) != "array" + then "dkms must be an array" + elif any(.dkms[]; type != "string" or length == 0) + then "dkms must contain only non-empty strings" + elif any(.dkms[]; test(",")) + then "dkms entries must not contain commas; use one array element per module" + elif any(.dkms[]; test("^[a-z0-9][a-z0-9+.-]*$") | not) + then "dkms entries must be a module name without the -dkms suffix (lowercase letters, digits, and + . -)" + elif any(.dkms[]; endswith("-dkms")) + then "dkms entries must omit the -dkms suffix (e.g. kgsl, not kgsl-dkms)" + elif ([.dkms[]] | unique | length) != (.dkms | length) + then "dkms must not contain duplicates" + else empty + end; + def suites_valid: if (.suites | type) != "array" or (.suites | length) == 0 then "suites must be a non-empty array" @@ -171,6 +193,7 @@ validation_errors=$(jq -r ' variant_name_valid, suites_valid, kernel_config_valid, + dkms_valid, if (.debian_version_stub | type) == "string" and (.debian_version_stub | test("~$")) then "debian_version_stub must not end in ~" else empty end, @@ -331,7 +354,11 @@ result=$(jq -c \ )[] as $suite | $row | del(.suites) - | . + {"suite": $suite, "kernel_config": ($row.kernel_config | join(","))} + | . + { + "suite": $suite, + "kernel_config": ($row.kernel_config | join(",")), + "dkms": ($row.dkms | join(",")) + } ] | if length == 0 then error(