feat(linux-coreos): introduce the CoreOS kernel

The linux-coreos kernel is based on the linux-yocto kernel with
additional in-tree kernel metadata. By default, ktype is set
to coreos so that CoreOS kernel policies are used to configure
the kernel in addition to machine specific configuration
options.

BREAKING CHANGE: Default kernel provider is now linux-coreos
This commit is contained in:
Sam Dolt 2023-11-21 15:35:04 +01:00
parent 254fa52313
commit b1f6bf3983
18 changed files with 83 additions and 111 deletions

View File

@ -2,6 +2,8 @@
#@NAME: Beaglebone-yocto machine #@NAME: Beaglebone-yocto machine
#@DESCRIPTION: Reference machine configuration for http://beagleboard.org/bone and http://beagleboard.org/black boards #@DESCRIPTION: Reference machine configuration for http://beagleboard.org/bone and http://beagleboard.org/black boards
require conf/machine/include/coreos.inc
MACHINE_EXTRA_RRECOMMENDS = "kernel-modules kernel-devicetree" MACHINE_EXTRA_RRECOMMENDS = "kernel-modules kernel-devicetree"
EXTRA_IMAGEDEPENDS += "virtual/bootloader" EXTRA_IMAGEDEPENDS += "virtual/bootloader"
@ -19,9 +21,6 @@ do_image_wic[recrdeptask] += "do_bootimg"
SERIAL_CONSOLES ?= "115200;ttyS0 115200;ttyO0 115200;ttyAMA0" SERIAL_CONSOLES ?= "115200;ttyS0 115200;ttyO0 115200;ttyAMA0"
APPEND:append = " console=ttyS0,115200" APPEND:append = " console=ttyS0,115200"
PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
PREFERRED_VERSION_linux-yocto ?= "6.5%"
KERNEL_IMAGETYPE = "zImage" KERNEL_IMAGETYPE = "zImage"
# ti/omap/ prefix was added in 6.5, need to be removed if someone want to build linux-yocto_6.1 # ti/omap/ prefix was added in 6.5, need to be removed if someone want to build linux-yocto_6.1
@ -36,7 +35,7 @@ UBOOT_MACHINE = "am335x_evm_defconfig"
UBOOT_ENTRYPOINT = "0x80008000" UBOOT_ENTRYPOINT = "0x80008000"
UBOOT_LOADADDRESS = "0x80008000" UBOOT_LOADADDRESS = "0x80008000"
MACHINE_FEATURES = "usbgadget usbhost vfat alsa" MACHINE_FEATURES += "usbgadget usbhost vfat alsa"
# support runqemu # support runqemu
EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native"
@ -60,5 +59,4 @@ EFIBOOTGUARD_TIMEOUT ?= "0"
COREOS_IMAGE_SWUPDATE_EXTRACLASSES += "coreos-image-swupdate-beaglebone" COREOS_IMAGE_SWUPDATE_EXTRACLASSES += "coreos-image-swupdate-beaglebone"
require conf/machine/include/coreos-generic-features/efi.inc
require conf/machine/include/coreos-generic-features/partitions.inc

View File

@ -3,6 +3,7 @@
#@DESCRIPTION: Machine support for EAGLE40-03 #@DESCRIPTION: Machine support for EAGLE40-03
# #
require conf/machine/include/coreos.inc
require include/coreos-generic-arch/x64.inc require include/coreos-generic-arch/x64.inc
MACHINE_FEATURES += "pci usbhost x86 acpi serial efi tpm2 " MACHINE_FEATURES += "pci usbhost x86 acpi serial efi tpm2 "
@ -10,9 +11,6 @@ MACHINE_FEATURES += "pci usbhost x86 acpi serial efi tpm2 "
# Kernel configuration # Kernel configuration
# ****************************************************************************** # ******************************************************************************
PREFERRED_VERSION_linux-yocto ?= "6.5%"
PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
KERNEL_IMAGETYPE = "bzImage" KERNEL_IMAGETYPE = "bzImage"
# getty configuration # getty configuration
@ -36,5 +34,5 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS += " kernel-modules"
# No watchdog available yet # No watchdog available yet
EFIBOOTGUARD_TIMEOUT ?= "0" EFIBOOTGUARD_TIMEOUT ?= "0"
require conf/machine/include/coreos-generic-features/efi.inc
require conf/machine/include/coreos-generic-features/partitions.inc

View File

