I wanted to know if it is possible to change kernels, for example, replacing Fedora's Linux kernel to that of FreeBSD's.

Now, there already existed the Debian GNU/kFreeBSD. Is it possible for me to customize a Linux distro to contain a BSD kernel?

  • 3
    MacOSX is a fully POSIX compliant BSD based kernel. And unlike Linux, which claims to not be a Unix system, OSX IS a Unix system (it is certified by The Open Group who owns the Unix trademark). You can't run Linux apps on Mac and you can't run Mac apps on Linux even though both run on Intel CPUs (well, technically AMD64)
    – slebetman
    Commented Dec 8, 2016 at 4:09

3 Answers 3


No, each kernel implements its own features in its own way. There's a large amount of POSIX compatibility but once you get out of that the executables need to be compiled with the kernel mechanisms already in place. Many projects contain source code that only gets compiled if you explicitly say that you're compiling for FreeBSD or Linux. That's essentially what kFreeBSD is. The tools support the FreeBSD kernel but they have to be compiled for it.

For example, if you try to use epoll_create on FreeBSD things won't work as expected.

Of course, you can cross compile the tools from a BSD system LFS-style but that's likely to take forever. Not as simple as just compiling a new kernel.

  • 1
    I'd like to hear your view on the MOOL kernel, there is already an OS that adapts it, BOSS linux. Commented Dec 7, 2016 at 15:10
  • It'll be interesting to see what comes of it but I haven't looked into it enough to say anything intelligent about it.
    – Bratchley
    Commented Dec 7, 2016 at 16:14
  • 1
    So, what your saying is, if I want to create a GNU userland based BSD system, I must recompile all the GNU software for the BSD kernel. Am I correct?
    – user85849
    Commented Dec 10, 2016 at 4:09
  • 2
    Anything that utilizes Linux-isms which would be pretty much everything. Might be easier to start with kFreeBSD and go from there.
    – Bratchley
    Commented Dec 10, 2016 at 15:02

FreeBSD doesn't use a Linux kernel - as its name suggests, it uses a BSD kernel.

It is possible to replace a Linux kernel with a different Linux kernel (either one you built yourself or one you extracted from a distribution). Do be aware that the user-space programs in your distribution may depend on particular kernel features to be compiled in, and may not work properly if you run them on a kernel built without those features. For example, a systemd-based distribution will require cgroups in the kernel.

For the example you mention, yes a GNU distribution can be built for a Linux kernel or for a BSD kernel. In many cases, there are compile-time differences (e.g. #ifdef) between programs compiled for the two, even if the kernels advertise the same ABI. At a minimum, the low-level libraries such as the C Runtime Library have to accommodate the differing kernel ABIs.

  • Boost for mention the C Runtime Library changing.
    – Joshua
    Commented Dec 7, 2016 at 17:31

Kernel is the independent part and is routinely replaced during the operating system updates. Some proprietary drivers (NVIDIA, etc) have the installation scripts that patch the driver into the kernel source, build that kernel and replace the current kernel with it. Hence if you develop your own kernel version that can perform all required functionality, should not be a big problem to plant it in and leave the rest of the operating system around. However most often such a "new kernel" is derived from the recent official version.

Solaris kernel has been ported this way in some degree, resulting OpenSolaris running Gnome environment.

Still, putting the completely different kernel is the significant effort, as interfaces must be bridged. This is likely to require lots of C programming and is not just about the build script.

You must log in to answer this question.