Patchwork [3/3] UBUNTU: Hyper-V KVP daemon -- add to the tools package

login
register
mail settings
Submitter Andy Whitcroft
Date April 6, 2012, 5:52 p.m.
Message ID <1333734763-6664-4-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/151231/
State New
Headers show

Comments

Andy Whitcroft - April 6, 2012, 5:52 p.m.
Add the Hyper-V KVP userspace daemon to the kernel tools package.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/rules.d/2-binary-arch.mk  |    4 ++++
 debian/rules.d/3-binary-indep.mk |    4 ++++
 debian/tools/generic             |   16 ++++++++++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644 debian/tools/generic

Patch

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 60b83d2..8308925 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -401,6 +401,7 @@  ifeq ($(do_tools),true)
 	if [ "$(arch)" = "amd64" ] || [ "$(arch)" = "i386" ]; then \
 		cd $(builddir)/tools/tools/power/x86/x86_energy_perf_policy && make CROSS_COMPILE=$(CROSS_COMPILE); \
 		cd $(builddir)/tools/tools/power/x86/turbostat && make CROSS_COMPILE=$(CROSS_COMPILE); \
+		cd $(builddir)/tools/tools/hv && make CROSS_COMPILE=$(CROSS_COMPILE) CFLAGS=-I../../include; \
 	fi
 endif
 	@touch $@
@@ -417,6 +418,9 @@  ifeq ($(do_tools),true)
 			$(toolspkgdir)/usr/bin/x86_energy_perf_policy_$(abi_release); \
 		install -s -m755 $(builddir)/tools/tools/power/x86/turbostat/turbostat \
 			$(toolspkgdir)/usr/bin/turbostat_$(abi_release); \
+		install -d $(toolspkgdir)/usr/sbin; \
+		install -s -m755 $(builddir)/tools/tools/hv/hv_kvp_daemon \
+			$(toolspkgdir)/usr/sbin/hv_kvp_daemon_$(abi_release); \
 	fi
 endif
 
diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
index 462d721..de3583a 100644
--- a/debian/rules.d/3-binary-indep.mk
+++ b/debian/rules.d/3-binary-indep.mk
@@ -81,6 +81,7 @@  endif
 
 install-tools: toolspkg = $(tools_common_pkg_name)
 install-tools: toolsbin = $(CURDIR)/debian/$(toolspkg)/usr/bin
+install-tools: toolssbin = $(CURDIR)/debian/$(toolspkg)/usr/sbin
 install-tools: toolsman = $(CURDIR)/debian/$(toolspkg)/usr/share/man
 install-tools: install-source
 ifeq ($(do_tools),true)
@@ -95,6 +96,8 @@  ifeq ($(do_tools),true)
 	if [ "$(arch)" = "amd64" ] || [ "$(arch)" = "i386" ]; then \
 		install -m755 debian/tools/x86_energy_perf_policy $(toolsbin)/x86_energy_perf_policy; \
 		install -m755 debian/tools/turbostat $(toolsbin)/turbostat; \
+		install -d $(toolssbin) ; \
+		install -m755 debian/tools/generic $(toolssbin)/hv_kvp_daemon; \
 	fi
 
 	rm -rf $(builddir)/tools
@@ -110,6 +113,7 @@  ifeq ($(do_tools),true)
 		install -d $(toolsman)/man8; \
 		install -m644 $(CURDIR)/tools/power/x86/x86_energy_perf_policy/*.8 $(toolsman)/man8; \
 		install -m644 $(CURDIR)/tools/power/x86/turbostat/*.8 $(toolsman)/man8; \
+		install -m644 $(CURDIR)/tools/hv/*.8 $(toolsman)/man8; \
 	fi
 endif
 
diff --git a/debian/tools/generic b/debian/tools/generic
new file mode 100644
index 0000000..61b427d
--- /dev/null
+++ b/debian/tools/generic
@@ -0,0 +1,16 @@ 
+#!/bin/bash
+full_version=`uname -r`
+
+# Removing flavour from version i.e. generic or server.
+flavour_abi=${full_version#*-}
+flavour=${flavour_abi#*-}
+version=${full_version%-$flavour}
+this="$0_$version"
+
+if [ ! -f "$this" ]; then
+    echo "$this not found" >&2
+    echo "You may need to install linux-tools-$version" >&2
+    exit 2
+fi
+
+exec "$this" "$@"