Skip to contentSkip to conversation

kvmtool: add new package

PATCH New gustavo.zacarias at free-electrons.com 2 participants 4 messages Jun 18, 2015 – Jun 21, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvmtool: add new package

From: Gustavo Zacarias <[email protected]>

---
 package/Config.in          |  1 +
 package/kvmtool/Config.in  | 32 ++++++++++++++++++++++++++++
 package/kvmtool/kvmtool.mk | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 85 insertions(+)
 create mode 100644 package/kvmtool/Config.in
 create mode 100644 package/kvmtool/kvmtool.mk
package/Config.in +1 -0
index 6dbc32d..19310ba 100644
@@ -366,6 +366,7 @@ endif
 	source "package/irda-utils/Config.in"
 	source "package/iucode-tool/Config.in"
 	source "package/kbd/Config.in"
+	source "pacakge/kvmtool/Config.in"
 	source "package/lcdproc/Config.in"
 	source "package/lirc-tools/Config.in"
 	source "package/lm-sensors/Config.in"
package/kvmtool/Config.in new file +32 -0
new file mode 100644
index 0000000..3497789
@@ -0,0 +1,32 @@
+config BR2_PACKAGE_KVMTOOL
+	bool "kvmtool"
+	depends on BR2_USE_MMU # guest simple init fork()
+	# No MADV_HUGEPAGE define in uClibc(-ng)
+	depends on (BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL)
+	# Only mips(64) big-endian seems to be supported (build breaks)
+	# Should work on powerpc64 but the build breaks with missing types
+	depends on \
+		BR2_aarch64 || BR2_arm       || BR2_armeb || BR2_i386 || \
+		BR2_mips    || BR2_x86_64
+	# libfdt is only required for DT architectures...
+	# ...but it's not able to build for static targets
+	depends on !(BR2_STATIC_LIBS && (BR2_aarch64 || BR2_arm || BR2_armeb))
+	select BR2_PACKAGE_DTC if BR2_aarch64 || BR2_arm || BR2_armeb
+	help
+	  kvmtool is a lightweight tool for hosting KVM guests.
+	  As a pure virtualization tool it only supports guests using
+	  the same architecture, though it supports running 32-bit guests
+	  on those 64-bit architectures that allow this.
+
+	  https://git.kernel.org/cgit/linux/kernel/git/will/kvmtool.git/tree/README
+
+comment "kvmtool needs a (e)glibc or musl toolchain"
+	depends on BR2_USE_MMU
+	depends on !(BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL)
+	depends on !(BR2_aarch64 || BR2_arm || BR2_armeb)
+
+comment "kvmtool needs a (e)glibc or musl toolchain w/ dynamic library"
+	depends on BR2_USE_MMU
+        depends on !(BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL) || \
+		BR2_STATIC_LIBS
+	depends on (BR2_aarch64 || BR2_arm || BR2_armeb)
package/kvmtool/kvmtool.mk new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 kvmtool: add new package

Quoted 7 lines · gustavo.zacarias at free-electrons.com

From: Gustavo Zacarias <[email protected]>

---
 package/Config.in          |  1 +
 package/kvmtool/Config.in  | 32 ++++++++++++++++++++++++++++
 package/kvmtool/kvmtool.mk | 52 ++++++++++++++++++++++++++++++++++++++++++++++

Could you add a hash file?

package/Config.in endif · line 369

Quoted 13 lines
 3 files changed, 85 insertions(+)
 create mode 100644 package/kvmtool/Config.in
 create mode 100644 package/kvmtool/kvmtool.mk
package/Config.in +1 -0
index 6dbc32d..19310ba 100644
@@ -366,6 +366,7 @@ endif
 	source "package/irda-utils/Config.in"
 	source "package/iucode-tool/Config.in"
 	source "package/kbd/Config.in"
+	source "pacakge/kvmtool/Config.in"
                   ^^
                   Excuse me? :-)

package/kvmtool/Config.in line 4

Quoted 13 lines
package/Config.in +0 -0
 	source "package/lcdproc/Config.in"
 	source "package/lirc-tools/Config.in"
 	source "package/lm-sensors/Config.in"
package/kvmtool/Config.in new file +4 -0
new file mode 100644
index 0000000..3497789
@@ -0,0 +1,32 @@
+config BR2_PACKAGE_KVMTOOL
+	bool "kvmtool"
+	depends on BR2_USE_MMU # guest simple init fork()
+	# No MADV_HUGEPAGE define in uClibc(-ng)

