XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)
C
mk-macvm-disk.sh: a disk also builds without the Metal plugin
qianshizhou43408b513e5a
diff --git a/scripts/mk-macvm-disk.sh b/scripts/mk-macvm-disk.shindex 9e4fe88..1973dce 100755--- a/scripts/mk-macvm-disk.sh+++ b/scripts/mk-macvm-disk.sh@@ -8,7 +8,8 @@# volume group and Preboot with the cryptexes, the Recovery container). The sealed System volume stays as installed; what the# hosted system needs is added to the Data volume only:# - the local user, automatic login, Setup Assistant done (tools/hosted/gui-user.py)-# - the CPU Metal plugin in /Library/GPUBundles (the GPU line's dist/XnuCpuMetal.bundle)+# - the CPU Metal plugin in /Library/GPUBundles (the GPU line's dist/XnuCpuMetal.bundle), if it was built: without+# it the hosted system has no Metal device at all (the bundle is the metal2vulkan/lavapipe CPU rendering path)# - a root shell on /dev/console (xnulinux.shell), the hosted system's console# - launchd's disabled list for daemons of hardware the hosted system has not (watchdog, audio, ...) and Rosetta's# and the static trust cache of that macOS build, for xnu.ko trustcache=. Apple's files stay on this host and in the VM.@@ -16,6 +17,9 @@ set -euo pipefailcd "$(dirname "$0")/.."V="bash scripts/vm.sh"SRC=${SRC:-$HOME/.tart/vms/xnumac/disk.img}; W=${W:-$PWD/../macvm}; IMG=$W/mac.img+# GPU is this host's own setting: an explicitly given path that does not hold a bundle is a mistake, not "build+# without one" (that is what leaving GPU unset is for).+if [ -n "${GPU-}" ] && [ ! -d "$GPU" ]; then echo "GPU=$GPU: no such bundle" >&2; exit 1; fiGPU=${GPU:-$PWD/gpu/xnu-cpu-metal/dist/XnuCpuMetal.bundle}# bluetoothd: no Bluetooth controller; it fails to boot the chip and exits, and launchd starts it again every few secondsDISABLE="com.apple.watchdogd com.apple.iomfb_bics_daemon com.apple.audiomxd com.apple.audio.coreaudiod com.apple.PerfPowerServices@@ -54,8 +58,15 @@ echo "keybags: $(sudo -n ls "$D/private/var/keybags" 2>/dev/null | tr '\n' ' ')"sudo -n rm -f "$D"/private/var/keybags/*sudo -n python3 tools/hosted/gui-user.py "$D" "$W/sys/System/Library/User Template"sudo -n mkdir -p "$D/Library/GPUBundles" "$D/Library/LaunchDaemons" "$D/private/var/db/com.apple.xpc.launchd"-sudo -n rm -rf "$D/Library/GPUBundles/XnuCpuMetal.bundle"; sudo -n ditto "$GPU" "$D/Library/GPUBundles/XnuCpuMetal.bundle"-sudo -n chown -R root:wheel "$D/Library/GPUBundles"+# The disk is a clone of a configurable SRC, which may already carry a bundle: clear it either way, so the disk has+# exactly the bundle this run was told about.+sudo -n rm -rf "$D/Library/GPUBundles/XnuCpuMetal.bundle"+if [ -d "$GPU" ]; then+ sudo -n ditto "$GPU" "$D/Library/GPUBundles/XnuCpuMetal.bundle"+ sudo -n chown -R root:wheel "$D/Library/GPUBundles"+else+ echo "no GPU bundle at $GPU: the hosted system runs without a Metal device"+fi# Third-party applications for the hosted system (e.g. Google Chrome, fetched from its vendor on this host; never in the# repo): every *.app in $APPS goes to /Applications on the Data volume.for a in "${APPS:-$W/../apps}"/*.app; do