Skip to content

Commit

Permalink
grub2: Make EFI grub work on aarch64
Browse files Browse the repository at this point in the history
(cherry picked from commit a9a7067)
  • Loading branch information
dezgeg committed Mar 7, 2017
1 parent f9489cc commit 0ccfb44
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pkgs/tools/misc/grub/2.0x.nix
Expand Up @@ -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";
Expand Down Expand Up @@ -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 "";
Expand Down

0 comments on commit 0ccfb44

Please sign in to comment.