24

I wanted to know in technical terms; what is the difference between BSD Kernel and Linux Kernel.
In Linux, we can download the source kernel then patch it and make and make modules it. Even we have multiple tools to edit the kernel config such as menuconfig, xconfig and ... .
But I couldn't find such kinda vast field on BSD. First, Could I download the BSD kernel? How could I config it? and ...

So what am I asking is: (Without referring to ancestry and etymology)

  • Is the Kernel in each case (in)dependent of a distribution?
  • Ways to config Each Kernel and tools available for the job?
  • Whether any Patch work could be done in each case?
  • Availability of the kernel outside the realm of distribution? (Kernel Sources)?
  • Flavour of Kernels available in each case (X??BSD/Linux) Like XEN/Vmware/GEN?
r004
  • 3,339
  • 8
  • 29
  • 51
  • 2
    There is not one BSD kernel as there is one Linux kernel... FreeBSD kernel, NetBSD kernel, OpenBSD kernel, etc. are all different (although they share a same basis). You should select one of them and read the documentation about downloading and compiling it. – lgeorget Mar 04 '14 at 22:09

2 Answers2

19

Well, first off, you speak of BSD as if they're is only one. Technically, I suppose, there is the original one they were all derived from—last release was in 1995. Searching for "4.4-Lite2" finds several copies, you can find out more about it at the Wikipedia's Berkeley Software Distribution article.

Derived from it are—among many things*—FreeBSD, OpenBSD, and NetBSD. All three are open source, and you can get their source code. Someone who says BSD nowadays is probably referring to one of them.

If you want to quickly browse them, there is a FreeBSD and Linux Kernel Cross-Reference. That site also has several other Unix-like kernels.

Unlike Linux, however, which exists as a standalone kernel project, the BSD kernels often are part of a larger project—they aren't independent of the distro. For example, the FreeBSD kernel is part of the FreeBSD project and is maintained in the same subversion repository as the rest of the distro.

There are some places the kernel is used without the rest of the userland, e.g., in Debian's kFreeBSD port.


*: Parts of the original BSD have gone pretty far indeed. For example, you'll see the notes about portions of software being copyright The Regents of the University of California all over the place. A lot of that is BSD. If you read the many-page notice included with Windows, for example, it's there.

derobert
  • 107,579
  • 20
  • 231
  • 279
10

This is specific for FreeBSD, but the method and organization are the same for NetBSD: this cover two of the main free BSD systems.

To get the sources (of the whole system) is quite easy, as you can install everything needed during a standard install (see FreeBSD install): enter image description here

You can also get the whole system sources through git (FreeBSD kernel moved to git in December 2020).

Then you copy / edit your kernel configuration file:

cd /usr/src/sys/<your_arch>/conf
cp GENERIC MYKERNEL

Unfortunately, there is no fancy tool such as menuconfig or xconfig, but the configuration is quite short and quite easy to read / modify

vi MYKERNEL

Finally you can make and install your customized kernel:

make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL

More information:

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
Ouki
  • 5,842
  • 4
  • 23
  • 31