Hacker News new | ask | show | jobs
by kstrauser 809 days ago
I'd forgotten that some Debian folks tried the exactly opposite for a while, a FreeBSD kernel with a GNU userland: https://wiki.debian.org/Debian_GNU/kFreeBSD
1 comments

There was also a Gentoo effort to run atop FreeBSD[0]. The challenge of course is that afaik none of the BSD kernel ABIs are considered stable. The stable interface is the BSD libc. That said, with binfmt_misc, I don't see a reason you couldn't just run (at least some) FreeBSD binaries on Linux with a thin syscall translation layer (rather something like qemu-system) and then your layer hooked via binfmt_misc. I'm not aware of anyone who has done this for FreeBSD, but prior efforts existed as alternate binfmts for SysVr4/5 ELF binaries[2]. Either way would take some elbow grease, but you *might* even be able just reuse binfmt_elf and just have a new interpreter for FreeBSD elf.

[0] https://wiki.gentoo.org/wiki/Gentoo_FreeBSD

[1] https://docs.kernel.org/admin-guide/binfmt-misc.html

[2] https://github.com/torvalds/linux/blob/master/fs/binfmt_elf....

FreeBSD has the same kind of abstraction layer that allows it to run Linux binaries, basically selecting which ABI to use per-executable. I wonder how hard it’d be to make a Linux equivalent?