# /boot/kernel vs /boot/GENERIC ?



## HL1234 (Jan 31, 2017)

Hello,
may be I have to much reading. I got confused about what is written in the documentation for update installation and what I find in /boot/defaults/loader.conf.
In it is written:

```
....
kernel="kernel"       # /boot sub-directory containing kernel and modules
bootfile="kernel"   # Kernel name (possibly absolute path)
....
```
 As this described. I get this directory: /boot/kernel with the kernel files.

-I have not customized this "kernel=.." in /boot/loader.conf

For `freebsd-update` it is written in the handbook under "*23.2.2. Applying Security Patches*" (2017): one paragraph before 'Note....':"_*Only the GENERIC kernel can be automatically updated by freebsd-update.* If a custom kernel is installed, it will have to be rebuilt and reinstalled after freebsd-update finishes installing the updates. However, freebsd-update will detect and update the GENERIC kernel if /boot/GENERIC exists, even if it is not the current running kernel of the system._"
This sentence confusing me "_However, freebsd-update will detect and update the GENERIC kernel if /boot/GENERIC exists, ...._"
Edit: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-freebsdupdate.html

I found as default in /boot/defaults/ the, also so used, path /boot/kernel and there is on the other-side written in the handbook about a default name */boot/GENERIC* for binary updates.

What is now the real default name for the kernel?
And, should I rename /boot/kernel to /boot/GENERIC whether I like to do automatic updates?
Thanks,


----------



## chrbr (Jan 31, 2017)

From my understanding the kernel for normal boot is in /boot/kernel. When a custom kernel is build and installed it will be copied to the same location. Therefore it is advised to copy the original generic kernel to /boot/GENERIC. Then `freebsd-update` can be used. Additionally there is a working kernel in addition to /boot/kernel.old in case something goes wrong.


HL1234 said:


> And, should I rename /boot/kernel to /boot/GENERIC whether I like to do automatic updates?


It should not be renamed. I do not know if it makes sense to have a copy of a generic kernel when there is no customized kernel.


----------



## SirDice (Jan 31, 2017)

If you're running the default GENERIC kernel you can ignore that entire section.


----------



## HL1234 (Jan 31, 2017)

Ah, OK I understand /boot/GENERIC is only important for `freebsd-update` when there is a custom kernel in use and I like to keep this backup saved standard kernel up to date. 

So if there is no directory /boot/GENERIC, is it right that `freebsd-update` will install ever in /boot/kernel independent in it is a generic or a customized kernel?


----------



## adamw@ (Feb 1, 2017)

The documentation is absolutely confusing here, and I've grumbled about it in the past.

Here's the deal.

freebsd-update(8)() will not touch /boot/GENERIC. It WILL, however, touch /boot/kernel, _if_ that is a stock GENERIC kernel.

If you want freebsd-update(8)() to update GENERIC for you automatically, leave the GENERIC kernel in /boot/kernel. Instead, install _your_ custom kernel into a new path via the (completely undocumented, AFAICT) switch 
	
	



```
INSTKERNNAME=
```
 in /etc/src.conf.

So if have 
	
	



```
ident= MYKERNEL
```
, put into /etc/src.conf:

```
.if ${KERNCONF} == "MYKERNEL"
INSTKERNNAME=    MYKERNEL
.endif
```

Now your kernel gets installed into /boot/MYKERNEL, /boot/kernel remains GENERIC, and freebsd-update(8)() will keep the GENERIC kernel (in /boot/kernel) up to date.

Also you might want to set it as the default kernel in /boot/loader.conf:

```
/boot/loader.conf:
  kernels="MYKERNEL kernel MYKERNEL.old kernel.old"
  kernel="MYKERNEL"
```


----------



## HL1234 (Feb 1, 2017)

Hello,
I have tested both methods to install a kernel. I have copied the old 10.3 kernel files to /boot/kernel. Then, first, I do a freebsd-update in expectation to get a full standard kernel with debug symbols - because for 11.0 it is written that this is the default:
`freebsd-update --currently-running 10.3-RELEASE -r 11.0-RELEASE upgrade`
and installed it - but in /usr/lib/debug/boot/kernel are no symbol files ??? 
Also the kernel have just 107 MB and 818 files - is this a full kernel?

