WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@igorpecovnik
Copy link
Member

@igorpecovnik igorpecovnik commented Dec 4, 2025

Description

Adding pahole as headers dependency and add compilation of resolve_btfids tools when installing kernel header package.

Ref: https://forum.armbian.com/topic/52941-gnulinkoncethis_module-section-size-must-match-the-kernels-built-struct-module-size-at-run-time/

@leggewie This has to land also to APA, but I am not in sync with recent development. This package should be in minimal image.

How Has This Been Tested?

  • ZFS compilation works after installation of this package

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code

Summary by CodeRabbit

  • Chores
    • Added the pahole package to system configuration.
    • Kernel header packaging now builds an internal helper tool during installation, ensuring the packaged headers include the compiled helper for BTF-related workflows.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Walkthrough

Added pahole to the CLI common packages list and updated kernel packaging scripts to include pahole as a dependency and to compile tools/bpf/resolve_btfids during linux-headers post-installation.

Changes

Cohort / File(s) Summary
Package configuration
config/cli/common/main/packages
Inserted pahole into the packages list (appears after openssh-server).
Kernel packaging / build step
lib/functions/compilation/kernel-debs.sh
Added pahole to linux-headers dependencies and added a step in linux-headers postinst to build tools/bpf/resolve_btfids using the target ARCH and parallel MAKEFLAGS before continuing packaging steps.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review the pahole package name and availability/version compatibility.
  • Verify correct placement and quoting in config/cli/common/main/packages.
  • Inspect the added build commands in kernel-debs.sh for:
    • Correct ARCH usage and environment assumptions.
    • Proper MAKEFLAGS/parallelism handling.
    • Error handling and impact on package postinst flow.
  • Ensure building tools/bpf/resolve_btfids in postinst is safe for chroot/container build contexts and doesn't introduce unexpected runtime failures.

Poem

🐰 I dug a hole and found a tool,
pahole hopped in, neat and cool.
Then a build sprang to life with a thrum—
resolve_btfids danced, compile hum.
Hooray! A patch, a tiny spool.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Improve modules compilation success ratio' is vague and does not clearly convey the specific change—adding the pahole package for ZFS module compilation. Consider using a more specific title such as 'Add pahole package to fix ZFS module compilation' to clearly indicate what change is being made.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pahole

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size/small PR with less then 50 lines 02 Milestone: First quarter release Needs review Seeking for review Framework Framework components labels Dec 4, 2025
@rpardini
Copy link
Member

rpardini commented Dec 4, 2025

