From: Ross Lagerwall Date: Thu, 5 Nov 2015 14:10:17 +0000 (+0000) Subject: Allow specifying a build-id dependency X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=06481a0806265c1a631503b0fdc65b167a3b464e;p=livepatch-build-tools.git Allow specifying a build-id dependency Allow including a build-id on which the created patch module depends. This will then be verified by the hypervisor during patch apply. --- diff --git a/xsplice-build b/xsplice-build index 5c6a033..f5495c0 100755 --- a/xsplice-build +++ b/xsplice-build @@ -29,6 +29,7 @@ CPUS="$(getconf _NPROCESSORS_ONLN)" DEBUG=n XEN_DEBUG=n SKIP= +DEPENDS= XENSYMS=xen-syms warn() { @@ -135,25 +136,35 @@ function create_patch() die "no functional changes found" fi + # Create a dependency section + > depends.bin + if [ -n "$DEPENDS" ]; then + perl -e "print pack 'H*', '${DEPENDS}'" >> depends.bin + fi + echo "Creating patch module..." ld -r -o output.o --build-id=sha1 $(find output -type f -name "*.o") || die "${SCRIPTDIR}"/prelink $debugopt output.o "${PATCHNAME}.xsplice" "$XENSYMS" &>> "${OUTPUT}/prelink.log" || die + + objcopy --add-section .xsplice.depends=depends.bin "${PATCHNAME}.xsplice" + objcopy --set-section-flags .xsplice.depends=alloc,readonly "${PATCHNAME}.xsplice" } usage() { - echo "usage: $(basename $0) [options]" >&2 - echo " -h, --help Show this help message" >&2 - echo " -s, --srcdir Xen source directory" >&2 - echo " -p, --patch Patch file" >&2 - echo " -o, --output Output directory" >&2 - echo " -j, --cpus Number of CPUs to use" >&2 - echo " -k, --skip Skip build or diff phase" >&2 - echo " -d, --debug Enable debug logging" >&2 - echo " --xen-debug Build debug Xen" >&2 - echo " --xen-syms Build against a xen-syms" >&2 + echo "usage: $(basename $0) [options]" >&2 + echo " -h, --help Show this help message" >&2 + echo " -s, --srcdir Xen source directory" >&2 + echo " -p, --patch Patch file" >&2 + echo " -o, --output Output directory" >&2 + echo " -j, --cpus Number of CPUs to use" >&2 + echo " -k, --skip Skip build or diff phase" >&2 + echo " -d, --debug Enable debug logging" >&2 + echo " --xen-debug Build debug Xen" >&2 + echo " --xen-syms Build against a xen-syms" >&2 + echo " --depends Required build-id" >&2 } -options=$(getopt -o hs:p:o:j:k:d -l "help,srcdir:patch:output:cpus:,skip:,debug,xen-debug,xen-syms:" -- "$@") || die "getopt failed" +options=$(getopt -o hs:p:o:j:k:d -l "help,srcdir:patch:output:cpus:,skip:,debug,xen-debug,xen-syms:,depends:" -- "$@") || die "getopt failed" eval set -- "$options" @@ -202,6 +213,11 @@ while [[ $# -gt 0 ]]; do [ -f "$XENSYMS" ] || die "xen-syms file does not exist" shift ;; + --depends) + shift + DEPENDS="$1" + shift + ;; --) shift break