From fcc6edbd306fcacc1a9d9e27cbb4bb9c942213a5 Mon Sep 17 00:00:00 2001 From: Andreas Loibl Date: Thu, 29 Sep 2011 20:28:12 +0200 Subject: call grub-mkimage in chroot --- config/binary_local-hooks/grub2-efi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/binary_local-hooks/grub2-efi b/config/binary_local-hooks/grub2-efi index 4984370..f786f3c 100755 --- a/config/binary_local-hooks/grub2-efi +++ b/config/binary_local-hooks/grub2-efi @@ -1,19 +1,16 @@ #!/bin/bash -platform=x86_64 +platform=x86_64-efi efi_name=x64 modules="search iso9660 configfile normal memdisk tar part_msdos fat" -memdisk_img= workdir= cleanup () { - [ -z "$memdisk_img" ] || rm -f "$memdisk_img" [ -z "$workdir" ] || rm -rf "$workdir" } trap cleanup EXIT HUP INT QUIT TERM -memdisk_img="$(mktemp efi-image.XXXXXX)" workdir="$(mktemp -d efi-image.XXXXXX)" # Skeleton configuration file which finds the real boot disk. @@ -36,9 +33,11 @@ mkdir -p "binary/efi/boot" sed -i.orig -e '/^normal:/{/gzio/!{s/$/ gzio/}}' chroot/usr/lib/grub/x86_64-efi/moddep.lst # Build the core image. -(cd "$workdir"; tar -cf - boot) >"$memdisk_img" -grub-mkimage -v -O "$platform" -m "$memdisk_img" \ - -o "binary/efi/boot/boot$efi_name.efi" -p '(memdisk)/boot/grub' $modules +(cd "$workdir"; tar -cf - boot) > chroot/memdisk.$$.img +chroot chroot grub-mkimage -O "$platform" -m "/memdisk.$$.img" \ + -o "/boot$efi_name.efi" -p '(memdisk)/boot/grub' $modules +rm chroot/memdisk.$$.img +mv "chroot/boot$efi_name.efi" "binary/efi/boot/boot$efi_name.efi" # restore original module order mv chroot/usr/lib/grub/x86_64-efi/moddep.lst{.orig,} @@ -63,5 +62,6 @@ for x in "chroot/usr/lib/grub/$platform"/*.mod; do done # include EFI shell -wget -O efi/boot/shellx64.efi 'http://tianocore.git.sourceforge.net/git/gitweb.cgi?p=tianocore/edk2;a=blob_plain;f=EdkShellBinPkg/FullShell/X64/Shell_Full.efi;hb=HEAD' +[ -f binary/efi/boot/shellx64.efi ] || \ +wget -O binary/efi/boot/shellx64.efi 'http://tianocore.git.sourceforge.net/git/gitweb.cgi?p=tianocore/edk2;a=blob_plain;f=EdkShellBinPkg/FullShell/X64/Shell_Full.efi;hb=HEAD' -- cgit v1.0