Skip to contentSkip to conversation

live-vm-common.bbclass: conditionally to add kernel and initrd to efi.img of ISO live

PATCH Hongxu Jia 1 participant 1 message Apr 7, 2025 1 message not in the archive

lore
Share & tools
lore

Hongxu Jia

author
#1 lore raw
In reply to a message not in the archive

Ping

//Hongxu

Quoted 61 lines · hongxu via lists.openembedded.org

Add var-EFI_ISO_KERNEL, if ${EFI_ISO_KERNEL} != "1", do not add kernel and initrd to efi.img of ISO live.

For grub-efi's ISO live, the kernel and initrd is not necessary in efi.img, because grub-efi's bootx64.efi sets `search.file ($cmdpath)/EFI/BOOT/grub.cfg root' to locate kernel and initrd in ISO live image.

It helps while the size of initrd is big to break the limit of efi.img in which the filesystem type is FAT

Also clean up ${EFIIMGDIR} before populating

Set EFI_ISO_KERNEL ??= "1" by default which adds kernel and initrd to efi.img as usual

---
  meta/classes-recipe/live-vm-common.bbclass | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
meta/classes-recipe/live-vm-common.bbclass +9 -3
index d90cc67ebc..f087d9e236 100644
@@ -48,18 +48,25 @@ efi_populate_common() {
          printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh
  }
 
+# Kernel(with initrd) image in efi.img of ISO live
+EFI_ISO_KERNEL ??= "1"
+
  efi_iso_populate() {
          iso_dir=$1
          efi_populate $iso_dir
+
+        rm -rf ${EFIIMGDIR}
          # Build a EFI directory to create efi.img
          mkdir -p ${EFIIMGDIR}/${EFIDIR}
          cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
-        cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
+        if [ "${EFI_ISO_KERNEL}" = "1" ]; then
+                cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
+        fi
 
          EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
          printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${EFIIMGDIR}/startup.nsh
 
-        if [ -f "$iso_dir/initrd" ] ; then
+        if [ -f "$iso_dir/initrd" -a "${EFI_ISO_KERNEL}" = "1" ] ; then
                  cp $iso_dir/initrd ${EFIIMGDIR}
          fi
  }
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#213836): https://lists.openembedded.org/g/openembedded-core/message/213836
Mute This Topic: https://lists.openembedded.org/mt/111953457/3617049
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-