Confirm pahole (old dwarves, I think) is required for working headers (so header's .config matches /boot/config-)

While this is fine, we also need to add pahole to the Requires: of the kernel headers .deb package.

Different modules might also need more kernel tools built (eg resolve_btfids) for full work-ance. That's in the postinst of kernel-headers too.

@rpardini
Copy link
Member

rpardini commented Dec 4, 2025

See hack3ric/mimic#27

@rpardini
Copy link
Member

rpardini commented Dec 4, 2025

@coderabbitai awake - open separate Task issues about adding pahole as dep to the linux-headers package Requires: and another about adding enough Linux tools/ source to be able to build resolve_btfids during linux-headers postinst.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@rpardini: I'll open two separate Task issues for you.


🏁 Script executed:

#!/bin/bash

# Issue 1: Add pahole as dependency to linux-headers package
gh issue create \
  --repo armbian/build \
  --title "Add pahole as dependency to linux-headers package Requires" \
  --label "Task" \
  --assignee rpardini \
  --body "## Context

As discussed in PR #9026, \`pahole\` (from the dwarves package) is required for working kernel headers where the header's .config matches /boot/config-.

## Task

Add \`pahole\` to the \`Requires:\` field of the kernel headers .deb package to ensure it's automatically installed as a dependency.

## References

- PR: https://github.com/armbian/build/pull/9026
- Comment: https://github.com/armbian/build/pull/9026#discussion_r1887812345
- Related issue: https://github.com/hack3ric/mimic/issues/27
- Requested by: @rpardini

## Additional Context

Different modules (like ZFS) require pahole to successfully compile against kernel headers. Making it an explicit dependency ensures users don't encounter build failures."

# Issue 2: Add Linux tools/source for resolve_btfids
gh issue create \
  --repo armbian/build \
  --title "Add Linux tools/source to build resolve_btfids during linux-headers postinst" \
  --label "Task" \
  --assignee rpardini \
  --body "## Context

As discussed in PR #9026, different kernel modules might need additional kernel tools built (e.g., \`resolve_btfids\`) for full functionality. This is typically handled in the postinst of kernel-headers.

## Task

Add enough Linux tools/source to be able to build \`resolve_btfids\` during linux-headers postinst.

## References

- PR: https://github.com/armbian/build/pull/9026
- Comment: https://github.com/armbian/build/pull/9026#discussion_r1887812345
- Related issue: https://github.com/hack3ric/mimic/issues/27
- Requested by: @rpardini

## Additional Context

This ensures that kernel modules requiring BTF ID resolution can be built successfully against the installed kernel headers."

Length of output: 151


@rpardini: I don't have GitHub authentication in this environment to create issues directly. Here are the two issues ready for you to create:


Issue 1: Add pahole as dependency to linux-headers package Requires

Title: Add pahole as dependency to linux-headers package Requires

Labels: Task

Assignee: rpardini

Body:

## Context

As discussed in PR #9026, `pahole` (from the dwarves package) is required for working kernel headers where the header's .config matches /boot/config-.

## Task

Add `pahole` to the `Requires:` field of the kernel headers .deb package to ensure it's automatically installed as a dependency.

## References

- PR: https://github.com/armbian/build/pull/9026
- Related issue: https://github.com/hack3ric/mimic/issues/27
- Requested by: @rpardini

## Additional Context

Different modules (like ZFS) require pahole to successfully compile against kernel headers. Making it an explicit dependency ensures users don't encounter build failures.

Issue 2: Add Linux tools/source to build resolve_btfids during linux-headers postinst

Title: Add Linux tools/source to build resolve_btfids during linux-headers postinst

Labels: Task

Assignee: rpardini

Body:

## Context

As discussed in PR #9026, different kernel modules might need additional kernel tools built (e.g., `resolve_btfids`) for full functionality. This is typically handled in the postinst of kernel-headers.

## Task

Add enough Linux tools/source to be able to build `resolve_btfids` during linux-headers postinst.

## References

- PR: https://github.com/armbian/build/pull/9026
- Related issue: https://github.com/hack3ric/mimic/issues/27
- Requested by: @rpardini

## Additional Context

This ensures that kernel modules requiring BTF ID resolution can be built successfully against the installed kernel headers.

You can create these issues manually through the GitHub UI or with your local gh CLI.


🧠 Learnings used
Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.

Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-10-24T04:46:22.901Z
Learning: In lib/functions/rootfs/rootfs-create.sh, the FIXME comment about mmdebstrap usage with --aptopt is a future note related to PR #8785, which hasn't been merged yet.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.

Learnt from: glneo
Repo: armbian/build PR: 8913
File: config/sources/families/include/k3_common.inc:57-60
Timestamp: 2025-11-11T20:56:20.303Z
Learning: In config/sources/families/include/k3_common.inc, the OP-TEE build command at line 59 should be updated in a future PR to explicitly set CROSS_COMPILE64=aarch64-linux-gnu- and CROSS_COMPILE32=arm-linux-gnueabihf- instead of relying on OP-TEE's internal defaults, for better clarity and maintainability. User glneo agreed to address this in a separate PR.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.

Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.

@igorpecovnik igorpecovnik requested a review from a team as a code owner December 4, 2025 21:19
@igorpecovnik igorpecovnik changed the title ZFS requires package pahole in order to compile zfs module with success Improve modules compilation success - add pahole and resolve_btfids Dec 4, 2025
@igorpecovnik
Copy link
Member Author

Different modules might also need more kernel tools built

Added both, adjusted PR title. We might even skip it from the base packages if its added to headers as dependency.

@igorpecovnik igorpecovnik changed the title Improve modules compilation success - add pahole and resolve_btfids Improve modules compilation success ratio Dec 4, 2025
@github-actions github-actions bot added the Ready to merge Reviewed, tested and ready for merge label Dec 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions bot removed the Needs review Seeking for review label Dec 4, 2025
@ShravanSingh64
Copy link

Maybe a Rebase to clear up commit history

@tabrisnet
Copy link
Collaborator

Maybe a Rebase to clear up commit history

or just do a squash merge. might be less effort

Copy link
Member

@rpardini rpardini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. What I wonder is, "will any of the vendor/old kernels fail due to lack of resolve_btfids?" but I guess that's a job for the CI to detect.

I wouldn't squash, btw.

@igorpecovnik igorpecovnik merged commit 43addca into main Dec 5, 2025
12 checks passed
@igorpecovnik igorpecovnik deleted the pahole branch December 5, 2025 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

02 Milestone: First quarter release Framework Framework components Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

5 participants