Reference: https://xenproject.atlassian.net/browse/XEN-90
If you create a Xen patch for livepatch that adds additional files to the build (adds the files and patches the Makefile to include them), the livepatch tools (from https://github.com/rosslagerwall/livepatch-build-tools) do not properly handle this. They ignore the new files in the patched/ output directory, as the script only lists object files from the original/ directory. After some investigation and experimenting, it seems the easiest way to resolve this issue is to list the object files in the patched/ directory (instead of the original/ directory), and if the source object file does not exist in the original/ directory, create an object file of the proper name from an empty .c file. The create-diff-object step works properly against this. Note that this method does not handle the removal of object files via the patching process. I've created a simple patch to livepatch-build that adds this capability. Directly calling gcc may not be the correct approach in all situations (the patch tools require the compiler version to match between object files), but it works for my environment (a XenServer build system using the system gcc). Please let me know if you have any other questions about this particular issue. I am happy to provide additional information if needed. -Bit ========================= +++ livepatch-build 2017-06-28 15:20:31.797362000 -0600 @@ -117,7 +117,7 @@ [[ -e "${OUTPUT}/original/changed_objs" ]] || die "no changed objects found" [[ -e "${OUTPUT}/patched/changed_objs" ]] || die "no changed objects found" - cd "${OUTPUT}/original" || die + cd "${OUTPUT}/patched" || die FILES="$(find xen -type f -name "*.o")" cd "${OUTPUT}" || die CHANGED=0 @@ -129,6 +129,15 @@ mkdir -p "output/$(dirname $i)" || die echo "Processing ${i}" echo "Run create-diff-object on $i" >> "${OUTPUT}/create-diff-object.log" + # Create an empty object file if none exists. + if [[ ! -e "original/$i" ]]; then + echo "Creating object file original/$i with no content." + TEMPPATH="$(mktemp -d /tmp/xenbuild.XXXXXX)" + touch "${TEMPPATH}/empty.c" + gcc -g -m64 -ffunction-sections -fdata-sections -c "${TEMPPATH}/empty.c" -o "original/$i" + rm "${TEMPPATH}/empty.c" + rmdir "${TEMPPATH}" + fi "${TOOLSDIR}"/create-diff-object $debugopt $PRELINK "original/$i" "patched/$i" "$XENSYMS" "output/$i" &>> "${OUTPUT}/create-diff-object.log" rc="${PIPESTATUS[0]}" if [[ $rc = 139 ]]; then
_______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel