packaging: enable parameterized multi-variant kernel packages - #62
Open
Bjordis Collaku (bjordiscollaku) wants to merge 8 commits into
Open
packaging: enable parameterized multi-variant kernel packages#62Bjordis Collaku (bjordiscollaku) wants to merge 8 commits into
Bjordis Collaku (bjordiscollaku) wants to merge 8 commits into
Conversation
…ig activation Replace the single hardcoded linux-image-<KVER>-qcom naming scheme with a fully parameterized model that supports multiple build targets from a single packaging tree. Package naming changes: - Source package name is now driven by SRCPKG make variable (default: linux-qcom-next). Previously hardcoded as linux-image-<KVER>-qcom. - Binary metapackage name is driven by BINPKG (default: linux-image-qcom-next). HDRPKG is derived automatically from BINPKG (linux-image- -> linux-headers-). - Versioned binary packages are linux-image-<KVER> and linux-headers-<KVER> (no trailing flavour suffix -- the flavour is embedded in KVER via LOCALVERSION). - Package version is now a real Debian version (<base>+<date>-<revision>) rather than the trivial 1-1. Constructed in the prepare target and written to debian/pkgversion for use by override_dh_gencontrol. - control.in and changelog.in gain @srcpkg@, @binpkg@, @HDRPKG@, @pkgver@ template variables alongside the existing @kver@ and @distro@. - control.in now produces 5 binary package stanzas: versioned image, image metapackage, versioned headers, headers metapackage, and debug symbols. LOCALVERSION propagation: - debian/rules prepare writes the LOCALVERSION suffix to debian/localversion. override_dh_auto_build reads it via shell cat, replacing the fragile sed back-derivation from the source package name that broke when the source package name no longer encodes the kernel version. - All binary package staging directories (PKG, HDR_PKG, DBG_PKG) and maintainer script names are now derived from BASE (cat debian/kernel.release) rather than from the source package name read from debian/changelog. Config fragment activation: - All 6 packaging config fragments moved from debian/config/ to debian/config-available/. debian/config/ is now empty by default. - prepare-source.sh --kernel-config <comma-list> copies named fragments from config-available/ into config/ before the build. debian/rules override_dh_auto_configure is unchanged -- it still globs debian/config/*.config. - Kernel-source fragments (qcom.config, prune.config) remain always-applied in override_dh_auto_configure when present in the kernel tree. - forky added to the list of valid distros in prepare-source.sh. prepare-source.sh gains --srcpkg, --binpkg, --debian-revision, --kernel-config flags. All new flags have sensible defaults for local builds. debian/clean and .gitignore updated to cover all newly generated files: debian/localversion, debian/pkgversion, and versioned maintainer scripts. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
The prepare target generates debian/localversion and debian/pkgversion before dpkg-buildpackage starts. Keep those files out of dh_clean and override_dh_auto_clean so they remain available to the build and control-generation overrides for the full package build. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
usage() previously ended with exit 0, and the unknown-option catch-all fell into it. This meant that callers using set -e (including the docker run step in build-kernel-deb.yml) sailed past a rejected flag with no error, proceeded with no debian/ directory injected, and produced a misleading failure much later in the build. Concretely: merging the CI branch before the packaging branch causes build-kernel-deb.yml to pass --srcpkg to the old prepare-source.sh. With exit 0 the prepare step succeeds, the artifact is uploaded with no debian/, and the failure surfaces inside Debusine's generate-source-package as a missing debian/changelog rather than at the argument-parsing stage where it belongs. Change usage() to exit 1 and make the *) catch-all exit 1 directly rather than delegating to usage(), so set -e in every caller stops the build immediately with a clear 'Unknown option' message. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
dpkg version ordering treats '~' as sorting before everything, including end-of-string, so 7.2.0~rc3 < 7.2.0 (correct: rc before final). Without the tilde, '-' is an alphanumeric separator and 7.2.0-rc3 > 7.2.0 (wrong: rc after final), which means apt refuses to upgrade any machine carrying a release-candidate package onto the corresponding final release. Confirmed with dpkg --compare-versions: 7.2.0-rc3+20260722-0qcom1 > 7.2.0+20260901-0qcom1 (broken, current) 7.2.0~rc3+20260722-0qcom1 < 7.2.0+20260901-0qcom1 (correct, after fix) This is the standard Debian practice: the official Debian experimental kernel package linux-image-6.14-rc7-amd64 ships Version: 6.14~rc7-1~exp1 while uname -r reports 6.14.0-rc7-amd64. The fix introduces EXTRA_DEB, derived from EXTRA by translating a leading '-rc' to '~rc', and uses it only when building BASE_KVER_CLEAN for the package version field. EXTRA itself is left unchanged so that KVER_RESOLVED (which becomes uname -r and the package name) keeps the kernel's native -rcN form. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
Include KVER_EXTRA in debian/localversion so the suffix passed to the kernel build matches the package name declared during preparation. Before staging package files, compare the declared versioned image package with linux-image-<kernelrelease>. Fail clearly on a mismatch to avoid silently empty packages caused by inconsistent build suffixes. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
build-kernel.sh was not updated when prepare-source.sh's interface changed, leaving four divergences: 1. Flag rename: --enable-configs was renamed to --kernel-config in prepare-source.sh. build-kernel.sh still forwarded --enable-configs, which prepare-source.sh now rejects. Because prepare-source.sh's unknown-option path previously exited 0, set -e in the caller did not catch it and the build proceeded with no debian/ injected. Rename the flag to --kernel-config at the call site (:257) and in the parser (:110). Keep --enable-configs as a deprecated alias so existing scripts do not break silently. 2. VALID_DISTROS diverged: build-kernel.sh lacked forky and unstable, which prepare-source.sh now accepts. A developer running build-kernel.sh --distro forky was rejected before prepare-source.sh was ever called, making the local entry point unusable for the two new suites this branch adds. 3. Default ENABLE_CONFIGS was empty: a plain ./build-kernel.sh --latest-tag produced a kernel with zero config fragments, where the base branch always applied all six. CI is unaffected (the workflow input default hardcodes all six), but the divergence was invisible from CI. Default to the same six-fragment set CI uses. 4. Install glob was stale: build-kernel.sh:325 printed 'sudo dpkg -i .../linux-image-*-qcom_*.deb', which matches zero of the produced .debs under the new naming scheme. Confirmed in run 30053624870: the glob appeared directly above an ls -lh listing five non-matching files. Update to linux-image-*_*_arm64.deb. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
Christopher Obbard (obbardc)
left a comment
There was a problem hiding this comment.
I had a quick look at this (just overall diff), it appears to be in the right kind of shape...
Set KBUILD_VERBOSE=1 so distribution builds retain the compiler and linker command lines needed for post-build diagnosis and build-log QA. This changes logging only; it does not change the generated packages. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
Two required checks on this PR were failing on pre-existing conditions unrelated to the packaging changes in this diff, inherited from qcom/debian/latest: - Repolinter's readme-references-license rule failed because README.md never mentioned licensing. Add the same "## License" section already used on the main-branch README, pointing at LICENSE.txt (BSD 3-Clause). - The required "Scan workflows for security issues" job (zizmor) flagged qcom-preflight-checks.yml's pull_request_target trigger as fundamentally insecure. This workflow's branch filter is scoped to `main`, but every actual PR against this packaging branch targets qcom/debian/latest, so the trigger never fires here in practice — the real "Run QC Preflight Checks" jobs seen on PRs come from an org-level required workflow, not this file. Switching to pull_request satisfies the linter with no behavioral change for same-repository PRs (repo secrets remain available since the fork-restriction only applies to pull_request from forks). Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
Bjordis Collaku (bjordiscollaku)
force-pushed
the
feat/matrix-expansion-packaging
branch
from
August 19, 2026 21:28
b78b066 to
f7f3dd7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This Enables
This PR turns the Debian packaging branch into a parameterized kernel-package builder. A matrix row can select the package identity, configuration fragments, Debian revision, and kernel release inputs for a kernel variant without duplicating packaging logic.
Matrix-to-Package Contract
srcpkglinux-qcom-next.binpkglinux-image-qcom-next.kernel_configdebian/config-available/.debian_revisionLOCALVERSIONandKVER_EXTRAuname -rand versioned package names.For the current Qualcomm Next delivery, the packaging flow produces the following set:
linux-qcom-nextlinux-image-<kernelrelease>linux-image-qcom-nextlinux-headers-<kernelrelease>linux-headers-qcom-nextImplementation
debian/control,debian/changelog,debian/localversion, anddebian/pkgversionfrom the selected inputs and resolved kernel release.debian/config-available/, activate only requested fragments, and reject unknown fragment names before the build begins.qcom.configandprune.configin the normal build path.prepare-source.shandbuild-kernel.shso local and CI builds invoke the same preparation interface.dpkg-buildpackage.-rcNto~rcNonly in the Debian version. Preserve-rcNinuname -r, package names, and installed paths.KVER_EXTRAandLOCALVERSIONconsistent between preparation, build execution, and package naming.KBUILD_VERBOSE := 1for complete distribution-build logs.Required Check Fixes
Two changes outside this PR's packaging scope were required to satisfy this repository's mandatory checks on the base branch:
## Licensesection toREADME.mdreferencingLICENSE.txt, satisfying Repolinter'sreadme-references-licenserule.README.mdhad no reference to a license anywhere.qcom-preflight-checks.yml's trigger frompull_request_targettopull_request, resolving a finding from the required workflow-security scan. That workflow'sbranches: [main]filter never matches this branch lineage's actual base (qcom/debian/latest), so the change is behavior-neutral for every PR that can currently trigger it.Validation
KVER_EXTRAbehavior.qli-stagingAPT repository for bothtrixieandforkyin the same run, each carrying a distinct, suite-specific Debian revision supplied by the CI side (#63) as one opaque string (0qli+staging1~bpo13+1fortrixie,0qli+staging1forforky), confirming this branch threads through anydebian_revisionvalue without parsing it.Target validation
This is also the regression check for the version-collision defect the CI side (#63) fixed: confirming clean on a live target, no HTTP 500, no pool-object ambiguity. Target: live Debian trixie device. Before upgrade, three kernels are already installed (a prior
20260817collision-fix validation run added the third):Pulling the
trixiepackage directly fromqli-staging:No
Err:lines and no HTTP 500 anywhere in the transfer or install; the two suites' packages no longer collide as ambiguous pool objects in the same repository.Post-reboot, the new kernel booted cleanly and coexists with all three prior kernels:
All four kernels remain installed side by side with no dpkg conflict, and systemd-boot carries a loader entry for each.
Dependencies
Before Merge
qcom-nextsource, metapackage, headers, debug-package identities, and selected configuration fragments are approved.qcom/debian/latest.