summary refs log tree commit diff
path: root/pkgs/tools/misc/grub
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2016-12-25 14:54:45 +0200
committerTuomas Tynkkynen <tuomas@tuxera.com>2017-03-07 16:11:41 +0200
commita9a706770a344f872035d05af7316064aa6390f5 (patch)
tree854c87a5bc9a69cbd386f7af1650beb85e09c8ff /pkgs/tools/misc/grub
parentd7674dabba39d21f24578d414da926d74a8ceb17 (diff)
grub2: Make EFI grub work on aarch64
Diffstat (limited to 'pkgs/tools/misc/grub')
-rw-r--r--pkgs/tools/misc/grub/2.0x.nix17
1 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/tools/misc/grub/2.0x.nix b/pkgs/tools/misc/grub/2.0x.nix
index eef1ac472280c..7a70f2bdbff33 100644
--- a/pkgs/tools/misc/grub/2.0x.nix
+++ b/pkgs/tools/misc/grub/2.0x.nix
@@ -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 "";