# freebsd-update with custom kernel config



## dougs (Jan 11, 2013)

I've set up my custom kernel to point to the GENERIC kernel per instructions at:

http://www.wonkity.com/~wblock/docs/html/kernelconfig.html

I'm using binaries on this particular system with the above custom kernel and thus use freebsd-update to update to the desired release version. My question is-- will freebsd-update not cause me to revert back to the GENERIC config instead of my desired custom kernel config file during the subsequent reboot? In other words, can I execute freebsd-update -r 9.1-RELEASE upgrade, freebsd-update install, reboot and expect to boot up with my custom kernel configs instead of the GENERIC config file?

~Doug


----------



## UNIXgod (Jan 11, 2013)

I expect not. Even if you compile from source it's generally good practice to compile world, GENERIC, install GENERIC boot into single user and install world. From there a custom kernel would be rebuilt against the newer sources. Some users would be confident to avoid GENERIC all together with this process and simply compile their custom kernel with the newer sources. I can't imagine that freebsd-update would automate custom kernel builds since it's meant for binary updating.


----------



## wblock@ (Jan 11, 2013)

If you want to keep a custom kernel, it's better to do it all from source.  On a reasonable system, devel/ccache can make compiles much faster.


----------



## dougs (Jan 12, 2013)

UNIXgod said:
			
		

> Even if you compile from source it's generally good practice to compile world, GENERIC, install GENERIC boot into single user and install world. From there a custom kernel would be rebuilt against the newer sources. Some users would be confident to avoid GENERIC all together with this process and simply compile their custom kernel with the newer sources.



My ARIES kernel config:

```
aries-root@~/bin# less /usr/src/sys/i386/conf/ARIES
#
# GENERIC -- Generic kernel configuration file for FreeBSD/i386
#
# For more information on this file, please read the config(5) manual page,
# and/or the handbook section on Kernel Configuration Files:
#
#    http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
#
# The handbook is also available locally in /usr/share/doc/handbook
# if you've installed the doc distribution, otherwise always see the
# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
# latest information.
#
# An exhaustive list of options and more detailed explanations of the
# device lines is also present in the ../../conf/NOTES and NOTES files.
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.
#
# $FreeBSD: releng/9.0/sys/i386/conf/GENERIC 227305 2011-11-07 13:40:54Z marius $

include         GENERIC
nocpu           I486_CPU
nocpu           I586_CPU
ident           ARIES

options         KVA_PAGES=512   # increase system memory usage from 1GB to 2GB for ZFS usage

nodevice        eisa
nodevice        fdc
```

Please note the "options KVA_PAGES=512" line.

Would the proper way of recompiling kernel and world be as follows:

```
# make buildworld
# make kernel KERNEL=GENERIC
# reboot
```
boot into single user mode

```
# install world
```
and then how do I reboot back using the ARIES kernel config?

The thing is- I want to bring in the 9.1 changes to the GENERIC configuration file while leaving the ARIES kernel configuration alone but be able to boot up using the ARIES kernel config. How do I accomplish this?

~Doug


----------



## dougs (Jan 12, 2013)

I quickly realized what I typed earlier wasn't exactly correct. Would the proper way of recompiling kernel and world be as follows:


```
# make buildworld
# make kernel KERNCONF=GENERIC
# nextboot -k GENERIC
# reboot
```
boot into single user mode

```
# fsck -p
# mount -u /
# mount -a -t ufs
# swapon -a
# adjkerntz -i
# cd /usr/src
# mergemaster -p
# make installworld KERNCONF=GENERIC
# mergemaster -Ui
# nextboot -k ARIES
# reboot
```

Is this a safe & good way to deal with a custom kernel config file that contains an INCLUDE parameter pointing to a GENERIC kernel config file while rebuilding world/kernel?

~Doug


----------



## kpa (Jan 12, 2013)

There's no need to switch back to GENERIC if you trust your custom kernel to work first time. It's just extra work for nothing.

Build world/kernel and install kernel:


```
# make buildworld
# make buildkernel installkernel KERNCONF=ARIES
# nextboot -o "-s" -k kernel
# shutdown -r now
```

Boot in single user mode (happens automatically with the above nextboot(8) line)


```
# adjkerntz -i
# fsck -p
# mount -a -t ufs
# swapon -a
# mergemaster -Ui -p
# cd /usr/src
# make installworld
# mergemaster -Ui
# make delete-old delete-old-libs
# reboot
```

Note the installworld doesn't care about the kernel config file, that's why there's no need to specify it.

I switched the order around a bit, you definitely want to have correct time set at the very first step.


----------