@ -1,6 +1,5 @@
# EFI Configuration # EFI Configuration
# ============================================================================== # ==============================================================================
MACHINE_FEATURES:append = " efi" MACHINE_FEATURES += " efi"
do_image_wic[depends] += "efibootguard-native:do_populate_sysroot efibootguard:do_deploy" do_image_wic[depends] += "efibootguard-native:do_populate_sysroot efibootguard:do_deploy"

View File

@ -0,0 +1 @@
PREFERRED_PROVIDER_virtual/kernel ?= "linux-coreos"

View File

@ -21,5 +21,3 @@ do_image_wic[recrdeptask] += "do_bootimg"
# ============================================================================== # ==============================================================================
COREOS_EFI_SECUREBOOT_INSTALL_PUBKEY_IN_EFIDIR = "1" COREOS_EFI_SECUREBOOT_INSTALL_PUBKEY_IN_EFIDIR = "1"
require conf/machine/include/coreos-generic-features/efi.inc
require conf/machine/include/coreos-generic-features/partitions.inc

View File

@ -0,0 +1,5 @@
# Common configuration for all coreos machine
require conf/machine/include/coreos-generic-features/kernel.inc
require conf/machine/include/coreos-generic-features/efi.inc
require conf/machine/include/coreos-generic-features/partitions.inc

View File

@ -2,6 +2,7 @@
#@NAME: Generic x86_64 #@NAME: Generic x86_64
#@DESCRIPTION: Machine configuration for generic x86_64 (64-bit) PCs and servers. Supports a moderately wide range of drivers that should boot and be usable on "typical" hardware. #@DESCRIPTION: Machine configuration for generic x86_64 (64-bit) PCs and servers. Supports a moderately wide range of drivers that should boot and be usable on "typical" hardware.
require conf/machine/include/coreos.inc
require include/coreos-generic-arch/x64.inc require include/coreos-generic-arch/x64.inc
require include/coreos-generic-machine/vm.inc require include/coreos-generic-machine/vm.inc
@ -9,3 +10,5 @@ QB_SYSTEM_NAME = "qemu-system-x86_64"
# Currently we don't support the watchdog # Currently we don't support the watchdog
EFIBOOTGUARD_TIMEOUT ?= "0" EFIBOOTGUARD_TIMEOUT ?= "0"

View File

@ -0,0 +1,9 @@
# SPDX-License-Identifier: MIT
define KMACHINE beaglebone
define KTYPE coreos
define KARCH arm
include ktypes/coreos.scc
# Include beaglebone.scc from yocto-kernel-cache
include bsp/beaglebone/beaglebone.scc

View File

@ -0,0 +1,11 @@
# SPDX-License-Identifier: MIT
define KMACHINE vm-x64
define KTYPE coreos
define KARCH arm
include ktypes/coreos.scc
include bsp/common-pc-64/common-pc-64.scc
include cfg/virtio.scc
include cfg/paravirt_kvm.scc
include cfg/hyperv.cfg

View File

@ -0,0 +1,4 @@
define KFEATURE_DESCRIPTION "HyperV Guest support"
define KFEATURE_COMPATIBILITY arch
kconf hardware hyperv.cfg

View File

@ -0,0 +1,4 @@
define KFEATURE_DESCRIPTION "kernel requirement for running k3s"
define KFEATURE_COMPATIBILITY all
kconf non-hardware k3s.cfg

View File

@ -0,0 +1,6 @@
# For now one, just fall-back to OE standard ktypes
include ktypes/standard/standard.scc
include features/netfilter/netfilter.scc
include cfg/efi.scc
include cfg/efi-ext.scc

View File

@ -0,0 +1,32 @@
KBRANCH ?= "v6.5/standard/base"
require recipes-kernel/linux/linux-yocto.inc
# CVE exclusions
include recipes-kernel/linux/cve-exclusion.inc
include recipes-kernel/linux/cve-exclusion_6.5.inc
SRCREV_machine ?= "128116621dee1ddbc7cf5f58cddc708d7b823600"
SRCREV_meta ?= "e4aaaaddfaf695039a7fc41815e24f57c29e30c0"
LINUX_VERSION ?= "6.5.10"
PV = "${LINUX_VERSION}+git"
SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH};protocol=https \
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-6.5;destsuffix=${KMETA};protocol=https \
file://coreos-kmeta;type=kmeta;name=coreos-kmeta;destsuffix=coreos-kmeta"
LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
KMETA = "kernel-meta"
# The distro or local.conf should set this, but we should fallback to coreos
# instead of standard if it's not the case
LINUX_KERNEL_TYPE ??= "coreos"
COMPATIBLE_MACHINE = "^(beaglebone|cn9130-cf-pro|vm-x64)$"
# Functionality flags
KERNEL_EXTRA_FEATURES ?= ""
KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}"
KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "", d)}"
KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/scsi/scsi-debug.scc", "", d)}"
KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/gpio/mockup.scc", "", d)}"

