COMPAT_BSDOS(8)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’… okay so first things first β€” compat_bsdos is the manual page for binary compatibility for BSDi releases πŸ¦‹

Like, it lives in the System Manager's Manual section 8, bestie. Sit down, grab a strawberry drink πŸ“, and let's get into it.


✨ NAME ✨

compat_bsdos β€” binary compatibility for BSDi releases πŸ‘‘

(it's literally just that. the whole vibe. old BSDi programs, running on your NetBSD. iconic.)


🌸 DESCRIPTION 🌸

Okay so here's the tea β˜•: the COMPAT_NOMID kernel option includes compatibility with BSDi 1.x–3.x a.out(5) binaries on NetBSD/i386 and NetBSD/amd64. Periodt.

On i386 this option is enabled by default in the GENERIC kernel β€” slay, no work needed πŸ’–. But on amd64 you gotta set it yourself, along with EXEC_AOUT. Both. Not one. Both. πŸ™ˆ

Null memory protection must be disabled with the sysctl(7) option vm.user_va0_disable set to 0 for the binaries to run successfully. Yes, actually set it to 0. Otherwise, no vibes, no execution, just sadness 😭.

BSD/OS binaries may be placed under /emul directory to match the location of other non-native executables on NetBSD β€” cute, organized, we love a tidy filesystem πŸŽ€. But the compatibility environment does not automatically lookup libraries under /emul/bsdos as happens with the shared libraries for NetBSD 1.0–1.5 a.out(5) binaries under /emul/aout. So like… don't assume the magic lookup works here, because it does not, and that's the whole point of the sentence. 🫢

BSD/386 1.0–1.1 uses static binaries that do not dynamically load libraries at runtime. Simple. Low maintenance. Respect honestly πŸ’œ.

BSD/OS 2.0 introduced "static shared libraries" as the default for standard binaries. (Yeah, the name is a whole contradiction, don't @ me, that's just what it's called.) The shared libraries are compiled from /lib and /usr/lib to a custom format bound to memory loading addresses for each library under /shlib. It's giving hardcoded main character energy πŸ”₯.

BiG caveat bestie: BSDi libraries under /shlib are not in the standard ar(5) or position-independent shared object formats and cannot be loaded by ldconfig(8) on NetBSD. Not a skill issue, it literally can't. πŸ’€

So in order for BSDi executables to access the objects at the hardcoded /shlib path, the user may setup a symbolic link from /shlib to /emul/bsdos/shlib. That's the trick. That's the whole trick. Write it down πŸ“.

And BSD/OS 4.0 switched to an ELF binary executable format that does not run under the compatibility layers currently available on NetBSD. So like… if you were hoping, no. πŸ™…β€β™€οΈ


πŸ‘€ SEE ALSO πŸ‘€

Go read these, they're all linked in the group chat:


🧚 HISTORY 🧚

A little lore drop, because the backstory ate 🌈:

  • BSD/386 1.0–1.1 was derived from 4.3BSD Reno code in the Net/2 release.
  • BSD/OS 2.0 was based on 4.4BSD Lite, but added the new static shared library format as the runtime default for executables. The build system included the shlicc command with the -Bstatic flag that allowed reverting to the standard library archive format that remained available under /lib and /usr/lib. So there was an escape hatch, bestie πŸšͺ✨.
  • NetBSD 1.0 added shared libraries using a standard position-independent shared object format. The previous default relocatable libraries in the traditional ar(5) format remained available. Nothing was taken from us, we just got more πŸ’….
  • OpenBSD 2.2–4.7 included a different compatibility implementation under the COMPAT_BSDOS kernel option. Different. Not the same one. Don't mix them up or it's gonna be awkward 😬.

πŸ’€ BUGS πŸ’€

Okay the messy part, gather round πŸŽ€:

  • BSD/OS compatibility was broken on NetBSD 5–6. Just… broken. That's it. That's the bug. 😭
  • BSD/OS 3.0 added SPARC support, but the binaries are incorrectly recognized as SunOS executables and fail on NetBSD/sparc and NetBSD/sparc64. Identity crisis fr fr πŸ™ˆ β€” they think they're SunOS and then everything falls apart.

ngl the whole thing is a vibe check on ancient binary formats and some of them are absolutely not passing 😭 but now you know every last detail, bestie, so go forth and slay πŸ«ΆπŸ’–

✨ and that's the page! ✨ this Debian-flavored edition was dated August 27, 2020 β€” mwah, go read the real thing if you need to cite it πŸ’œπŸŽ€

πŸ“¦ where this page comes from