Skip to content

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

C

-noprogress (the progress-bar loop never ends without a display); stages around InitIOKit/ConfigureIOKit

Heyang Zhou0b90317ef767
diff --git a/xnu-ko/xnu_main.c b/xnu-ko/xnu_main.c
index c5a491c..858be25 100644
--- a/xnu-ko/xnu_main.c
+++ b/xnu-ko/xnu_main.c
@@ -90,7 +90,7 @@ struct boot_args_v2 { /* pexpert/arm64/boot.h layout */
u64_t bootFlags, memSizeActual;
};
-static const char *cmdline = "debug=0x8 -v serial=0 startup_debug=1 vm_compression_limit=1572864";
+static const char *cmdline = "debug=0x8 -v -noprogress serial=0 startup_debug=1 vm_compression_limit=1572864";
/* Walk XNU's kernel tables (inside its contiguous DRAM) for va and log the descriptors. */
diff --git a/xnu-patches/0001-linux64-stage-hook.patch b/xnu-patches/0001-linux64-stage-hook.patch
index 1ac9b23..9a3f25b 100644
--- a/xnu-patches/0001-linux64-stage-hook.patch
+++ b/xnu-patches/0001-linux64-stage-hook.patch
@@ -1150,6 +1150,26 @@ index 0eae1f6..9a4e240 100644
#if defined(__x86_64__) && (DEVELOPMENT || DEBUG)
read_lbr();
#endif
+diff --git a/pexpert/arm/pe_init.c b/pexpert/arm/pe_init.c
+index b7134a6..7848b62 100644
+--- a/pexpert/arm/pe_init.c
++++ b/pexpert/arm/pe_init.c
+@@ -410,12 +410,15 @@ PE_init_iokit(void)
+ #endif
+ }
+
++ { extern void linux64_stage_ext(unsigned long); linux64_stage_ext(8001); }
+ InitIOKit(PE_state.deviceTreeHead);
++ { extern void linux64_stage_ext(unsigned long); linux64_stage_ext(8002); }
+ #if defined(XNU_SOURCE_CORECRYPTO14) && XNU_SOURCE_CORECRYPTO14
+ extern void source_corecrypto14_bootstrap(void);
+ source_corecrypto14_bootstrap();
+ #endif
+ ConfigureIOKit();
++ { extern void linux64_stage_ext(unsigned long); linux64_stage_ext(8003); }
+ }
+
+ void
diff --git a/pexpert/arm/pe_kprintf.c b/pexpert/arm/pe_kprintf.c
index fea9411..af15540 100644
--- a/pexpert/arm/pe_kprintf.c