Re: [PATCH 02/11] klp-build: Add --patch-only option

From
Josh Poimboeuf <jpoimboe@kernel.org>
Date
2026-10-27 02:22:27
Also in
linux-kselftest, lkml
Reply to
Song Liu, 2026-10-17
On Fri, Oct 16, 2026 at 05:24:32PM -0700, Song Liu wrote:
klp-build fixes the input patches before building the patched kernel:
it combines them into a single patch against the original source and
adds #line directives, so that unchanged functions further down a
patched file keep their __LINE__ values.  This only happens after the
original kernel has been built, so seeing the result, or testing this
step, takes a full kernel build and --keep-tmp.
Not sure how this last sentence is relevant, either way klp-build will
run to completion (or failure)?

Also the above feels like a strawman, I think the real justification for
this is the selftests?
quoted hunk ↗ jump to hunk
+++ b/scripts/livepatch/klp-build
@@ -19,7 +19,7 @@ set -o nounset
 # This helps keep execution in pipes so pipefail+ERR trap can catch errors.
 shopt -s lastpipe
 
-unset DEBUG_CLONE DIFF_CHECKSUM SKIP_CLEANUP VERBOSE XTRACE
+unset DEBUG_CLONE DIFF_CHECKSUM PATCH_ONLY SKIP_CLEANUP VERBOSE XTRACE
 
 REPLACE=1
 SHORT_CIRCUIT=0
@@ -137,6 +137,7 @@ Options:
 
 Advanced Options:
    -d, --debug			Show symbol/reloc cloning decisions
+       --patch-only		Print the fixed patch(es) and exit without building
This is basically bolting a test hook onto klp-build.

What if we move the patch validating/fixing into a self-contained
klp-prepare-patch script?  There might be a small amount of duplication
for some of the patch handling but that would hopefully be minimal.

Then the selftests can run it directly and klp-build doesn't need the
new option and the PATCH_ONLY special casing.

-- 
Josh
Thread (16 messages) 16 messages, 3 authors, last reply 19d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help