kernel: add opt-in linux-image-dbg package with debug info - #10244
#10244kernel: add opt-in linux-image-dbg package with debug info#10244iav wants to merge 1 commit into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughOptional kernel debug packaging now selects the toolchain extension, includes debug inputs in artifact versioning, and creates a version-linked Debian package containing ChangesKernel debug-symbol packaging
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant BuildConfig
participant ArtifactVersioning
participant DebianPackaging
participant DebugPackage
BuildConfig->>ArtifactVersioning: enable debug inputs and toolchain
ArtifactVersioning->>DebianPackaging: produce distinct linux-dbg artifact mapping
DebianPackaging->>DebugPackage: invoke debug package callback
DebugPackage->>DebugPackage: validate and install vmlinux
DebugPackage-->>DebianPackaging: write pinned Depends and Provides metadata
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/functions/compilation/kernel-debs.sh`:
- Line 654: Remove armbian-$BRANCH from the Provides list for the debug symbols
package, leaving only the debug-package providers so apt cannot treat it as a
kernel image provider.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ca5819ef-8743-4bd4-8619-feb4b2e17d9b
📒 Files selected for processing (3)
lib/functions/artifacts/artifact-kernel.shlib/functions/compilation/kernel-debs.shlib/functions/configuration/main-config.sh
|
Interesting. How does one use such debug info, in practice? |
|
Four practical uses, all of which need exactly the 1. Crash analysis: kdump + then 2. Live introspection: 3. 4. The point of doing it this way: debug info is only useful if it belongs to that exact binary. So the dbg package has a strict It's opt-in ( |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/data-sync-maintainers.yml:
- Around line 14-19: Remove the unsupported metadata permission entry from the
workflow’s top-level permissions block, leaving the valid contents,
pull-requests, and issues permissions unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3da1d094-1eb1-4e1b-8f6d-126bbd1e9b62
📒 Files selected for processing (4)
.github/workflows/data-sync-maintainers.ymllib/functions/artifacts/artifact-kernel.shlib/functions/compilation/kernel-debs.shlib/functions/configuration/main-config.sh
🚧 Files skipped from review as they are similar to previous changes (3)
- lib/functions/configuration/main-config.sh
- lib/functions/compilation/kernel-debs.sh
- lib/functions/artifacts/artifact-kernel.sh
f3541b9 to
0340785
Compare
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. Split DWARF (CONFIG_DEBUG_INFO_SPLIT) is rejected with a rebuild hint: a vmlinux-only package would be an empty shell there.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. Deployment reversioning rewrites only theVersion:field, so the pairing survives it and dpkg refuses to install debug symbols for a kernel built from any other inputs. WithKERNEL_DBG_PACKAGE=yesthe artifact hash additionally coversKERNEL_COMPILER(prefix), the probed compiler version,KERNEL_EXTRA_CFLAGS, and the sources of the make-time hooks (kernel_make_config,custom_kernel_make_params); thekernel-version-toolchainextension is force-enabled for a visible toolchain part in the version string.config_dumpemitsKERNEL_DBG_PACKAGEand the compiler inputs so the artifact reducer never coalesces dbg and non-dbg targets.Scope: an opt-in for local builds; the feature is not wired into the apt repository publishing pipeline.
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 — regular builds keep their existing cache entries.
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(BuildID present); gdb resolvesinfo line start_kernel→init/main.c:1018from the packaged vmlinuxdpkg -iof the image with a stale dbg present is caught byapt-get checkand healed by--fix-brokenVersion: 26.08.0-trunkwith the versioned-buildpairing intactChecklist:
Summary by CodeRabbit
New Features
KERNEL_DBG_PACKAGE=yes.-dbgvariant.Bug Fixes