View File

@ -1,23 +0,0 @@
inherit coreos-efi-sbsign
require conf/image-uefi.conf
# Ensure EFI STUB is enabled
KERNEL_FEATURES:append = " cfg/efi.scc cfg/efi-ext.scc"
# By default we use a Unified Kernel Image that contain the kernel, the
# kernel command line and some device tree, so we don't need to sign the output
# of the kernel recipes
COREOS_KERNEL_EFI_SIGNED ??= "0"
# Extend the kernel_do_deploy function from kernel.bbclass to sign the kernel
kernel_do_deploy:append() {
if [ "${COREOS_KERNEL_EFI_SIGNED}" == "1" ]; then
deployDir="${DEPLOYDIR}"
for imageType in ${KERNEL_IMAGETYPES} ; do
baseName="$imageType-${KERNEL_IMAGE_NAME}"
coreos_efi_secureboot_sign_app "$deployDir/$baseName${KERNEL_IMAGE_BIN_EXT}"
done
fi
}

View File

@ -1,36 +0,0 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
# vm-x64 settings
# ==============================================================================
# The machine use the default KBRANCH, SRCREV and Linux Version set in OECore,
# so that the kernel get updated when updated OECore
KMACHINE:vm-x64 ?= "common-pc-64"
COMPATIBLE_MACHINE:vm-x64 = "vm-x64"
# Enable some kernel features related to virtualiuzation
KERNEL_FEATURES:append:vm-x64=" cfg/virtio.scc cfg/paravirt_kvm.scc"
# Eagle 40-03 settings
# ==============================================================================
# The machine use the default KBRANCH, SRCREV and Linux Version set in OECore,
# so that the kernel get updated when updated OECore
KMACHINE:eagle40-03 ?= "common-pc-64"
COMPATIBLE_MACHINE:eagle40-03 = "eagle40-03"
# Beaglebone Settings
# ==============================================================================
# The machine use the default KBRANCH, SRCREV and Linux Version set in OECore,
# so that the kernel get updated when updated OECore
KMACHINE:beaglebone ?= "beaglebone"
COMPATIBLE_MACHINE:beaglebone = "beaglebone"
# CoreOS Generic Settings
# ==============================================================================
require ${@bb.utils.contains("COMBINED_FEATURES", "efi", "linux-yocto-coreos-efi.inc", "", d)}
SRC_URI += " file://k3s_kernel_adaptions.cfg"
SRC_URI:append:vm-x64 = " file://hyperv.cfg"

View File

@ -1,37 +0,0 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
# vm-x64 settings
# ==============================================================================
# The machine use the default KBRANCH, SRCREV and Linux Version set in OECore,
# so that the kernel get updated when updated OECore
KMACHINE:vm-x64 ?= "common-pc-64"
COMPATIBLE_MACHINE:vm-x64 = "vm-x64"
# Enable some kernel features related to virtualiuzation
KERNEL_FEATURES:append:vm-x64=" cfg/virtio.scc cfg/paravirt_kvm.scc"
# Eagle 40-03 settings
# ==============================================================================
# The machine use the default KBRANCH, SRCREV and Linux Version set in OECore,
# so that the kernel get updated when updated OECore
KMACHINE:eagle40-03 ?= "common-pc-64"
COMPATIBLE_MACHINE:eagle40-03 = "eagle40-03"
# Beaglebone Settings
# ==============================================================================
# The machine use the default KBRANCH, SRCREV and Linux Version set in OECore,
# so that the kernel get updated when updated OECore
KMACHINE:beaglebone ?= "beaglebone"
COMPATIBLE_MACHINE:beaglebone = "beaglebone"
# CoreOS Generic Settings
# ==============================================================================
require ${@bb.utils.contains("COMBINED_FEATURES", "efi", "linux-yocto-coreos-efi.inc", "", d)}
SRC_URI += " file://k3s_kernel_adaptions.cfg"
SRC_URI:append:vm-x64 = " file://hyperv.cfg"