That's weird, it comes from kernel headers and I do see it in
asm-generic/mman-common.h. But that is not included by sys/mman.h, so you need to include asm/mman.h...

Quoted 12 lines
package/kvmtool/Config.in new file +12 -0
+	depends on (BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL)
+	# Only mips(64) big-endian seems to be supported (build breaks)
+	# Should work on powerpc64 but the build breaks with missing types
+	depends on \
+		BR2_aarch64 || BR2_arm       || BR2_armeb || BR2_i386 || \
+		BR2_mips    || BR2_x86_64
+	# libfdt is only required for DT architectures...
+	# ...but it's not able to build for static targets
+	depends on !(BR2_STATIC_LIBS && (BR2_aarch64 || BR2_arm || BR2_armeb))
+	select BR2_PACKAGE_DTC if BR2_aarch64 || BR2_arm || BR2_armeb
+	help
+	  kvmtool is a lightweight tool for hosting KVM guests.

package/kvmtool/Config.in line 26

Quoted 10 lines
package/kvmtool/Config.in new file +10 -0
+	  As a pure virtualization tool it only supports guests using
+	  the same architecture, though it supports running 32-bit guests
+	  on those 64-bit architectures that allow this.
+
+	  https://git.kernel.org/cgit/linux/kernel/git/will/kvmtool.git/tree/README
+
+comment "kvmtool needs a (e)glibc or musl toolchain"
+	depends on BR2_USE_MMU
+	depends on !(BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL)
+	depends on !(BR2_aarch64 || BR2_arm || BR2_armeb)

This should depend on the supported architectures. Since the arm ones are
excluded, it would be just BR2_i386 || BR2_mips || BR2_x86_64

Quoted 12 lines
package/kvmtool/Config.in new file +6 -0
+
+comment "kvmtool needs a (e)glibc or musl toolchain w/ dynamic library"
+	depends on BR2_USE_MMU
+        depends on !(BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL) || \
+		BR2_STATIC_LIBS
+	depends on (BR2_aarch64 || BR2_arm || BR2_armeb)
package/kvmtool/kvmtool.mk new file +0 -0
new file mode 100644
index 0000000..200b77e

package/kvmtool/kvmtool.mk line 7

Quoted 7 lines
package/kvmtool/kvmtool.mk new file +7 -0
@@ -0,0 +1,52 @@
+################################################################################
+#
+# kvmtool
+#
+################################################################################
+
+#KVMTOOL_VERSION = 0fc7018d0be707c3f48fe78ef6276636d7eae65a

Remove.

package/kvmtool/kvmtool.mk line 16

Quoted 9 lines
package/kvmtool/kvmtool.mk new file +9 -0
+KVMTOOL_VERSION = 372f583d359a5bdcbbe7268809c8d1dc179c64d2
+KVMTOOL_SITE = $(BR2_KERNEL_MIRROR)/scm/linux/kernel/git/will/kvmtool.git
+KVMTOOL_SITE_METHOD = git
+KVMTOOL_DEPENDENCIES = dtc \
+	$(if $(BR2_PACKAGE_BINUTILS),binutils) \
+	$(if $(BR2_PACKAGE_LIBAIO),libaio) \
+	$(if $(BR2_PACKAGE_LIBVNCSERVER),libvncserver) \
+	$(if $(BR2_PACKAGE_SDL),sdl) \
+	$(if $(BR2_PACKAGE_ZLIB),zlib)

Makefile tells me there's an optional dependency on libgtk3 as well.

Regards,
Arnout

