Skip to Content.
Sympa Menu

sm-commit - [[SM-Commit] ] GIT changes to master grimoire by Pavel Vinogradov (65b130db260bd9f07ecde0cade90398cb0aa4281)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Pavel Vinogradov <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org, sm-commit AT lists.sourcemage.org
  • Subject: [[SM-Commit] ] GIT changes to master grimoire by Pavel Vinogradov (65b130db260bd9f07ecde0cade90398cb0aa4281)
  • Date: Sun, 16 Aug 2026 00:34:22 +0000

GIT changes to master grimoire by Pavel Vinogradov <public AT sourcemage.org>:

disk/refind/DETAILS | 1
disk/refind/HISTORY | 7
disk/refind/PRE_BUILD | 4
disk/refind/patches/gnu-efi-4-compat.patch | 204
+++++++++++++
disk/refind/patches/refind-0.14.2-fix-binutils-2.46.patch | 17 +
disk/refind/patches/refind-0.14.2-fix-gnu-efi-3.0.18.patch | 77 ++++
6 files changed, 310 insertions(+)

New commits:
commit 65b130db260bd9f07ecde0cade90398cb0aa4281
Author: Pavel Vinogradov <public AT sourcemage.org>
Commit: Pavel Vinogradov <public AT sourcemage.org>

disk/refind: added patches from Arch Linux and
Gentoo to build with current binutils and gnu-efi

diff --git a/disk/refind/DETAILS b/disk/refind/DETAILS
index 70fd545..d71dbe0 100755
--- a/disk/refind/DETAILS
+++ b/disk/refind/DETAILS
@@ -2,6 +2,7 @@
SPELL=refind
VERSION=0.14.2

SOURCE_HASH=sha512:76a52ed422ab3d431e6530fae4d13a51e8ed100568d4290207aaee87a84700b077bb79c4f4917027f5286de422954e1872fca288252ec756072d6c075b102e1e
+ PAATCHLEVEL=1
SOURCE="$SPELL-src-$VERSION.tar.gz"
SOURCE_URL[0]=$SOURCEFORGE_URL/project/$SPELL/$VERSION/$SOURCE
SOURCE_DIRECTORY="$BUILD_DIRECTORY/$SPELL-$VERSION"
diff --git a/disk/refind/HISTORY b/disk/refind/HISTORY
index 6b23b41..999e450 100644
--- a/disk/refind/HISTORY
+++ b/disk/refind/HISTORY
@@ -1,3 +1,10 @@
+2026-08-15 Pavel Vinogradov <public AT sourcemage.org>
+ * DETAILS: PATCHLEVEL++
+ * PRE_BUILD, patches/gnu-efi-4-compat.patch,
+ patches/refind-0.14.2-fix-binutils-2.46.patch,
+ patches/refind-0.14.2-fix-gnu-efi-3.0.18.patch: added patches from
+ Arch Linux and Gentoo to fix building with current binutils and
gnu-efi
+
2024-08-30 Pavel Vinogradov <public AT sourcemage.org>
* DETAILS: version 0.14.2

