Skip to content

XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)

C

vm-mk-sysdisk: the tarball lives in /var/tmp (the VM's /tmp is cleared at boot)

Heyang Zhou778823a615f2
diff --git a/scripts/vm-mk-sysdisk.sh b/scripts/vm-mk-sysdisk.sh
index 83b5fee..bad6b62 100755
--- a/scripts/vm-mk-sysdisk.sh
+++ b/scripts/vm-mk-sysdisk.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# In the VM: an HFS+ system disk image for the host-disk root (/var/tmp/sys.img): Apple's dyld, the dyld shared cache,
-# a few /bin tools (from /tmp/sys.tar, made on the macOS host; Apple binaries stay local, never in the repo) and the test init.
+# a few /bin tools (from /var/tmp/sys.tar, made on the macOS host; Apple binaries stay local, never in the repo) and the test init.
set -euo pipefail
IMG=${IMG:-/var/tmp/sys.img}
cd ~/w/poc/tools/init && bash vm-install.sh >/dev/null 2>&1 || true
@@ -8,7 +8,7 @@ sudo umount /mnt/sys 2>/dev/null || true
rm -f $IMG; truncate -s ${SIZE:-16G} $IMG
mkfs.hfsplus -v xnulinux-sys $IMG >/dev/null
sudo mkdir -p /mnt/sys; sudo mount -o loop -t hfsplus $IMG /mnt/sys
-sudo tar xf /tmp/sys.tar -C /mnt/sys --warning=no-unknown-keyword
+sudo tar xf /var/tmp/sys.tar -C /mnt/sys --warning=no-unknown-keyword
sudo mkdir -p /mnt/sys/sbin /mnt/sys/dev /mnt/sys/private/var/select /mnt/sys/private/tmp /mnt/sys/System/Library /mnt/sys/usr/lib
sudo ln -sf private/var /mnt/sys/var; sudo ln -sf private/tmp /mnt/sys/tmp
sudo ln -sf /bin/bash /mnt/sys/private/var/select/sh