Provide more context for common klp-build failure modes.  Clarify which
user-provided patch is unsupported or failed to apply, and explicitly
identify which kernel build (original or patched) failed.

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

diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
index 6d3adadfc394..80703ec4d775 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -351,7 +351,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
@@ -496,6 +496,7 @@ clean_kernel() {
 }
 
 build_kernel() {
+       local build="$1"
        local log="$TMP_DIR/build.log"
        local objtool_args=()
        local cmd=()
@@ -533,7 +534,7 @@ build_kernel() {
                "${cmd[@]}"                                                     
\
                        1> >(tee -a "$log")                                     
\
                        2> >(tee -a "$log" | grep0 -v "modpost.*undefined!" >&2)
-       )
+       ) || die "$build kernel build failed"
 }
 
 find_objects() {
@@ -808,7 +809,7 @@ fi
 if (( SHORT_CIRCUIT <= 1 )); then
        status "Building original kernel"
        clean_kernel
-       build_kernel
+       build_kernel "original"
        status "Copying original object files"
        copy_orig_objects
 fi
@@ -818,7 +819,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.53.0


Reply via email to