@@ -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() {
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(-)