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
The kernel builds on a Mac with only the command-line tools: migcom from usr/libexec, nproc and python shims, make 3.81's lines judged
shimoku74c001a3a6832b
diff --git a/tools/make-kernel.sh b/tools/make-kernel.shindex 3ef5870..bc8f08f 100755--- a/tools/make-kernel.sh+++ b/tools/make-kernel.sh@@ -16,10 +16,11 @@ cd "$(dirname "$0")/.." || exit 1KERNEL=${KERNEL:-xnu-src/xnu-8796.121.2/BUILD/obj/DEVELOPMENT_ARM64_BCM2837/mach.development.bcm2837}# the make targets that failed, less the ones that are the symbol-set steps and the targets that only-# stand above them (config_all and the recursion into config/, and the top-level `all`)+# stand above them (config_all and the recursion into config/, and the top-level `all`). GNU make 4 names the makefile's line+# in a failed target ([Makefile:12: all]); macOS's make 3.81 does not ([all]).unexpected_failures() {grep -E '^make(\[[0-9]+\])?: \*\*\* ' "$1" |- grep -vE '\.symbolset\]|check_all_exports|config_all|_recurse_into_config|\[Makefile:[0-9]+: all\]|^make: \*\*\* \[all\] Error'+ grep -vE '\.symbolset\]|check_all_exports|config_all|_recurse_into_config|\[(Makefile:[0-9]+: )?all\] Error'}judge() { # judge LOG: 0 if the kernel is built and only the symbol-set steps faileddiff --git a/xnu-deps/setup.sh b/xnu-deps/setup.shindex f506b30..c390093 100755--- a/xnu-deps/setup.sh+++ b/xnu-deps/setup.sh@@ -132,9 +132,20 @@ stage1() {if [ "$XNU_HOST_OS" = Darwin ]; then# macOS has it all: mig (Xcode's; it takes $MIGCC and $MIGCOM from the kernel build), unifdef, cshlink "$(/usr/bin/xcrun -f mig)" host/bin/mig- link "$(/usr/bin/xcrun -f migcom)" host/bin/migcom+ # with the command-line tools alone, migcom is in usr/libexec, where xcrun does not look (and xcrun must not find+ # host/bin's own link on the PATH)+ migcom=$(xcode-select -p)/usr/libexec/migcom+ [ -x "$migcom" ] || migcom=$(PATH=/usr/bin:/bin /usr/bin/xcrun -f migcom)+ link "$migcom" host/bin/migcomlink /usr/bin/unifdef host/bin/unifdeflink /bin/tcsh host/bin/tcsh+ # what XNU's makefiles call by Linux's names: GNU's nproc (MakeInc.cmd's job count) and python+ printf '#!/bin/sh\n# nproc as GNU coreutils has it, on macOS\nexec sysctl -n hw.ncpu\n' | update host/bin/nproc+ chmod +x host/bin/nproc+ # (a script, not a link: /usr/bin/python3 is a shim that looks for the tool its own name says, and "python" there is none)+ rm -f host/bin/python+ printf '#!/bin/sh\nexec python3 "$@"\n' | update host/bin/python+ chmod +x host/bin/pythonfi# mig: Apple's own does not build on glibc; this is a port that doesif [ ! -x host/bin/migcom ] || [ ! -x host/bin/mig ]; then