3.3.4. Kernel Types

A kernel type defines a high-level kernel policy by aggregating non-hardware configuration fragments with patches you want to use when building a Linux kernel of a specific type (e.g. a real-time kernel). Syntactically, kernel types are no different than features as described in the "Features" section. The LINUX_KERNEL_TYPE variable in the kernel recipe selects the kernel type. For example, in the linux-yocto_4.12.bb kernel recipe found in poky/meta/recipes-kernel/linux, a require directive includes the poky/meta/recipes-kernel/linux/linux-yocto.inc file, which has the following statement that defines the default kernel type:

     LINUX_KERNEL_TYPE ??= "standard"
            

Another example would be the real-time kernel (i.e. linux-yocto-rt_4.12.bb). This kernel recipe directly sets the kernel type as follows:

     LINUX_KERNEL_TYPE = "preempt-rt"
            

Note

You can find kernel recipes in the meta/recipes-kernel/linux directory of the Source Directory (e.g. poky/meta/recipes-kernel/linux/linux-yocto_4.12.bb). See the "Using Kernel Metadata in a Recipe" section for more information.

Three kernel types ("standard", "tiny", and "preempt-rt") are supported for Linux Yocto kernels:

For any given kernel type, the Metadata is defined by the .scc (e.g. standard.scc). Here is a partial listing for the standard.scc file, which is found in the ktypes/standard directory of the yocto-kernel-cache Git repository:

     # Include this kernel type fragment to get the standard features and
     # configuration values.

     # Note: if only the features are desired, but not the configuration
     #       then this should be included as:
     #             include ktypes/standard/standard.scc nocfg
     #       if no chained configuration is desired, include it as:
     #             include ktypes/standard/standard.scc nocfg inherit



     include ktypes/base/base.scc
     branch standard

     kconf non-hardware standard.cfg

     include features/kgdb/kgdb.scc
                .
                .
                .

     include cfg/net/ip6_nf.scc
     include cfg/net/bridge.scc

     include cfg/systemd.scc

     include features/rfkill/rfkill.scc
            

As with any .scc file, a kernel type definition can aggregate other .scc files with include commands. These definitions can also directly pull in configuration fragments and patches with the kconf and patch commands, respectively.

Note

It is not strictly necessary to create a kernel type .scc file. The Board Support Package (BSP) file can implicitly define the kernel type using a define KTYPE myktype line. See the "BSP Descriptions" section for more information.