kernel building from source vs freebsd-update fetch install

I've always updated via freebsd-update fetch install, but now I'm trying my hand at building kernel from source and I'm not sure what I'm doing... If my system is at:

Code:
freebsd-version -kru
14.0-RELEASE-p5
14.0-RELEASE-p5
14.0-RELEASE-p5

What source do I put in /usr/src to build from. I currently have git clone --branch releng/14.0 https://git.FreeBSD.org/src.git /usr/src, but isn't that 14.0 without the p's? If I do make buildworld buildkernel and make installworld installkernel is that gonna hose things? I mean, I figure it will boot and run things, but will I be mixing paradigms and causing an inability to upgrade using freebsd-update? Also, what about modules, are they included in the build process or do I need to do something else. Another question I have is - if I do bectl create before doing the installworld/kernel will that protect me sufficiently or will I need to back up anything else should I want to get back to where I start.

Whew! That's a lot of confusion. Help :).
 
  • The releng/14.0 branch has all the patches + will have any future patches for the 14.0 release. When there is a new patch, you can "git pull" and it will pull any new changes. After this you can rebuild.
  • I am not sure if freebsd-update can be used when you build from sources. Typically you don't mix the two.
  • Modules are rebuilt when you buildworld. Except any modules from ports.
  • If you want to play it safe, do "make installkernel", then reboot. In case something has gone wrong you can revert more easily. If everything is fine, you can do "make installworld". In general, after this you'd do "etcupdate" to update any /etc/ file changes.
  • Read the handbook section on this carefully for more details.
 
The easy way to build a kernel where you have sane control over what you're actually doing and where everything is:

cd /sys/amd64/conf
config GENERIC
cd /sys/amd64/compile/GENERIC
make depend && make

and you have a kernel. Typically you can create your own kernel config and name it something other than GENERIC. 14-RELEASE was missing the CC_CUBIC option so if your build complains about a bunch of cc_ functions missing you'll need to add it.

This method allows you to keep any number of different kernels that you can flip in and out for testing
 
This is no answer to your questions but notes I took for myself before upgrading my systems from source (13.1-pX-RELEASE to 14.0-RELEASE). Tested them beforhand repetatly in VirtualBox VM's, approximating same configuration as the systems to be upgraded. Source built once, on a host system, NFS mounted on test systems.

Maybe you (and others) find them useful.

Code:
As advised in UPDATING, COMMON ITEMS, General Notes,
"To run your build attempts in an "environmental clean room",
prefix all make commands with 'env -i '."

 - env -i make -jX buildworld
 - env -i make -jX buildkernel

[Major upgrade]
 - Create boot media (memstick) for emergency
 - backup system (zfs snapshot -r)

 - Edit /etc/rc.conf   /boot/loader.conf
   deactivate (comment) kernel module driver (ports, system)

[Minor/Major upgrade]
 - bectl -r 14.0
 - bectl activate 14.0
 - reboot
   (or instead of activate, reboot
   bectl mount beName [mountpoint]
   make install{kernel|world} DESTDIR=[mountpoint])

 - make installkernel

 - reboot into single user mode (or not)

 - etcupdate -s /usr/src-14.0 -p
   eventually
   etcupdate resolve -s /usr/src-14.0

     use "-D destdir" if bectl mount beName [mountpoint]
 
 - cd /usr/src-14
 - make installworld

 - etcupdate -s /usr/src-14.0 -B

     use "-D destdir" if bectl mount beName [mountpoint]

If bectl mount beName [mountpoint] reboot in upgraded beName first

 - yes|make delete-old
 
   or: make -DBATCH_DELETE_OLD_FILES delete-old
 
 - yes|make delete-old-libs
 
   or: make -DBATCH_DELETE_OLD_FILES delete-old-libs
 
[Major Upgrade]
 - mv /boot/efi/efi/freebsd/loader.efi   loader.efi.old
   cp /boot/loader.efi /boot/efi/efi/freebsd/
 - mv /boot/efi/efi/boot/bootx64.efi   bootx64.efi.old
   cp /boot/loader.efi /boot/efi/efi/boot/bootx64.efi

 - reboot

 - zpool upgrade
 - zpool upgrade -a

If the plan is to build from source from now on, to reduce build time, if not done yet, use META_MODE and CCACHE.
 
Back
Top