Quoted 37 lines
package/kvmtool/kvmtool.mk new file +36 -0
+KVMTOOL_LICENSE = GPLv2
+KVMTOOL_LICENSE_FILES = COPYING
+
+# This is required to convert a static binary (init helper) back into
+# object-file format, and in multilib toolchains like CS 2012.09 for x86
+# the default is i386, hence when building for x86_64 things break since
+# LD doesn't autodetect the input file format.
+# GCC-as-linker can't accomplish this feat easily either since it's mixing
+# static content (guest_init.o) with dynamic one (lkvm) making
+# a relocatable output file.
+# The purpose of this trick is to embed the init helper into the main
+# binary to help users in guest system startup, which would otherwise
+# require more complex guest images.
+# This needs revisiting if/when X32 ABI support is added.
+#
+# If more packages need this (unlikely) an ld wrapper might be a better
+# solution, using gcc -dumpspecs information.
+KVMTOOL_EXTRA_LDFLAGS = \
+	$(if $(BR2_x86_64),-m elf_x86_64)
+
+# Disable -Werror, otherwise musl is not happy
+KVMTOOL_MAKE_OPTS = \
+	CROSS_COMPILE="$(TARGET_CROSS)" \
+	LDFLAGS="$(TARGET_LDFLAGS) $(KVMTOOL_EXTRA_LDFLAGS)" \
+	WERROR=0
+
+define KVMTOOL_BUILD_CMDS
+	ARCH=$(KERNEL_ARCH) $(MAKE) -C $(@D) $(KVMTOOL_MAKE_OPTS)
+endef
+
+define KVMTOOL_INSTALL_TARGET_CMDS
+	ARCH=$(KERNEL_ARCH) $(MAKE) -C $(@D) $(KVMTOOL_MAKE_OPTS) install \
+		DESTDIR=$(TARGET_DIR) prefix=/usr
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH 1/1 kvmtool: add new package

Quoted 1 line · Arnout Vandecappelle

Could you add a hash file?

I didn't know we were adding hashes to git sources, it's bad for a couple of reasons.

Quoted 6 lines

package/Config.in endif · line 369

Quoted 4 lines

source "package/irda-utils/Config.in"
source "package/iucode-tool/Config.in"
source "package/kbd/Config.in"

package/Config.in +1 -0
+	source "pacakge/kvmtool/Config.in"
                    ^^
                    Excuse me? :-)

Yeah, that's what happens when you move a backport into current and you're still ill/running a fever.
And it should also belong in System apps rather than Hardware.

Quoted 5 lines

package/kvmtool/Config.in line 4

Quoted 1 line
package/kvmtool/Config.in new file +1 -0
+	# No MADV_HUGEPAGE define in uClibc(-ng)

That's weird, it comes from kernel headers and I do see it in
asm-generic/mman-common.h. But that is not included by sys/mman.h, so you need to include asm/mman.h...

I don't think that's correct, it may work, but the madvise manpages says that only sys/mman.h is required.
The MADV_ defines in uclibc are in bits/mman.h, like on glibc and musl, so basically they're incomplete/old and a patch to uclibc would be the correct way to fix this.

Quoted 7 lines

package/kvmtool/Config.in line 26

Quoted 4 lines
package/kvmtool/Config.in new file +4 -0
+comment "kvmtool needs a (e)glibc or musl toolchain"
+	depends on BR2_USE_MMU
+	depends on !(BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL)
+	depends on !(BR2_aarch64 || BR2_arm || BR2_armeb)

This should depend on the supported architectures. Since the arm ones are
excluded, it would be just BR2_i386 || BR2_mips || BR2_x86_64

Ack.

Quoted 3 lines
Quoted 1 line

+#KVMTOOL_VERSION = 0fc7018d0be707c3f48fe78ef6276636d7eae65a

Remove.

Ack.

Quoted 1 line

Makefile tells me there's an optional dependency on libgtk3 as well.

Yes, but only for x86, whatever that means (ARCH_HAS_FRAMEBUFFER). Fixed, though only build tested.
I'll send v2 shortly.
Regards.

#3 lore raw

PATCH 1/1 kvmtool: add new package

Quoted 6 lines · Gustavo Zacarias
Quoted 1 line · Arnout Vandecappelle

Could you add a hash file?

I didn't know we were adding hashes to git sources, it's bad for a couple of reasons.

Argh, silly me.

[snip]

Quoted 11 lines
Quoted 5 lines
Quoted 1 line

+ # No MADV_HUGEPAGE define in uClibc(-ng)

That's weird, it comes from kernel headers and I do see it in
asm-generic/mman-common.h. But that is not included by sys/mman.h, so you need to include asm/mman.h...

I don't think that's correct, it may work, but the madvise manpages says that only sys/mman.h is required.
The MADV_ defines in uclibc are in bits/mman.h, like on glibc and musl, so basically they're incomplete/old and a patch to uclibc would be the correct way to fix this.

OK.

Regards,
Arnout

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F