Skip to content

Commit

Permalink
Improve 'BootLogo' Handling
Browse files Browse the repository at this point in the history
dakanji committed Jan 10, 2025
1 parent 65be5b9 commit adafab2
Showing 16 changed files with 476 additions and 162 deletions.
62 changes: 61 additions & 1 deletion BootMaster/config.c
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
* Portions Copyright (c) 2021 Joe van Tunen ([email protected])
*
* Modifications distributed under the preceding terms.
@@ -2362,6 +2362,9 @@ VOID ReadConfig (
BOOLEAN GotSyncTrustAll;
BOOLEAN GotNoneSyncTrust;
BOOLEAN OutLoopSyncTrust;
BOOLEAN GotNoBootLogoAll;
BOOLEAN GotNoneNoBootLogo;
BOOLEAN OutLoopNoBootLogo;
BOOLEAN GotGraphicsForAll;
BOOLEAN GotNoneGraphicsFor;
BOOLEAN OutLoopGraphicsFor;
@@ -2508,6 +2511,7 @@ VOID ReadConfig (
CheckManual = DoneManual = FALSE;
GotNoneHideui = OutLoopHideui = FALSE;
GotNoneSyncTrust = OutLoopSyncTrust = FALSE;
GotNoneNoBootLogo = OutLoopNoBootLogo = FALSE;
GotNoneGraphicsFor = OutLoopGraphicsFor = FALSE;
#if REFIT_DEBUG > 0
if (!OuterLoop) {
@@ -3745,6 +3749,62 @@ VOID ReadConfig (
TokenList, TokenCount
);
}
else if (MyStriCmp (TokenList[0], L"disable_bootlogo")) {
#if REFIT_DEBUG > 0
if (!OuterLoop && !OutLoopNoBootLogo) {
UpdatedToken = LogUpdate (
TokenList[0], NotRunBefore, TRUE
);
}
#endif

GotNoBootLogoAll = FALSE;
if (!OuterLoop && !OutLoopNoBootLogo) {
// DA-TAG: Allows reset/override in 'included' config files
OutLoopNoBootLogo = TRUE;
GlobalConfig.DisableBootLogo = DISABLE_BOOTLOGO_OFF;
}

for (i = 1; i < TokenCount; i++) {
Flag = TokenList[i];
if (MyStrBegins (Flag, L"Off")) {
// DA-TAG: Required despite earlier reset
// This will always be used if in token list
GotNoneNoBootLogo = TRUE;
GlobalConfig.DisableBootLogo = DISABLE_BOOTLOGO_OFF;
break;
}

if (!GotNoBootLogoAll) {
// DA-TAG: Arranged as so to prioritise 'Off' above
if (MyStrBegins (Flag, L"All")) {
GotNoBootLogoAll = TRUE;
GlobalConfig.DisableBootLogo = DISABLE_BOOTLOGO_ALL;
}
else {
if (0);
else if (MyStrBegins (Flag, L"Lin")) GlobalConfig.DisableBootLogo |= DISABLE_BOOTLOGO_LIN;
else if (MyStrBegins (Flag, L"Win")) GlobalConfig.DisableBootLogo |= DISABLE_BOOTLOGO_WIN;
else {
MsgStr = PoolPrint (
L"WARN: Invalid 'disable_bootlogo' Token:- '%s'", Flag
);

#if REFIT_DEBUG > 0
if (NotRunBefore) MuteLogger = FALSE;
LOG_MSG("%s - %s", OffsetNext, MsgStr);
if (NotRunBefore) MuteLogger = TRUE;
#endif

SwitchToText (FALSE);
PrintUglyText (MsgStr, NEXTLINE);
PauseForKey();
MY_FREE_POOL(MsgStr);
}
}
}
} // for
}
else if (MyStriCmp (TokenList[0], L"supply_nvme")) {
#if REFIT_DEBUG > 0
if (!OuterLoop) {
9 changes: 8 additions & 1 deletion BootMaster/global.h
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
*
* Modifications distributed under the preceding terms.
*/
@@ -294,6 +294,12 @@ EFI\\OEM\\Boot\\bootmgfw.efi"
#define REQUIRE_TRUST_VERIFY (64)
#define ENFORCE_TRUST_EVERY (127) // 1 + 2 + 4 + 8 + 16 + 32 + 64

// Bit codes (Actual Decimal) ... Used in GlobalConfig.DisableBootLogo
#define DISABLE_BOOTLOGO_OFF (0) // Binary: 0000 0000 0000
#define DISABLE_BOOTLOGO_LIN (1) // Binary: 0000 0000 0001
#define DISABLE_BOOTLOGO_WIN (2) // Binary: 0000 0000 0010
#define DISABLE_BOOTLOGO_ALL (3) // Binary: 0000 0000 0011 (1 + 2)

// Bit codes (Actual Decimal) ... Used in GlobalConfig.HideUIFlags
#define HIDEUI_FLAG_NONE (0)
#define HIDEUI_FLAG_BANNER (1)
@@ -531,6 +537,7 @@ typedef struct {
UINTN RequestedScreenWidth;
UINTN RequestedScreenHeight;
UINTN BannerBottomEdge;
UINTN DisableBootLogo;
UINTN HideUIFlags;
UINTN SyncTrust;
UINTN MaxTags;
107 changes: 75 additions & 32 deletions BootMaster/icns.c
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
* Portions Copyright (c) 2021 Joe van Tunen ([email protected])
*
* Modifications distributed under the preceding terms.
@@ -261,6 +261,8 @@ EG_IMAGE * LoadOSIcon (
IN BOOLEAN BootLogo
) {
EG_IMAGE *Image;
BOOLEAN WinAltIcon;
BOOLEAN LoadCustom;
CHAR16 *CutoutName;
CHAR16 *BaseName;
UINTN Index2;
@@ -272,7 +274,14 @@ EG_IMAGE * LoadOSIcon (
return NULL;
}

// Try to find an icon from the OSIconName list
if (BootLogo && GlobalConfig.DisableBootLogo == DISABLE_BOOTLOGO_ALL) {
return NULL;
}

LoadCustom = MyStriCmp (FallbackIconName, EXIT_SPLASH);
WinAltIcon = MyStriCmp (FallbackIconName, L"windows");

// Try to find an icon from the OSIconName list.
Index = 0;
OurId = -1;
Image = NULL;
@@ -286,8 +295,8 @@ EG_IMAGE * LoadOSIcon (
CutoutName
);

// Skip cache check if BootLogo is set
// BootLogo is not cached
// Skip cache check if BootLogo is set.
// BootLogo is not cached.
if (GlobalConfig.HelpIcon && !BootLogo) {
for (Index2 = 0; Index2 < BASE_OS_ICON_COUNT; Index2++) {
Image = LoadIndexedIcon (BaseName, Index2);
@@ -306,10 +315,11 @@ EG_IMAGE * LoadOSIcon (
MY_FREE_POOL(CutoutName);
} // while

// Try again with "os_" if that fails and BootLogo was set
if (BootLogo && Image == NULL) {
Index = 0;
OurId = -1;
// Try again with 'os_' if that fails,
// BootLogo was set, but not 'LoadCustom'.
if (!LoadCustom && BootLogo && Image == NULL) {
Index = 0;
OurId = -1;
while (
Image == NULL &&
(CutoutName = FindCommaDelimited (OSIconName, Index++)) != NULL
@@ -319,37 +329,25 @@ EG_IMAGE * LoadOSIcon (
CutoutName
);

// Skip cache check if BootLogo is set
// BootLogo is not cached
if (GlobalConfig.HelpIcon && !BootLogo) {
for (Index2 = 0; Index2 < BASE_OS_ICON_COUNT; Index2++) {
Image = LoadIndexedIcon (BaseName, Index2);
if (Image != NULL) {
OurId = (Index2 < BASE_OS_ICON_COUNT)
? Index2 : (BASE_OS_ICON_COUNT - 1);

break;
}
} // for
}

// No cache check as BootLogo is set.
// BootLogo is not cached.
UpdateBaseIcon (BaseName, &Image);

MY_FREE_POOL(BaseName);
MY_FREE_POOL(CutoutName);
} // while
}

// Try again using "FallbackIconName" if that fails
// Try again using 'FallbackIconName' if that fails.
if (Image == NULL) {
BaseName = PoolPrint (
L"%s_%s",
(BootLogo) ? L"boot" : L"os",
FallbackIconName
);

// Skip cache check if BootLogo is set
// BootLogo is not cached
// Skip cache check if BootLogo is set.
// BootLogo is not cached.
if (GlobalConfig.HelpIcon && !BootLogo) {
for (Index2 = 0; Index2 < BASE_OS_ICON_COUNT; Index2++) {
Image = LoadIndexedIcon (BaseName, Index2);
@@ -364,10 +362,38 @@ EG_IMAGE * LoadOSIcon (

UpdateBaseIcon (BaseName, &Image);
MY_FREE_POOL(BaseName);

// If that fails and 'WinAltIcon' is set,
// try with 'win' as 'FallbackIconName'.
if (Image == NULL && WinAltIcon) {
BaseName = PoolPrint (
L"%s_%s",
(BootLogo) ? L"boot" : L"os",
L"win"
);

// Skip cache check if BootLogo is set.
// BootLogo is not cached.
if (GlobalConfig.HelpIcon && !BootLogo) {
for (Index2 = 0; Index2 < BASE_OS_ICON_COUNT; Index2++) {
Image = LoadIndexedIcon (BaseName, Index2);
if (Image != NULL) {
OurId = (Index2 < BASE_OS_ICON_COUNT)
? Index2 : (BASE_OS_ICON_COUNT - 1);

break;
}
} // for
}

UpdateBaseIcon (BaseName, &Image);
MY_FREE_POOL(BaseName);
}
}

// Try again with "os_" if that fails and BootLogo was set
if (BootLogo && Image == NULL) {
// Try again with 'os_' if that fails,
// BootLogo was set, but not 'LoadCustom'.
if (!LoadCustom && BootLogo && Image == NULL) {
BaseName = PoolPrint (L"os_%s", FallbackIconName);

if (GlobalConfig.HelpIcon) {
@@ -384,10 +410,27 @@ EG_IMAGE * LoadOSIcon (

UpdateBaseIcon (BaseName, &Image);
MY_FREE_POOL(BaseName);

// Try 'os_win' if that fails and 'WinAltIcon' is set.
if (Image == NULL && WinAltIcon) {
if (GlobalConfig.HelpIcon) {
for (Index2 = 0; Index2 < BASE_OS_ICON_COUNT; Index2++) {
Image = LoadIndexedIcon (L"os_win", Index2);
if (Image != NULL) {
OurId = (Index2 < BASE_OS_ICON_COUNT)
? Index2 : (BASE_OS_ICON_COUNT - 1);

break;
}
} // for
}

UpdateBaseIcon (L"os_win", &Image);
}
}

// Try again with the "unknown" icon specifically if that fails.
// Only if BootLogo is *NOT* set ... No "unknown" BootLogo icon
// Only if BootLogo is *NOT* set ... No "unknown" BootLogo icon.
if (!BootLogo &&
Image == NULL &&
!MyStriCmp (FallbackIconName, L"unknown")
@@ -406,8 +449,8 @@ EG_IMAGE * LoadOSIcon (
}
}

// Use the "dummy" image if still fails
if (Image == NULL) {
// Use the "dummy" image if still fails and BootLogo is *NOT* set.
if (!BootLogo && Image == NULL) {
#if REFIT_DEBUG > 0
ALT_LOG(1, LOG_LINE_NORMAL, L"Set Dummy Image");
#endif
@@ -425,12 +468,12 @@ EG_IMAGE * LoadOSIcon (
}
}

// Return NULL if all failed
// Return NULL if all failed.
if (Image == NULL) {
return NULL;
}

// Cache the image if appropriate and not BootLogo
// Cache the image if appropriate and not BootLogo.
if (GlobalConfig.HelpIcon && !BootLogo) {
if (OurId >= 0 && TableBuiltinIconOS[OurId].Image == NULL) {
TableBuiltinIconOS[OurId].Image = Image;
4 changes: 3 additions & 1 deletion BootMaster/icns.h
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
*
* Modifications distributed under the preceding terms.
*/
@@ -105,6 +105,8 @@ EG_IMAGE * BuiltinIcon (IN UINTN Id);
#define BASE_OS_ICON_UEFI (10)
#define BASE_OS_ICON_COUNT (11)

#define EXIT_SPLASH L"outlogo"

#endif

/* EOF */
136 changes: 105 additions & 31 deletions BootMaster/launch_efi.c
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
*
* Modifications distributed under the preceding terms.
*/
@@ -53,6 +53,7 @@
#include "icns.h"
#include "menu.h"
#include "apple.h"
#include "linux.h"
#include "install.h"
#include "mystrings.h"
#include "screenmgt.h"
@@ -570,12 +571,16 @@ EFI_STATUS StartEFIImage (
EFI_STATUS Status;
EFI_STATUS ReturnStatus;
EFI_GUID SystemdGuid = SYSTEMD_GUID_VALUE;
CHAR16 *FullLoadOptions;
CHAR16 *MsgStrTmp;
CHAR16 *MsgStrEx;
CHAR16 *MsgStr;
CHAR16 *TmpStr;
CHAR16 *EspGUID;
CHAR16 *FullLoadOptions;
UINTN ScaleLogo;
UINTN OrigIconBig;
BOOLEAN LoaderValid;
EG_IMAGE *BootLogoImage;
EFI_HANDLE ChildImageHandle;
EFI_HANDLE TempImageHandle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
@@ -783,43 +788,112 @@ EFI_STATUS StartEFIImage (

// DA-TAG: Investigate This
// Re-enable the EFI watchdog timer (optionally)
//
// Turn control over to the image
if (IsBoot &&
OSType == 'L' &&
GlobalConfig.WriteSystemdVars
(
(
OSType == 'L' &&
!(GlobalConfig.DisableBootLogo & DISABLE_BOOTLOGO_LIN)
) || (
OSType == 'W' &&
!(GlobalConfig.DisableBootLogo & DISABLE_BOOTLOGO_WIN)
)
)
) {
// Inform SystemD of RefindPlus ESP
EspGUID = GuidAsString (&(SelfVolume->PartGuid));
if (!Verbose) {
if (ScreenW > 1024 && ScreenH > 1024) {
// Stash current size
OrigIconBig = GlobalConfig.IconSizes[ICON_SIZE_BIG];

// Set scale factor
if (0);
else if (OrigIconBig >= 256) ScaleLogo = 1;
else if (OrigIconBig >= 128) ScaleLogo = 2;
else if (OrigIconBig >= 64) ScaleLogo = 4;
else ScaleLogo = 8;

// Apply scale factor
GlobalConfig.IconSizes[ICON_SIZE_BIG] *= ScaleLogo;
}

#if REFIT_DEBUG > 0
MsgStr = PoolPrint (
L"LoaderDevicePartUUID Value for SystemD:- '%s'",
EspGUID
);
ALT_LOG(1, LOG_LINE_NORMAL, L"%s", MsgStr);
MY_FREE_POOL(MsgStr);
#endif
BootLogoImage = LoadOSIcon (NULL, EXIT_SPLASH, TRUE);
if (BootLogoImage == NULL) {
TmpStr = NULL;

Status = EfivarSetRaw (
&SystemdGuid, L"LoaderDevicePartUUID",
EspGUID, StrLen (EspGUID) * 2 + 2, FALSE
);
#if REFIT_DEBUG > 0
if (EFI_ERROR(Status)) {
if (OSType == 'L') {
GuessLinuxDistribution (&TmpStr, Volume, Filename, FALSE);
}

if (TmpStr == NULL) {
TmpStr = StrDuplicate (Volume->OSIconName);
}

ToLower (TmpStr);

BootLogoImage = LoadOSIcon (
TmpStr,
(OSType == 'L') ? L"linux" : L"windows",
TRUE
);

MY_FREE_POOL(TmpStr);
}

if (BootLogoImage != NULL) {
BltImageAlpha (
BootLogoImage,
(ScreenW - BootLogoImage->Width ) >> 1,
(ScreenH - BootLogoImage->Height) >> 1,
&(GlobalConfig.ScreenBackground->PixelData[0])
);

// Avoid mere flash
//
// Wait 0.75 seconds
// DA-TAG: 100 Loops == 1 Sec
RefitStall (75);
}

if (ScreenW > 1024 && ScreenH > 1024) {
// Reset to stashed size
GlobalConfig.IconSizes[ICON_SIZE_BIG] = OrigIconBig;
}

MY_FREE_IMAGE(BootLogoImage);
} // if !Verbose

if (OSType == 'L' && GlobalConfig.WriteSystemdVars) {
// Inform SystemD of RefindPlus ESP
EspGUID = GuidAsString (&(SelfVolume->PartGuid));

#if REFIT_DEBUG > 0
MsgStr = PoolPrint (
L"'%r' When Setting 'LoaderDevicePartUUID' UEFI Variable",
Status
L"LoaderDevicePartUUID:- '%s'",
EspGUID
);
ALT_LOG(1, LOG_STAR_SEPARATOR, L"WARN: '%s'", MsgStr);
LOG_MSG("\n\n");
LOG_MSG("WARN: %s", MsgStr);
ALT_LOG(1, LOG_LINE_NORMAL, L"%s", MsgStr);
MY_FREE_POOL(MsgStr);
}
#endif
#endif

Status = EfivarSetRaw (
&SystemdGuid, L"LoaderDevicePartUUID",
EspGUID, StrLen (EspGUID) * 2 + 2, FALSE
);
#if REFIT_DEBUG > 0
if (EFI_ERROR(Status)) {
MsgStr = PoolPrint (
L"'%r' When Setting 'LoaderDevicePartUUID' UEFI Variable",
Status
);
ALT_LOG(1, LOG_STAR_SEPARATOR, L"WARN: '%s'", MsgStr);
LOG_MSG("\n\n");
LOG_MSG("WARN: %s", MsgStr);
MY_FREE_POOL(MsgStr);
}
#endif

MY_FREE_POOL(EspGUID);
} // if GlobalConfig.WriteSystemdVars
MY_FREE_POOL(EspGUID);
} // if GlobalConfig.WriteSystemdVars
} // if IsBoot && OSType

// Store loader name if booting and set to do so
if (BootSelection != NULL) {
186 changes: 113 additions & 73 deletions BootMaster/launch_legacy.c
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
*
* Modifications distributed under the preceding terms.
*/
@@ -63,7 +63,6 @@

extern BOOLEAN IsBoot;
extern BOOLEAN DisplayLoader;
extern EG_PIXEL StdBackgroundPixel;
extern REFIT_MENU_SCREEN *MainMenu;

#ifndef __MAKEWITH_GNUEFI
@@ -515,118 +514,171 @@ EFI_STATUS StartLegacyImageList (
return Status;
} // static EFI_STATUS StartLegacyImageList()

VOID StartLegacy (
static
EG_IMAGE * LegacyHelper (
IN LEGACY_ENTRY *Entry,
IN CHAR16 *SelectionName
IN CHAR16 *SelectionName,
IN BOOLEAN TypeMac
) {
EFI_STATUS Status;
UINTN ErrorInStep;
CHAR16 *MsgStrA;
EG_IMAGE *BootLogoImage;
EFI_DEVICE_PATH_PROTOCOL *DiscoveredPathList[MAX_DISCOVERED_PATHS];
CHAR16 *MsgStrA;
EG_IMAGE *BootLogoImage; // Must be freed by Caller


LOG_SEP(L"X");
LOG_INCREMENT();
BREAD_CRUMB(L"%a: 1 - START", __func__);
IsBoot = TRUE;
if (TypeMac) {
MsgStrA = L"Load Legacy Bootcode:- 'Mac-Style'";
}
else {
MsgStrA = L"Load Legacy Bootcode:- 'UEFI-Style'";
}
BeginExternalScreen (TRUE, MsgStrA);

BREAD_CRUMB(L"%a: 2", __func__);
MsgStrA = L"Load 'Mac-Style' Legacy Bootcode";
BeginExternalScreen (TRUE, MsgStrA);
if ((MyStrStr (Entry->Volume->OSName, L"Windows") && !(GlobalConfig.DisableBootLogo & DISABLE_BOOTLOGO_WIN)) ||
(MyStrStr (Entry->Volume->OSName, L"Linux" ) && !(GlobalConfig.DisableBootLogo & DISABLE_BOOTLOGO_LIN))
) {
BREAD_CRUMB(L"%a: 2a 1", __func__);
BootLogoImage = LoadOSIcon (NULL, EXIT_SPLASH, TRUE);

BREAD_CRUMB(L"%a: 2a 2", __func__);
if (BootLogoImage == NULL) {
BREAD_CRUMB(L"%a: 2a 2a 1", __func__);
BootLogoImage = LoadOSIcon (
Entry->Volume->OSIconName,
L"legacy", TRUE
);
BREAD_CRUMB(L"%a: 2a 2a 2", __func__);
}
BREAD_CRUMB(L"%a: 2a 3", __func__);
}
else {
BREAD_CRUMB(L"%a: 2b 1", __func__);
BootLogoImage = NULL;
}

BREAD_CRUMB(L"%a: 3", __func__);
BootLogoImage = LoadOSIcon (
Entry->Volume->OSIconName,
L"legacy", TRUE
);

BREAD_CRUMB(L"%a: 4", __func__);
if (BootLogoImage != NULL) {
BREAD_CRUMB(L"%a: 4a 1", __func__);
BREAD_CRUMB(L"%a: 3a 1", __func__);
BltImageAlpha (
BootLogoImage,
(ScreenW - BootLogoImage->Width ) >> 1,
(ScreenH - BootLogoImage->Height) >> 1,
&StdBackgroundPixel
&(GlobalConfig.ScreenBackground->PixelData[0])
);
BREAD_CRUMB(L"%a: 4a 2", __func__);

BREAD_CRUMB(L"%a: 3a 2", __func__);
// Avoid mere flash
//
// Wait 0.75 seconds
// DA-TAG: 100 Loops == 1 Sec
RefitStall (75);
}

BREAD_CRUMB(L"%a: 5", __func__);
BREAD_CRUMB(L"%a: 4", __func__);
if (IsBoot) {
BREAD_CRUMB(L"%a: 4a 1", __func__);
StoreLoaderName (SelectionName);
}

#if REFIT_DEBUG > 0
ALT_LOG(1, LOG_LINE_NORMAL,
L"%s for '%s'",
MsgStrA, SelectionName
);
#endif

BREAD_CRUMB(L"%a: 5 - END:- VOID", __func__);
LOG_DECREMENT();
LOG_SEP(L"X");

return BootLogoImage; // Must be freed by Caller
} // static EG_IMAGE * LegacyHelper()

VOID StartLegacy (
IN LEGACY_ENTRY *Entry,
IN CHAR16 *SelectionName
) {
EFI_STATUS Status;
UINTN ErrorInStep;
CHAR16 *MsgStrA;
EG_IMAGE *BootLogoImage;
EFI_DEVICE_PATH_PROTOCOL *DiscoveredPathList[MAX_DISCOVERED_PATHS];


LOG_SEP(L"X");
LOG_INCREMENT();
BREAD_CRUMB(L"%a: 1 - START", __func__);
IsBoot = TRUE;

BREAD_CRUMB(L"%a: 2", __func__);
BootLogoImage = LegacyHelper (Entry, SelectionName, TRUE);

BREAD_CRUMB(L"%a: 3", __func__);
if (Entry->Volume->IsMbrPartition) {
BREAD_CRUMB(L"%a: 5a 1", __func__);
BREAD_CRUMB(L"%a: 3a 1", __func__);
ActivateMbrPartition (
Entry->Volume->WholeDiskBlockIO,
Entry->Volume->MbrPartitionIndex
);
BREAD_CRUMB(L"%a: 5a 2", __func__);
BREAD_CRUMB(L"%a: 3a 2", __func__);
}

BREAD_CRUMB(L"%a: 6", __func__);
BREAD_CRUMB(L"%a: 4", __func__);
if (Entry->Volume->WholeDiskDevicePath != NULL &&
Entry->Volume->DiskKind != DISK_KIND_OPTICAL
) {
BREAD_CRUMB(L"%a: 6a 1", __func__);
BREAD_CRUMB(L"%a: 4a 1", __func__);
WriteBootDiskHint (Entry->Volume->WholeDiskDevicePath);
BREAD_CRUMB(L"%a: 6a 2", __func__);
BREAD_CRUMB(L"%a: 4a 2", __func__);
}

BREAD_CRUMB(L"%a: 7", __func__);
BREAD_CRUMB(L"%a: 5", __func__);
ExtractLegacyLoaderPaths (
DiscoveredPathList,
MAX_DISCOVERED_PATHS,
LegacyLoaderList
);

BREAD_CRUMB(L"%a: 8", __func__);
StoreLoaderName (SelectionName);

#if REFIT_DEBUG > 0
LOG_MSG("%s for '%s'", MsgStrA, SelectionName);
ALT_LOG(1, LOG_LINE_NORMAL,
L"%s for '%s'",
MsgStrA, SelectionName
);
#endif

BREAD_CRUMB(L"%a: 9", __func__);
BREAD_CRUMB(L"%a: 6", __func__);
ErrorInStep = 0;
MY_FREE_IMAGE(BootLogoImage);
Status = StartLegacyImageList (
DiscoveredPathList,
Entry->LoadOptions,
&ErrorInStep
);

BREAD_CRUMB(L"%a: 10", __func__);
BREAD_CRUMB(L"%a: 7", __func__);
if (Status == EFI_NOT_FOUND) {
BREAD_CRUMB(L"%a: 10a 1", __func__);
BREAD_CRUMB(L"%a: 7a 1", __func__);
if (ErrorInStep == 1) {
BREAD_CRUMB(L"%a: 10a 1a 1", __func__);
BREAD_CRUMB(L"%a: 7a 1a 1", __func__);
SwitchToText (FALSE);

BREAD_CRUMB(L"%a: 10a 1a 2", __func__);
BREAD_CRUMB(L"%a: 7a 1a 2", __func__);
MsgStrA = L"Ensure Latest Firmware Updates Are Installed";
REFIT_CALL_2_WRAPPER(gST->ConOut->SetAttribute, gST->ConOut, ATTR_ERROR);
PrintUglyText (MsgStrA, NEXTLINE);
REFIT_CALL_2_WRAPPER(gST->ConOut->SetAttribute, gST->ConOut, ATTR_BASIC);
BREAD_CRUMB(L"%a: 10a 1a 3", __func__);
BREAD_CRUMB(L"%a: 7a 1a 3", __func__);

#if REFIT_DEBUG > 0
LOG_MSG("** WARN: %s", MsgStrA);
LOG_MSG("\n\n");
#endif

BREAD_CRUMB(L"%a: 10a 1a 4", __func__);
BREAD_CRUMB(L"%a: 7a 1a 4", __func__);
PauseForKey();
BREAD_CRUMB(L"%a: 10a 1a 5", __func__);
BREAD_CRUMB(L"%a: 7a 1a 5", __func__);
SwitchToGraphics();
}
else if (ErrorInStep == 3) {
BREAD_CRUMB(L"%a: 10a 1b 1", __func__);
BREAD_CRUMB(L"%a: 7a 1b 1", __func__);
SwitchToText (FALSE);

BREAD_CRUMB(L"%a: 10a 1b 2", __func__);
BREAD_CRUMB(L"%a: 7a 1b 2", __func__);
MsgStrA = L"Firmware Refused to Boot from Selected Volume";
REFIT_CALL_2_WRAPPER(gST->ConOut->SetAttribute, gST->ConOut, ATTR_ERROR);
PrintUglyText (MsgStrA, NEXTLINE);
@@ -640,7 +692,7 @@ VOID StartLegacy (
#if REFIT_DEBUG > 0
LOG_MSG("\n");
#endif
BREAD_CRUMB(L"%a: 10a 1b 2a 1", __func__);
BREAD_CRUMB(L"%a: 7a 1b 2a 1", __func__);
MsgStrA = L"Legacy Boot from External Drive *IS NOT* Well Supported by Apple Firmware";
PrintUglyText (MsgStrA, NEXTLINE);
#if REFIT_DEBUG > 0
@@ -652,18 +704,18 @@ VOID StartLegacy (
LOG_MSG("\n\n");
#endif

BREAD_CRUMB(L"%a: 10a 1b 3", __func__);
BREAD_CRUMB(L"%a: 7a 1b 3", __func__);
PauseForKey();

BREAD_CRUMB(L"%a: 10a 1b 4", __func__);
BREAD_CRUMB(L"%a: 7a 1b 4", __func__);
SwitchToGraphics();
} // if/else ErrorInStep
} // if Status == EFI_NOT_FOUND

BREAD_CRUMB(L"%a: 11", __func__);
BREAD_CRUMB(L"%a: 8", __func__);
FinishExternalScreen();

BREAD_CRUMB(L"%a: 12 - END:- VOID", __func__);
BREAD_CRUMB(L"%a: 9 - END:- VOID", __func__);
LOG_DECREMENT();
LOG_SEP(L"X");
} // VOID StartLegacy()
@@ -674,25 +726,15 @@ VOID StartLegacyUEFI (
CHAR16 *SelectionName
) {
CHAR16 *MsgStrA;
CHAR16 *MsgStrB;
EG_IMAGE *BootLogoImage;


IsBoot = TRUE;

MsgStrA = L"Load 'UEFI-Style' Legacy Bootcode";
BeginExternalScreen (TRUE, MsgStrA);
StoreLoaderName (SelectionName);

#if REFIT_DEBUG > 0
LOG_MSG("%s for '%s'", MsgStrA, SelectionName);
ALT_LOG(1, LOG_LINE_NORMAL,
L"%s for '%s'",
MsgStrA, SelectionName
);
#endif
BootLogoImage = LegacyHelper (Entry, SelectionName, FALSE);

UninitRefitLib();
BdsLibConnectDevicePath (Entry->BdsOption->DevicePath);
MY_FREE_IMAGE(BootLogoImage);
BdsLibDoLegacyBoot (Entry->BdsOption);

// There was a failure if we get here.
@@ -701,17 +743,15 @@ VOID StartLegacyUEFI (
#endif
ReinitRefitLib();

MsgStrB = PoolPrint (L"Failure on \"%s\"", MsgStrA);
MsgStrA = L"Failure on Loading 'UEFI-Style' Legacy Bootcode";

#if REFIT_DEBUG > 0
ALT_LOG(1, LOG_LINE_NORMAL, L"%s", MsgStrB);
ALT_LOG(1, LOG_LINE_NORMAL, L"%s", MsgStrA);
#endif

Print(L"%s", MsgStrB);
Print(L"%s", MsgStrA);
PauseForKey();

MY_FREE_POOL(MsgStrB);

FinishExternalScreen();
} // static VOID StartLegacyUEFI()

@@ -917,7 +957,7 @@ VOID AddLegacyEntryUEFI (
}
if (Entry->me.Image == NULL) {
Entry->me.Image = LoadOSIcon (
L"legacy", L"legacy", TRUE
L"legacy", L"legacy", FALSE
);
}
Entry->LoadOptions = (DiskType == BBS_CDROM)
79 changes: 67 additions & 12 deletions BootMaster/linux.c
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
* Portions Copyright (c) 2021 Joe van Tunen (joevt@shaw.ca)
*
* Modifications distributed under the preceding terms.
@@ -489,6 +489,12 @@ VOID GuessLinuxDistribution (
CHAR16 *LoaderPath,
BOOLEAN FirstOnly
) {
UINTN i;
CHAR16 *LinuxName;
CHAR16 *ShowName; // *DO NOT* Free
BOOLEAN Found;


LOG_SEP(L"X");
LOG_INCREMENT();
BREAD_CRUMB(L"%a: 1 - START", __func__);
@@ -504,40 +510,89 @@ VOID GuessLinuxDistribution (
if (!FirstOnly || *OSIconName == NULL) {
BREAD_CRUMB(L"%a: 4a 1", __func__);
ParseReleaseFile (OSIconName, Volume, L"etc\\lsb-release", FirstOnly);
BREAD_CRUMB(L"%a: 4a 2", __func__);
}

// DA-TAG: Strip out misc unwanted
BREAD_CRUMB(L"%a: 5", __func__);
DeleteItemFromCsvList (L"gnu", OSIconName);
DeleteItemFromCsvList (L"linux", OSIconName);

BREAD_CRUMB(L"%a: 6", __func__);
if (FirstOnly && *OSIconName != NULL) {
BREAD_CRUMB(L"%a: 6a 1 - END:- OSIconNameList = %s", __func__, *OSIconName);
LOG_DECREMENT();
LOG_SEP(L"X");

return;
}

// Search for clues in kernel filename
BREAD_CRUMB(L"%a: 7", __func__);
if (FindSubStr (LoaderPath, L".fc")) {
BREAD_CRUMB(L"%a: 5a 1 - Fedora Loader", __func__);
if (FirstOnly && *OSIconName == NULL) {
BREAD_CRUMB(L"%a: 5a 1a 1", __func__);
BREAD_CRUMB(L"%a: 7a 1 - Fedora Loader", __func__);
if (FirstOnly) {
BREAD_CRUMB(L"%a: 7a 1a 1", __func__);
*OSIconName = StrDuplicate (L"Fedora");
}
else {
BREAD_CRUMB(L"%a: 5a 1b 1", __func__);
BREAD_CRUMB(L"%a: 7a 1b 1", __func__);
MergeUniqueStrings (OSIconName, L"fedora", L',');
BREAD_CRUMB(L"%a: 7a 1b 2", __func__);
}
BREAD_CRUMB(L"%a: 5a 2", __func__);
BREAD_CRUMB(L"%a: 7a 2", __func__);
}
else if (FindSubStr (LoaderPath, L".el")) {
BREAD_CRUMB(L"%a: 5b 1 - RedHat Loader", __func__);
if (FirstOnly && *OSIconName == NULL) {
BREAD_CRUMB(L"%a: 5b 1a 1", __func__);
BREAD_CRUMB(L"%a: 7b 1 - RedHat Loader", __func__);
if (FirstOnly) {
BREAD_CRUMB(L"%a: 7b 1a 1", __func__);
*OSIconName = StrDuplicate (L"RedHat");
}
else {
BREAD_CRUMB(L"%a: 5b 1b 1", __func__);
BREAD_CRUMB(L"%a: 7b 1b 1", __func__);
MergeUniqueStrings (OSIconName, L"redhat", L',');
BREAD_CRUMB(L"%a: 7b 1b 2", __func__);
}
BREAD_CRUMB(L"%a: 5b 2", __func__);
BREAD_CRUMB(L"%a: 7b 2", __func__);
}
else {
BREAD_CRUMB(L"%a: 7c 1 - General Check", __func__);
Found = FALSE;

i = 0;
while (
!Found &&
(LinuxName = FindCommaDelimited (MAIN_LINUX_DISTROS, i++)) != NULL
) {
ShowName = GetShowName (LinuxName);
if (FindSubStr (LoaderPath, ShowName)) {
Found = TRUE;

if (FirstOnly) {
*OSIconName = StrDuplicate (ShowName);
}
else {
MergeUniqueStrings (OSIconName, ShowName, L',');
}
}

if (!Found && FindSubStr (LoaderPath, LinuxName)) {
Found = TRUE;

if (FirstOnly) {
*OSIconName = StrDuplicate (LinuxName);
}
else {
MergeUniqueStrings (OSIconName, LinuxName, L',');
}
}

MY_FREE_POOL(LinuxName);
} // while
BREAD_CRUMB(L"%a: 7c 2", __func__);
}

BREAD_CRUMB(L"%a: 6 - END:- VOID - Output OSIconNameList = %s", __func__,
BREAD_CRUMB(L"%a: 8 - END:- OSIconNameList = %s", __func__,
(*OSIconName) ? *OSIconName : L"NULL"
);
LOG_DECREMENT();
5 changes: 3 additions & 2 deletions BootMaster/main.c
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
* Portions Copyright (c) 2021 Joe van Tunen (joevt@shaw.ca)
*
* Modifications distributed under the preceding terms.
@@ -141,6 +141,7 @@ REFIT_CONFIG GlobalConfig = {
.RequestedScreenWidth = 0,
.RequestedScreenHeight = 0,
.BannerBottomEdge = 0,
.DisableBootLogo = 0,
.HideUIFlags = 0,
.SyncTrust = 0,
.MaxTags = 0,
@@ -3224,7 +3225,7 @@ VOID AboutRefindPlus (VOID) {
MY_FREE_POOL(TmpStr);

AddMenuInfoLine (AboutMenu, L"", FALSE);
AddMenuInfoLine (AboutMenu, L"Copyright 2020-2024 Dayo Akanji and Others", FALSE);
AddMenuInfoLine (AboutMenu, L"Copyright 2020-2025 Dayo Akanji and Others", FALSE);
AddMenuInfoLine (AboutMenu, L"Portions Copyright 2012-2024 Roderick W. Smith", FALSE);
AddMenuInfoLine (AboutMenu, L"Portions Copyright 2006-2010 Christoph Pfisterer", FALSE);
AddMenuInfoLine (AboutMenu, L"Portions Copyright The Intel Corporation and Others", FALSE);
7 changes: 3 additions & 4 deletions BootMaster/scan.c
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
*
* Modifications distributed under the preceding terms.
*/
@@ -180,9 +180,8 @@ VOID VetCSR (VOID) {
#endif
} // static VOID VetCSR()

static
CHAR16 * GetShowName (
CHAR16 *LinuxName
IN CHAR16 *LinuxName
) {
CHAR16 *ShowName;

@@ -196,7 +195,7 @@ CHAR16 * GetShowName (
else ShowName = LinuxName;

return ShowName;
} // static CHAR16 * GetShowName()
} // CHAR16 * GetShowName()

// Creates a copy of a menu screen.
// Returns a pointer to the copy of the menu screen.
3 changes: 2 additions & 1 deletion BootMaster/scan.h
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2021-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2021-2025 Dayo Akanji (sf.net/u/dakanji/profile)
*
* Modifications distributed under the preceding terms.
*/
@@ -177,6 +177,7 @@ VOID ScanFirmwareDefined (
IN UINTN TypeTag
);

CHAR16 * GetShowName (IN CHAR16 *LinuxName);
CHAR16 * SetVolJoin (
IN CHAR16 *InstanceName,
IN BOOLEAN ForBoot
3 changes: 1 addition & 2 deletions BootMaster/screenmgt.c
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@
*/
/*
* Modified for RefindPlus
* Copyright (c) 2020-2024 Dayo Akanji (sf.net/u/dakanji/profile)
* Copyright (c) 2020-2025 Dayo Akanji (sf.net/u/dakanji/profile)
* Portions Copyright (c) 2021 Joe van Tunen (joevt@shaw.ca)
*
* Modifications distributed under the preceding terms.
@@ -79,7 +79,6 @@ EG_PIXEL BlackPixel = { 0x00, 0x00, 0x00, 0 };
EG_PIXEL GrayPixel = { 0xBF, 0xBF, 0xBF, 0 };
EG_PIXEL WhitePixel = { 0xFF, 0xFF, 0xFF, 0 };

EG_PIXEL StdBackgroundPixel = { 0xBF, 0xBF, 0xBF, 0 };
EG_PIXEL MenuBackgroundPixel = { 0xBF, 0xBF, 0xBF, 0 };
EG_PIXEL DarkBackgroundPixel = { 0x00, 0x00, 0x00, 0 };

11 changes: 11 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -6,6 +6,17 @@
- Forced garbage collection worked on Apple Macs worked as fallback
* Errors messages were still shown and logged
* This bug was introduced in v0.14.0.AA (Commit c0906f1)
- Improves `BootLogo` Handling
* Misc optimisation and extension added
* Main visible extensions:
- Boot logos now displayed for both legacy and UEFI boot
- Enlarged Linux/Windows icons are shown as exit splash screen
- Changes can be leveraged to define custom exit splash screens
* `boot_outlogo` file will be used if present
* `boot_distroname` will be used if present otherwise
* `os_distroname` will be used if present otherwise
* Enabled by default but can be adjusted using a new `disable_bootlogo` configuration token
- This can be used to fully or partially disable boot logo display
- Improves `Shortcut Key` Handling
* No longer allocates keys based on the operating system type/name
- There was no way of knowing what would be loaded in many cases
2 changes: 1 addition & 1 deletion INFO.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RefindPlus ... A Boot Manager for Mac and PC
Copyright 2020-2024 Dayo Akanji and Others
Copyright 2020-2025 Dayo Akanji and Others
sf.net/u/dakanji/profile

Portions Copyright 2012-2024 Roderick W. Smith
1 change: 1 addition & 0 deletions README-Dev.md
Original file line number Diff line number Diff line change
@@ -94,6 +94,7 @@ decline_help_text |Disables feature that sets screen text to complementary c
decouple_key_f10 |Unmaps the `F10` key from native screenshots (the `\` key remains mapped)
disable_apfs_load |Disables inbuilt provision of APFS filesystem capability
disable_apfs_sync |Disables feature allowing direct APFS/FileVault boot (Without "PreBoot")
disable_bootlogo |Disables display of boot logos on loading some items if required
disable_check_amfi |Disables AMFI Checks on Mac OS if required
disable_check_compat |Disables Mac version compatibility checks if required
disable_pass_gop_thru |Disables feature that provides GOP instance on UGA for some loading screens
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -172,7 +172,7 @@ Significant visible implementation differences vis-a-vis the upstream base are:
- > The RefindPlus implementation maintains consistency with how other configuration tokens are handled.
- **UI Scaling:** WQHD monitors are correctly determined not to be HiDPI monitors and UI elements are not scaled up on such monitors when the RefindPlus-specific `scale_ui` configuration token is set to automatically detect the screen resolution. RefindPlus also takes vertically orientated screens into account and additionally scales UI elements down when low resolution screens (less than 1025px on the longest edge) are detected.
- > Additionally, UI elements on extremely high resultion screens (greater than 5999px on the longest edge) receive a `4X scaling` as opposed to the `2X scaling` applied for standard HiDPI screens.
- **Loader Icons:** RefindPlus defaults to preferring generic icons for loaders ahead of the slower to load custom icons where possible. The upstream icon search implementation involves only loading such icons after a search for custom icons has not turned anything up.
- **Loader Icons:** RefindPlus prefers `os_windows` and `boot_windows` icon files, if present, over `os_win` and `boot_win` and the `win8` variants. Separately, RefindPlus defaults to preferring generic icons for loaders ahead of the slower to load custom icons where possible. The upstream icon search implementation involves only loading such icons after a search for custom icons has not turned anything up.
- > Activate the RefindPlus-specific `decline_help_icon` configuration token to use the upstream icon search implementation instead of the RefindPlus default.
- **GOP Driver Provision:** RefindPlus attempts to ensure that UEFI 2.x GOP drivers are available on EFI 1.x units by attempting to reload such drivers when it detects an absence of GOP on such units to permit the use of modern GPUs on legacy units.
- > Activate the RefindPlus-specific `disable_reload_gop` configuration token to switch this feature off.
21 changes: 21 additions & 0 deletions config.conf-sample-Dev
Original file line number Diff line number Diff line change
@@ -133,6 +133,27 @@
#
#disable_apfs_sync

# RefindPlus defaults to displaying a "boot logo" icon before loading instances
# of Windows or Linux to mimic a BGRT. This feature can be leveraged to define
# custom exit splash screens by taking advantage of the following behaviour:
# - 'boot_outlogo' file will be used if present
# - 'boot_distroname' will be used if present otherwise
# - 'os_distroname' will be used if present otherwise
#
# The options below are available:
# Win - Disable Bootlogo for Windows Loaders
# Lin - Disable Bootlogo for Linux Stub Loaders
# All - Disable Bootlogo for Every Type of Loader
# Off - Disable Bootlogo for None of the Above (Default)
#
# NOTES:
# 1. The 'All' option takes precedence over others apart from 'Off'
# 2. The 'Off' option takes precedence over every other setting
#
# Inactive when commented out or set to 'Off' (Does not disable boot logos)
#
#disable_bootlogo Win

# Disable Apple Mobile File Integrity (AMFI) checks on booting MacOS. Whenever
# this token is active, RefindPlus will add a "amfi_get_out_of_my_way=1" boot
# argument which, along with System Integrity Protection (SIP), restricts

0 comments on commit adafab2

Please sign in to comment.