Skip to content

kbuild: merge config fragments from the kernel source tree - #3225

Open
bhcopeland wants to merge 2 commits into
kernelci:mainfrom
bhcopeland:kbuild-tree-fragments
Open

bhcopeland wants to merge 2 commits into
kernelci:mainfrom
bhcopeland:kbuild-tree-fragments

Conversation

@bhcopeland

Copy link
Copy Markdown
Member

A fragment can only carry config symbols or a make target, so a job that needs the options a subsystem's selftests declare has to either run 'make kselftest-merge', which merges every selftest config and brings in lockdep, DEBUG_PAGEALLOC and the rest, or copy that one config file into fragments.yaml, where it goes stale as the kernel's copy changes.

Accept a 'tree:' entry naming a config fragment file in the kernel source tree, such as 'tree:tools/testing/selftests/arm64/config', and merge it as each tree ships it. The make backend merges it with merge_config.sh from inside the tree; tuxmake is given its path in the tree. The path is written into the build script unquoted, so one that is empty, absolute, lexically outside the tree or holding anything but letters, digits, '.', '_', '-' and '/' fails the job.

When a tree does not ship the file its merge is skipped with a message, and the build continues: tools/testing/selftests/arm64/config first appears in v7.3-rc1, and the same fragment is built for stable branches that predate it. The check happens when the script runs, since the tree is only unpacked then.

@bhcopeland

Copy link
Copy Markdown
Member Author

@bhcopeland
bhcopeland requested a review from roxell September 25, 2026 22:21
@bhcopeland
bhcopeland marked this pull request as draft September 25, 2026 22:22
@bhcopeland bhcopeland closed this Sep 26, 2026
@bhcopeland bhcopeland reopened this Oct 28, 2026
@bhcopeland
bhcopeland force-pushed the kbuild-tree-fragments branch from 2903b20 to a8b950f Compare October 28, 2026 17:31
aistcv added a commit to aistcv/kernelci-pipeline that referenced this pull request Oct 28, 2026
Build tools/perf alongside mainline arm64 kernels using the dedicated
GCC 15 perf image from kernelci-core. Combine defconfig with lab-setup,
perf and perf-arm64, and disable kselftest compilation.

Read the common and arm64 perf fragments from tools/perf/tests/config-fragments
in the selected kernel using tree directives, keeping the settings aligned
with that kernel revision.

Request perf and pass CORESIGHT=1 through extra_targets, using TuxMake's
existing positional make-assignment support to enable OpenCSD decoding.
Schedule the job for mainline checkout events to produce a perf archive.

Requires the tree-fragment support from kernelci/kernelci-core#3225 and
a published arm64-perf-kernelci image containing that support.

Signed-off-by: Aishwarya TCV <aishwarya.tcv@arm.com>
@bhcopeland
bhcopeland marked this pull request as ready for review October 29, 2026 10:37
@bhcopeland
bhcopeland force-pushed the kbuild-tree-fragments branch 3 times, most recently from d774c79 to 8c6337a Compare October 30, 2026 10:17
A fragment can only carry config symbols or a make target, so a job that
needs the options a subsystem's selftests declare has to either run
'make kselftest-merge', which merges every selftest config and brings in
lockdep, DEBUG_PAGEALLOC and the rest, or copy that one config file into
fragments.yaml, where it goes stale as the kernel's copy changes.

Accept a 'tree:<path>' entry naming a config fragment file in the kernel
source tree, such as 'tree:tools/testing/selftests/arm64/config', and
merge it as each tree ships it. The make backend merges it with
merge_config.sh from inside the tree; tuxmake is given its path in the
tree. The path is written into the build script unquoted, so one that is
empty, absolute, lexically outside the tree or holding anything but
letters, digits, '.', '_', '-' and '/' fails the job.

When a tree does not ship the file its merge is skipped with a message,
and the build continues: tools/testing/selftests/arm64/config first
appears in v7.3-rc1, and the same fragment is built for stable branches
that predate it. The check happens when the script runs, since the tree
is only unpacked then.

Signed-off-by: Ben Copeland <ben.copeland@linaro.org>
A 'make:<target>' fragment entry is written into the build script
unquoted, both as 'make <target>' for the make backend and as
--kconfig-add=make:<target> for tuxmake, so a target holding whitespace
or shell syntax would be run as shell, and one starting with '-' would
be taken as an option.

Accept only a plain target name, a letter or digit followed by letters,
digits, '.', '_' and '-', and refuse anything else as a job error. That
covers kselftest-merge and the *.config fragment targets. A bare 'make:'
is still skipped.

Suggested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Ben Copeland <ben.copeland@linaro.org>
@bhcopeland
bhcopeland force-pushed the kbuild-tree-fragments branch from 8c6337a to 2e9bdcd Compare October 30, 2026 10:21
@aistcv

aistcv commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

With this implementation Core applies inline settings first, then the tree file. Could we preserve entry order when mixing tree fragments and inline settings? Could you clarify the order of inline overrides?

@nuclearcat nuclearcat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks great

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants