Updating Kernel & World

Obtain or update source

1. Obtain the initial source

 Github changed security in September 2021 
git clone -b master --single-branch --depth 1  git://github.com/freebsd/freebsd.git /usr/src

git clone -b main --single-branch --depth 1 https://github.com/freebsd/freebsd.git /usr/src
     or
git clone -b 15/stable --single-branch --depth 1 https://github.com/freebsd/freebsd.git /usr/src

2. prepare now for future updates

git config pull.rebase true

*. Update after the source tree is setup:

cd /usr/src
git pull

The build process

1. Start fresh

rm -rf /usr/obj/*
make cleanworld
make clean

2. Build world

make -j `sysctl -n hw.ncpu` buildworld

3. Build and install kernel

make -j `sysctl -n hw.ncpu` kernel KERNCONF=GENERIC KERNCONFDIR=/usr/src/sys/amd64/conf

4. Go to single user

reboot

Watch for the FreeBSD startup menu, press space as needed to pause it -- choose 'singleuser' by hitting '2'.  Enter your root password if password is prompted.  It is NOT recommended to use another shell, at the prompt below, tap the return or enter key.
Enter full pathname of shell or RETURN for /bin/sh

5. Regain access to /usr/src

mount all items in /etc/fstab as read-write:

mount -u /

mount all ZFS datasets

zfs mount -a
cd /usr/src

6. Prepare the system files then install world

 Mergemaster removed Nov 20, 2023 
mergemaster -p

etcupdate -p
make -j `sysctl -n hw.ncpu` installworld

*. Fix date/time as needed:

Should you see the message below, which can appear,

At installworld Make: "/usr/src/Makefile" line 360: Check your date/time

it is a simple fix, type the following command to continue:

adjkerntz -i

7. Interactively modify configuration files to better fit the new install

Report changes, then do the merge

mergemaster -iUF

etcupdate -n ; etcupdate

Handle conflicts

etcupdate resolve

8. Cleanup possibly conflicting remnant files

yes|make delete-old
yes|make delete-old-libs

9. Reboot into your new updated kernel and world.

reboot

No comments:

Frequently viewed this week