From 61ef8f0b425625795cf724d6e5a7eb9ddc451e28 Mon Sep 17 00:00:00 2001 From: Vladimír Čunát Date: Wed, 20 Feb 2019 11:18:20 +0100 Subject: grub2: patch to work with updated binutils This blocked some EFI stuff and consequently the channels. I would fetchpatch, but their cgit server won't work on this commit. --- pkgs/tools/misc/grub/2.0x.nix | 30 +++++++++++----------- .../misc/grub/relocation-not-implemented.diff | 25 ++++++++++++++++++ 2 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 pkgs/tools/misc/grub/relocation-not-implemented.diff (limited to 'pkgs/tools/misc/grub') diff --git a/pkgs/tools/misc/grub/2.0x.nix b/pkgs/tools/misc/grub/2.0x.nix index 2a8734822ac..fa1729b929c 100644 --- a/pkgs/tools/misc/grub/2.0x.nix +++ b/pkgs/tools/misc/grub/2.0x.nix @@ -47,6 +47,21 @@ stdenv.mkDerivation rec { sha256 = "03vvdfhdmf16121v7xs8is2krwnv15wpkhkf16a4yf8nsfc3f2w1"; }; + patches = [ + ./fix-bash-completion.patch + # This patch makes grub compatible with the XFS sparse inode + # feature introduced by xfsprogs-4.16. + # to be removed in grub-2.03 + (fetchpatch { + url = https://git.savannah.gnu.org/cgit/grub.git/patch/?id=cda0a857dd7a27cd5d621747464bfe71e8727fff; + sha256 = "0k9qrkdxwdqk6sz05q9smqwjr6pvgc9adx1mlf0807g4im91xnm0"; + }) + ./relocation-not-implemented.diff + ]; + postPatch = '' + substituteInPlace ./configure --replace '/usr/share/fonts/unifont' '${unifont}/share/fonts' + ''; + nativeBuildInputs = [ bison flex python pkgconfig ]; buildInputs = [ ncurses libusb freetype gettext lvm2 fuse ] ++ optional doCheck qemu @@ -57,10 +72,6 @@ stdenv.mkDerivation rec { # Work around a bug in the generated flex lexer (upstream flex bug?) NIX_CFLAGS_COMPILE = "-Wno-error"; - postPatch = '' - substituteInPlace ./configure --replace '/usr/share/fonts/unifont' '${unifont}/share/fonts' - ''; - preConfigure = '' for i in "tests/util/"*.in do @@ -82,17 +93,6 @@ stdenv.mkDerivation rec { unset CPP # setting CPP intereferes with dependency calculation ''; - patches = [ - ./fix-bash-completion.patch - # This patch makes grub compatible with the XFS sparse inode - # feature introduced by xfsprogs-4.16. - # to be removed in grub-2.03 - (fetchpatch { - url = https://git.savannah.gnu.org/cgit/grub.git/patch/?id=cda0a857dd7a27cd5d621747464bfe71e8727fff; - sha256 = "0k9qrkdxwdqk6sz05q9smqwjr6pvgc9adx1mlf0807g4im91xnm0"; - }) - ]; - configureFlags = [ "--enable-grub-mount" ] # dep of os-prober ++ optional zfsSupport "--enable-libzfs" ++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystemsBuild.${stdenv.hostPlatform.system}.target}" "--program-prefix=" ] diff --git a/pkgs/tools/misc/grub/relocation-not-implemented.diff b/pkgs/tools/misc/grub/relocation-not-implemented.diff new file mode 100644 index 00000000000..0b7bf947d14 --- /dev/null +++ b/pkgs/tools/misc/grub/relocation-not-implemented.diff @@ -0,0 +1,25 @@ +https://git.savannah.gnu.org/cgit/grub.git/commit/util?id=842c390469e2c2e10b5 +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index a2bb054..39d7efb 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -841,6 +841,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, + break; + + case R_X86_64_PC32: ++ case R_X86_64_PLT32: + { + grub_uint32_t *t32 = (grub_uint32_t *) target; + *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32) +diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c +index 9179285..a79271f 100644 +--- a/util/grub-module-verifier.c ++++ b/util/grub-module-verifier.c +@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = { + -1 + }, (int[]){ + R_X86_64_PC32, ++ R_X86_64_PLT32, + -1 + } + }, -- cgit 1.4.1