diff options
author | Samuel Dionne-Riel <samuel@dionne-riel.com> | 2024-06-03 17:03:11 -0400 |
---|---|---|
committer | Arnout Engelen <arnout@bzzt.net> | 2024-06-04 15:59:50 +0200 |
commit | 19453d29fcbdb9669256b48aba09750c157727bd (patch) | |
tree | 88ede5b691cdc4c833d08a9d705cd6706f85d606 /pkgs/os-specific | |
parent | f6f7831460f0c998ba8919ee88502b943a44eec5 (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. Co-Authored-By: Arnout Engelen <arnout@bzzt.net>
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r-- | pkgs/os-specific/linux/syslinux/default.nix | 37 | ||||
-rw-r--r-- | pkgs/os-specific/linux/syslinux/import-efisetjmp.patch | 22 |
2 files changed, 49 insertions, 10 deletions
diff --git a/pkgs/os-specific/linux/syslinux/default.nix b/pkgs/os-specific/linux/syslinux/default.nix index 5c1216c8bfd1b..c2115fa2cea92 100644 --- a/pkgs/os-specific/linux/syslinux/default.nix +++ b/pkgs/os-specific/linux/syslinux/default.nix @@ -1,11 +1,14 @@ { lib , stdenv -, fetchgit +, fetchFromRepoOrCz +, gnu-efi , fetchurl +, fetchpatch , libuuid , makeWrapper , mtools , nasm +, nixosTests , perl , python3 }: @@ -16,11 +19,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"; + src = fetchFromRepoOrCz { + repo = "syslinux"; rev = "b40487005223a78c3bb4c300ef6c436b3f6ec1f7"; - sha256 = "sha256-GqvRTr9mA2yRD0G0CF11x1X0jCgqV4Mh+tvE0/0yjqk="; - fetchSubmodules = true; + hash = "sha256-XNC+X7UYxdMQQAg4MLACQLxRNnI5/ZCOiCJrEkKgPeM="; }; patches = let @@ -65,6 +67,8 @@ stdenv.mkDerivation { "0018-prevent-pow-optimization.patch" "26f0e7b2" "sha256-dVzXBi/oSV9vYgU85mRFHBKuZdup+1x1BipJX74ED7E=") + # Fixes build with "modern" gnu-efi + ./import-efisetjmp.patch ]; postPatch = '' @@ -74,10 +78,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 +89,7 @@ stdenv.mkDerivation { buildInputs = [ libuuid + gnu-efi ]; # Fails very rarely with 'No rule to make target: ...' @@ -111,8 +112,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; @@ -125,6 +140,8 @@ stdenv.mkDerivation { rm -rf $out/share/syslinux/com32 ''; + passthru.tests.biosCdrom = nixosTests.boot.biosCdrom; + meta = with lib; { homepage = "https://www.syslinux.org/"; description = "A lightweight bootloader"; diff --git a/pkgs/os-specific/linux/syslinux/import-efisetjmp.patch b/pkgs/os-specific/linux/syslinux/import-efisetjmp.patch new file mode 100644 index 0000000000000..6d1744fc4340d --- /dev/null +++ b/pkgs/os-specific/linux/syslinux/import-efisetjmp.patch @@ -0,0 +1,22 @@ +From 68defee52f4eba82eefaeea17f21c7498448dd6b Mon Sep 17 00:00:00 2001 +From: Samuel Dionne-Riel <samuel@dionne-riel.com> +Date: Mon, 3 Jun 2024 16:16:25 -0400 +Subject: [PATCH] efi/efi.h: Add efisetjmp.h + +See https://github.com/ncroxon/gnu-efi/commit/486ba3c3bdd147b7d98159b9e650be60bce0f027 +--- + efi/efi.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/efi/efi.h b/efi/efi.h +index c266532f3..e4497574b 100644 +--- a/efi/efi.h ++++ b/efi/efi.h +@@ -23,6 +23,7 @@ + #include <efi.h> + #include <efilib.h> + #include <efistdarg.h> ++#include <efisetjmp.h> + + /* Delay for 100 ms */ + #define EFI_NOMAP_PRINT_DELAY 100 |