Search code examples
yocto

Correct value for Yocto KMACHINE setting


I'm trying to find the correct value for the KMACHINE setting, defined as "The machine as known by the kernel."

When I manually configure the kernel (outside of Yocto) I do not enter a machine type. I do set ARCH=arm, choose a "system type" config option like CONFIG_ARCH_LPC32XX=y, or load a defconfig like lpc32xx_defconfig but I don't know if any of those is what KMACHINE is supposed to be.

As an example, the Yocto documentation gives intel-core2-32 which does not appear anywhere the Linux 5.15 sources.


Solution

  • KMACHINE is used to select Yocto-specific metadata for building the kernel, and is not passed to the kernel build system. By default, it is set to ${MACHINE} in kernel-yocto.bbclass, and can be overridden if a machine does not need its own metadata selection, and can instead use an existing metadata.

    There's a better description under LINUX_KERNEL_TYPE in the manual (paraphrased):

    The KMACHINE and LINUX_KERNEL_TYPE variables define the search arguments used by Yocto's kernel tools to find the appropriate description within Yocto's kernel metadata with which to build out the kernel sources and configuration.

    This kernel metadata is maintained by the Yocto Project, in the yocto-kernel-cache repository. It is optional, and is only used if the selected kernel recipe is a "linux-yocto" style recipe (i.e. it inherits linux-yocto.inc).

    If you're using an out-of-kernel-tree defconfig to configure your kernel, it's unlikely you'll need Yocto's kernel metadata, and therefore don't need to override KMACHINE.