about summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorSamuel Dionne-Riel <samuel@dionne-riel.com>2024-06-03 17:03:11 -0400
committerSamuel Dionne-Riel <samuel@dionne-riel.com>2024-06-03 21:59:06 -0400
commitd38bc8b64c1a89547f551631236dfb8ce188c0c8 (patch)
treedfe9d15a61c859ffa981ce8d18dbcf8130cc6ac9 /pkgs/os-specific
parentd4bcd3a83145cb747d12045f76f1675a6755a9c8 (diff)
syslinux: Use Nixpkgs' gnu-efi
This resolves awkwardness with the gnu-efi submodule.
Though this builds only the arch-appropriate EFI program, but since it
was not used within Nixpkgs, it shouldn't be an issue.
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/syslinux/default.nix40
1 files changed, 29 insertions, 11 deletions
diff --git a/pkgs/os-specific/linux/syslinux/default.nix b/pkgs/os-specific/linux/syslinux/default.nix
index 5c1216c8bfd1b..162db8a040a6a 100644
--- a/pkgs/os-specific/linux/syslinux/default.nix
+++ b/pkgs/os-specific/linux/syslinux/default.nix
@@ -1,7 +1,9 @@
 { lib
 , stdenv
-, fetchgit
+, fetchFromRepoOrCz
+, gnu-efi
 , fetchurl
+, fetchpatch
 , libuuid
 , makeWrapper
 , mtools
@@ -16,11 +18,10 @@ stdenv.mkDerivation {
 
   # This is syslinux-6.04-pre3^1; syslinux-6.04-pre3 fails to run.
   # Same issue here https://www.syslinux.org/archives/2019-February/026330.html
-  src = fetchgit {
-    url = "https://repo.or.cz/syslinux";
-    rev = "b40487005223a78c3bb4c300ef6c436b3f6ec1f7";
-    sha256 = "sha256-GqvRTr9mA2yRD0G0CF11x1X0jCgqV4Mh+tvE0/0yjqk=";
-    fetchSubmodules = true;
+  src = fetchFromRepoOrCz {
+    repo = "syslinux";
+    rev = "759fe3d75276aac5c7f9dd7dcbfb56323a85fff1";
+    hash = "sha256-NNA8Q7+rQ/TdcB6rgtjWjtoXxLJtI4HjV+2UVKqTSR0=";
   };
 
   patches = let
@@ -65,6 +66,12 @@ stdenv.mkDerivation {
       "0018-prevent-pow-optimization.patch"
       "26f0e7b2"
       "sha256-dVzXBi/oSV9vYgU85mRFHBKuZdup+1x1BipJX74ED7E=")
+    (fetchpatch {
+      # Fixes build with "modern" gnu-efi
+      # https://github.com/samueldr/syslinux/commit/68defee52f4eba82eefaeea17f21c7498448dd6b
+      url = "https://github.com/samueldr/syslinux/commit/68defee52f4eba82eefaeea17f21c7498448dd6b.patch";
+      hash = "sha256-5xIqM8Gq8D86HL1i7fBTHRB/ZR2XtCz5VsT4bI5vneo=";
+    })
   ];
 
   postPatch = ''
@@ -74,10 +81,6 @@ stdenv.mkDerivation {
     # fix tests
     substituteInPlace tests/unittest/include/unittest/unittest.h \
       --replace-fail /usr/include/ ""
-
-    # Hack to get `gcc -m32' to work without having 32-bit Glibc headers.
-    mkdir gnu-efi/inc/ia32/gnu
-    touch gnu-efi/inc/ia32/gnu/stubs-32.h
   '';
 
   nativeBuildInputs = [
@@ -89,6 +92,7 @@ stdenv.mkDerivation {
 
   buildInputs = [
     libuuid
+    gnu-efi
   ];
 
   # Fails very rarely with 'No rule to make target: ...'
@@ -111,8 +115,22 @@ stdenv.mkDerivation {
     "MANDIR=$(out)/share/man"
     "PERL=perl"
     "HEXDATE=0x00000000"
+    # Works around confusing (unrelated) error messages when upx is not made available
+    "UPX=false"
+
+    # Configurations needed to make use of external gnu-efi
+    "LIBEFI=${gnu-efi}/lib/libefi.a"
+    "LIBDIR=${gnu-efi}/lib/"
+    "EFIINC=${gnu-efi}/include/efi"
+
+    # Legacy bios boot target is always built
+    "bios"
   ]
-  ++ lib.optionals stdenv.hostPlatform.isi686 [ "bios" "efi32" ];
+  # Build "ia32" EFI for i686
+  ++ lib.optional stdenv.hostPlatform.isi686 "efi32"
+  # Build "x86_64" EFI for x86_64
+  ++ lib.optional stdenv.hostPlatform.isx86_64 "efi64"
+  ;
 
   # Some tests require qemu, some others fail in a sandboxed environment
   doCheck = false;