How do you install the FreeBSD10 kernel sources?

You can manually download and extract a tarball of the full source tree for your specific release from ftp://ftp.freebsd.org/pub/FreeBSD/releases/

E.g.

fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.2-RELEASE/src.txz

tar -C / -xzvf src.txz

10.2-RELEASE MUST be replaced with correct version of your OS.

One can find version using command: freebsd-version -k

The minor versions should be ignored to fetch from the above URL. For ex: if it is 10.2-RELEASE-p1, just use: 10.2-RELEASE


A bit more generic solution:

fetch -o /tmp ftp://ftp.freebsd.org/pub/`uname -s`/releases/`uname -m`/`uname -r | cut -d'-' -f1,2`/src.txz

tar -C / -xvf /tmp/src.txz

And you can replace /tmp with your favorite directory to download things into.

Or:

svn checkout https://svn.freebsd.org/base/releng/`uname -r | cut -d'-' -f1,1` /usr/src

You can do it:

git clone https://github.com/freebsd/freebsd.git /usr/src
cd /usr/src; make clean

Tags:

Kernel

Freebsd