FreeBSD 15 - now, kernel is a package. How to install my compiled kernel as a package ?

Dear all,

I recently installed FreeBSD 15. During the installation, I chose the packaged base installation. That means that now, my kernel is a part of a package.

# pkg which /boot/kernel/kernel
/boot/kernel/kernel was installed by package FreeBSD-kernel-generic-15.0


My question is:

How can is install my freshly compiled kernel ?
If I do a basic make installkernel, my new kernel with replace files in the installed kernel FreeBSD-kernel-generic-15.0 package, leading to package inconsistencies.

What I need is:
  1. Make a kernel package after kernel compilation.
  2. Remove the old kernel package.
  3. Install the new kernel package.
How can I do that ?
Thank you very much,
Best regards,
Cédric
 
Well, thinking about it for couple seconds makes me think "don't mix ports (your compiled kernel) and packages." That leads me to think about what people normally tell others to do after they say that, which is poudriere.
 
What does /usr/src/Makefile have in comments at the top? A lot of the targets are listed along with a reference to "build(7)" so there may have been additional targets added to create packages. Like maybe "make pkgkernel" or something (that target is speculation on my part)

ETA:
man build shows some interesting new targets, distributeworld and packageworld seem appropriate (there is a reference to release(7))
 
Creating a custom pkgbase kernel package alone is unsupported, currently. There are plans to add support for this.

A custom pkgbase kernel package can be created, but it requires "buildworld" and other steps, unnecessarily IMHO. Aside from that, pkg-upgrade(8) may/will try to replace the custom kernel package (unless it's pkg-lock(8)'ed).

A better strategy is to separate the kernel from pkgbase packages. For this, pkg-unregister(8) the pkgbase kernel (which will make it invisible to pkg(8)), install and maintain the custom kernel from source built code.

If you decide to use a pkgbase kernel again, just install the generic kernel package.
 
Creating a custom pkgbase kernel package alone is unsupported, currently. There are plans to add support for this.

A custom pkgbase kernel package can be created, but it requires "buildworld" and other steps, unnecessarily IMHO. Aside from that, pkg-upgrade(8) may/will try to replace the custom kernel package (unless it's pkg-lock(8)'ed).

A better strategy is to separate the kernel from pkgbase packages. For this, pkg-unregister(8) the pkgbase kernel (which will make it invisible to pkg(8)), install and maintain the custom kernel from source built code.

If you decide to use a pkgbase kernel again, just install the generic kernel package.

Hi T-Daemon

Thank you for your reply. That's clear now:

What I did is:
  1. make buildkernel
  2. pkg unregister FreeBSD-kernel-generic-15.0
  3. make installkernel DESTDIR=/
Thank you very much.
Regards,
Cédric
 
What does /usr/src/Makefile have in comments at the top? A lot of the targets are listed along with a reference to "build(7)" so there may have been additional targets added to create packages. Like maybe "make pkgkernel" or something (that target is speculation on my part)

ETA:
man build shows some interesting new targets, distributeworld and packageworld seem appropriate (there is a reference to release(7))
Hi mer,

T-Daemon gave me an interesting answer.
Thank you for your help,
Regards,
Cédric
 
  • Like
Reactions: mer
Back
Top