‹ jan0sch.de

Install FreeBSD sources.

2018-06-08

In some cases you may need the sources (kernel source) for your FreeBSD installation. However if you did not select the source package in the installer it will not be installed.

The installation is actually quite simple but is not done via a tool as some might expect. In former times you could use sysinstall but that does not exist anymore.

You can either connect via your favourite ftp client (lftp) to the official server (or a mirror of your choice) or you can use the fetch command to retrieve the source package. Be sure to download the correct version (e.g. use freebsd-version -k to find out).

% freebsd-version -k
11.1-RELEASE-p10
% fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.1-RELEASE/src.txz
src.txz                                       100% of  140 MB   23 MBps 00m06s
% su -
Password:
# tar -xzvf src.txz -C /
...

This will extract the sources into the proper locations.