grub2: Make EFI grub work on aarch64

This commit is contained in:
Tuomas Tynkkynen 2016-12-25 14:54:45 +02:00
parent d7674dabba
commit a9a706770a

View File

@ -12,12 +12,21 @@ let
"x86_64-linux".target = "i386";
};
efiSystems = {
efiSystemsBuild = {
"i686-linux".target = "i386";
"x86_64-linux".target = "x86_64";
"aarch64-linux".target = "aarch64";
};
canEfi = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) efiSystems);
# For aarch64, we need to use '--target=aarch64-efi' when building,
# but '--target=arm64-efi' when installing. Insanity!
efiSystemsInstall = {
"i686-linux".target = "i386";
"x86_64-linux".target = "x86_64";
"aarch64-linux".target = "arm64";
};
canEfi = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) efiSystemsBuild);
inPCSystems = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) pcSystems);
version = "2.x-2015-11-16";
@ -89,11 +98,11 @@ stdenv.mkDerivation rec {
patches = [ ./fix-bash-completion.patch ];
configureFlags = optional zfsSupport "--enable-libzfs"
++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystems.${stdenv.system}.target}" "--program-prefix=" ];
++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystemsBuild.${stdenv.system}.target}" "--program-prefix=" ];
# save target that grub is compiled for
grubTarget = if efiSupport
then "${efiSystems.${stdenv.system}.target}-efi"
then "${efiSystemsInstall.${stdenv.system}.target}-efi"
else if inPCSystems
then "${pcSystems.${stdenv.system}.target}-pc"
else "";