From patchwork Wed Jun 24 18:44:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gustavo.zacarias@free-electrons.com X-Patchwork-Id: 488168 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 87E261402E8 for ; Thu, 25 Jun 2015 04:44:32 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id F2FF491B32; Wed, 24 Jun 2015 18:44:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SQDqQoTebwQj; Wed, 24 Jun 2015 18:44:27 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 462419171E; Wed, 24 Jun 2015 18:44:27 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 7188F1C0361 for ; Wed, 24 Jun 2015 18:44:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6D89F90F35 for ; Wed, 24 Jun 2015 18:44:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ypHZU6UvIhfM for ; Wed, 24 Jun 2015 18:44:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.zacarias.com.ar (www.zacarias.com.ar [176.9.42.171]) by whitealder.osuosl.org (Postfix) with ESMTPS id 29DCF90E32 for ; Wed, 24 Jun 2015 18:44:23 +0000 (UTC) Received: from asgard (cpe-186-22-136-136.telecentro-reversos.com.ar [186.22.136.136] (may be forged)) (authenticated bits=0) by www.zacarias.com.ar (8.15.1/8.15.1) with ESMTPSA id t5OIiHC5008980 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 24 Jun 2015 18:44:20 GMT Received: by asgard (sSMTP sendmail emulation); Wed, 24 Jun 2015 15:44:11 -0300 From: gustavo.zacarias@free-electrons.com To: buildroot@busybox.net Date: Wed, 24 Jun 2015 15:44:11 -0300 Message-Id: <1435171451-19539-1-git-send-email-gustavo.zacarias@free-electrons.com> X-Mailer: git-send-email 2.3.6 X-Virus-Scanned: clamav-milter 0.98.7 at www X-Virus-Status: Clean Cc: Gustavo Zacarias Subject: [Buildroot] [PATCH v3] kvmtool: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Gustavo Zacarias Signed-off-by: Gustavo Zacarias Reviewed-by: Arnout Vandecappelle (Essensium/Mind) --- package/Config.in | 1 + package/kvmtool/Config.in | 31 +++++++++++++++++++++++++++ package/kvmtool/kvmtool.mk | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 package/kvmtool/Config.in create mode 100644 package/kvmtool/kvmtool.mk diff --git a/package/Config.in b/package/Config.in index fac632f..6522618 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1403,6 +1403,7 @@ endif source "package/irqbalance/Config.in" source "package/keyutils/Config.in" source "package/kmod/Config.in" + source "package/kvmtool/Config.in" source "package/lxc/Config.in" source "package/monit/Config.in" source "package/ncdu/Config.in" diff --git a/package/kvmtool/Config.in b/package/kvmtool/Config.in new file mode 100644 index 0000000..f047c75 --- /dev/null +++ b/package/kvmtool/Config.in @@ -0,0 +1,31 @@ +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 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_i386 || BR2_mips || BR2_x86_64 + depends on !(BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL) + +comment "kvmtool needs a (e)glibc or musl toolchain w/ dynamic library" + depends on BR2_USE_MMU + depends on BR2_aarch64 || BR2_arm || BR2_armeb + depends on !(BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL) || \ + BR2_STATIC_LIBS diff --git a/package/kvmtool/kvmtool.mk b/package/kvmtool/kvmtool.mk new file mode 100644 index 0000000..7f682db --- /dev/null +++ b/package/kvmtool/kvmtool.mk @@ -0,0 +1,53 @@ +################################################################################ +# +# kvmtool +# +################################################################################ + +KVMTOOL_VERSION = 372f583d359a5bdcbbe7268809c8d1dc179c64d2 +KVMTOOL_SITE = $(BR2_KERNEL_MIRROR)/scm/linux/kernel/git/will/kvmtool.git +KVMTOOL_SITE_METHOD = git +KVMTOOL_DEPENDENCIES = \ + $(if $(BR2_PACKAGE_BINUTILS),binutils) \ + $(if $(BR2_PACKAGE_DTC),dtc) \ + $(if $(BR2_PACKAGE_LIBAIO),libaio) \ + $(if $(BR2_PACKAGE_LIBGTK3),libgtk3) \ + $(if $(BR2_PACKAGE_LIBVNCSERVER),libvncserver) \ + $(if $(BR2_PACKAGE_SDL),sdl) \ + $(if $(BR2_PACKAGE_ZLIB),zlib) +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 + $(TARGET_MAKE_ENV) ARCH=$(KERNEL_ARCH) $(MAKE) -C $(@D) $(KVMTOOL_MAKE_OPTS) +endef + +define KVMTOOL_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) ARCH=$(KERNEL_ARCH) $(MAKE) -C $(@D) \ + $(KVMTOOL_MAKE_OPTS) install DESTDIR=$(TARGET_DIR) prefix=/usr +endef + +$(eval $(generic-package))