kernel: add Pre/Post hooks to Kernel/Configure - #25217
Open
alewi-westermo wants to merge 1 commit into
Open
alewi-westermo wants to merge 1 commit into
alewi-westermo wants to merge 1 commit into
Conversation
Kernel/Configure is a plain one-liner that calls Kernel/Configure/Default.
A target that needs to run an extra configuration step has to override
the whole define and re-issue the Kernel/Configure/Default call, coupling
the target to build-system internals.
Frame the Kernel/Configure/Default call with additive Pre/Post hook
lists, mirroring the Hooks/Configure/{Pre,Post} pattern already used for
package builds in include/package.mk. Kernel/Configure is expanded as a
normal multi-line recipe, so the hooks are separated with $(sep) exactly
like the package hooks. Targets can then append to
Hooks/KernelConfigure/{Pre,Post} without touching the shared define.
Default behaviour is unchanged: with no hooks registered both loops
expand to nothing and only Kernel/Configure/Default runs.
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Alexander Wilhelm <[email protected]>
openwrt-ai
reviewed
Sep 16, 2026
| define Kernel/Configure | ||
| $(foreach hook,$(Hooks/KernelConfigure/Pre),$(call $(hook))$(sep)) | ||
| $(call Kernel/Configure/Default) | ||
| $(foreach hook,$(Hooks/KernelConfigure/Post),$(call $(hook))$(sep)) |
Collaborator
There was a problem hiding this comment.
A Post hook lands after headers_install and the .vermagic md5 at kernel-defaults.mk:128-129, which are derived from .config.set. So a hook doing the "extra configuration step" the commit message motivates — editing $(LINUX_DIR)/.config — would silently leave .vermagic and user_headers describing the pre-hook config. Is the Post point meant only for non-config side effects, or should it sit before that tail?
Generated by Claude Code
| endef | ||
|
|
||
| define Kernel/Configure | ||
| $(foreach hook,$(Hooks/KernelConfigure/Pre),$(call $(hook))$(sep)) |
Collaborator
There was a problem hiding this comment.
nit: nothing in the tree assigns Hooks/KernelConfigure/{Pre,Post}, so this lands as an unused extension point. Is there a follow-up target patch that could go in the same series?
Generated by Claude Code
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.
Kernel/Configure is a plain one-liner that calls Kernel/Configure/Default. A target that needs to run an extra configuration step has to override the whole define and re-issue the Kernel/Configure/Default call, coupling the target to build-system internals.
Frame the Kernel/Configure/Default call with additive Pre/Post hook lists, mirroring the Hooks/Configure/{Pre,Post} pattern already used for package builds in include/package.mk. Kernel/Configure is expanded as a normal multi-line recipe, so the hooks are separated with $(sep) exactly like the package hooks. Targets can then append to Hooks/KernelConfigure/{Pre,Post} without touching the shared define. Default behaviour is unchanged: with no hooks registered both loops expand to nothing and only Kernel/Configure/Default runs.
Assisted-by: Claude:claude-opus-4.8