我正在尝试为OS X High Sierra 10.13.3构建并运行xnu-4570.41.2 kernel。我根据ssen's blog和this more recent tutorial等指南在当地编译它。编译内核后,我将其加载到High Sierra 10.13.3 VirtualBox VM上,替换内核,以便从内核启动。
虽然VM正在启动并运行我的内核(可以在我替换内核之前和之后uname -a
输出的差异以及我添加到启动过程中的print语句中看到),我在内核扩展预链接过程中看到了以下错误。它们出现在启动过程中,每当我根据指南的说明用我自己的内核替换VM内核后运行sudo kextcache -invalidate /
。
kxld[com.apple.iokit.IOStorageFamily]: In interface com.apple.kpi.mach of __kernel__, couldn't find symbol _mach_bridge_register_regwrite_timestamp_callback
kxld[com.apple.iokit.IOStorageFamily]: In interface com.apple.kpi.private of __kernel__, couldn't find symbol _kern_buflet_get_data_length
kxld[com.apple.iokit.IOStorageFamily]: In interface com.apple.kpi.private of __kernel__, couldn't find symbol _kern_buflet_get_data_limit
kxld[com.apple.iokit.IOStorageFamily]: In interface com.apple.kpi.private of __kernel__, couldn't find symbol _kern_buflet_get_data_offset
...
kxld[com.apple.nke.applicationfirewall]: In interface com.apple.kpi.private of __kernel__, couldn't find symbol _xcpm_mbox_lock
kxld[com.apple.nke.applicationfirewall]: In interface com.apple.kpi.private of __kernel__, couldn't find symbol _xcpm_mbox_unlock
kxld[com.apple.nke.applicationfirewall]: In interface com.apple.kpi.bsd of __kernel__, couldn't find symbol _bpf_tap_packet_in
kxld[com.apple.nke.applicationfirewall]: In interface com.apple.kpi.bsd of __kernel__, couldn't find symbol _bpf_tap_packet_out
这些只是大约18,000个这样的错误的一个样本。虽然这些错误不会阻止构建工作的PrelinkedKernel,但内核编译或安装中显然缺少一些步骤。为什么会出现这些错误?有谁知道我怎么解决它们?
基于来自开源堆栈交换的this question谈论我遗漏的一些xcpm
符号,我得出结论,这些符号缺失,因为它们来自Apple不会随xnu开源发布的专有文件。
更新:可以通过在xnu/config/Private.exports
中为它们指定声明来解决这些缺失符号错误。通过kernelshaman's Makefile构建内核会自动为您添加这些符号。