Skip to content

Apple's open-source XNU kernel on Android phones: its own loader and drivers, Metal on the Adreno. Runs from RAM; a reboot gives the phone back to Android.

C
1.2 KB
Raw Blame
#!/bin/bash
# Minimal xcrun replacement for building XNU on Linux
HB="$(cd "$(dirname "$0")" && pwd)"
# On macOS the host side (the SDK and tools the build tools of SETUP/ are made with) is the real
# xcrun's business; only the kernel's own SDK is ours.
case " $* " in *" -sdk macosx"*) [ "$(uname)" = Darwin ] && exec /usr/bin/xcrun "$@" ;; esac
sdk=""; find=""; show=""
while [ $# -gt 0 ]; do case "$1" in
  -sdk) sdk="$2"; shift 2;; -verbose) shift;;
  -find|--find|-f) find="$2"; shift 2;;
  -show-sdk-path|--show-sdk-path) show=path; shift;;
  -show-sdk-version|--show-sdk-version) show=version; shift;;
  -show-sdk-platform-path|--show-sdk-platform-path) show=platform; shift;;
  -show-sdk-platform-version) show=version; shift;;
  *) break;; esac; done
SDKP="${XNU_SDK_PATH:?XNU_SDK_PATH not set}"
case "$show" in
  path) case "$sdk" in /*) echo "$sdk";; *) echo "$SDKP";; esac; exit 0;;
  version) echo "${XNU_SDK_VERSION:-16.5}"; exit 0;;
  platform) echo "${XNU_PLATFORM_PATH:-/Platforms/iPhoneOS.platform}"; exit 0;;
esac
if [ -n "$find" ]; then
  for d in "$HB" /usr/bin; do [ -x "$d/$find" ] && { echo "$d/$find"; exit 0; }; done
  [ "$(uname)" = Darwin ] && exec /usr/bin/xcrun -find "$find"
  exit 1
fi
[ $# -gt 0 ] && exec "$@"