kernel: add opt-in linux-image-dbg package with debug info#192
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb29c6257e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dce11eb7d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 9f49ec2. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f49ec2518
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
1511121 to
4768089
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4768089ea0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0025a478d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1e0d19fbf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2afb8da4c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Kernels built with CONFIG_DEBUG_INFO produce a vmlinux with full debug info, but only the stripped Image is packaged; vmlinux is discarded with the build tree, leaving nothing to analyze kdump vmcores with. Debian ships it as linux-image-*-dbg, Ubuntu as -dbgsym ddebs, Fedora as kernel-debuginfo. Add KERNEL_DBG_PACKAGE=yes (default no) producing a linux-image-BRANCH-FAMILY-dbg deb (Debian-style -dbg suffix) with vmlinux at /usr/lib/debug/lib/modules/<version>/vmlinux — the standard search path of crash, drgn and gdb. The debug package is pinned to its exact kernel build via a versioned virtual package: linux-image provides linux-image-BRANCH-FAMILY-build (= artifact_version), and the dbg package depends on it. artifact_version encodes every build input (source SHA1, patches, .config, hooks, toolchain), and reversioning rewrites only the Version: field, so the pairing survives deployment reversioning and dpkg refuses to install debug symbols for a kernel built from any other inputs. The variable is hashed into the artifact version only when enabled, so dbg-enabled builds get a cache entry distinct from regular builds (a cached tarball without the dbg deb would otherwise poison them). Compiler identity and version are made part of the artifact version by force-enabling the kernel-version-toolchain extension for dbg builds, and KERNEL_EXTRA_CFLAGS is hashed in as well — compiler-distinct builds must not share a version, or debug symbols from one could pair with an image from another. Disabled by default: vmlinux with DWARF5 is ~0.5-1 GB unpacked (~150-300 MB deb). Assisted-by: Claude:claude-fable-5
Description
Kernels built with
CONFIG_DEBUG_INFOproduce a vmlinux with full debug info, but only the stripped Image is packaged — vmlinux is discarded with the build tree, leaving nothing to analyze kdump vmcores with. Debian ships it aslinux-image-*-dbg, Ubuntu as-dbgsymddebs, Fedora askernel-debuginfo.This adds
KERNEL_DBG_PACKAGE=yes(defaultno) producing alinux-image-<BRANCH>-<LINUXFAMILY>-dbgpackage (Debian-style-dbgsuffix) with vmlinux at/usr/lib/debug/lib/modules/<version>/vmlinux— the standard search path of crash, drgn and gdb.Exact build pairing: linux-image declares a versioned virtual
Provides: linux-image-<BRANCH>-<LINUXFAMILY>-build (= artifact_version), and the dbg package carries a versioned Depends on it.artifact_versionencodes every build input (source SHA1, patches, .config, hooks, toolchain), and deployment reversioning rewrites only theVersion:field — so the pairing survives reversioning and dpkg refuses to install debug symbols for a kernel built from any other inputs.Why a build variable and not an extension: there is currently no hook point to add a package to the kernel artifact —
artifact_map_packagesis built after the last extension hook runs, and without an entry in that map the deb would not be part of the deb-tar artifact and thus invisible to the ORAS cache. The dbg package's siblings (dtb, headers, libc-dev) are all gated by core variables; this follows the same pattern.Cache correctness: the variable is hashed into the artifact version only when enabled — dbg-enabled builds get a cache entry distinct from regular builds (a cached tarball without the dbg deb would otherwise poison them).
Cost: vmlinux with DWARF5 is ~0.5–1 GB unpacked (measured deb: ~520 MB for meson64-edge) — hence opt-in.
How Has This Been Tested?
./compile.sh kernel BOARD=odroidn2 BRANCH=edge KERNEL_DBG_PACKAGE=yes— deb produced; vmlinux iswith debug_info, not stripped(12.debug_*sections, BuildID present)Version: 26.08.0-trunk,Depends: linux-image-edge-meson64, linux-image-edge-meson64-build (= 7.1.4-S7a5c-...)— the versioned pairing survives reversioningChecklist:
Note
Medium Risk
Touches kernel artifact versioning, deb control Provides/Depends, and packaging of large debug binaries; mistakes could break cache correctness or allow mismatched kernel/dbg installs, but the feature is off by default.
Overview
Introduces an opt-in
KERNEL_DBG_PACKAGE=yespath that adds alinux-image-<branch>-<family>-dbgdeb containing unstrippedvmlinuxunder/usr/lib/debug/lib/modules/<version>/vmlinuxfor crash/drgn/gdb.Packaging and pairing: When enabled, the build also emits the dbg deb from a new packaging callback (requires
vmlinux, warns withoutCONFIG_DEBUG_INFO, fails onCONFIG_DEBUG_INFO_SPLIT).linux-imagegains a versioned virtual providelinux-image-*-build (= artifact_version); the dbg package depends on that same version so debug symbols stay tied to one kernel build through reversioning.Artifacts and cache: The kernel artifact map includes
linux-dbg, reducer inputs record dbg vs non-dbg (plus compiler, extra cflags, and make-hook hashes when dbg is on), andartifact_kernel_prepare_versionfolds those into the version hash so ORAS/cache cannot serve dbg-less tarballs to dbg builds or mix toolchain/hook-distinct pairs.Config: After family config,
KERNEL_DBG_PACKAGE=yesauto-enables thekernel-version-toolchainextension for visible version differentiation.Reviewed by Cursor Bugbot for commit 3bb38b8. Bugbot is set up for automated code reviews on this repo. Configure here.