I copied this kernel form /boot/kernel to /boot/GENERIC. Then, second, I fetched the sources:
`svn checkout svn://svn.freebsd.org/base/release/11.0.1 /usr/src` and do:
`make buildkernel`
`make installkernel`
but I created before the file `/etc/src.conf`. And in this file there are some settings, like 

```
#
#    /etc/src.conf  (default location)   
#
#   --source build options
#   --for *make buildworld* *make buildkernel*
#   src.conf is to set make(1) variables that control the aspects
#   of how the system builds. It uses the standard makefile syntax.

WITHOUT_DEBUG_FILES=yes
```

After
`make installkernel` has finished I take a look into /usr/lib/debug/boot/kernel and expected that there are no files, because of the option in src.conf I had given. But know all debug symbols for the kernel has been build ??? 

This is total reverse I had read about it. What could here be wrong?


----------



## HL1234 (Feb 1, 2017)

adamw@ said:


> The documentation is absolutely confusing here, ...


*We have to correct the handbook!* I do recommend this. It is not the first time, I try to learn and understand FreeBSD by reading the handbook and ended at least in questions...

Thank You for give me your update. But, see my last reply, /etc/src.conf seems not to work at all on my rented virtual server space.
This is my src.conf.

Is there something written wrong?


```
#HL-170131 (vServer-hetzner.de)
# *****************************************************************************
#
#    /etc/src.conf  (default location)  
#
#   --source build options
#   --for *make buildworld* *make buildkernel*
#   src.conf is to set make(1) variables that control the aspects
#   of how the system builds. It uses the standard makefile syntax.
#  
#   src.conf should not   specify   any dependencies to make(1)
#   it only affects buildings FreeBSD not ports or packages
#
#    see >man 8 src.conf
#
#   *Only the GENERIC kernel /boot/GENERIC can be automatically updated by freebsd-update.*
#   If a custom kernel is installed, it will have to be rebuilt and reinstalled after freebsd-update
#   finishes installing the updates.
#   But - handbook: The updates distributed by freebsd-update do not always involve the kernel. It is not
#   necessary to rebuild a custom kernel if the kernel sources have not been modified
#   by freebsd-update install.
#
# *****************************************************************************

# *****************************************************************************
#HL-170127 added for FreeBSD 11.0 running on vServer
# *****************************************************************************
WITHOUT_DEBUG_FILES=yes
WITHOUT_FLOPPY=yes
WITHOUT_GAMES=yes
WITHOUT_HTML=yes               # Set to not build HTML docs.
WITHOUT_SENDMAIL=yes           # not build sendmail(8) and related programs. -> installiere ich selber
WITHOUT_TALK=yes               # The talk utility is a visual communication program
                               # which copies lines from your terminal to that of another user.
WITH_TESTS=yes                   # To install the FreeBSD Test Suite in /usr/tests              

#HL-170127 error in buildkernel
#   /home/bsdsrc/usr.sbin/bhyve/pci_xhci.c:49:10: *fatal error:* 'dev/usb/usbdi.h' file not found
#   #include <dev/usb/usbdi.h>
#   bmake[4]: stopped in /home/bsdsrc/usr.sbin/bhyve
#   *** Error code 1
# --> wieder raus genommen
#WITHOUT_USB=yes               #  virtual Server outside

WITHOUT_BLUETOOTH=yes
WITHOUT_WIRELESS=yes           # virtual Server outside
WITHOUT_WIRELESS_SUPPORT=yes
#WITHOUT_ZFS=yes
```


----------



## chrbr (Feb 2, 2017)

Dear HL1234,
At least the src.conf below worked for me

```
WITHOUT_CLANG_EXTRAS=yes 
WITHOUT_CLANG_FULL=yes 
WITHOUT_LLDB=yes 
WITH_CCACHE_BUILD=yes
```
to build FreeBSD11.0 Stable. Some days ago I have had excluded additional things. The effect was that the mode of the monitor could not be negotiated by kms_i915. And the system did not start with a GENERIC release kernel and the "reduced" world. I think src.conf gives space for optimizations. But with increased optimizations it needs a better understanding of the involved compromises and side effects.


----------

