[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen: Add macOS hypervisor build configuration


  • To: Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 5 Feb 2026 18:07:00 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rFe9E+J28HPWXB1sL4ayUNH0zJUfEmo73nL+XIVOAaU=; b=jYQnhJaNlLxpyhhmNt/xMuZMS8lUgc+BVLso1RbGp/qMJqlUzA/dN3ZQgJnGtJerPz7W0pb6tGPBoypxPZHOahiysRtpYLfWtDxWnDynQoKT7BSeinboiSX9NVz80gixPjau/m4mxXlg0VgD4nsPSG/3sW9r8F1+ZwoNAjTTzUPPaueJNDgieq5TDuEUUpNimgMWOhdWW+cnUUFKdn3t/72cj34UX0cU3/2E54b7HzRAzFLF+foer2Too0vu65fHRD23u0lNUp+a3w0Yx94g9RkL6zRee3k8ty1XAqUjzRnwuDMb4pIMQ5RGl11TJKjCFIWomO9AfW5VTnMzv0Xakg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=unDFw0e1gKno2sC/nGqDTVEP4RYSzF7ofLaIUqdgb3ZJH5hDGE0n6wTCzgYoa3vTnmSAHO3Q6WwYDpYRB3s3E+D5m3ltLt3jVbnyQBonTyZkeK/Zel2MIXKDcE/mfqcSetx/UrkS5uzgXM66Etm5vbYirmYxF9owMgsTWcsQyHOTRBVuTov3GpoGRnzNSfUoiFBq2bQIGhaOMtME1F6koWhmp1QJR/MVnncuDXFxu8xJ58C9QGavmsYIe3N0Mo73DKPPt1++3vDUb3nu6P4mcOEPgxUsLq0TDBTsey1+spB0s++B3NW0emZOPNkKKFF37pYB2Tp0McN8l44/zfd9JQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 05 Feb 2026 17:07:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Feb 05, 2026 at 12:33:54PM +0100, Bertrand Marquis wrote:
> Xen does not currently document how to build the hypervisor on macOS, and
> there is no Darwin configuration for selecting a Homebrew-based GNU
> toolchain. Native builds are not supported; the hypervisor must be
> cross-built with a GNU toolchain and GNU make/sed.
> 
> Add a minimal Darwin.mk which selects the GNU tool definitions used by
> the macOS workflow and point to the build guide for required tools and
> setup. Document the Homebrew cross toolchain and GNU tools needed to
> build the hypervisor on macOS.
> 
> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
> ---
>  config/Darwin.mk            |  6 ++++
>  docs/misc/build-on-macos.md | 66 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 72 insertions(+)
>  create mode 100644 config/Darwin.mk
>  create mode 100644 docs/misc/build-on-macos.md
> 
> diff --git a/config/Darwin.mk b/config/Darwin.mk
> new file mode 100644
> index 000000000000..a4e3efa81842
> --- /dev/null
> +++ b/config/Darwin.mk
> @@ -0,0 +1,6 @@
> +# Use GNU tool definitions; the macOS workflow relies on Homebrew GNU tools.
> +# See docs/misc/build-on-macos.md for required tools and setup.
> +include $(XEN_ROOT)/config/StdGNU.mk
> +
> +# We are always cross compiling so fake COMPILE_ARCH
> +XEN_COMPILE_ARCH = Darwin
> diff --git a/docs/misc/build-on-macos.md b/docs/misc/build-on-macos.md
> new file mode 100644
> index 000000000000..6b56cd8eccab
> --- /dev/null
> +++ b/docs/misc/build-on-macos.md
> @@ -0,0 +1,66 @@
> +# Building Xen Hypervisor on macOS
> +
> +This guide explains how to cross-compile the Xen hypervisor (xen
> +subdirectory only) on macOS. This does **not** build the tools.

More on this below, I'm not sure I would call it a "cross-compile".
Only when doing so from a x86 silicon Mac?

> +## Prerequisites
> +
> +Install the following packages using Homebrew:
> +
> +```bash
> +# Cross-compilation toolchain for ARM64
> +brew install aarch64-elf-gcc
> +
> +# GNU tools (required for compatibility)
> +brew install make gnu-sed
> +```

Installing make / sed are not strictly needed.

> +
> +Homebrew installs under `/opt/homebrew` on Apple Silicon and `/usr/local` on
> +Intel Macs. Adjust paths below accordingly.
> +
> +### Verification
> +
> +Verify your installation:
> +
> +```bash
> +# Check cross compiler
> +aarch64-elf-gcc --version
> +
> +# Check GNU make (adjust prefix if needed)
> +/opt/homebrew/opt/make/libexec/gnubin/make --version
> +
> +# Check GNU sed (adjust prefix if needed)
> +/opt/homebrew/opt/gnu-sed/libexec/gnubin/sed --version
> +```

Checking for make / sed can be removed.

> +
> +## Building the Hypervisor
> +
> +Set up GNU tools in PATH and build:
> +
> +```bash
> +# Set up GNU tools in PATH (adjust prefix if needed)
> +export 
> PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/make/libexec/gnubin:$PATH"

Do you really need the gnubin?  I think this was only for sed / make,
which is not really needed.

> +
> +# Build Xen hypervisor only (in-tree)
> +cd xen/
> +make XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-elf- HOSTCC=gcc
> +
> +# Optional: out-of-tree build directory
> +# make XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-elf- HOSTCC=gcc 
> O=$PWD/build-mac
> +```
> +
> +## Architecture Support
> +
> +Currently supported architectures:
> +
> +- **ARM64** (`arm64`) - Default, uses `aarch64-elf-gcc`

It could possibly also use the llvm package from homebrew, but I can
add later if I get some time to test.

> +
> +Other targets may work if the corresponding cross toolchain is installed,
> +but this guide has only been tested on ARM64.
> +
> +## Limitations
> +
> +- **Hypervisor only**: This only builds the Xen hypervisor, not the tools
> +- **Cross-compilation only**: Native builds are not supported

Probably a more philosophical question, but is it really a cross
compilation if I'm building an arm64 Xen on Apple arm64 silicon?

Sure, it might use a different toolchain from native, but it's still a
"native" build from an architectural perspective?

> +- **macOS-specific**: Instructions optimized for macOS with Homebrew
> +- **GNU tools required**: Native BSD tools are not compatible

That last item can be removed.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.