
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
}

