make installkernel without changing kernel.old

Hi,

I am upgrading my system from 11-RELEASE to 11-STABLE. Using old school build world from sources. I was using GENERIC kernel and now prepared my own kernel config (ZFS1) to use with the upgrade.

Followed the handbook https://www.freebsd.org/doc/handbook/makeworld.html

Everything went smooth. I installed my kernel, world and used mergemaster etc. After rebooting system I could not mount because of a forgotten driver support in my custom kernel.

Now, I think I fixed the problem. New ZFS2 kernel is rebuild and ready to install. However, If there is another problem in my final ZFS2 kernel, and GENERIC kernel which is kernel.old now will be overwritten with my broken custom kernel ZFS1. And, I might have more troubles booting up my system.

So, I wonder if there is a way to do a "make installkernel KERNCONF=ZFS2" and keep current kernel.old (GENERIC) in my case same as before running the command?

Thanks.
 
You can simply rename the directory to something like /boot/kernel.good/. That will make sure it's not overwritten and you can keep using it as a fallback.
 
Hi SirDice,

I was searching more of a way to keep it as is kernel.old which gives easier usage at boot time and less hassle of dealing with manual loader commands.

If there is no make parameters at this time, I appreciate to be directed somewhere where I can place a wish list, please. I would be volunteer if I had better knowledge of preparing/modifying Makefiles myself.

Thanks.
 
If I recall correctly the boot loader scripts will automatically pick up the directory and make it selectable, just like kernel.old.
 
I manually moved /boot/kernel.old as /boot/kernel.good.
Used make installkernel...
After that there are 3 directories under /boot starting with "kernel".
Issued a system reboot and I only see 2 options for kernel at boot screen. They are either "default/kernel" or "kernel.old"

I believe, boot loader scripts are not automatically searching for more than 2 kernels. I wish they would have as this is a better approach to what I am searching for.
 
Ah, I was hoping it picked it up automatically. If you need to load the "good" kernel just drop to the loader prompt from the menu and issue these commands:
Code:
unload kernel
boot /boot/kernel.good/kernel

That should boot the system with your kernel.good.
 
I used FreeBSD from 3.2 to 7.0. Then I had to change job and stopped using FreeBSD. Now, I might have a project that I can use FreeBSD and installed latest version for test purposes. There are a lot changed. Loading kernel.old is quite simple now.

I know I can drop to loader prompt and load completely different kernel in /boot folder. Since so many improvements are there in FreeBSD from the last time I used it, I was just searching for an already implemented way of avoiding the need for dropping to loader prompt. Seems there is none as of today.

Thanks for your time.
 
With KODIR variable?

Code:
make kernel KERNCONF=ZFS2 KODIR=/boot/testing
nextboot -k testing
shutdown -r now

Then, if the new kernel is right, install/use it for good:
Code:
mv /boot/kernel /boot/kernel.old
cp -R /boot/testing /boot/kernel
 
Hi tobik and julp.

Both replies are valuable. I personally like julp's post more.

Thank you.
 
Back
Top