* [PATCH 1/2] live-vm-common.bbclass: conditionally to add kernel and initrd to efi.img of ISO live
@ 2025-03-28 13:02 Hongxu Jia
2025-03-28 13:02 ` [PATCH 2/2] image-live.bbclass: fix booting EFI ISO live failed Hongxu Jia
0 siblings, 1 reply; 4+ messages in thread
From: Hongxu Jia @ 2025-03-28 13:02 UTC (permalink / raw)
To: openembedded-core
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
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
meta/classes-recipe/live-vm-common.bbclass | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/meta/classes-recipe/live-vm-common.bbclass b/meta/classes-recipe/live-vm-common.bbclass
index d90cc67ebc..f087d9e236 100644
--- a/meta/classes-recipe/live-vm-common.bbclass
+++ b/meta/classes-recipe/live-vm-common.bbclass
@@ -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
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] image-live.bbclass: fix booting EFI ISO live failed 2025-03-28 13:02 [PATCH 1/2] live-vm-common.bbclass: conditionally to add kernel and initrd to efi.img of ISO live Hongxu Jia @ 2025-03-28 13:02 ` Hongxu Jia 2025-04-07 16:28 ` [OE-core] " Ross Burton 0 siblings, 1 reply; 4+ messages in thread From: Hongxu Jia @ 2025-03-28 13:02 UTC (permalink / raw) To: openembedded-core In ISO live, if the size of efi.img >= 32MB, and copy EFI application (bootx64.efi) to efi.img behind of kernel and initrd, UEFI system could not find EFI application bootx64.efi In UEFI shell: ... Shell> ls FS0:\ Directory of: FS0:\ 04/05/2011 23:00 12,985,344 bzImage 04/05/2011 23:00 <DIR> 2,048 EFI 04/05/2011 23:00 20,494,696 initrd 04/05/2011 23:00 26 startup.nsh 3 File(s) 33,480,066 bytes 1 Dir(s) Shell> ls FS0:\EFI Directory of: FS0:\EFI 0 File(s) 0 bytes 0 Dir(s) ... The fs type of efi.img is FAT, it seems UEFI system only know first 32MB in efi.img, due to kernel and initrd take the most disk space, in order to make sure EFI application bootx64.efi could be detected by UEFI system, copy EFI BOOT and other configuration first, and then kernel and initrd at last As comparing, after applying this commit, for the same project, EFI application bootx64.efi was found In UEFI shell: ... Shell> ls FS0:\ Directory of: FS0:\ 04/05/2011 23:00 12,985,344 bzImage 04/05/2011 23:00 <DIR> 2,048 EFI 04/05/2011 23:00 20,494,696 initrd 04/05/2011 23:00 26 startup.nsh 3 File(s) 33,480,066 bytes 1 Dir(s) Shell> ls FS0:\EFI\BOOT Directory of: FS0:\EFI\BOOT\ 04/05/2011 23:00 <DIR> 2,048 . 04/05/2011 23:00 <DIR> 2,048 .. 04/05/2011 23:00 655,360 bootx64.efi 04/05/2011 23:00 281 grub.cfg 2 File(s) 655,641 bytes 2 Dir(s) ... Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- meta/classes-recipe/image-live.bbclass | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/meta/classes-recipe/image-live.bbclass b/meta/classes-recipe/image-live.bbclass index d2e95ef51c..40ee86b822 100644 --- a/meta/classes-recipe/image-live.bbclass +++ b/meta/classes-recipe/image-live.bbclass @@ -211,7 +211,24 @@ build_fat_img() { fi # Copy FATSOURCEDIR recursively into the image file directly - mcopy -i ${FATIMG} -s ${FATSOURCEDIR}/* ::/ + fat_source_dirs="$(ls ${FATSOURCEDIR}/* -d)" + fat_sources="" + for source_dir in $fat_source_dirs; do + # Skip kernel and initrd + if [ ${source_dir%${KERNEL_IMAGETYPE}} = "$source_dir" -a \ + ${source_dir%initrd} = "$source_dir" ];then + fat_sources="$fat_sources $source_dir" + fi + done + # Copy EFI BOOT and other configuration at first + mcopy -i ${FATIMG} -s $fat_sources ::/ + # Copy kernel and initrd at last if available + if [ -e ${FATSOURCEDIR}/${KERNEL_IMAGETYPE} ];then + mcopy -i ${FATIMG} ${FATSOURCEDIR}/${KERNEL_IMAGETYPE} ::/ + fi + if [ -e ${FATSOURCEDIR}/initrd ]; then + mcopy -i ${FATIMG} ${FATSOURCEDIR}/initrd ::/ + fi } build_hddimg() { -- 2.25.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH 2/2] image-live.bbclass: fix booting EFI ISO live failed 2025-03-28 13:02 ` [PATCH 2/2] image-live.bbclass: fix booting EFI ISO live failed Hongxu Jia @ 2025-04-07 16:28 ` Ross Burton 2025-04-08 4:30 ` hongxu 0 siblings, 1 reply; 4+ messages in thread From: Ross Burton @ 2025-04-07 16:28 UTC (permalink / raw) To: hongxu.jia@eng.windriver.com; +Cc: openembedded-core@lists.openembedded.org On 28 Mar 2025, at 13:02, hongxu via lists.openembedded.org <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote: > > In ISO live, if the size of efi.img >= 32MB, and copy EFI application > (bootx64.efi) to efi.img behind of kernel and initrd, UEFI system > could not find EFI application bootx64.efi That sounds very suspicious to me, especially the 32MB limit. Is this file system being accidentally created as FAT12, which does have a 32MB limit? Can you try just forcing FATSIZE=“-F 32” to force FAT32 instead of these patches? Ross ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] image-live.bbclass: fix booting EFI ISO live failed 2025-04-07 16:28 ` [OE-core] " Ross Burton @ 2025-04-08 4:30 ` hongxu 0 siblings, 0 replies; 4+ messages in thread From: hongxu @ 2025-04-08 4:30 UTC (permalink / raw) To: openembedded-core [-- Attachment #1: Type: text/plain, Size: 149 bytes --] Hi Ross, Forcing FATSIZE=“-F 32” did not work, I also tried to use GPT + FAT partition to instead of MBR + FAT, and still failed //Hongxu [-- Attachment #2: Type: text/html, Size: 239 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-08 4:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-03-28 13:02 [PATCH 1/2] live-vm-common.bbclass: conditionally to add kernel and initrd to efi.img of ISO live Hongxu Jia 2025-03-28 13:02 ` [PATCH 2/2] image-live.bbclass: fix booting EFI ISO live failed Hongxu Jia 2025-04-07 16:28 ` [OE-core] " Ross Burton 2025-04-08 4:30 ` hongxu
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.