summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Loibl <andreas@andreas-loibl.de>2011-09-29 20:28:12 +0200
committerAndreas Loibl <andreas@andreas-loibl.de>2011-09-29 20:28:12 +0200
commitfcc6edbd306fcacc1a9d9e27cbb4bb9c942213a5 (patch)
treec06547e4b61a8c1be9878d2a97647d5e3eded463
parente747a371c4287f6b6af58d5558c7961d3d1866a0 (diff)
downloadkanotix-fcc6edbd306fcacc1a9d9e27cbb4bb9c942213a5.zip
kanotix-fcc6edbd306fcacc1a9d9e27cbb4bb9c942213a5.tar.gz
call grub-mkimage in chroot
-rwxr-xr-xconfig/binary_local-hooks/grub2-efi16
1 files 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'