Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/linux-tools: add hv_vss_daemon
@ 2019-12-05 15:44 Pascal de Bruijn
  2019-12-05 20:55 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Pascal de Bruijn @ 2019-12-05 15:44 UTC (permalink / raw)
  To: buildroot

hyperv integration services for snapshotting a running vm

hv_vss_daemon facilitates a FIFREEZE initiated from the hypervisor

Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
---
 package/linux-tools/Config.in                      |  5 ++++
 package/linux-tools/linux-tool-hv_vss_daemon.mk.in | 34 ++++++++++++++++++++++
 .../linux-tools/linux-tool-hv_vss_daemon.service   | 11 +++++++
 3 files changed, 50 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-hv_vss_daemon.mk.in
 create mode 100644 package/linux-tools/linux-tool-hv_vss_daemon.service

diff --git a/package/linux-tools/Config.in b/package/linux-tools/Config.in
index ab8cc38..4b750e2 100644
--- a/package/linux-tools/Config.in
+++ b/package/linux-tools/Config.in
@@ -116,4 +116,9 @@ config BR2_PACKAGE_LINUX_TOOLS_TMON
 	  tmon is a terminal-based tool (using curses) that allows the
 	  user to access thermal information about the system.
 
+config BR2_PACKAGE_LINUX_TOOLS_HV_VSS_DAEMON
+	bool "hv_vss_daemon"
+	select BR2_PACKAGE_LINUX_TOOLS
+	help
+	  HyperV VSS snapshot daemon
 endmenu
diff --git a/package/linux-tools/linux-tool-hv_vss_daemon.mk.in b/package/linux-tools/linux-tool-hv_vss_daemon.mk.in
new file mode 100644
index 0000000..2de13a7
--- /dev/null
+++ b/package/linux-tools/linux-tool-hv_vss_daemon.mk.in
@@ -0,0 +1,34 @@
+################################################################################
+#
+# hv_vss_daemon
+#
+################################################################################
+
+LINUX_TOOLS += hv_vss_daemon
+
+HV_VSS_DAEMON_MAKE_OPTS = CROSS=$(TARGET_CROSS)
+
+define HV_VSS_DAEMON_BUILD_CMDS
+	$(Q)if test ! -f $(LINUX_DIR)/tools/hv/hv_vss_daemon.c ; then \
+		echo "Your kernel version is too old and does not have the HyperV VSS daemon tool." ; \
+		exit 1 ; \
+	fi
+
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/hv \
+		$(HV_VSS_DAEMON_MAKE_OPTS) \
+		hv_vss_daemon
+endef
+
+define HV_VSS_DAEMON_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/hv/hv_vss_daemon \
+		$(TARGET_DIR)/usr/sbin/hv_vss_daemon
+endef
+
+define HV_VSS_DAEMON_INSTALL_INIT_SYSTEMD
+        mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+        $(INSTALL) -m 0644 -D package/linux-tools/linux-tool-hv_vss_daemon.service \
+                $(TARGET_DIR)/usr/lib/systemd/system/hv_vss_daemon.service
+	ln -sf ../../../../usr/lib/systemd/system/hv_vss_daemon.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/hv_vss_daemon.service
+endef
+
diff --git a/package/linux-tools/linux-tool-hv_vss_daemon.service b/package/linux-tools/linux-tool-hv_vss_daemon.service
new file mode 100644
index 0000000..f653f7b
--- /dev/null
+++ b/package/linux-tools/linux-tool-hv_vss_daemon.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=HyperV VSS daemon
+After=syslog.target
+ConditionVirtualization=microsoft
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/hv_vss_daemon --no-daemon
+
+[Install]
+WantedBy=multi-user.target
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH] package/linux-tools: add hv_vss_daemon
  2019-12-05 15:44 [Buildroot] [PATCH] package/linux-tools: add hv_vss_daemon Pascal de Bruijn
@ 2019-12-05 20:55 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2019-12-05 20:55 UTC (permalink / raw)
  To: buildroot

Hello Pascal,

On Thu,  5 Dec 2019 16:44:28 +0100
Pascal de Bruijn <p.debruijn@unilogic.nl> wrote:

> hyperv integration services for snapshotting a running vm
> 
> hv_vss_daemon facilitates a FIFREEZE initiated from the hypervisor
> 
> Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>

Thanks for the patch, but I believe it was insufficiently tested :-/

> diff --git a/package/linux-tools/linux-tool-hv_vss_daemon.mk.in b/package/linux-tools/linux-tool-hv_vss_daemon.mk.in
> new file mode 100644
> index 0000000..2de13a7
> --- /dev/null
> +++ b/package/linux-tools/linux-tool-hv_vss_daemon.mk.in
> @@ -0,0 +1,34 @@
> +################################################################################
> +#
> +# hv_vss_daemon
> +#
> +################################################################################
> +
> +LINUX_TOOLS += hv_vss_daemon
> +
> +HV_VSS_DAEMON_MAKE_OPTS = CROSS=$(TARGET_CROSS)

This is not sufficient, with just this, the user-space program is
compiled with the host compiler, and therefore the build fails with:

ERROR: architecture for "/usr/sbin/hv_vss_daemon" is "Advanced Micro Devices X86-64", should be "ARM"

To fix this, don't pass CROSS=, but just pass $(LINUX_MAKE_FLAGS), just
like most other linux-tools makefiles are doing.

> +define HV_VSS_DAEMON_INSTALL_INIT_SYSTEMD

This cannot work, as it will never be called: hv-vss-daemon is not a
package from the point of view of Buildroot. What is a package is
"linux-tools".

The reason why HV_VSS_DAEMON_INSTALL_TARGET_CMDS works is because we
have some special logic in package/linux-tools/linux-tools.mk:

LINUX_TOOLS_POST_INSTALL_TARGET_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
        $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
                $(call UPPERCASE,$(tool))_INSTALL_TARGET_CMDS))

but there is nothing like this for _INSTALL_INIT_SYSTEMD, so I don't
see how this variable could have ever been called.

Did you actually test this, and verified that the systemd unit was
installed as expected ?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-05 20:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-05 15:44 [Buildroot] [PATCH] package/linux-tools: add hv_vss_daemon Pascal de Bruijn
2019-12-05 20:55 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox