# This class generate the UKI kernel needed by WIC and by swupdate # This class should not be used directly, as it's ihnerited by # the coreos-image class require conf/image-uefi.conf inherit kernel-artifact-names inherit coreos-efi-sbsign # Output file name # ============================================================================== COREOS_KERNEL_EXT ??= ".efi" COREOS_KERNEL_NAME ??= "kernel-${MACHINE}" COREOS_KERNEL_FILENAME ??= "${COREOS_KERNEL_NAME}${COREOS_KERNEL_EXT}" COREOS_KERNEL ??= "${DEPLOY_DIR_IMAGE}/${COREOS_KERNEL_FILENAME}" # Kernel command line # ============================================================================== # AUTOLABEL will be replaced by the right PARTLABEL (rootfs0 or rootfs1) at # runtime in the efibootguard UKI stub COREOS_ROOTFS_ROOT ??= "PARTLABEL=AUTOLABEL" COREOS_KERNEL_CMDLINE ??= "root=${COREOS_ROOTFS_ROOT} ${APPEND} rootwait" COREOS_UKI_PART_KERNEL_FILENAME ??= "${KERNEL_IMAGETYPE}-${MACHINE}${KERNEL_IMAGE_BIN_EXT}" COREOS_UKI_PART_KERNEL ??= "${DEPLOY_DIR_IMAGE}/${COREOS_UKI_PART_KERNEL_FILENAME}" COREOS_UKI_PART_STUB_FILENAME ??= "kernel-stub${EFI_ARCH}.efi" COREOS_UKI_PART_STUB ??= "${STAGING_LIBDIR}/efibootguard/${COREOS_UKI_PART_STUB_FILENAME}" COREOS_UKI_PART_INITRAMFS ??= "" # UKI Generation # ============================================================================== do_image_uki() { deployDir="${DEPLOY_DIR_IMAGE}" # Create an array with device tree if any DTB_PARAMS="" for dtb in ${KERNEL_DEVICETREE}; do # Bitbake allow full path inside KERNEL_DEVICETREE, but we want the # filename only dtb=$(basename "${dtb}") DTB_PARAMS="${DTB_PARAMS} --dtb=${deployDir}/${dtb}" done echo "kernel: ${COREOS_UKI_PART_KERNEL_FILENAME}" echo "dtb: ${DTB_PARAMS}" echo "cmdline: ${COREOS_KERNEL_CMDLINE}" echo "initramfs: ${COREOS_UKI_PART_INITRAMFS}" if [ ! -z "${COREOS_UKI_PART_INITRAMFS}" ]; then DTB_PARAMS="${DTB_PARAMS} --initrd=${COREOS_UKI_PART_INITRAMFS}" fi echo "initramfs: ${INITRAMFS_PARAMS}" bg_gen_unified_kernel \ "${COREOS_UKI_PART_STUB}" \ "${COREOS_UKI_PART_KERNEL}" \ "${COREOS_KERNEL}" \ --cmdline "${COREOS_KERNEL_CMDLINE}" \ ${DTB_PARAMS} coreos_efi_secureboot_sign_app "${deployDir}/${COREOS_KERNEL_FILENAME}" } do_image_uki[depends] += "virtual/kernel:do_deploy efibootguard-native:do_populate_sysroot efibootguard:do_populate_sysroot" addtask image_uki after do_image before do_image_complete # UKI image is normally embedded into a WIC image do_image_wic[recrdeptask] += "do_image_uki" # UKI image is normally embedded into a SWU image do_image_swu[recrdeptask] += "${@'do_image_uki' if d.getVar('COREOS_IMAGE_GENERATE_SWU') == '1' else ''}" # UKI image may embedded the rootfs as a cpio archive, in this case do_image_uki should run after do_image_cpio do_image_uki[recrdeptask] += "${@'do_image_cpio' if d.getVar('COREOS_UKI_PART_INITRAMFS') else ''}"