Provide a little bit more context behind some of the klp-build failure
modes clarify which of the user-provided patches is unsupported,
doesn't apply, and which kernel build failed.

Signed-off-by: Joe Lawrence <[email protected]>
---
 scripts/livepatch/klp-build | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
index 535ca18e32c5..64a18c2ae1ba 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -429,7 +429,7 @@ check_unsupported_patches() {
                for file in "${files[@]}"; do
                        case "$file" in
                                lib/*|*.S)
-                                       die "unsupported patch to $file"
+                                       die "$patch unsupported patch to $file"
                                        ;;
                        esac
                done
@@ -449,7 +449,7 @@ apply_patch() {
                # The sed strips the version signature from 'git format-patch',
                # otherwise 'git apply --recount' warns.
                sed -n '/^-- /q;p' "$patch" |
-                       git apply "${extra_args[@]}"
+                       git apply "${extra_args[@]}" || die "$patch doesn't 
apply (retry with --fuzz?)"
        )
 
        APPLIED_PATCHES+=("$patch")
@@ -601,6 +601,7 @@ clean_kernel() {
 }
 
 build_kernel() {
+       local build="$1"
        local log="$TMP_DIR/build.log"
        local objtool_args=()
        local cmd=()
@@ -638,7 +639,7 @@ build_kernel() {
                "${cmd[@]}"                                                     
\
                        1> >(tee -a "$log")                                     
\
                        2> >(tee -a "$log" | grep0 -v "modpost.*undefined!" >&2)
-       )
+       ) || die "$build kernel build failed"
 }
 
 find_objects() {
@@ -913,7 +914,7 @@ if (( SHORT_CIRCUIT <= 1 )); then
        validate_patches
        status "Building original kernel"
        clean_kernel
-       build_kernel
+       build_kernel "Original"
        status "Copying original object files"
        copy_orig_objects
 fi
@@ -923,7 +924,7 @@ if (( SHORT_CIRCUIT <= 2 )); then
        fix_patches
        apply_patches
        status "Building patched kernel"
-       build_kernel
+       build_kernel "Patched"
        revert_patches
        status "Copying patched object files"
        copy_patched_objects
-- 
2.52.0


Reply via email to