> +# Build and post-process livepatch module in $KMOD_DIR > +build_patch_module() { > + local makefile="$KMOD_DIR/Kbuild" > + local log="$KMOD_DIR/build.log" > + local cflags=() > + local files=() > + local cmd=() > + > + rm -rf "$KMOD_DIR" > + mkdir -p "$KMOD_DIR" > + > + cp -f "$SRC/scripts/livepatch/init.c" "$KMOD_DIR" > + > + echo "obj-m := $NAME.o" > "$makefile" > + echo -n "$NAME-y := init.o" >> "$makefile" > + > + find "$DIFF_DIR" -type f -name "*.o" | mapfile -t files > + [[ ${#files[@]} -eq 0 ]] && die "no changes detected" > + > + for file in "${files[@]}"; do > + local rel_file="${file#"$DIFF_DIR"/}" > + local kmod_file="$KMOD_DIR/$rel_file" > + local cmd_file > + > + mkdir -p "$(dirname "$kmod_file")" > + cp -f "$file" "$kmod_file" > + > + # Tell kbuild this is a prebuilt object > + cp -f "$file" "${kmod_file}_shipped" > + > + echo -n " $rel_file" >> "$makefile" > + > + cmd_file="$ORIG_DIR/$(dirname "$rel_file")/.$(basename > "$rel_file").cmd" > + [[ -e "$cmd_file" ]] && cp -f "$cmd_file" "$(dirname > "$kmod_file")"
Hi Josh, Should the .cmd file copy come from the reference SRC and not original ORIG directory? cmd_file="$SRC/$(dirname "$rel_file")/.$(basename "$rel_file").cmd" because I don't see any .cmd files in klp-tmp/orig/ FWIW, I only noticed this after backporting the series to centos-stream-10. There, I got this build error: Building original kernel Copying original object files Fixing patches Building patched kernel Copying patched object files Diffing objects vmlinux.o: changed function: cmdline_proc_show Building patch module: livepatch-test.ko <...>/klp-tmp/kmod/.vmlinux.o.cmd: No such file or directory make[2]: *** [scripts/Makefile.modpost:145: <...>/klp-tmp/kmod/Module.symvers] Error 1 make[1]: *** [<...>/Makefile:1936: modpost] Error 2 make: *** [Makefile:236: __sub-make] Error 2 The above edit worked for both your upstream branch and my downstream backport. -- Joe