← Back to context

Comment by TheDong

8 hours ago

> The core is open source, though. macOS' particular choice for its graphical user land is proprietary as well

I ran into a kernel panic specific to my macbook's hardware. How do I compile a new kernel with some extra debug printlns and boot it to figure out the panic?

On any actually open source operating system, this is doable, but I'm not holding my breath for any working instruction here. As far as I know, there's no way to modify the source code of, and then boot, the macOS kernel.

Perhaps "the core is open source" doesn't mean that I can run a modified kernel to you?

> I ran into a kernel panic specific to my macbook's hardware. How do I compile a new kernel with some extra debug printlns and boot it to figure out the panic?

1. You can find panic logs in Console.app. macOS writes them into NVRAM and stows away into files on its next boot. That will give you the process and kernel extension that was the culprit, and a stack trace.

2. sudo nvram boot-args="debug=0x122" or something like this will increase log output from the kernel. Those debug prints are probably there already. You can even attach a debugger running from somewhere else, presumably over Thunderbolt on newer machines.

> How do I compile a new kernel with some extra debug printlns and boot it to figure out the panic?

First, explain how you are doing it with the AT&T UNIX kernel. We can then help you adapt the process to Darwin.

> On any actually open source operating system, this is doable

I suspect you forgot to read the thread. While the grandparent comment considered AT&T UNIX to be "open source", that doesn't mean open source in the way we think of the term today. AT&T UNIX was very much proprietary in its own right. Today, we'd probably say "source available". Whether or not that is doable was dependent on what kind of agreement you had with the owner. They might have let you for a substantial fee, but Apple might let you for a substantial fee too. Have you asked?

  • AT&T did not ship with the kernel source code, but they often shipped with the compiled object files of the kernel and a command line utility that allowed to change the kernel configuration parameters, after which the kernel would get re-linked into a new one.

    Not open source by any definition, but it was a viable way to obtain a new kernel image. The practice has become obsolete after the adoption of loadable kernel modules across nearly all UNIX flavours, with the exception being OpenBSD (if my memory serves me well).