Patchwork [3/5] grub-efi-native: Add support for EFI ISO images

login
register
mail settings
Submitter Jason Wessel
Date Sept. 12, 2013, 5:19 p.m.
Message ID <1379006387-20186-4-git-send-email-jason.wessel@windriver.com>
Download mbox | patch
Permalink /patch/57907/
State New
Headers show

Comments

Jason Wessel - Sept. 12, 2013, 5:19 p.m.
The iso9660 file system support needs to be added to grub in order to
be able to correctly find the grub.cfg.  The grub commands to locate
the grub.cfg also needs to be encoded into grub's default
configuration.

This change allows the resulting grub binary to work both in the hard
drive / USB boot case or the optical media boot case.

[YOCTO #4100]

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 meta/recipes-bsp/grub/grub-efi-native_2.00.bb |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Darren Hart - Sept. 12, 2013, 5:48 p.m.
On Thu, 2013-09-12 at 12:19 -0500, Jason Wessel wrote:
> The iso9660 file system support needs to be added to grub in order to
> be able to correctly find the grub.cfg.  The grub commands to locate
> the grub.cfg also needs to be encoded into grub's default
> configuration.
> 
> This change allows the resulting grub binary to work both in the hard
> drive / USB boot case or the optical media boot case.
> 



> [YOCTO #4100]
> 
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> ---
>  meta/recipes-bsp/grub/grub-efi-native_2.00.bb |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-bsp/grub/grub-efi-native_2.00.bb b/meta/recipes-bsp/grub/grub-efi-native_2.00.bb
> index 2d3d68a..3cff838 100644
> --- a/meta/recipes-bsp/grub/grub-efi-native_2.00.bb
> +++ b/meta/recipes-bsp/grub/grub-efi-native_2.00.bb
> @@ -66,9 +66,13 @@ EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
>                  --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
>  
>  do_mkimage() {
> -	./grub-mkimage -p /EFI/BOOT -d ./grub-core/ \
> +	# Search for the grub.cfg on the local boot media with built in config file
> +	echo 'search.file /EFI/BOOT/grub.cfg root' > cfg\
> +	echo 'set prefix=($root)/EFI/BOOT' >> cfg

Hrm, I think adding a cfg as a file via the SRC_URI would be preferable
to dynamically creating it every time. This would make it easier to
modify the config in the future.

Otherwise, looks good.

Patch

diff --git a/meta/recipes-bsp/grub/grub-efi-native_2.00.bb b/meta/recipes-bsp/grub/grub-efi-native_2.00.bb
index 2d3d68a..3cff838 100644
--- a/meta/recipes-bsp/grub/grub-efi-native_2.00.bb
+++ b/meta/recipes-bsp/grub/grub-efi-native_2.00.bb
@@ -66,9 +66,13 @@  EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
                 --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
 
 do_mkimage() {
-	./grub-mkimage -p /EFI/BOOT -d ./grub-core/ \
+	# Search for the grub.cfg on the local boot media with built in config file
+	echo 'search.file /EFI/BOOT/grub.cfg root' > cfg
+	echo 'set prefix=($root)/EFI/BOOT' >> cfg
+
+	./grub-mkimage -c cfg -p /EFI/BOOT -d ./grub-core/ \
 	               -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
-	               boot linux ext2 fat serial part_msdos part_gpt normal efi_gop
+	               boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search
 }
 addtask mkimage after do_compile before do_install