|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH LIVEPATCH-BUILD-TOOLS] Support "make install"
Add rules to support using "make install".
Use "make install DESTDIR=... PREFIX=..." to customize the installation
path.
Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
---
Makefile | 10 ++++++++++
livepatch-build | 20 +++++++++++++++++---
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index aa5d5b0..f96b150 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,9 @@
SHELL = /bin/sh
CC = gcc
+INSTALL = install
+PREFIX ?= /usr/local
+BINDIR = $(DESTDIR)$(PREFIX)/bin
+LIBEXECDIR = $(DESTDIR)$(PREFIX)/libexec/livepatch-build-tools
.PHONY: all install clean
.DEFAULT: all
@@ -25,5 +29,11 @@ create-diff-object: $(CREATE_DIFF_OBJECT_OBJS)
prelink: $(PRELINK_OBJS)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
+install: all
+ $(INSTALL) -d $(LIBEXECDIR)
+ $(INSTALL) $(TARGETS) livepatch-gcc $(LIBEXECDIR)
+ $(INSTALL) -d $(BINDIR)
+ $(INSTALL) livepatch-build $(BINDIR)
+
clean:
$(RM) $(TARGETS) $(CREATE_DIFF_OBJECT_OBJS) $(PRELINK_OBJS) *.d insn/*.d
diff --git a/livepatch-build b/livepatch-build
index 8dc8889..5ef2c88 100755
--- a/livepatch-build
+++ b/livepatch-build
@@ -49,6 +49,18 @@ die() {
exit 1
}
+find_tools() {
+ if [[ -e "$SCRIPTDIR/create-diff-object" ]]; then
+ # Running from source tree
+ TOOLSDIR="$SCRIPTDIR"
+ elif [[ -e
"$SCRIPTDIR/../libexec/livepatch-build-tools/create-diff-object" ]]; then
+ # Running installed
+ TOOLSDIR="$(readlink -f $SCRIPTDIR/../libexec/livepatch-build-tools)"
+ else
+ return 1
+ fi
+}
+
function make_patch_name()
{
PATCHNAME=$(basename "$1")
@@ -78,7 +90,7 @@ function build_special()
cd "${SRCDIR}" || die
# Capture .o files from the patched build
- export CROSS_COMPILE="${SCRIPTDIR}/livepatch-gcc "
+ export CROSS_COMPILE="${TOOLSDIR}/livepatch-gcc "
export LIVEPATCH_BUILD_DIR="$(pwd)/"
export LIVEPATCH_CAPTURE_DIR="$OUTPUT/${name}"
mkdir -p "$LIVEPATCH_CAPTURE_DIR"
@@ -112,7 +124,7 @@ function create_patch()
mkdir -p "output/$(dirname $i)" || die
echo "Processing ${i}"
echo "Run create-diff-object on $i" >>
"${OUTPUT}/create-diff-object.log"
- "${SCRIPTDIR}"/create-diff-object $debugopt $PRELINK "original/$i"
"patched/$i" "$XENSYMS" "output/$i" &>> "${OUTPUT}/create-diff-object.log"
+ "${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
warn "create-diff-object SIGSEGV"
@@ -146,7 +158,7 @@ function create_patch()
chmod +x "${PATCHNAME}.livepatch"
else
ld -r -o output.o --build-id=sha1 $(find output -type f -name "*.o")
|| die
- "${SCRIPTDIR}"/prelink $debugopt output.o "${PATCHNAME}.livepatch"
"$XENSYMS" &>> "${OUTPUT}/prelink.log" || die
+ "${TOOLSDIR}"/prelink $debugopt output.o "${PATCHNAME}.livepatch"
"$XENSYMS" &>> "${OUTPUT}/prelink.log" || die
fi
objcopy --add-section .livepatch.depends=depends.bin
"${PATCHNAME}.livepatch"
@@ -168,6 +180,8 @@ usage() {
echo " --prelink Prelink" >&2
}
+find_tools || die "can't find supporting tools"
+
options=$(getopt -o hs:p:o:j:k:d -l
"help,srcdir:patch:output:cpus:,skip:,debug,xen-debug,xen-syms:,depends:,prelink"
-- "$@") || die "getopt failed"
eval set -- "$options"
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |