X-Git-Url: https://code.delx.au/refind/blobdiff_plain/32fb076b277cc9e421d4a0c1cbcaab9cfee8c060..480ba418c97ece5557ac0efc5dc189ff19fb8b8f:/refind/main.c diff --git a/refind/main.c b/refind/main.c index 6b574ed..881ac38 100644 --- a/refind/main.c +++ b/refind/main.c @@ -1177,16 +1177,22 @@ INTN TimeComp(IN EFI_TIME *Time1, IN EFI_TIME *Time2) { return 0; } // INTN TimeComp() -// Adds a loader list element, keeping it sorted by date. Returns the new -// first element (the one with the most recent date). +// Adds a loader list element, keeping it sorted by date. EXCEPTION: Fedora's rescue +// kernel, which begins with "vmlinuz-0-rescue," should not be at the top of the list, +// since that will make it the default if kernel folding is enabled, so float it to +// the end. +// Returns the new first element (the one with the most recent date). static struct LOADER_LIST * AddLoaderListEntry(struct LOADER_LIST *LoaderList, struct LOADER_LIST *NewEntry) { struct LOADER_LIST *LatestEntry, *CurrentEntry, *PrevEntry = NULL; + BOOLEAN LinuxRescue = FALSE; LatestEntry = CurrentEntry = LoaderList; if (LoaderList == NULL) { LatestEntry = NewEntry; } else { - while ((CurrentEntry != NULL) && (TimeComp(&(NewEntry->TimeStamp), &(CurrentEntry->TimeStamp)) < 0)) { + if (StriSubCmp(L"vmlinuz-0-rescue", NewEntry->FileName)) + LinuxRescue = TRUE; + while ((CurrentEntry != NULL) && (LinuxRescue || (TimeComp(&(NewEntry->TimeStamp), &(CurrentEntry->TimeStamp)) < 0))) { PrevEntry = CurrentEntry; CurrentEntry = CurrentEntry->NextEntry; } // while @@ -2210,6 +2216,7 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) LoadDrivers(); ScanVolumes(); // Do before ReadConfig() because it needs SelfVolume->VolName ReadConfig(GlobalConfig.ConfigFilename); + SetVolumeIcons(); if (GlobalConfig.SpoofOSXVersion && GlobalConfig.SpoofOSXVersion[0] != L'\0') SetAppleOSInfo();