BSD Updates and Building from Source

BSD Update Notes for OpenBSD and FreeBSD, check http://www.openbsd.org and http://www.freebsd.org for the most up-to-date instructions.

#OpenBSD CVS notes
#NOTE: Make sure to pick servers close to you.
CVSROOT=anoncvs@anoncvs1.usa.openbsd.org:/cvs
export CVSROOT
PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/`uname -r`/packages/`uname -m`/
export PKG_PATH

#First checkout the source
cd /usr
cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs get -rOPENBSD_5_8 -P src
cd /usr
cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs get -rOPENBSD_5_8 -P ports

#Getting source updates after the initial checkout
cd /usr/src;
cvs -q up -rOPENBSD_5_8 -Pd;

#Getting port updates
cd /usr/ports;
cvs -q up -rOPENBSD_5_8 -Pd;

#Rebuilding the kernel
#To rebuild the default kernel from stable:

cd /usr/src/sys/arch/`uname -m`/conf
/usr/sbin/config GENERIC
cd ../compile/GENERIC
make clean && make
make install

#Replace amd64 with your architecture, e.g. sparc, alpha, etc.
#Rebooting with the new kernel
reboot

#As above, substitute your architecture for amd64.
#If your system has trouble booting the new kernel,
#you can easily go back and reboot from the old kernel,
#now called obsd.
#Rebuilding the binaries

#To rebuild the system binaries:

rm -rf /usr/obj/*
cd /usr/src
make obj
cd /usr/src/etc && env DESTDIR=/ make distrib-dirs
cd /usr/src
make build

#This will take awhile...

#Binary only updates for FreeBSD:
freebsd-update fetch install


#FreeBSD Rebuild for World and Kernel
#The following steps assume that you have checked out the latest
#source for a stable branch from the FreeBSD subversion
svn checkout http://svn0.us-east.FreeBSD.org/base/stable/10 /usr/src
#Then run the following to update
cd /usr/src
svn update
cd /usr/src && make buildworld && make buildkernel KERNCONF=NEWCONF
#Install in single-user or reboot with secure-level off depending on your setup
cd /usr/src/ && make installkernel KERNCONF=NEWCONF && mergemaster -pa && make installworld && make delete-old && mergemaster -Ui
#Port Updates:
portaudit -Fda
portsnap fetch extract
portupgrade -fa