own kernel vs. update

Polytropon freebsd at edvax.de
Tue Jul 7 16:28:17 UTC 2015


Re-including list, hope that's okay...

On Tue, 7 Jul 2015 18:00:22 +0200, Lev wrote:
> Is there any way to compile my kernel and put the result somewhere else, and
> make the bootloader load my new kernel?

Yes, this is possible. The kernel and the modules can be
found in /usr/obj - the subtree where all parts of the
compiled systems go before they are installed to their
final places. The KODIR variable can be set for the
installation process to _not_ default to /boot/kernel
for the results:

	# cd /usr/src
	# make kernel KERNCONF=MYKERNEL KODIR=mykernel

NB: "make kernel" is shorthand for "make buildkernel &&
make installkernel".

Then you can edit /boot/loader.conf to load your custom
kernel instead of the GENERIC one that's being installed
(and updated with freebsd-update):

	autoboot_delay="5"
	kernel="mykernel"
	bootfile="kernel"

This will make the loader load /boot/mykernel/kernel
and ignore /boot/kernel/kernel (the GENERIC kernel).

See "man loader.conf" and /boot/defaults/loader.conf for
details and examples.

Maybe this is helpful:

https://www.freebsd.org/doc/handbook/kernelconfig-building.html

https://www.freebsd.org/doc/handbook/kernelconfig-trouble.html#kernelconfig-noboot



> And if I want to run the stock
> kernel, I can chose between FreeBSD's and mine?

The loader allows that, too. Its interactive mode can
be used, see the "unload <name>" and "load <name>"
commands when the boot loader has been interrupted.

	unload mykernel
	load kernel
	boot	

This assumes you're not using the boot menu.





-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list