Skip to content

Commit e6bc4f7

Browse files
authored
syslinux: apply patches to fix pointer mismatch (#368469)
2 parents 26b95a4 + 3008b70 commit e6bc4f7

File tree

3 files changed

+42
-74
lines changed

3 files changed

+42
-74
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/efi/main.c b/efi/main.c
2+
index 6a748412..a914e31a 100644
3+
--- a/efi/main.c
4+
+++ b/efi/main.c
5+
@@ -187,7 +187,7 @@ __export void local_boot(uint16_t ax)
6+
* Inform the firmware that we failed to execute correctly, which
7+
* will trigger the next entry in the EFI Boot Manager list.
8+
*/
9+
- longjmp(&load_error_buf, 1);
10+
+ longjmp(load_error_buf, 1);
11+
}
12+
13+
void bios_timer_cleanup(void)
14+
@@ -1385,7 +1385,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *table)
15+
status = uefi_call_wrapper(in->ReadKeyStroke, 2, in, &key);
16+
} while (status == EFI_SUCCESS);
17+
18+
- if (!setjmp(&load_error_buf))
19+
+ if (!setjmp(load_error_buf))
20+
load_env32(NULL);
21+
22+
/* load_env32() failed.. cancel timer and bailout */

pkgs/by-name/sy/syslinux/gcc10.patch

Lines changed: 0 additions & 33 deletions
This file was deleted.

pkgs/by-name/sy/syslinux/package.nix

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
stdenv,
44
fetchFromRepoOrCz,
55
gnu-efi,
6-
fetchurl,
76
fetchpatch,
87
libuuid,
98
makeWrapper,
@@ -28,51 +27,34 @@ stdenv.mkDerivation {
2827

2928
patches =
3029
let
31-
fetchDebianPatch =
32-
name: commit: hash:
33-
fetchurl {
34-
url = "https://salsa.debian.org/images-team/syslinux/raw/" + commit + "/debian/patches/" + name;
35-
inherit name hash;
36-
};
30+
archlinuxCommit = "db7884ec80642781edeead3e3bbd883a15b9b3ce";
3731
fetchArchlinuxPatch =
38-
name: commit: hash:
39-
fetchurl {
40-
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/" + commit + "/trunk/" + name;
32+
name: hash:
33+
fetchpatch {
34+
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/syslinux/-/raw/${archlinuxCommit}/${name}";
4135
inherit name hash;
4236
};
4337
in
4438
[
45-
./gcc10.patch
46-
(fetchDebianPatch "0002-gfxboot-menu-label.patch" "fa1349f1"
47-
"sha256-0f6QhM4lJmGflLige4n7AZTodL7vnyAvi5dIedd/Lho="
48-
)
49-
(fetchArchlinuxPatch "0005-gnu-efi-version-compatibility.patch"
50-
"821c3da473d1399d930d5b4a086e46a4179eaa45"
51-
"sha256-hhCVnfbAFWj/R4yh60qsMB87ofW9RznarsByhl6L4tc="
52-
)
53-
(fetchArchlinuxPatch "0025-reproducible-build.patch" "821c3da473d1399d930d5b4a086e46a4179eaa45"
54-
"sha256-mnb291pCSFvDNxY7o4BosJ94ib3BpOGRQIiY8Q3jZmI="
55-
)
56-
(fetchDebianPatch
57-
# mbr.bin: too big (452 > 440)
58-
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414
59-
"0016-strip-gnu-property.patch"
60-
"7468ef0e38c43"
61-
"sha256-lW+E6THuXlTGvhly0f/D9NwYHhkiKHot2l+bz9Eaxp4="
62-
)
63-
(fetchDebianPatch
64-
# mbr.bin: too big (452 > 440)
65-
"0017-single-load-segment.patch"
66-
"012e1dd312eb"
67-
"sha256-C6VmdlTs1blMGUHH3OfOlFBZsfpwRn9vWodwqVn8+Cs="
68-
)
69-
(fetchDebianPatch "0018-prevent-pow-optimization.patch" "26f0e7b2"
70-
"sha256-dVzXBi/oSV9vYgU85mRFHBKuZdup+1x1BipJX74ED7E="
71-
)
39+
(fetchArchlinuxPatch "0002-gfxboot-menu-label.patch" "sha256-eoId3jn4eRxItil5naoGMBGOJM/p5FG74ePwxiJ0w/8=")
40+
(fetchArchlinuxPatch "0005-gnu-efi-version-compatibility.patch" "sha256-5oZ/24emWNPHx621v/9i2xU6rodpVCM0R18hCU35eDk=")
41+
(fetchArchlinuxPatch "0006-Replace-builtin-strlen-that-appears-to-get-optimized.patch" "sha256-aq2vKqGonhMI2gRrAYNe+VRD8Vwijn7kOOv5wqAncx8=")
42+
# mbr.bin: too big (452 > 440)
43+
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414
44+
(fetchArchlinuxPatch "0016-strip-gnu-property.patch" "sha256-gn69YHbObqg6uTLPTtu8otNBFuCSyazwxLW3FbTNLX4=")
45+
# mbr.bin: too big (452 > 440)
46+
(fetchArchlinuxPatch "0017-single-load-segment.patch" "sha256-pGDcP62k50YkGgP0pFp5NSe7X0sojfLCzTmJtba2Yww=")
7247
# Fixes build with "modern" gnu-efi
48+
(fetchArchlinuxPatch "0018-prevent-pow-optimization.patch" "sha256-1+u8Kb6bxRbTPm0QCCt4yViLozzD/+/yspkJasOFM+g=")
49+
(fetchArchlinuxPatch "0025-reproducible-build.patch" "sha256-vhth9CFHqChPQPgGhUWVpYwMFnnjoMVIGr7Wfu1jcDY=")
50+
(fetchArchlinuxPatch "0027-use-correct-type-for-size.patch" "sha256-5nlKwIbXpZEyBrBSq9Zg0D+PRF7/kzEG13WzpwzDpPA=")
51+
7352
./import-efisetjmp.patch
7453
# Upstream patch: https://www.syslinux.org/archives/2024-February/026903.html
7554
./define-wchar_t.patch
55+
# gnu-efi changed their definition to already be a 1-elem array, don't double-ref it.
56+
# https://github.com/ncroxon/gnu-efi/commit/5b74db0e154ffd2fba4bcc254069844f21913988
57+
./fix-longjmp-calls.patch
7658
];
7759

7860
postPatch = ''
@@ -115,10 +97,7 @@ stdenv.mkDerivation {
11597
# gcc-10. Otherwise build fails as:
11698
# ld: acpi/xsdt.o:/build/syslinux-b404870/com32/gpllib/../gplinclude/memory.h:40: multiple definition of
11799
# `e820_types'; memory.o:/build/syslinux-b404870/com32/gpllib/../gplinclude/memory.h:40: first defined here
118-
# and with gcc14+ also:
119-
# /build/source/com32/chain/chain.c:517:44:
120-
# error: passing argument 3 of 'loadfile' from incompatible pointer type
121-
env.NIX_CFLAGS_COMPILE = "-fcommon -Wno-error=incompatible-pointer-types";
100+
env.NIX_CFLAGS_COMPILE = "-fcommon";
122101

123102
makeFlags =
124103
[

0 commit comments

Comments
 (0)