diff --git a/disk/refind/PRE_BUILD b/disk/refind/PRE_BUILD
new file mode 100755
index 0000000..6c5c8c9
--- /dev/null
+++ b/disk/refind/PRE_BUILD
@@ -0,0 +1,4 @@
+default_pre_build &&
+cd "${SOURCE_DIRECTORY}" &&
+
+apply_patch_dir "patches"
diff --git a/disk/refind/patches/gnu-efi-4-compat.patch
b/disk/refind/patches/gnu-efi-4-compat.patch
new file mode 100644
index 0000000..b53ab5e
--- /dev/null
+++ b/disk/refind/patches/gnu-efi-4-compat.patch
@@ -0,0 +1,204 @@
+diff --git a/EfiLib/gnuefi-helper.c b/EfiLib/gnuefi-helper.c
+index 8730403..032c7c7 100644
+--- a/EfiLib/gnuefi-helper.c
++++ b/EfiLib/gnuefi-helper.c
+@@ -109,6 +109,8 @@ UnicodeStrToAsciiStr (
+ @return The length of String.
+
+ **/
++// prevent duplicate definitions when compiled against gnu-efi 4.x
++#ifndef _GNU_EFI_4_0
+ UINTN
+ AsciiStrLen (
+ IN CONST CHAR8 *String
+@@ -129,6 +131,7 @@ AsciiStrLen (
+ }
+ return Length;
+ }
++#endif
+
+ /**
+ Determine whether a given device path is valid.
+diff --git a/EfiLib/gnuefi-helper.h b/EfiLib/gnuefi-helper.h
+index b691155..d3b4112 100644
+--- a/EfiLib/gnuefi-helper.h
++++ b/EfiLib/gnuefi-helper.h
+@@ -38,10 +38,12 @@ UnicodeStrToAsciiStr (
+ OUT CHAR8 *Destination
+ );
+
++#ifndef _GNU_EFI_4_0
+ UINTN
+ AsciiStrLen (
+ IN CONST CHAR8 *String
+ );
++#endif
+
+ UINTN
+ EFIAPI
+diff --git a/EfiLib/legacy.c b/EfiLib/legacy.c
+index 4ee6229..3fa470b 100644
+--- a/EfiLib/legacy.c
++++ b/EfiLib/legacy.c
+@@ -16,11 +16,12 @@
+ */
+
+ #ifdef __MAKEWITH_GNUEFI
++#define GNU_EFI_USE_REALLOCATEPOOL_ABI 0
+ #include "efi.h"
+ #include "efilib.h"
+ #include "gnuefi-helper.h"
+ #define EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH
+-#define EfiReallocatePool ReallocatePool
++#define EfiReallocatePool MyReallocatePool
+ #define EfiLibLocateProtocol LibLocateProtocol
+ #else
+ #include "../include/tiano_includes.h"
+diff --git a/filesystems/fsw_efi.h b/filesystems/fsw_efi.h
+index bb51073..6182a46 100644
+--- a/filesystems/fsw_efi.h
++++ b/filesystems/fsw_efi.h
+@@ -42,8 +42,11 @@
+ #include "../include/refit_call_wrapper.h"
+
+ #ifdef __MAKEWITH_GNUEFI
++// prevent duplicate definitions when compiled against gnu-efi 4.x
++#ifndef _GNU_EFI_4_0
+ #define CompareGuid(a, b) CompareGuid(a, b)==0
+ #endif
++#endif
+
+ #define REFIND_EFI_DISK_IO_PROTOCOL_GUID \
+ { \
+diff --git a/refind/driver_support.c b/refind/driver_support.c
+index cba4132..69ec6f2 100644
+--- a/refind/driver_support.c
++++ b/refind/driver_support.c
+@@ -99,6 +99,7 @@ EFI_GUID gMyEfiBlockIoProtocolGuid = { 0x964E5B21, 0x6459,
0x11D2, { 0x8E, 0x39,
+ EFI_GUID gMyEfiSimpleFileSystemProtocolGuid = { 0x964E5B22, 0x6459, 0x11D2,
{ 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
+
+ #ifdef __MAKEWITH_GNUEFI
++#define CompareGuid MyCompareGuid
+ struct MY_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;
+ struct MY_EFI_FILE_PROTOCOL;
+
+@@ -607,3 +608,38 @@ BOOLEAN LoadDrivers(VOID) {
+ ConnectAllDriversToAllControllers();
+ return (NumFound > 0);
+ } /* BOOLEAN LoadDrivers() */
++
++#ifdef __MAKEWITH_GNUEFI
++/* When using GNU-EFI, revert to the old CompareGuid() and RtCompareGuid()
++ functions, because GNU-EFI 4.x changed their definitions in a way that
broke
++ rEFInd. Modified from GNU-EFI 3.x functions in lib/guid.c and
++ lib/runtime/efirtlib.c; original copyright Intel & BSD-licensed. */
++INTN
++MyCompareGuid(
++ IN EFI_GUID *Guid1,
++ IN EFI_GUID *Guid2
++ )
++{
++ return MyRtCompareGuid (Guid1, Guid2);
++}
++
++INTN
++RUNTIMEFUNCTION
++MyRtCompareGuid (
++ IN EFI_GUID *Guid1,
++ IN EFI_GUID *Guid2
++ )
++{
++ INT32 *g1, *g2, r;
++
++ g1 = (INT32 *) Guid1;
++ g2 = (INT32 *) Guid2;
++
++ r = g1[0] - g2[0];
++ r |= g1[1] - g2[1];
++ r |= g1[2] - g2[2];
++ r |= g1[3] - g2[3];
++
++ return r;
++}
++#endif
+diff --git a/refind/driver_support.h b/refind/driver_support.h
+index 5869a8c..40eee33 100644
+--- a/refind/driver_support.h
++++ b/refind/driver_support.h
+@@ -22,6 +22,8 @@
+
+ #ifdef __MAKEWITH_GNUEFI
+ #include <efi.h>
++INTN MyCompareGuid(IN EFI_GUID *Guid1, IN EFI_GUID *Guid2);
++INTN RUNTIMEFUNCTION MyRtCompareGuid(IN EFI_GUID *Guid1, IN EFI_GUID
*Guid2);
+ #else
+ #include "../include/tiano_includes.h"
+ #endif
+diff --git a/refind/lib.c b/refind/lib.c
+index 7a9f28e..7cd72dd 100644
+--- a/refind/lib.c
++++ b/refind/lib.c
+@@ -56,6 +56,7 @@
+ */
+
+ #pragma pack(0)
++#define GNU_EFI_USE_REALLOCATEPOOL_ABI 0
+ #include "global.h"
+ #include "lib.h"
+ #include "icns.h"
+@@ -69,7 +70,7 @@
+ #include "mystrings.h"
+
+ #ifdef __MAKEWITH_GNUEFI
+-#define EfiReallocatePool ReallocatePool
++#define EfiReallocatePool MyReallocatePool
+ #else
+ #define LibLocateHandle gBS->LocateHandleBuffer
+ #define DevicePathProtocol gEfiDevicePathProtocolGuid
+@@ -1972,3 +1973,34 @@ VOID EraseUint32List(UINT32_LIST **TheList) {
+ *TheList = NextItem;
+ } // while
+ } // EraseUin32List()
++
++#ifdef __MAKEWITH_GNUEFI
++/* When using GNU-EFI, revert to the old ReallocatePool() function, because
++ GNU-EFI 4.x changed its definition in a way that broke rEFInd.
++ Modified from EfiLib/BmLib.c (matches GNU-EFI 3.x); original copyright
Intel
++ & BSD-licensed. */
++VOID *
++MyReallocatePool (
++ IN VOID *OldPool,
++ IN UINTN OldSize,
++ IN UINTN NewSize
++ )
++{
++ VOID *NewPool;
++
++ NewPool = NULL;
++ if (NewSize != 0) {
++ NewPool = AllocateZeroPool (NewSize);
++ }
++
++ if (OldPool != NULL) {
++ if (NewPool != NULL) {
++ MyCopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
++ }
++
++ FreePool (OldPool);
++ }
++
++ return NewPool;
++}
++#endif
+diff --git a/refind/lib.h b/refind/lib.h
+index 73c5c12..0c8f10d 100644
+--- a/refind/lib.h
++++ b/refind/lib.h
+@@ -48,6 +48,7 @@
+ #ifdef __MAKEWITH_GNUEFI
+ #include "efi.h"
+ #include "efilib.h"
++VOID * MyReallocatePool(IN VOID *OldPool, IN UINTN OldSize, IN UINTN
NewSize);
+ #define EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH
+ #else
+ #include "../include/tiano_includes.h"
diff --git a/disk/refind/patches/refind-0.14.2-fix-binutils-2.46.patch
b/disk/refind/patches/refind-0.14.2-fix-binutils-2.46.patch
new file mode 100644
index 0000000..78d4b97
--- /dev/null
+++ b/disk/refind/patches/refind-0.14.2-fix-binutils-2.46.patch
@@ -0,0 +1,17 @@
+https://bugs.gentoo.org/970041
+
+In binutils 2.46, objcopy became more strict with what it accepts as target.
+
+--- a/Make.common
++++ b/Make.common
+@@ -121,8 +121,8 @@
+ # objcopy flags for GNU-EFI
+ #
+
+-FORMAT = --target=efi-app-$(ARCH)
+-FORMAT_DRIVER = --target=efi-bsdrv-$(ARCH)
++FORMAT = --output-target=efi-app-$(ARCH)
++FORMAT_DRIVER = --output-target=efi-bsdrv-$(ARCH)
+
+ #
+ # Modifications on a per-architecture basis....
diff --git a/disk/refind/patches/refind-0.14.2-fix-gnu-efi-3.0.18.patch
b/disk/refind/patches/refind-0.14.2-fix-gnu-efi-3.0.18.patch
new file mode 100644
index 0000000..b5d9d26
--- /dev/null
+++ b/disk/refind/patches/refind-0.14.2-fix-gnu-efi-3.0.18.patch
@@ -0,0 +1,77 @@
+The same commit from gnu-efi that changed CopyMem in a way that broke refind
also changed SetMem.
+This patch attempts to fix it in the same way upstream fixed CopyMem.
+
+The commit:
https://sourceforge.net/p/gnu-efi/code/ci/deb8a7f267d96299b9aa41300539f617db54c2a9/
+The bug: https://bugs.gentoo.org/934474
+
+--- a/gptsync/gptsync.c
++++ b/gptsync/gptsync.c
+@@ -164,7 +164,7 @@ static UINTN write_mbr(VOID)
+ }
+ if (!have_bootcode) {
+ // no boot code found in the MBR, add the syslinux MBR code
+- SetMem(sector, MBR_BOOTCODE_SIZE, 0);
++ refit_call3_wrapper(gBS->SetMem, sector, MBR_BOOTCODE_SIZE, 0);
+ refit_call3_wrapper(gBS->CopyMem, sector, syslinux_mbr,
SYSLINUX_MBR_SIZE);
+ }
+
+--- a/libeg/lodepng_xtra.c
++++ b/libeg/lodepng_xtra.c
+@@ -87,7 +87,7 @@ int MyStrlen(const char *InString) {
+ } // int MyStrlen()
+
+ VOID *MyMemSet(VOID *s, int c, size_t n) {
+- SetMem(s, c, n);
++ MySetMem(s, c, n);
+ return s;
+ }
+
+--- a/refind/config.c
++++ b/refind/config.c
+@@ -667,7 +667,7 @@ VOID ReadConfig(CHAR16 *FileName)
+ HandleStrings(TokenList, TokenCount,
&(GlobalConfig.DriverDirs));
+
+ } else if (MyStriCmp(TokenList[0], L"showtools")) {
+- SetMem(GlobalConfig.ShowTools, NUM_TOOLS * sizeof(UINTN), 0);
++ MySetMem(GlobalConfig.ShowTools, NUM_TOOLS * sizeof(UINTN), 0);
+ GlobalConfig.HiddenTags = FALSE;
+ for (i = 1; (i < TokenCount) && (i < NUM_TOOLS); i++) {
+ FlagName = TokenList[i];
+--- a/refind/launch_legacy.c
++++ b/refind/launch_legacy.c
+@@ -114,7 +114,7 @@ static EFI_STATUS ActivateMbrPartition(IN EFI_BLOCK_IO
*BlockIO, IN UINTN Partit
+ }
+ if (!HaveBootCode) {
+ // no boot code found in the MBR, add the syslinux MBR code
+- SetMem(SectorBuffer, MBR_BOOTCODE_SIZE, 0);
++ MySetMem(SectorBuffer, MBR_BOOTCODE_SIZE, 0);
+ MyCopyMem(SectorBuffer, syslinux_mbr, SYSLINUX_MBR_SIZE);
+ }
+
+--- a/refind/lib.c
++++ b/refind/lib.c
+@@ -651,7 +651,7 @@ static VOID SetFilesystemData(IN UINT8 *Buffer, IN UINTN
BufferSize, IN OUT REFI
+
+ LOG(2, LOG_LINE_NORMAL, L"Identifying filesystem types....");
+ if ((Buffer != NULL) && (Volume != NULL)) {
+- SetMem(&(Volume->VolUuid), sizeof(EFI_GUID), 0);
++ MySetMem(&(Volume->VolUuid), sizeof(EFI_GUID), 0);
+ Volume->FSType = FS_TYPE_UNKNOWN;
+
+ if (BufferSize >= (1024 + 100)) {
+--- a/refind/lib.h
++++ b/refind/lib.h
+@@ -133,10 +133,13 @@ VOID MyFreePool(IN OUT VOID *Pointer);
+
+ // When using GNU-EFI, call the EFI's built-in gBS->CopyMem() function,
because
+ // GNU-EFI 3.0.18 changed its CopyMem() definition in a way that broke
rEFInd.
++// Same for SetMem
+ #ifdef __MAKEWITH_GNUEFI
+ #define MyCopyMem(Dest, Src, len) refit_call3_wrapper(gBS->CopyMem, Dest,
Src, len)
++#define MySetMem(Dest, Src, len) refit_call3_wrapper(gBS->SetMem, Dest,
Src, len)
+ #else
+ #define MyCopyMem(Dest, Src, len) CopyMem(Dest, Src, len)
++#define MySetMem(Dest, Src, len) SetMem(Dest, Src, len)
+ #endif
+
+ BOOLEAN EjectMedia(VOID);


  • [[SM-Commit] ] GIT changes to master grimoire by Pavel Vinogradov (65b130db260bd9f07ecde0cade90398cb0aa4281), Pavel Vinogradov, 08/15/2026

Archive powered by MHonArc 2.6.24.

Top of Page