≡ Menu

How do I install FreeBSD kernel source code?

Q. I need to configure FreeBSD kernel but not able to find out source code in /usr/src/sys directory. How do I install FreeBSD source code?

A.Your kernel and all related source code is located at /usr/src/sys directory which is also accessible through the /sys path.

If there is not a /usr/src/sys directory on your system, then the kernel source has not been installed. The easiest way to do this is by running sysinstall as root, choosing Configure, then Distributions, then src, then base and sys
# sysinstall

Select Configure
Select Distributions
Select src
Then base and sys > Select ok

Further readings

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 8 comments… add one }
  • SIFE September 17, 2009, 11:41 pm

    Salamo Alikom
    does any way to get it with cvs ?

  • Cristian Navalici October 6, 2009, 4:57 pm

    Thanks a lot for the information!
    It was helpful

  • Dask January 29, 2010, 5:56 pm

    tnks man!
    It really help me!

  • Ben February 11, 2010, 12:26 pm

    followed these steps, but got:

    Warning: Can’t find the ‘8.0-RELEASE-p2’ distribution on this FTP server.

    I chose many different servers. What now?

  • Ben February 11, 2010, 12:38 pm

    actually, need to:

    # sysinstall

    then change the release name to 8.0-RELEASE and it works fine after that.

  • sateesh June 30, 2012, 6:04 pm

    how do I install sources using pkg_add

  • bsd newbie August 22, 2012, 6:11 pm

    Thanks. It’s very helpful. I have been benefiting from your website. Keep up the good work. :D

  • nixkid November 27, 2012, 7:51 pm

    Sysinstall is mostly dead. It won’t install the source distribution for you any more. But now you can solve this problem in the Howto forum: http://forums.freebsd.org/showthread.php?t=29172.

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , ,