From nobody Mon Feb 9 18:48:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1770211040008321.72566357175197; Wed, 4 Feb 2026 05:17:20 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1220534.1529209 (Exim 4.92) (envelope-from ) id 1vncke-0004fx-Mq; Wed, 04 Feb 2026 13:17:00 +0000 Received: by outflank-mailman (output) from mailman id 1220534.1529209; Wed, 04 Feb 2026 13:17:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vncke-0004fq-KK; Wed, 04 Feb 2026 13:17:00 +0000 Received: by outflank-mailman (input) for mailman id 1220534; Wed, 04 Feb 2026 13:17:00 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vnckd-0004fi-VE for xen-devel@lists.xenproject.org; Wed, 04 Feb 2026 13:16:59 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id c7eaaade-01cb-11f1-9ccf-f158ae23cfc8; Wed, 04 Feb 2026 14:16:57 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0067F339; Wed, 4 Feb 2026 05:16:50 -0800 (PST) Received: from C3HXLD123V.arm.com (unknown [10.57.54.132]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 188E33F778; Wed, 4 Feb 2026 05:16:54 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c7eaaade-01cb-11f1-9ccf-f158ae23cfc8 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [RFC PATCH] xen: Add macOS hypervisor build support Date: Wed, 4 Feb 2026 14:16:30 +0100 Message-ID: X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1770211042724154100 Content-Type: text/plain; charset="utf-8" Xen does not currently document how to build the hypervisor on macOS, and there is no Darwin configuration for a Homebrew-based toolchain. In addition, the Makefile silent-mode detection can be tripped by -I paths that contain an "s", which hides build commands unexpectedly. Add a minimal Darwin configuration, document the Homebrew toolchain and PATH setup (including prefix differences and an out-of-tree example), and clarify that the guide is tested on arm64. Tighten silent-mode detection to only look at the short option word. Functional impact: The Xen hypervisor can be cross-built on macOS (arm64) with the documented Homebrew toolchain, and make output is no longer forced silent by --include-dir paths. Signed-off-by: Bertrand Marquis --- This patch does not intent to say that building on mac os is supported but it can be helpful for people developing on mac os (I have been using that for a while) and is solving a Makefile issue that could be hit by others in other environments. The doc file is quick attempt to document that for others, happy to get comments from others to find out if they think this is useful or not or if this should not be documented there. --- config/Darwin.mk | 4 +++ docs/misc/build-on-macos.md | 66 +++++++++++++++++++++++++++++++++++++ xen/Makefile | 2 +- 3 files changed, 71 insertions(+), 1 deletion(-) 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..64a1dfcb42ed --- /dev/null +++ b/config/Darwin.mk @@ -0,0 +1,4 @@ +include $(XEN_ROOT)/config/StdGNU.mk + +# We are always cross compiling so fake COMPILE_ARCH +XEN_COMPILE_ARCH =3D 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. + +## 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 +``` + +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 +``` + +## Building the Hypervisor + +Set up GNU tools in PATH and build: + +```bash +# Set up GNU tools in PATH (adjust prefix if needed) +export PATH=3D"/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/= make/libexec/gnubin:$PATH" + +# Build Xen hypervisor only (in-tree) +cd xen/ +make XEN_TARGET_ARCH=3Darm64 CROSS_COMPILE=3Daarch64-elf- HOSTCC=3Dgcc + +# Optional: out-of-tree build directory +# make XEN_TARGET_ARCH=3Darm64 CROSS_COMPILE=3Daarch64-elf- HOSTCC=3Dgcc O= =3D$PWD/build-mac +``` + +## Architecture Support + +Currently supported architectures: + +- **ARM64** (`arm64`) - Default, uses `aarch64-elf-gcc` + +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 +- **macOS-specific**: Instructions optimized for macOS with Homebrew +- **GNU tools required**: Native BSD tools are not compatible diff --git a/xen/Makefile b/xen/Makefile index 13e336ba5484..adeb869f32ad 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -116,7 +116,7 @@ endif # If the user is running make -s (silent mode), suppress echoing of # commands =20 -ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) +ifneq ($(findstring s,$(firstword $(MAKEFLAGS))),) quiet :=3D silent_ endif =20 --=20 2.52.0