diff mbox series

[kvm-unit-tests,2/2] README: Document steps to run the tests on macOS

Message ID 20200320145541.38578-3-r.bolshakov@yadro.com (mailing list archive)
State New, archived
Headers show
Series Add support of hvf accel | expand

Commit Message

Roman Bolshakov March 20, 2020, 2:55 p.m. UTC
While at it, mention that hvf is a valid accel parameter.

Cc: Cameron Esfahani <dirty@apple.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 README.macOS.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 README.md       |  6 ++++--
 2 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 README.macOS.md

Comments

Cameron Esfahani March 23, 2020, 10:17 p.m. UTC | #1
Reviewed-by: Cameron Esfahani <dirty@apple.com>

Cameron Esfahani
dirty@apple.com

"We do what we must because we can."

Aperture Science



> On Mar 20, 2020, at 7:55 AM, Roman Bolshakov <r.bolshakov@yadro.com> wrote:
> 
> While at it, mention that hvf is a valid accel parameter.
> 
> Cc: Cameron Esfahani <dirty@apple.com>
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
> README.macOS.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++
> README.md       |  6 ++++--
> 2 files changed, 51 insertions(+), 2 deletions(-)
> create mode 100644 README.macOS.md
> 
> diff --git a/README.macOS.md b/README.macOS.md
> new file mode 100644
> index 0000000..de46d5f
> --- /dev/null
> +++ b/README.macOS.md
> @@ -0,0 +1,47 @@
> +# kvm-unit-tests on macOS
> +
> +Cross-compiler with ELF support is required for build of kvm-unit-tests on
> +macOS.
> +
> +## Building cross-compiler from source
> +
> +A cross-compiler toolchain can be built from source using crosstool-ng. The
> +latest released version of
> +[crosstool-ng](https://github.com/crosstool-ng/crosstool-ng) can be installed
> +using [homebrew](https://brew.sh)
> +```
> +$ brew install crosstool-ng
> +```
> +
> +A case-sensitive APFS/HFS+ volume has to be created using Disk Utility as a
> +build and installation directory for the cross-compiler. Please [see Apple
> +documentation](https://support.apple.com/guide/disk-utility/dsku19ed921c/mac)
> +for details.
> +
> +Assuming the case-sensitive volume is named /Volumes/BuildTools, the
> +cross-compiler can be built and installed there:
> +```
> +$ X_BUILD_DIR=/Volumes/BuildTools/ct-ng-build
> +$ X_INSTALL_DIR=/Volumes/BuildTools/x-tools
> +$ mkdir $X_BUILD_DIR
> +$ ct-ng -C $X_BUILD_DIR x86_64-unknown-linux-gnu
> +$ ct-ng -C $X_BUILD_DIR build CT_PREFIX=$X_INSTALL_DIR
> +```
> +
> +Once compiled, the cross-compiler can be used to build the tests:
> +```
> +$ ./configure --cross-prefix=$X_INSTALL_DIR/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-
> +$ make
> +```
> +
> +## Pre-built cross-compiler
> +
> +x86_64-elf-gcc package in Homebrew provides pre-built cross-compiler but it
> +fails to compile kvm-unit-tests.
> +
> +## Running the tests
> +
> +GNU coreutils should be installed prior to running the tests: 
> +```
> +$ brew install coreutils
> +```
> diff --git a/README.md b/README.md
> index 396fbf8..48be206 100644
> --- a/README.md
> +++ b/README.md
> @@ -15,6 +15,8 @@ To create the test images do:
> 
> in this directory.  Test images are created in ./ARCH/\*.flat
> 
> +NOTE: GCC cross-compiler is required for [build on macOS](README.macOS.md).
> +
> ## Standalone tests
> 
> The tests can be built as standalone.  To create and use standalone tests do:
> @@ -47,7 +49,7 @@ environment variable:
> 
>     QEMU=/tmp/qemu/x86_64-softmmu/qemu-system-x86_64 ./x86-run ./x86/msr.flat
> 
> -To select an accelerator, for example "kvm" or "tcg", specify the
> +To select an accelerator, for example "kvm", "hvf" or "tcg", specify the
> ACCEL=name environment variable:
> 
>     ACCEL=kvm ./x86-run ./x86/msr.flat
> @@ -78,7 +80,7 @@ which can then be accessed in the usual ways, e.g. VAL = getenv("KEY").
> Any key=val strings can be passed, but some have reserved meanings in
> the framework.  The list of reserved environment variables is below
> 
> -    QEMU_ACCEL                   either kvm or tcg
> +    QEMU_ACCEL                   either kvm, hvf or tcg
>     QEMU_VERSION_STRING          string of the form `qemu -h | head -1`
>     KERNEL_VERSION_STRING        string of the form `uname -r`
> 
> -- 
> 2.24.1
>
diff mbox series

Patch

diff --git a/README.macOS.md b/README.macOS.md
new file mode 100644
index 0000000..de46d5f
--- /dev/null
+++ b/README.macOS.md
@@ -0,0 +1,47 @@ 
+# kvm-unit-tests on macOS
+
+Cross-compiler with ELF support is required for build of kvm-unit-tests on
+macOS.
+
+## Building cross-compiler from source
+
+A cross-compiler toolchain can be built from source using crosstool-ng. The
+latest released version of
+[crosstool-ng](https://github.com/crosstool-ng/crosstool-ng) can be installed
+using [homebrew](https://brew.sh)
+```
+$ brew install crosstool-ng
+```
+
+A case-sensitive APFS/HFS+ volume has to be created using Disk Utility as a
+build and installation directory for the cross-compiler. Please [see Apple
+documentation](https://support.apple.com/guide/disk-utility/dsku19ed921c/mac)
+for details.
+
+Assuming the case-sensitive volume is named /Volumes/BuildTools, the
+cross-compiler can be built and installed there:
+```
+$ X_BUILD_DIR=/Volumes/BuildTools/ct-ng-build
+$ X_INSTALL_DIR=/Volumes/BuildTools/x-tools
+$ mkdir $X_BUILD_DIR
+$ ct-ng -C $X_BUILD_DIR x86_64-unknown-linux-gnu
+$ ct-ng -C $X_BUILD_DIR build CT_PREFIX=$X_INSTALL_DIR
+```
+
+Once compiled, the cross-compiler can be used to build the tests:
+```
+$ ./configure --cross-prefix=$X_INSTALL_DIR/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-
+$ make
+```
+
+## Pre-built cross-compiler
+
+x86_64-elf-gcc package in Homebrew provides pre-built cross-compiler but it
+fails to compile kvm-unit-tests.
+
+## Running the tests
+
+GNU coreutils should be installed prior to running the tests: 
+```
+$ brew install coreutils
+```
diff --git a/README.md b/README.md
index 396fbf8..48be206 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,8 @@  To create the test images do:
 
 in this directory.  Test images are created in ./ARCH/\*.flat
 
+NOTE: GCC cross-compiler is required for [build on macOS](README.macOS.md).
+
 ## Standalone tests
 
 The tests can be built as standalone.  To create and use standalone tests do:
@@ -47,7 +49,7 @@  environment variable:
 
     QEMU=/tmp/qemu/x86_64-softmmu/qemu-system-x86_64 ./x86-run ./x86/msr.flat
 
-To select an accelerator, for example "kvm" or "tcg", specify the
+To select an accelerator, for example "kvm", "hvf" or "tcg", specify the
 ACCEL=name environment variable:
 
     ACCEL=kvm ./x86-run ./x86/msr.flat
@@ -78,7 +80,7 @@  which can then be accessed in the usual ways, e.g. VAL = getenv("KEY").
 Any key=val strings can be passed, but some have reserved meanings in
 the framework.  The list of reserved environment variables is below
 
-    QEMU_ACCEL                   either kvm or tcg
+    QEMU_ACCEL                   either kvm, hvf or tcg
     QEMU_VERSION_STRING          string of the form `qemu -h | head -1`
     KERNEL_VERSION_STRING        string of the form `uname -r`