-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix kernel-headers package: build modpost in postinst for DKMS support #9264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughCopied host binaries Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
c4b8b19 to
fdbb888
Compare
rpardini
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't include binaries in kernel-headers.
We cross-compile during build (on CI, usually on large amd64 machines, targetting arm64) and there would be an architecture mismatch.
Even if that was not the case, there would be a glibc mismatch.
Since kernel 6.18, `make M=scripts/mod/` no longer works due to kbuild changes (commit 13b25489b6f8). The standard `make scripts` doesn't build scripts/mod (modpost, mk_elfconfig) which are required for DKMS/external module builds. Solution: In postinst, temporarily add `subdir-y += mod` to scripts/Makefile before running `make scripts`. This makes kbuild descend into scripts/mod/ and build modpost with proper dependencies (empty.o → mk_elfconfig → elfconfig.h → modpost). This approach: - Works for both native and cross-compilation scenarios - Builds modpost natively on the target system (correct architecture) - Uses standard kbuild mechanisms with proper dependency handling - No binaries are shipped in the package Tested: Cross-compiled on x86_64, installed on arm64 (helios64), DKMS module (bcachefs) built and loaded successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
fdbb888 to
0eeec83
Compare
Summary
Since kernel 6.18,
make M=scripts/mod/no longer works due to kbuild changes (commit 13b25489b6f8). The standardmake scriptsdoesn't build scripts/mod (modpost, mk_elfconfig) which are required for DKMS/external module builds.Solution: In postinst, temporarily add
subdir-y += modto scripts/Makefile before runningmake scripts. This makes kbuild descend into scripts/mod/ and build modpost with proper dependencies (empty.o → mk_elfconfig → elfconfig.h → modpost).This approach:
Test plan
🤖 Generated with Claude Code