After a FreeBSD -RELEASE has been released, development continues to the next version. Development is done in a number of branches, like -STABLE and -CURRENT. In this article I'll explain how to track the -STABLE branch.-STABLE is the branch which will bring the next stable release. -CURRENT is the unstable development branch. -CURRENT is only meant for developers! Note: -STABLE is a BRANCH. That means it is being developed constantly. This also means -STABLE could be broken at any moment. Do not worry though, I've never noticed any problem with it.

Deleting the current sources

First lets get rid of the current /usr/src:


# cd /usr
# rm -dfr src
# mkdir src
# cd /usr/src

Now we need to checkout sources using the following command.


# svnlite checkout https://svn.FreeBSD.org/base/stable/12 /usr/src

Please DO NOT continue until at least the sources are updated via svn

Building the base system and kernel

Read /usr/src/UPDATING

UPDATING contains important information and clues needed for upgrading FreeBSD. It could be you need to add a user first, or enable a device in your kernel, or whatever. Things like this are in UPDATING, so read it:


# less /usr/src/UPDATING

Remove old obj files. The very first time you run the second or third command, don't be surprised if you see "no match"


# cd /usr/obj
# chflags -R noschg *
# rm -fr *

Update files essential for buildworld


# mergemaster -p

You will get prompted Do you wish to delete what is left of /var/tmp/temproot? [no]. Hit Enter for No. It will spit out an output. Continue on.

Build the world (This can take a REALLY long time. On a 500Mhz PC It can take over an hour-and-a-half.)

If you have a multi-core processor, or multi-processor system, you can do:

# make -jX buildworld

Replace X with the number of total processor cores your system has plus 1. So, on a single CPU dual-core processor, you'd use -j3.


# cd /usr/src
# make buildworld

Build the kernel
(change MYKERNEL to the name of your custom kernel configuration file or GENERIC if you don't use a custom configured kernel)


# cd /usr/src
# make buildkernel KERNCONF=MYKERNEL

Installing the base system and kernel

Install your new kernel:

(change MYKERNEL to the name of your custom kernel configuration file or GENERIC if you don't use a custom configured kernel)


# cd /usr/src
# make installkernel KERNCONF=MYKERNEL

We will get more into customizing your kernel later.

Now lets reboot the machine.


# reboot

Now lets Install world


# cd /usr/src
# mergemaster -p

You will get prompted Do you wish to delete what is left of /var/tmp/temproot? [no]. Hit Enter for No. It will spit out an output. Continue on.


# make installworld

Update /etc


# rm -fr /etc.old

(The very first time you run this command, don't be surprised if you see "no match" )


# cp -Rp /etc /etc.old
# /usr/sbin/mergemaster

Reboot and enjoy your new -STABLE system


# fastboot