92 lines
3.5 KiB
Plaintext
92 lines
3.5 KiB
Plaintext
# 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_KERNEL0_NAME ??= "kernel0-${MACHINE}"
|
|
COREOS_KERNEL1_NAME ??= "kernel1-${MACHINE}"
|
|
COREOS_KERNEL0_FILENAME ??= "${COREOS_KERNEL0_NAME}${COREOS_KERNEL_EXT}"
|
|
COREOS_KERNEL0 ??= "${DEPLOY_DIR_IMAGE}/${COREOS_KERNEL0_FILENAME}"
|
|
COREOS_KERNEL1_FILENAME ??= "${COREOS_KERNEL1_NAME}${COREOS_KERNEL_EXT}"
|
|
COREOS_KERNEL1 ??= "${DEPLOY_DIR_IMAGE}/${COREOS_KERNEL1_FILENAME}"
|
|
|
|
# Kernel command line
|
|
# ==============================================================================
|
|
|
|
COREOS_ROOTFS0_ROOT ??= "PARTLABEL=rootfs0"
|
|
COREOS_ROOTFS1_ROOT ??= "PARTLABEL=rootfs1"
|
|
COREOS_KERNEL0_CMDLINE ??= "root=${COREOS_ROOTFS0_ROOT} ${APPEND} rootwait"
|
|
COREOS_KERNEL1_CMDLINE ??= "root=${COREOS_ROOTFS1_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 "cmdline0: ${COREOS_KERNEL0_CMDLINE}"
|
|
echo "cmdline1: ${COREOS_KERNEL1_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_KERNEL0}" \
|
|
--cmdline "${COREOS_KERNEL0_CMDLINE}" \
|
|
${DTB_PARAMS}
|
|
|
|
bg_gen_unified_kernel \
|
|
"${COREOS_UKI_PART_STUB}" \
|
|
"${COREOS_UKI_PART_KERNEL}" \
|
|
"${COREOS_KERNEL1}" \
|
|
--cmdline "${COREOS_KERNEL1_CMDLINE}" \
|
|
${DTB_PARAMS}
|
|
|
|
coreos_efi_secureboot_sign_app "${deployDir}/${COREOS_KERNEL0_FILENAME}"
|
|
coreos_efi_secureboot_sign_app "${deployDir}/${COREOS_KERNEL1_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 ''}"
|