Procházet zdrojové kódy

dubhe: kvmtool: Added kvmtool support

Added kvmtool bb recipes.

Signed-off-by: yang.lee <yang.lee@starfivetech.com>
yang.lee před 1 rokem
rodič
revize
2b565e9a7c

+ 25 - 0
recipes-extended/kvmtool/files/0001-kvmtool-9p-fixed-compilation-error.patch

@@ -0,0 +1,25 @@
+From e04b44c12402494ef5619205bfff03dab3e3d9cb Mon Sep 17 00:00:00 2001
+From: Dariusz Pelowski <dariusz.pelowski@gmail.com>
+Date: Sun, 5 Nov 2017 12:39:52 +0100
+Subject: [PATCH] kvmtool: 9p: fixed compilation error
+
+makedev is defined in sys/sysmacros.h
+
+Signed-off-by: Dariusz Pelowski <dariusz.pelowski@gmail.com>
+
+---
+ virtio/9p.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/virtio/9p.c b/virtio/9p.c
+index b78f2b3..838c5c4 100644
+--- a/virtio/9p.c
++++ b/virtio/9p.c
+@@ -16,6 +16,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <sys/vfs.h>
++#include <sys/sysmacros.h>
+ 
+ #include <linux/virtio_ring.h>
+ #include <linux/virtio_9p.h>

+ 27 - 0
recipes-extended/kvmtool/files/0002-kvmtool-add-EXTRA_CFLAGS-variable.patch

@@ -0,0 +1,27 @@
+From a1c255983169e094c18d82131939b2b66e581000 Mon Sep 17 00:00:00 2001
+From: Dariusz Pelowski <dariusz.pelowski@gmail.com>
+Date: Sun, 5 Nov 2017 12:39:21 +0100
+Subject: [PATCH] kvmtool: add EXTRA_CFLAGS variable
+
+to avoid CFLAGS overriding introduce new EXTRA_CFLAGS variable
+for setting via command argument
+
+Signed-off-by: Dariusz Pelowski <dariusz.pelowski@gmail.com>
+
+---
+ Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index c05b2c0..2ce753f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,6 +2,8 @@
+ # Define WERROR=0 to disable -Werror.
+ #
+ 
++CFLAGS += $(EXTRA_CFLAGS)
++
+ ifeq ($(strip $(V)),)
+ 	ifeq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
+ 		E = @echo

+ 23 - 0
recipes-extended/kvmtool/files/0003-kvmtool-Werror-disabled.patch

@@ -0,0 +1,23 @@
+From 459ebaebf368869ae26eb8031ff44a789e238988 Mon Sep 17 00:00:00 2001
+From: Cevat Bostancioglu <bostancioglucevat@gmail.com>
+Date: Wed, 19 Jun 2019 20:36:56 +0300
+Subject: [PATCH] WERROR override disabled.
+
+WERROR override causes gcc sizeof-pointer-memaccess,  format-truncation errors.
+
+---
+ Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Makefile b/Makefile
+index 2ce753f..fe2e3cb 100644
+--- a/Makefile
++++ b/Makefile
+@@ -4,6 +4,7 @@
+ 
+ CFLAGS += $(EXTRA_CFLAGS)
+ 
++WERROR = 0
+ ifeq ($(strip $(V)),)
+ 	ifeq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
+ 		E = @echo

+ 41 - 0
recipes-extended/kvmtool/files/external-crosscompiler.patch

@@ -0,0 +1,41 @@
+From 91b7123682c67ec8b0c50147c9ebd59efa563f26 Mon Sep 17 00:00:00 2001
+From: Stefan Agner <stefan@agner.ch>
+Date: Tue, 6 Sep 2016 11:51:40 -0700
+Subject: [PATCH] kvmtool: add lightweight hypervisor native Linux KVM tool
+
+Upstream-Status: Inappropriate [embedded specific]
+
+This allows OpenEmbedded to pass in cross compiler configuration using
+the default envirnment variables. It is required so that kvmtool can
+be linked against the cross-compiled libfdt library.
+
+---
+ Makefile | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index e9121dc..c05b2c0 100644
+--- a/Makefile
++++ b/Makefile
+@@ -19,12 +19,6 @@ include config/utilities.mak
+ include config/feature-tests.mak
+ -include $(OUTPUT)KVMTOOLS-VERSION-FILE
+ 
+-CC	:= $(CROSS_COMPILE)gcc
+-CFLAGS	:=
+-LD	:= $(CROSS_COMPILE)ld
+-LDFLAGS	:=
+-OBJCOPY	:= $(CROSS_COMPILE)objcopy
+-
+ FIND	:= find
+ CSCOPE	:= cscope
+ TAGS	:= ctags
+@@ -343,7 +337,7 @@ $(warning No static libc found. Skipping guest init)
+ endif
+ 
+ ifeq (y,$(ARCH_WANT_LIBFDT))
+-	ifneq ($(call try-build,$(SOURCE_LIBFDT),$(CFLAGS),-lfdt),y)
++	ifneq ($(call try-build,$(SOURCE_LIBFDT),$(CPPFLAGS) $(CFLAGS),-lfdt),y)
+           $(error No libfdt found. Please install libfdt-dev package)
+ 	else
+ 		CFLAGS_DYNOPT	+= -DCONFIG_HAS_LIBFDT

+ 29 - 0
recipes-extended/kvmtool/kvmtool.bb

@@ -0,0 +1,29 @@
+SUMMARY = "Native Linux KVM tool"
+DESCRIPTION = "kvmtool is a lightweight tool for hosting KVM guests."
+
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://COPYING;md5=fcb02dc552a041dee27e4b85c7396067"
+
+DEPENDS = "dtc libaio zlib"
+do_configure[depends] += "virtual/kernel:do_shared_workdir"
+
+inherit kernel-arch
+
+SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git;branch=master \
+           file://external-crosscompiler.patch \
+           file://0001-kvmtool-9p-fixed-compilation-error.patch \
+           file://0002-kvmtool-add-EXTRA_CFLAGS-variable.patch \
+           file://0003-kvmtool-Werror-disabled.patch \
+           "
+
+SRCREV = "faae833a746f1c59f64fb05e9c08e62b5b0002eb"
+PV = "5.10.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OEMAKE='V=1 EXTRA_CFLAGS="-I${STAGING_KERNEL_BUILDDIR}/include/generated -I${STAGING_KERNEL_BUILDDIR}/arch/${ARCH}/include/generated"'
+
+do_install() {
+    install -d ${D}${bindir}
+    install -m 0755 ${S}/lkvm ${D}${bindir}/
+}