Unverified Commit d2d63347 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

grub2_ieee1275: init at 2.12 (#442701)

parents c352064f 44030658
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
  runtimeShell,
  zfs ? null,
  efiSupport ? false,
  ieee1275Support ? false,
  zfsSupport ? false,
  xenSupport ? false,
  xenPvhSupport ? false,
@@ -61,6 +62,11 @@ let
    riscv64-linux.target = "riscv64";
  };

  ieee1275SystemsBuild = {
    x86_64-linux.target = "i386";
    powerpc64-linux.target = "powerpc";
  };

  xenSystemsBuild = {
    i686-linux.target = "i386";
    x86_64-linux.target = "x86_64";
@@ -90,8 +96,16 @@ let
in

assert zfsSupport -> zfs != null;
assert !(efiSupport && (xenSupport || xenPvhSupport));
assert !(xenSupport && xenPvhSupport);
assert lib.asserts.assertMsg (
  lib.lists.length (
    lib.lists.filter (x: x) [
      efiSupport
      ieee1275Support
      xenSupport
      xenPvhSupport
    ]
  ) <= 1 # (0 == pc)
) "Only <= 1 of grub2's platform-related *Support options may be enabled at the same time";

stdenv.mkDerivation rec {
  pname = "grub";
@@ -677,6 +691,10 @@ stdenv.mkDerivation rec {
    "--target=${efiSystemsBuild.${stdenv.hostPlatform.system}.target}"
    "--program-prefix="
  ]
  ++ lib.optionals ieee1275Support [
    "--with-platform=ieee1275"
    "--target=${ieee1275SystemsBuild.${stdenv.hostPlatform.system}.target}"
  ]
  ++ lib.optionals xenSupport [
    "--with-platform=xen"
    "--target=${xenSystemsBuild.${stdenv.hostPlatform.system}.target}"
@@ -690,6 +708,8 @@ stdenv.mkDerivation rec {
  grubTarget =
    if efiSupport then
      "${efiSystemsInstall.${stdenv.hostPlatform.system}.target}-efi"
    else if ieee1275Support then
      "${ieee1275SystemsBuild.${stdenv.hostPlatform.system}.target}-ieee1275"
    else
      lib.optionalString inPCSystems "${pcSystems.${stdenv.hostPlatform.system}.target}-pc";

@@ -733,6 +753,8 @@ stdenv.mkDerivation rec {
    platforms =
      if efiSupport then
        lib.attrNames efiSystemsBuild
      else if ieee1275Support then
        lib.attrNames ieee1275SystemsBuild
      else if xenSupport then
        lib.attrNames xenSystemsBuild
      else if xenPvhSupport then
+4 −0
Original line number Diff line number Diff line
@@ -2782,6 +2782,10 @@ with pkgs;
    efiSupport = true;
  };

  grub2_ieee1275 = grub2.override {
    ieee1275Support = true;
  };

  grub2_light = grub2.override {
    zfsSupport = false;
  };