syslinux: apply patches to fix pointer mismatch (#368469)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
diff --git a/efi/main.c b/efi/main.c
|
||||
index 6a748412..a914e31a 100644
|
||||
--- a/efi/main.c
|
||||
+++ b/efi/main.c
|
||||
@@ -187,7 +187,7 @@ __export void local_boot(uint16_t ax)
|
||||
* Inform the firmware that we failed to execute correctly, which
|
||||
* will trigger the next entry in the EFI Boot Manager list.
|
||||
*/
|
||||
- longjmp(&load_error_buf, 1);
|
||||
+ longjmp(load_error_buf, 1);
|
||||
}
|
||||
|
||||
void bios_timer_cleanup(void)
|
||||
@@ -1385,7 +1385,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *table)
|
||||
status = uefi_call_wrapper(in->ReadKeyStroke, 2, in, &key);
|
||||
} while (status == EFI_SUCCESS);
|
||||
|
||||
- if (!setjmp(&load_error_buf))
|
||||
+ if (!setjmp(load_error_buf))
|
||||
load_env32(NULL);
|
||||
|
||||
/* load_env32() failed.. cancel timer and bailout */
|
||||
@@ -1,33 +0,0 @@
|
||||
diff --git a/dos/string.h b/dos/string.h
|
||||
index f648de2..a502132 100644
|
||||
--- a/dos/string.h
|
||||
+++ b/dos/string.h
|
||||
@@ -5,12 +5,13 @@
|
||||
#ifndef _STRING_H
|
||||
#define _STRING_H
|
||||
|
||||
+#include <stddef.h>
|
||||
+
|
||||
/* Standard routines */
|
||||
#define memcpy(a,b,c) __builtin_memcpy(a,b,c)
|
||||
#define memmove(a,b,c) __builtin_memmove(a,b,c)
|
||||
#define memset(a,b,c) __builtin_memset(a,b,c)
|
||||
#define strcpy(a,b) __builtin_strcpy(a,b)
|
||||
-#define strlen(a) __builtin_strlen(a)
|
||||
|
||||
/* This only returns true or false */
|
||||
static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)
|
||||
@@ -21,6 +22,13 @@ static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)
|
||||
return rv;
|
||||
}
|
||||
|
||||
+static inline size_t strlen(const char *s)
|
||||
+{
|
||||
+ size_t len = 0;
|
||||
+ while (*s++) len++;
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
extern char *strchr(const char *s, int c);
|
||||
|
||||
#endif /* _STRING_H */
|
||||
@@ -3,7 +3,6 @@
|
||||
stdenv,
|
||||
fetchFromRepoOrCz,
|
||||
gnu-efi,
|
||||
fetchurl,
|
||||
fetchpatch,
|
||||
libuuid,
|
||||
makeWrapper,
|
||||
@@ -28,51 +27,34 @@ stdenv.mkDerivation {
|
||||
|
||||
patches =
|
||||
let
|
||||
fetchDebianPatch =
|
||||
name: commit: hash:
|
||||
fetchurl {
|
||||
url = "https://salsa.debian.org/images-team/syslinux/raw/" + commit + "/debian/patches/" + name;
|
||||
inherit name hash;
|
||||
};
|
||||
archlinuxCommit = "db7884ec80642781edeead3e3bbd883a15b9b3ce";
|
||||
fetchArchlinuxPatch =
|
||||
name: commit: hash:
|
||||
fetchurl {
|
||||
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/" + commit + "/trunk/" + name;
|
||||
name: hash:
|
||||
fetchpatch {
|
||||
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/syslinux/-/raw/${archlinuxCommit}/${name}";
|
||||
inherit name hash;
|
||||
};
|
||||
in
|
||||
[
|
||||
./gcc10.patch
|
||||
(fetchDebianPatch "0002-gfxboot-menu-label.patch" "fa1349f1"
|
||||
"sha256-0f6QhM4lJmGflLige4n7AZTodL7vnyAvi5dIedd/Lho="
|
||||
)
|
||||
(fetchArchlinuxPatch "0005-gnu-efi-version-compatibility.patch"
|
||||
"821c3da473d1399d930d5b4a086e46a4179eaa45"
|
||||
"sha256-hhCVnfbAFWj/R4yh60qsMB87ofW9RznarsByhl6L4tc="
|
||||
)
|
||||
(fetchArchlinuxPatch "0025-reproducible-build.patch" "821c3da473d1399d930d5b4a086e46a4179eaa45"
|
||||
"sha256-mnb291pCSFvDNxY7o4BosJ94ib3BpOGRQIiY8Q3jZmI="
|
||||
)
|
||||
(fetchDebianPatch
|
||||
# mbr.bin: too big (452 > 440)
|
||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414
|
||||
"0016-strip-gnu-property.patch"
|
||||
"7468ef0e38c43"
|
||||
"sha256-lW+E6THuXlTGvhly0f/D9NwYHhkiKHot2l+bz9Eaxp4="
|
||||
)
|
||||
(fetchDebianPatch
|
||||
# mbr.bin: too big (452 > 440)
|
||||
"0017-single-load-segment.patch"
|
||||
"012e1dd312eb"
|
||||
"sha256-C6VmdlTs1blMGUHH3OfOlFBZsfpwRn9vWodwqVn8+Cs="
|
||||
)
|
||||
(fetchDebianPatch "0018-prevent-pow-optimization.patch" "26f0e7b2"
|
||||
"sha256-dVzXBi/oSV9vYgU85mRFHBKuZdup+1x1BipJX74ED7E="
|
||||
)
|
||||
(fetchArchlinuxPatch "0002-gfxboot-menu-label.patch" "sha256-eoId3jn4eRxItil5naoGMBGOJM/p5FG74ePwxiJ0w/8=")
|
||||
(fetchArchlinuxPatch "0005-gnu-efi-version-compatibility.patch" "sha256-5oZ/24emWNPHx621v/9i2xU6rodpVCM0R18hCU35eDk=")
|
||||
(fetchArchlinuxPatch "0006-Replace-builtin-strlen-that-appears-to-get-optimized.patch" "sha256-aq2vKqGonhMI2gRrAYNe+VRD8Vwijn7kOOv5wqAncx8=")
|
||||
# mbr.bin: too big (452 > 440)
|
||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414
|
||||
(fetchArchlinuxPatch "0016-strip-gnu-property.patch" "sha256-gn69YHbObqg6uTLPTtu8otNBFuCSyazwxLW3FbTNLX4=")
|
||||
# mbr.bin: too big (452 > 440)
|
||||
(fetchArchlinuxPatch "0017-single-load-segment.patch" "sha256-pGDcP62k50YkGgP0pFp5NSe7X0sojfLCzTmJtba2Yww=")
|
||||
# Fixes build with "modern" gnu-efi
|
||||
(fetchArchlinuxPatch "0018-prevent-pow-optimization.patch" "sha256-1+u8Kb6bxRbTPm0QCCt4yViLozzD/+/yspkJasOFM+g=")
|
||||
(fetchArchlinuxPatch "0025-reproducible-build.patch" "sha256-vhth9CFHqChPQPgGhUWVpYwMFnnjoMVIGr7Wfu1jcDY=")
|
||||
(fetchArchlinuxPatch "0027-use-correct-type-for-size.patch" "sha256-5nlKwIbXpZEyBrBSq9Zg0D+PRF7/kzEG13WzpwzDpPA=")
|
||||
|
||||
./import-efisetjmp.patch
|
||||
# Upstream patch: https://www.syslinux.org/archives/2024-February/026903.html
|
||||
./define-wchar_t.patch
|
||||
# gnu-efi changed their definition to already be a 1-elem array, don't double-ref it.
|
||||
# https://github.com/ncroxon/gnu-efi/commit/5b74db0e154ffd2fba4bcc254069844f21913988
|
||||
./fix-longjmp-calls.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
@@ -115,10 +97,7 @@ stdenv.mkDerivation {
|
||||
# gcc-10. Otherwise build fails as:
|
||||
# ld: acpi/xsdt.o:/build/syslinux-b404870/com32/gpllib/../gplinclude/memory.h:40: multiple definition of
|
||||
# `e820_types'; memory.o:/build/syslinux-b404870/com32/gpllib/../gplinclude/memory.h:40: first defined here
|
||||
# and with gcc14+ also:
|
||||
# /build/source/com32/chain/chain.c:517:44:
|
||||
# error: passing argument 3 of 'loadfile' from incompatible pointer type
|
||||
env.NIX_CFLAGS_COMPILE = "-fcommon -Wno-error=incompatible-pointer-types";
|
||||
env.NIX_CFLAGS_COMPILE = "-fcommon";
|
||||
|
||||
makeFlags =
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user