Friday, December 16, 2005

Make World

Applicable to: FreeBSD 4.11 Updated: December 16,2005

This Sheet describes the procedure for updating FreeBSD from source. Before performing this procedure, you should review the FreeBSD Handbook article Rebuilding "world".

Read /usr/src/UPDATING carefully so that you understand any special procedures that are required. If you do not follow such special procedures, you run the risk of rendering your system unusable. Make sure you have a backup of all the important files on your system!

Run cvsup to update the sources:

# /usr/local/bin/cvsup -g -L 2 /usr/src/stable-supfile

If you've created the /usr/local/bin/cvsrun script described in the Updating Sources with CVSup cheat sheet, you can also run:

# /usr/local/bin/cvsrun

If you need help setting up /usr/src/stable-supfile, see the Updating Sources with CVSup cheat sheet.
Edit or create /etc/make.conf and enter the following options to override the defaults:

CFLAGS= -O -pipe
COPTFLAGS= -O -pipe
NO_PROFILE= true

Backup /etc:

# cp -Rp /etc /etc.old

If required by /usr/src/UPDATING, run mergemaster to update files essential to the success of buildworld:

# /usr/sbin/mergemaster -p -v -w 132 (eliminate '-w 132' if 132-column video mode is not activated)

Remove old /usr/obj:

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

Compile the sources:

# cd /usr/src# make buildworld

If make doesn't run, i.e., it appears to be frozen and not compiling anything, run make with a clean environment:

# env -i make buildworld

Compile and install the new kernel:

# make kernel KERNCONF=YOURKERNEL

If you don't already have a custom kernel configuration, use GENERIC in place of YOURKERNEL above. If you wish to create a custom kernel, see the Building a Custom Kernel cheat sheet.

Drop to single user mode:

# shutdown now (Notice no '-r' or '-h')

Alternatively, you can reboot into single user mode:

# shutdown -r now

OR, for 4.X try to boot in single mode:

(at prompt: shutdown -h now, on reboot press spacebar as soon as you see baton. You should see 'boot:' as prompt, type /kernel -s. If you don't press baton immediately, you'll see 'ok' as prompt. In that case type 'unload kernel' and then 'boot /kernel -s)

Then choose 'Boot to Single User Mode' at the FreeBSD boot menu. Once the shell prompt has appeared, mount the drive partitions:

# fsck -p
# mount -u /
# mount -a -t ufs
# swapon -a

If you are using a serial terminal that supports 132x43 (or similar) video, set the video mode:

# /bin/stty columns 132 rows 43

Run mergemaster to update files essential to the success of installworld:

# /usr/sbin/mergemaster -p -v -w 132 (eliminate '-w 132' if 132-column video mode is not activated)

Install the new system binaries:

# cd /usr/src# make installworld

Update system configuration files:

# /usr/sbin/mergemaster -v -w 132 (eliminate '-w 132' if 132x43 video mode is not activated)

Reboot to multi-user mode:

# shutdown -r now