You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e1c3a49
Browse filesBrowse the repository at this point in the historyBrowse files
<li><strong>One bundle vs. size:</strong> a single <code>drm.kext</code> carrying the driver(s) + all-vendor firmware works but is large (hundreds of MB). Splitting per-vendor (<code>amd</code>/<code>intel</code>/<code>radeon</code>) uses the identical mechanism if size matters.</li>
134
134
</ul>
135
135
136
-
<h2id="workflow">5. The conversion workflow</h2>
137
-
<p>A build/CI step layered <em>after</em><code>bsd.kmod.mk</code> produces each <code>.ko</code>— natural home is the <code>nextbsd-kernel-modules</code> build (and later a 3rd-party repo for <code>drm-kmod</code> etc.):</p>
136
+
<h2id="workflow">5. The conversion workflow — a NextBSD <code>kmutil</code></h2>
137
+
<p><strong>No Apple tool ever <em>converted</em> a foreign module into a kext</strong> — macOS modules were always kexts, and the one format change (NeXT loadable kernel servers → OS X IOKit) was a manual rewrite. So the wrap/convert step is genuinely novel; the closest precedent is <code>kextlibs</code> for the <em>dependency</em> half (§9). The right packaging is to build a single NextBSD orchestrator — reasonably named <code>kmutil</code> (clean-room reimplementation composing the open-source <code>kext_tools</code> pieces, not a port of the closed <code>kmutil</code>) — that subsumes the converter, dep-resolution, and collection-building under one Apple-shaped command. A build/CI step layered <em>after</em><code>bsd.kmod.mk</code> produces each <code>.ko</code>— natural home is the <code>nextbsd-kernel-modules</code> build:</p>
138
138
<ol>
139
139
<li>Build the <code>.ko</code> as today.</li>
140
140
<li>Extract metadata (module name, <code>MODULE_VERSION</code>, <code>MODULE_DEPEND</code>, every <code>MDT_PNP_INFO</code> table) by parsing the <code>.ko</code> (port <code>kldxref</code>’s scan) or its <code>linker.hints</code>.</li>
141
141
<li>Classify: real driver (has PNP) vs firmware stub (Model A) vs plain payload (Model B).</li>
142
+
<li>Resolve dependencies: reuse <code>kextlibs</code>’ symbol→<code>OSBundleLibraries</code> logic, but matched against <em>our own</em> kernel’s exported symbols (no Apple KDK needed). Note <code>OSBundleLibraries</code> is decorative here (§6) — <code>MODULE_DEPEND</code>/<code>linker.hints</code> stays authoritative — so this is for fidelity, not load order.</li>
142
143
<li>Generate <code>Info.plist</code> (§2) with <code>IOKitPersonalities</code> (§3); lay out <code>Foo.kext/Contents/{Info.plist,MacOS/Foo,Resources/…}</code>.</li>
143
144
<li>Install bundles into the image overlay at <code>/System/Library/Extensions</code> (firmware into the relevant kext’s <code>Resources/</code>).</li>
144
145
<li>Point the loader at the Extensions tree (interim: <code>kld</code> via <code>kern.module_path</code>/full-path; later: the ported kextd reads bundle personalities).</li>
146
+
<li>Optionally prelink a selected set into a boot collection (reuse <code>kextcache</code> logic) — ties to <ahref="#loaderconf">§8</a>/#180.</li>
145
147
</ol>
146
-
<p>The conversion is a deterministic codegen step; it touches no kernel code. It can ship in <code>nextbsd-kernel-modules</code> independently of the kextd/hwregd work.</p>
148
+
<p>The conversion is a deterministic codegen step; it touches no kernel code. It can ship in <code>nextbsd-kernel-modules</code> independently of the kextd/hwregd work. The orchestrator unifies this converter (§5), the kext userland (§9), and the boot collection (§8) behind one <code>kmutil</code>:</p>
149
+
<preclass="code">nextbsd kmutil
150
+
├─ convert .ko → Foo.kext bundle ← novel (no Apple precedent)
<tr><td><code>kextload</code></td><td><code>kext_tools</code></td><td><code>kldload(2)</code> of the inner <code>.ko</code> + register <code>IOKitPersonalities</code></td></tr>
<tr><td><code>kextutil</code> / <code>kextfind</code></td><td><code>kext_tools</code></td><td>bundle validation / search over <code>/System/Library/Extensions</code></td></tr>
205
+
<tr><td><code>kextlibs</code></td><td><code>kext_tools</code></td><td>scan a built kext’s undefined symbols → compute <code>OSBundleLibraries</code>. <strong>Reusable in the converter</strong> (§5 step 4), matched against <em>our</em> kernel’s exported symbols — no Apple KDK needed.</td></tr>
206
+
<tr><td><code>kextsymboltool</code></td><td><code>kext_tools</code></td><td>generate/merge kext symbol files (debug/link aid); paired with <code>kextlibs</code> for the dependency pass.</td></tr>
<tr><td><code>kextcache</code></td><td><code>kext_tools</code></td><td>collection builder — ties to <strong>#180</strong> boot collection</td></tr>
199
209
<tr><td><code>kmutil</code></td><td><em>not open source</em></td><td>present a <code>kmutil</code>-shaped front later if wanted; build from <code>kext_tools</code></td></tr>
0 commit comments