From 8ac0889dff415fb5b7c8b69593081c6e6d5029e3 Mon Sep 17 00:00:00 2001 From: srs5694 Date: Wed, 9 Dec 2015 21:25:21 -0500 Subject: [PATCH] Sort Fedora's rescue kernel (vmlinuz-0-rescue*) to the end of the list to keep it from becoming the default when kernel folding is enabled. --- Makefile | 2 +- NEWS.txt | 12 ++++++++++-- debian/changelog | 2 +- refind/main.c | 12 +++++++++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 829d1a6..c7d9799 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ MOK_DIR=mok GPTSYNC_DIR=gptsync EFILIB_DIR=EfiLib export EDK2BASE=/usr/local/UDK2014/MyWorkSpace -export REFIND_VERSION='L"0.10.0.13"' +export REFIND_VERSION='L"0.10.0.14"' # The "all" target builds with the TianoCore library if possible, but falls # back on the more easily-installed GNU-EFI library if TianoCore isn't diff --git a/NEWS.txt b/NEWS.txt index 0beac95..81d43bb 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,14 +1,22 @@ 0.10.1 (??/??/201?): -------------------- +- Modified time-based sorting of loaders in a single directory to push + anything starting with "vmlinuz-0-rescue" to the end of the list. Fedora + gives its rescue kernels filenames that begin with that string, and if + such a kernel happens to be the most recent, treating it normally will + cause it to become the default when kernel folding is in use. This is + almost certainly undesirable, so this change keeps the rescue kernel at + the end of the list instead, which is saner. + - Significantly reworked the project's Makefiles. This should have no impact on ordinary users, and even most developers should barely notice it; but it should make future extensions to additional platforms or building in different environments easier. - Added workaround to gptsync for issue with some Macs' EFIs that caused - the program to skip through all prompts accepting the default option. - This would normally cause gptsync to do nothing. + the program to skip through all prompts, thus accepting the default + option. This would normally cause gptsync to do nothing. - Added type code 53746F72-6167-11AA-AA11-00306543ECAC (Apple Core Storage, gdisk type AF05) to list of partition types recognized by gptsync. diff --git a/debian/changelog b/debian/changelog index afdd614..daaa9d4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -refind (0.10.0.12-0ppa1) wily; urgency=medium +refind (0.10.0.14-0ppa1) wily; urgency=medium * Version bump diff --git a/refind/main.c b/refind/main.c index 6b574ed..36cf202 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 -- 2.39.2