Add buildroot 2018-02
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
From 08e14a662b9e75daec29722e49150869952ba1b6 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Mon, 20 Nov 2017 22:09:39 +0100
|
||||
Subject: [PATCH] Makefile: remove -Werror to avoid build failures
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
[Matthew: Refactoring of Thomas Petazzoni's original.]
|
||||
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
|
||||
---
|
||||
Makefile | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 7231334..d9ad42b 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -53,7 +53,6 @@ cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
|
||||
COMMON_CFLAGS += -g $(autodepend-flags)
|
||||
COMMON_CFLAGS += -Wall -Wwrite-strings -Wclobbered -Wempty-body -Wuninitialized
|
||||
COMMON_CFLAGS += -Wignored-qualifiers -Wunused-but-set-parameter
|
||||
-COMMON_CFLAGS += -Werror
|
||||
frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer
|
||||
fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "")
|
||||
fnostack_protector := $(call cc-option, -fno-stack-protector, "")
|
||||
--
|
||||
2.14.2
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
From 8d9a62a5fa89001266352a929c5d40b28c0dda85 Mon Sep 17 00:00:00 2001
|
||||
From: Matt Weber <matthew.weber@rockwellcollins.com>
|
||||
Date: Fri, 12 Jan 2018 19:07:27 -0600
|
||||
Subject: [PATCH v2] kvm-unit-tests: test for rdseed/rdrand
|
||||
|
||||
The build fails when the host binutils isn't at least 2.23
|
||||
(2.22.x introduced RDSEED).
|
||||
|
||||
Fixes:
|
||||
http://autobuild.buildroot.net/results/c39/c3987a3cbd2960b0ff50f872636bdfd8d1a9c820/
|
||||
|
||||
Upstream:
|
||||
https://marc.info/?l=kvm&m=151580743523259&w=2
|
||||
|
||||
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
configure | 18 ++++++++++++++++++
|
||||
x86/vmx_tests.c | 6 ++++++
|
||||
3 files changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index d9ad42b..799e9b5 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -50,7 +50,7 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile
|
||||
cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
|
||||
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
|
||||
|
||||
-COMMON_CFLAGS += -g $(autodepend-flags)
|
||||
+COMMON_CFLAGS += -g $(autodepend-flags) $(EXTRA_CFLAGS)
|
||||
COMMON_CFLAGS += -Wall -Wwrite-strings -Wclobbered -Wempty-body -Wuninitialized
|
||||
COMMON_CFLAGS += -Wignored-qualifiers -Wunused-but-set-parameter
|
||||
frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer
|
||||
diff --git a/configure b/configure
|
||||
index dd9d361..21c0219 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -171,6 +171,23 @@ mkdir -p lib
|
||||
ln -sf "$asm" lib/asm
|
||||
|
||||
|
||||
+cat > rd_test.c <<EOF
|
||||
+#include <stdint.h>
|
||||
+int main() {
|
||||
+ uint16_t seed=0;
|
||||
+ unsigned char ok;
|
||||
+ asm volatile ("rdseed %0; setc %1"
|
||||
+ : "=r" (seed), "=qm" (ok));
|
||||
+ return ok;
|
||||
+}
|
||||
+EOF
|
||||
+if $cross_prefix$cc -o /dev/null rd_test.c &> /dev/null; then
|
||||
+ echo "Checking for rdseed/rdrand... Yes."
|
||||
+else
|
||||
+ echo "Checking for rdseed/rdrand... No."
|
||||
+ extra_cflags="-DNO_RDSEEDRAND"
|
||||
+fi
|
||||
+
|
||||
# create the config
|
||||
cat <<EOF > config.mak
|
||||
SRCDIR=$srcdir
|
||||
@@ -181,6 +198,7 @@ ARCH_NAME=$arch_name
|
||||
PROCESSOR=$processor
|
||||
CC=$cross_prefix$cc
|
||||
CXX=$cross_prefix$cxx
|
||||
+EXTRA_CFLAGS=$extra_cflags
|
||||
LD=$cross_prefix$ld
|
||||
OBJCOPY=$cross_prefix$objcopy
|
||||
OBJDUMP=$cross_prefix$objdump
|
||||
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
|
||||
index 4a3e94b..2cbe3eb 100644
|
||||
--- a/x86/vmx_tests.c
|
||||
+++ b/x86/vmx_tests.c
|
||||
@@ -770,8 +770,10 @@ asm(
|
||||
"insn_sldt: sldt %ax;ret\n\t"
|
||||
"insn_lldt: xor %eax, %eax; lldt %ax;ret\n\t"
|
||||
"insn_str: str %ax;ret\n\t"
|
||||
+#ifndef NO_RDSEEDRAND
|
||||
"insn_rdrand: rdrand %rax;ret\n\t"
|
||||
"insn_rdseed: rdseed %rax;ret\n\t"
|
||||
+#endif
|
||||
);
|
||||
extern void insn_hlt();
|
||||
extern void insn_invlpg();
|
||||
@@ -796,8 +798,10 @@ extern void insn_lldt();
|
||||
extern void insn_str();
|
||||
extern void insn_cpuid();
|
||||
extern void insn_invd();
|
||||
+#ifndef NO_RDSEEDRAND
|
||||
extern void insn_rdrand();
|
||||
extern void insn_rdseed();
|
||||
+#endif
|
||||
|
||||
u32 cur_insn;
|
||||
u64 cr3;
|
||||
@@ -853,8 +857,10 @@ static struct insn_table insn_table[] = {
|
||||
{"DESC_TABLE (LLDT)", CPU_DESC_TABLE, insn_lldt, INSN_CPU1, 47, 0, 0, 0},
|
||||
{"DESC_TABLE (STR)", CPU_DESC_TABLE, insn_str, INSN_CPU1, 47, 0, 0, 0},
|
||||
/* LTR causes a #GP if done with a busy selector, so it is not tested. */
|
||||
+#ifndef NO_RDSEEDRAND
|
||||
{"RDRAND", CPU_RDRAND, insn_rdrand, INSN_CPU1, VMX_RDRAND, 0, 0, 0},
|
||||
{"RDSEED", CPU_RDSEED, insn_rdseed, INSN_CPU1, VMX_RDSEED, 0, 0, 0},
|
||||
+#endif
|
||||
// Instructions always trap
|
||||
{"CPUID", 0, insn_cpuid, INSN_ALWAYS_TRAP, 10, 0, 0, 0},
|
||||
{"INVD", 0, insn_invd, INSN_ALWAYS_TRAP, 13, 0, 0, 0},
|
||||
--
|
||||
1.9.1
|
||||
|
||||
44
buildroot/package/kvm-unit-tests/Config.in
Normal file
44
buildroot/package/kvm-unit-tests/Config.in
Normal file
@@ -0,0 +1,44 @@
|
||||
config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
|
||||
bool
|
||||
# On ARM, it uses virtualization extensions
|
||||
default y if BR2_cortex_a7 || BR2_cortex_a12 || \
|
||||
BR2_cortex_a15 || BR2_cortex_a15_a7 || \
|
||||
BR2_cortex_a17 || BR2_cortex_a17_a7
|
||||
default y if BR2_i386 || BR2_x86_64
|
||||
default y if BR2_powerpc64 || BR2_powerpc64le
|
||||
|
||||
config BR2_PACKAGE_KVM_UNIT_TESTS
|
||||
bool "kvm-unit-tests"
|
||||
depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
|
||||
# on i386 and x86-64, __builtin_reachable is used, so we need
|
||||
# gcc 4.5 at least. on i386, we use the target gcc, while on
|
||||
# x86-64 we use the host gcc (see .mk file for details)
|
||||
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || !BR2_i386
|
||||
depends on BR2_HOST_GCC_AT_LEAST_4_5 || !BR2_x86_64
|
||||
depends on BR2_HOSTARCH = "x86_64" || !BR2_x86_64
|
||||
select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64=y
|
||||
help
|
||||
kvm-unit-tests is a project as old as KVM. As its name
|
||||
suggests, it's purpose is to provide unit tests for KVM. The
|
||||
unit tests are tiny guest operating systems that generally
|
||||
execute only tens of lines of C and assembler test code in
|
||||
order to obtain its PASS/FAIL result. Unit tests provide KVM
|
||||
and virt hardware functional testing by targeting the
|
||||
features through minimal implementations of their use per
|
||||
the hardware specification. The simplicity of unit tests
|
||||
make them easy to verify they are correct, easy to maintain,
|
||||
and easy to use in timing measurements. Unit tests are also
|
||||
often used for quick and dirty bug reproducers. The
|
||||
reproducers may then be kept as regression tests. It's
|
||||
strongly encouraged that patches implementing new KVM
|
||||
features are submitted with accompanying unit tests.
|
||||
|
||||
http://www.linux-kvm.org/page/KVM-unit-tests
|
||||
|
||||
comment "kvm-unit-tests needs a toolchain w/ gcc >= 4.5"
|
||||
depends on BR2_i386
|
||||
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
|
||||
|
||||
comment "kvm-unit-tests needs a host gcc >= 4.5"
|
||||
depends on BR2_x86_64
|
||||
depends on !BR2_HOST_GCC_AT_LEAST_4_5
|
||||
2
buildroot/package/kvm-unit-tests/kvm-unit-tests.hash
Normal file
2
buildroot/package/kvm-unit-tests/kvm-unit-tests.hash
Normal file
@@ -0,0 +1,2 @@
|
||||
# Locally computed
|
||||
sha256 346c543de9e953db283072e1c591cab9d0eb775f7fb1fff3d7560f38bdf6bdf2 kvm-unit-tests-kvm-unit-tests-20171020.tar.gz
|
||||
57
buildroot/package/kvm-unit-tests/kvm-unit-tests.mk
Normal file
57
buildroot/package/kvm-unit-tests/kvm-unit-tests.mk
Normal file
@@ -0,0 +1,57 @@
|
||||
################################################################################
|
||||
#
|
||||
# kvm-unit-tests
|
||||
#
|
||||
################################################################################
|
||||
|
||||
KVM_UNIT_TESTS_VERSION = kvm-unit-tests-20171020
|
||||
KVM_UNIT_TESTS_SITE = $(BR2_KERNEL_MIRROR)/scm/virt/kvm/kvm-unit-tests.git
|
||||
KVM_UNIT_TESTS_SITE_METHOD = git
|
||||
KVM_UNIT_TESTS_LICENSE = LGPL-2.0
|
||||
KVM_UNIT_TESTS_LICENSE_FILES = COPYRIGHT
|
||||
|
||||
ifeq ($(BR2_arm),y)
|
||||
KVM_UNIT_TESTS_ARCH = arm
|
||||
else ifeq ($(BR2_i386),y)
|
||||
KVM_UNIT_TESTS_ARCH = i386
|
||||
else ifeq ($(BR2_powerpc64)$(BR2_powerpc64le),y)
|
||||
KVM_UNIT_TESTS_ARCH = ppc64
|
||||
else ifeq ($(BR2_x86_64),y)
|
||||
KVM_UNIT_TESTS_ARCH = x86_64
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_ENDIAN),"LITTLE")
|
||||
KVM_UNIT_TESTS_ENDIAN = little
|
||||
else
|
||||
KVM_UNIT_TESTS_ENDIAN = big
|
||||
endif
|
||||
|
||||
KVM_UNIT_TESTS_CONF_OPTS =\
|
||||
--arch="$(KVM_UNIT_TESTS_ARCH)" \
|
||||
--processor="$(call qstrip,$(BR2_GCC_TARGET_CPU))" \
|
||||
--endian="$(KVM_UNIT_TESTS_ENDIAN)"
|
||||
|
||||
# For all architectures but x86-64, we use the target
|
||||
# compiler. However, for x86-64, we use the host compiler, as
|
||||
# kvm-unit-tests builds 32 bit code, which Buildroot toolchains for
|
||||
# x86-64 cannot do.
|
||||
ifneq ($(BR2_x86_64),y)
|
||||
KVM_UNIT_TESTS_CONF_OPTS += --cross-prefix="$(TARGET_CROSS)"
|
||||
endif
|
||||
|
||||
define KVM_UNIT_TESTS_CONFIGURE_CMDS
|
||||
cd $(@D) && ./configure $(KVM_UNIT_TESTS_CONF_OPTS)
|
||||
endef
|
||||
|
||||
define KVM_UNIT_TESTS_BUILD_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) standalone
|
||||
endef
|
||||
|
||||
define KVM_UNIT_TESTS_INSTALL_TARGET_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
DESTDIR=$(TARGET_DIR)/usr/share/kvm-unit-tests/ \
|
||||
install
|
||||
endef
|
||||
|
||||
# Does use configure script but not an autotools one
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user