Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure booting XNU on macOS 15.0 UTM VM #22

Open
Fuzion24 opened this issue Jan 7, 2025 · 9 comments
Open

Failure booting XNU on macOS 15.0 UTM VM #22

Fuzion24 opened this issue Jan 7, 2025 · 9 comments

Comments

@Fuzion24
Copy link

Fuzion24 commented Jan 7, 2025

I created a UTM VM with UniversalMac_15.0_24A335_Restore.ipsw. On the VM, I successfully built the kernel collection for 15.0 using darwin-xnu-build with the following build command:
KERNEL_CONFIG=RELEASE ARCH_CONFIG=ARM64 MACHINE_CONFIG=VMAPPLE ./build.sh --kc (and later with DEVELOPMENT)

Rebooting the VM into recovery I did the following:

bputil -a
csrutil disable
csrutil authenticated-root disable
kmutil configure-boot -c /Volumes/Macintosh\ HD/Users/user/darwin-xnu-build/fakeroot/oss-xnu.macOS.15.0.kc.vmapple --volume /Volumes/Macintosh\ HD/

After a VM reboot, the VM fails to boot with no additional information. I tried again after building a development kernel for 15.0 with the same results of it not booting. I went through these entire steps of setting up a new build vm and building for 15.1 (UniversalMac_15.1_24B2083_Restore.ipsw) with the same results.

Are there known-good instructions for getting a customer kernel up and booting that I'm missing?

@blacktop
Copy link
Owner

blacktop commented Jan 7, 2025

I know that the KC should be built on the same host that it'll be ran on so you might need to create a normal macOS VM to run the final step of combining the compiled kernel with all the kexts into the KernelCollection that you'll ultimately run. Does that sound right @jprx?

@blacktop
Copy link
Owner

blacktop commented Jan 7, 2025

Oh wait I'm sorry you are saying you did this all on the VM?

@blacktop
Copy link
Owner

blacktop commented Jan 7, 2025

I know that @jprx runs and tests all the VMAPPLE builds in VMs that we've marked as good, but I think he has his own step for creating the final KC

@Fuzion24
Copy link
Author

Fuzion24 commented Jan 7, 2025

Yes, I'm saying I did the build on the VM I was attempting to boot the KC on -> Oh wait I'm sorry you are saying you did this all on the VM?

@jprx if you want to share any tips/tricks for booting this it would be greatly appreciated

@jprx
Copy link
Contributor

jprx commented Jan 7, 2025

I've heard from several people that there are issues with booting custom kernels in VMs on M2 and newer chips. We currently believe this is due to issues in the KDK kernel support libraries for those chips. I only test all our supported releases on M1 where I have not encountered any issues. Are you running an M2 or newer device?

@Fuzion24
Copy link
Author

Fuzion24 commented Jan 7, 2025

yes. The device I was testing the VM on was a M3 MBA, I'll see if i can dig up a M1 and confirm.

In the meantime is there any way to get a debug log from the VM setup I have now?

@Fuzion24
Copy link
Author

Fuzion24 commented Jan 9, 2025

I confirmed that I was able to build and boot a kernel into a UTM VM running macOS 15.0 using the steps provided in my first comment above on an M1 MBA host. These exact same steps fail on both a M2 and M3 MBA.

I attempted using a number of different macOS 15.0 IPSWs for the target VM on the M2 + M3 hosts - none of which worked.

@Fuzion24
Copy link
Author

Fuzion24 commented Jan 11, 2025

On an M3 host running 15.1.1, in a UTM VM running 15.0 (with an IPSW meant for a M3) : I was able to repack a KASAN kernel from the KDK into a kernel collection and boot it:

kmutil create -z -n boot -a arm64e -B ~/kasan.vmapple.kc -V release -k /Library/Developer/KDKs/KDK_15.0_24A335.kdk/System/Library/Kernels/kernel.kasan.vmapple -r /System/Library/Extensions/ \
-r /System/Library/DriverExtensions \
-x $(kmutil inspect -V release --no-header | grep -v "SEPHiber" | awk '{print " -b "$1; }')
Darwin users-Virtual-Machine.local 24.0.0 Darwin Kernel Version 24.0.0: 
Mon Aug 12 21:05:42 PDT 2024; root:xnu_kasan-11215.1.10~2/KASAN_ARM64_VMAPPLE arm64
user@users-Virtual-Machine ~ % csrutil status
System Integrity Protection status: disabled.

Repacking the kernel built from from darwin-xnu-build (for 15.0) in the same way, as follows, fails to boot:

 kmutil create -z -n boot -a arm64e -B ~/built.kc  -V release -k ~/darwin-xnu-build/build/xnu.obj/RELEASE_ARM64_VMAPPLE/kernel.release.vmapple  -r /System/Library/Extensions/ \
-r /System/Library/DriverExtensions \
-x $(kmutil inspect -V release --no-header | grep -v "SEPHiber" | awk '{print " -b "$1; }')

@Fuzion24
Copy link
Author

@jprx could you elaborate a bit more on "issues in the KDK kernel support libraries for those chips" or is there a better forum to discuss this somewhere? Discord?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants