From b8b1a02cc8cd3519503b2731af83231bdeed689c Mon Sep 17 00:00:00 2001 From: srs5694 Date: Sun, 4 May 2014 18:40:01 -0400 Subject: [PATCH] Significant improvements to legacy-mode boot support, particularly on UEFI-based PCs. Version 0.8.0 release. --- EfiLib/BdsHelper.c | 159 +++++++--------- EfiLib/legacy.c | 349 ------------------------------------ EfiLib/legacy.h | 30 ++-- NEWS.txt | 12 +- docs/refind/bootmode.html | 4 +- docs/refind/configfile.html | 12 +- docs/refind/drivers.html | 2 +- docs/refind/features.html | 10 +- docs/refind/getting.html | 18 +- docs/refind/index.html | 2 +- docs/refind/installing.html | 2 +- docs/refind/linux.html | 2 +- docs/refind/revisions.html | 4 +- docs/refind/secureboot.html | 2 +- docs/refind/themes.html | 2 +- docs/refind/todo.html | 30 ++-- docs/refind/using.html | 8 +- filesystems/fsw_efi.c | 2 +- gptsync/gptsync.h | 2 +- refind.conf-sample | 11 +- refind.spec | 4 +- refind/lib.c | 22 ++- refind/lib.h | 1 + refind/main.c | 100 +++++++---- 24 files changed, 240 insertions(+), 550 deletions(-) diff --git a/EfiLib/BdsHelper.c b/EfiLib/BdsHelper.c index 2e70c7b..40f4483 100644 --- a/EfiLib/BdsHelper.c +++ b/EfiLib/BdsHelper.c @@ -6,6 +6,8 @@ #include "BdsHelper.h" +#include "legacy.h" +#include "../refind/screen.h" EFI_GUID gEfiLegacyBootProtocolGuid = { 0xdb9a1e3d, 0x45cb, 0x4abb, { 0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d }}; @@ -25,77 +27,69 @@ EFI_GUID gEfiLegacyBootProtocolGuid = { 0xdb9a1e3d, 0x45cb, 0x4abb, { 0x85, @param DeviceType The device type that we wish to enable **/ -VOID -UpdateBbsTable ( - IN UINT16 DeviceType - ) -{ - UINT16 Idx; - EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; - EFI_STATUS Status; - UINT16 HddCount = 0; - HDD_INFO *HddInfo = NULL; - UINT16 BbsCount = 0; - BBS_TABLE *LocalBbsTable = NULL; - - Status = gBS->LocateProtocol (&gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); - if (EFI_ERROR (Status)) { +VOID UpdateBbsTable (BDS_COMMON_OPTION *Option) { + UINT16 Idx; + EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; + EFI_STATUS Status; + UINT16 HddCount = 0; + HDD_INFO *HddInfo = NULL; + UINT16 BbsCount = 0; + BBS_TABLE *LocalBbsTable = NULL; + BBS_BBS_DEVICE_PATH *OptionBBS; + CHAR16 Desc[100]; + + Status = gBS->LocateProtocol (&gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); + if (EFI_ERROR (Status) || (Option == NULL)) { return; - } - - Status = LegacyBios->GetBbsInfo (LegacyBios, &HddCount, &HddInfo, &BbsCount, &LocalBbsTable); - - //Print (L"\n"); - //Print (L" NO Prio bb/dd/ff cl/sc Type Stat segm:offs\n"); - //Print (L"=============================================\n"); - - for (Idx = 0; Idx < BbsCount; Idx++) - { - if(LocalBbsTable[Idx].DeviceType == 0){ - continue; - } - - // Set devices of a particular type to BootPriority of 0. I believe 0 is the highest priority - if(LocalBbsTable[Idx].DeviceType == DeviceType){ - LocalBbsTable[Idx].BootPriority = 0; - } - -/* - Print ( - L" %02x: %04x %02x/%02x/%02x %02x/%02x %04x %04x %04x:%04x\n", - (UINTN) Idx, - (UINTN) LocalBbsTable[Idx].BootPriority, - (UINTN) LocalBbsTable[Idx].Bus, - (UINTN) LocalBbsTable[Idx].Device, - (UINTN) LocalBbsTable[Idx].Function, - (UINTN) LocalBbsTable[Idx].Class, - (UINTN) LocalBbsTable[Idx].SubClass, - (UINTN) LocalBbsTable[Idx].DeviceType, - (UINTN) * (UINT16 *) &LocalBbsTable[Idx].StatusFlags, - (UINTN) LocalBbsTable[Idx].BootHandlerSegment, - (UINTN) LocalBbsTable[Idx].BootHandlerOffset, - (UINTN) ((LocalBbsTable[Idx].MfgStringSegment << 4) + LocalBbsTable[Idx].MfgStringOffset), - (UINTN) ((LocalBbsTable[Idx].DescStringSegment << 4) + LocalBbsTable[Idx].DescStringOffset) - ); -*/ - } - - //Print(L"\n"); + } + + OptionBBS = (BBS_BBS_DEVICE_PATH *) Option->DevicePath; + Status = LegacyBios->GetBbsInfo (LegacyBios, &HddCount, &HddInfo, &BbsCount, &LocalBbsTable); + +// Print (L"\n"); +// Print (L" NO Prio bb/dd/ff cl/sc Type Stat segm:offs\n"); +// Print (L"=============================================\n"); + + for (Idx = 0; Idx < BbsCount; Idx++) { + if(LocalBbsTable[Idx].DeviceType == 0) { + continue; + } + + BdsBuildLegacyDevNameString (&LocalBbsTable[Idx], Idx, sizeof (Desc), Desc); + + // Set devices of a particular type to BootPriority of 0 or 1. 0 is the highest priority. + if (LocalBbsTable[Idx].DeviceType == OptionBBS->DeviceType) { + if (StriCmp(Desc, Option->Description) == 0) { + // This entry exactly matches what we're looking for; make it highest priority + LocalBbsTable[Idx].BootPriority = 0; + } else { + // This entry doesn't exactly match, but is the right disk type; make it a bit lower + // in priority. Done mainly as a fallback in case of string-matching weirdness. + LocalBbsTable[Idx].BootPriority = 1; + } // if/else + } // if + +// Print ( +// L" %02x: %04x %02x/%02x/%02x %02x/%02x %04x %04x %04x:%04x\n", +// (UINTN) Idx, +// (UINTN) LocalBbsTable[Idx].BootPriority, +// (UINTN) LocalBbsTable[Idx].Bus, +// (UINTN) LocalBbsTable[Idx].Device, +// (UINTN) LocalBbsTable[Idx].Function, +// (UINTN) LocalBbsTable[Idx].Class, +// (UINTN) LocalBbsTable[Idx].SubClass, +// (UINTN) LocalBbsTable[Idx].DeviceType, +// (UINTN) * (UINT16 *) &LocalBbsTable[Idx].StatusFlags, +// (UINTN) LocalBbsTable[Idx].BootHandlerSegment, +// (UINTN) LocalBbsTable[Idx].BootHandlerOffset, +// (UINTN) ((LocalBbsTable[Idx].MfgStringSegment << 4) + LocalBbsTable[Idx].MfgStringOffset), +// (UINTN) ((LocalBbsTable[Idx].DescStringSegment << 4) + LocalBbsTable[Idx].DescStringOffset) +// ); +// Print(L"%s\n", Desc); + + } // for } -// Internal helper function -// BOOLEAN ArrayContains(UINT16* Arr, UINT8 ArrLen, UINT8 Target) -// { -// UINT8 i; -// for(i = 0; i < ArrLen; i++) -// { -// if(Arr[i] == Target) -// return TRUE; -// } -// -// return FALSE; -// } - /** Boot the legacy system with the boot option @@ -113,31 +107,14 @@ BdsLibDoLegacyBoot ( { EFI_STATUS Status; EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; - BBS_BBS_DEVICE_PATH *OptionBBS; Status = gBS->LocateProtocol (&gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; } - OptionBBS = (BBS_BBS_DEVICE_PATH *) Option->DevicePath; - -// Print(L"\n\n"); -// Print(L"Option->Name='%s'\n", Option->OptionName); -// Print(L"Option->Number='%d'\n", Option->OptionNumber); -// Print(L"Option->Description='%s'\n", Option->Description); -// Print(L"Option->LoadOptionsSize='%d'\n",Option->LoadOptionsSize); -// Print(L"Option->BootCurrent='%d'\n",Option->BootCurrent); -// Print(L"Option->DevicePath->Type= '%d'\n", Option->DevicePath->Type); -// Print(L"Option->DevicePath->SubType= '%d'\n", Option->DevicePath->SubType); -// Print(L"Option->DevicePath->Length[0]= '%d'\n", Option->DevicePath->Length[0]); -// Print(L"Option->DevicePath->Length[1]= '%d'\n", Option->DevicePath->Length[1]); -// Print(L"OptionBBS->DeviceType='%d'\n",OptionBBS->DeviceType); -// Print(L"OptionBBS->StatusFlag='%d'\n",OptionBBS->StatusFlag); -// Print(L"OptionBBS->String[0]='%s'\n",OptionBBS->String); -// Print(L"About to legacy boot!\n"); -// PauseForKey(); - - UpdateBbsTable(OptionBBS->DeviceType); - - return LegacyBios->LegacyBoot (LegacyBios, (BBS_BBS_DEVICE_PATH *) Option->DevicePath, Option->LoadOptionsSize, Option->LoadOptions); -} \ No newline at end of file + + UpdateBbsTable(Option); + + return LegacyBios->LegacyBoot(LegacyBios, (BBS_BBS_DEVICE_PATH *) Option->DevicePath, + Option->LoadOptionsSize, Option->LoadOptions); +} diff --git a/EfiLib/legacy.c b/EfiLib/legacy.c index 7728f97..4578da0 100644 --- a/EfiLib/legacy.c +++ b/EfiLib/legacy.c @@ -709,7 +709,6 @@ BdsAddNonExistingLegacyBootOptions ( UINT16 OptionNumber; BOOLEAN Exist; - Print(L"Entering BdsAddNonExistingLegacyBootOptions()\n"); HddCount = 0; BbsCount = 0; LocalHddInfo = NULL; @@ -762,7 +761,6 @@ BdsAddNonExistingLegacyBootOptions ( &BbsIndex, &OptionNumber ); - Print(L"Boot entry #%d %s exist.\n", Index, Exist ? L"does" : L"does not"); if (!Exist) { // // Not found such type of legacy device in boot options or we found but it's disabled @@ -821,8 +819,6 @@ BdsAddNonExistingLegacyBootOptions ( FreePool (BootOrder); } - Print(L"Exiting BdsAddNonExistingLegacyBootOptions()\n"); - return Status; } @@ -963,7 +959,6 @@ BdsDeleteAllInvalidLegacyBootOptions ( // // Update BootOrder // - Print(L"About to call BdsDeleteBootOption() on Index == %d\n", Index); BdsDeleteBootOption ( BootOrder[Index], BootOrder, @@ -1018,7 +1013,6 @@ BdsDeleteAllInvalidLegacyBootOptions ( // // should delete // - Print(L"Second About to call BdsDeleteBootOption(), Index = %d\n", Index); BdsDeleteBootOption ( BootOrder[Index], BootOrder, @@ -1211,346 +1205,3 @@ BdsCreateDevOrder ( return Status; } - -/** - Add the legacy boot devices from BBS table into - the legacy device boot order. - - @retval EFI_SUCCESS The boot devices are added successfully. - @retval EFI_NOT_FOUND The legacy boot devices are not found. - @retval EFI_OUT_OF_RESOURCES Memmory or storage is not enough. - @retval EFI_DEVICE_ERROR Fail to add the legacy device boot order into EFI variable - because of hardware error. -**/ -EFI_STATUS -EFIAPI -BdsUpdateLegacyDevOrder ( - VOID - ) -{ - LEGACY_DEV_ORDER_ENTRY *DevOrder; - LEGACY_DEV_ORDER_ENTRY *NewDevOrder; - LEGACY_DEV_ORDER_ENTRY *Ptr; - LEGACY_DEV_ORDER_ENTRY *NewPtr; - UINTN DevOrderSize; - EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; - EFI_STATUS Status; - UINT16 HddCount; - UINT16 BbsCount; - HDD_INFO *LocalHddInfo; - BBS_TABLE *LocalBbsTable; - INTN Index; - INTN Index2; - UINTN *Idx; - UINTN FDCount; - UINTN HDCount; - UINTN CDCount; - UINTN NETCount; - UINTN BEVCount; - UINTN TotalSize; - UINTN HeaderSize; - UINT16 *NewFDPtr; - UINT16 *NewHDPtr; - UINT16 *NewCDPtr; - UINT16 *NewNETPtr; - UINT16 *NewBEVPtr; - UINT16 *NewDevPtr; - UINTN FDIndex; - UINTN HDIndex; - UINTN CDIndex; - UINTN NETIndex; - UINTN BEVIndex; - - Print(L"Entering BdsUpdateLegacyDevOrder()\n"); - - Idx = NULL; - FDCount = 0; - HDCount = 0; - CDCount = 0; - NETCount = 0; - BEVCount = 0; - TotalSize = 0; - HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16); - FDIndex = 0; - HDIndex = 0; - CDIndex = 0; - NETIndex = 0; - BEVIndex = 0; - NewDevPtr = NULL; - - Print(L"About to call EfiLibLocateProtocol()\n"); - Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID **) &LegacyBios); - if (EFI_ERROR (Status)) { - return Status; - } - - Print(L"About to call GetBbsInfo()\n"); - Status = LegacyBios->GetBbsInfo ( - LegacyBios, - &HddCount, - &LocalHddInfo, - &BbsCount, - &LocalBbsTable - ); - if (EFI_ERROR (Status)) { - return Status; - } - - Print(L"About to call BdsLibGetVariableAndSize()\n"); - DevOrder = BdsLibGetVariableAndSize ( - VAR_LEGACY_DEV_ORDER, - &gEfiLegacyDevOrderVariableGuid, - &DevOrderSize - ); - if (NULL == DevOrder) { - Print(L"DevOrder was NULL\n"); - return BdsCreateDevOrder (LocalBbsTable, BbsCount); - } - // - // First we figure out how many boot devices with same device type respectively - // - Print(L"About to enter for() loop, BbsCount = %d\n", BbsCount); - for (Index = 0; Index < BbsCount; Index++) { -// Print(L" Loop: %d\n", Index); - if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) || - (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM) - ) { - continue; - } - - switch (LocalBbsTable[Index].DeviceType) { - case BBS_FLOPPY: - FDCount++; - break; - - case BBS_HARDDISK: - HDCount++; - break; - - case BBS_CDROM: - CDCount++; - break; - - case BBS_EMBED_NETWORK: - NETCount++; - break; - - case BBS_BEV_DEVICE: - BEVCount++; - break; - - default: - break; - } - } - - Print(L"Done with for() loop; counted:\n Floppies: %d\n Hard disks: %d\n CD-ROMs: %d\n", FDCount, HDCount, CDCount); - TotalSize += (HeaderSize + FDCount * sizeof (UINT16)); - TotalSize += (HeaderSize + HDCount * sizeof (UINT16)); - TotalSize += (HeaderSize + CDCount * sizeof (UINT16)); - TotalSize += (HeaderSize + NETCount * sizeof (UINT16)); - TotalSize += (HeaderSize + BEVCount * sizeof (UINT16)); - - Print(L"About to allocate memory for NewDevOrder\n"); - NewDevOrder = AllocateZeroPool (TotalSize); - if (NULL == NewDevOrder) { - return EFI_OUT_OF_RESOURCES; - } - - - Print(L"About to copy FD entries\n"); - // - // copy FD - // - Ptr = DevOrder; - NewPtr = NewDevOrder; - NewPtr->BbsType = Ptr->BbsType; - NewPtr->Length = (UINT16) (sizeof (UINT16) + FDCount * sizeof (UINT16)); - Print(L" Copying FD entries; about to loop from 0 to %d\n", Ptr->Length / sizeof (UINT16) - 1); - for (Index = 0; Index < (INTN) (Ptr->Length / sizeof (UINT16) - 1); Index++) { -// Print(L" Looping: Index = %d\n", Index); - if (LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_IGNORE_ENTRY || - LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_DO_NOT_BOOT_FROM || - LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_FLOPPY - ) { - continue; - } - -// Print(L" About to set data\n"); - NewPtr->Data[FDIndex] = Ptr->Data[Index]; - FDIndex++; - } - Print(L" Done with for() loop\n"); - NewFDPtr = NewPtr->Data; - - Print(L"About to copy HD entries\n"); - // - // copy HD - // - Ptr = (LEGACY_DEV_ORDER_ENTRY *) (&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]); - NewPtr = (LEGACY_DEV_ORDER_ENTRY *) (&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]); - NewPtr->BbsType = Ptr->BbsType; - NewPtr->Length = (sizeof (UINT16) + HDCount * sizeof (UINT16)); - for (Index = 0; Index < (INTN) (Ptr->Length / sizeof (UINT16) - 1); Index++) { - if (LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_IGNORE_ENTRY || - LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_DO_NOT_BOOT_FROM || - LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_LOWEST_PRIORITY || - LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_HARDDISK - ) { - continue; - } - - NewPtr->Data[HDIndex] = Ptr->Data[Index]; - HDIndex++; - } - NewHDPtr = NewPtr->Data; - - Print(L"About to copy CD entries\n"); - // - // copy CD - // - Ptr = (LEGACY_DEV_ORDER_ENTRY *) (&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]); - NewPtr = (LEGACY_DEV_ORDER_ENTRY *) (&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]); - NewPtr->BbsType = Ptr->BbsType; - NewPtr->Length = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16)); - for (Index = 0; Index < (INTN) (Ptr->Length / sizeof (UINT16) - 1); Index++) { - if (LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_IGNORE_ENTRY || - LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_DO_NOT_BOOT_FROM || - LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_LOWEST_PRIORITY || - LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_CDROM - ) { - continue; - } - - NewPtr->Data[CDIndex] = Ptr->Data[Index]; - CDIndex++; - } - NewCDPtr = NewPtr->Data; - - // - // copy NET - // - Ptr = (LEGACY_DEV_ORDER_ENTRY *) (&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]); - NewPtr = (LEGACY_DEV_ORDER_ENTRY *) (&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]); - NewPtr->BbsType = Ptr->BbsType; - NewPtr->Length = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16)); - for (Index = 0; Index < (INTN) (Ptr->Length / sizeof (UINT16) - 1); Index++) { - if (LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_IGNORE_ENTRY || - LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_DO_NOT_BOOT_FROM || - LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_LOWEST_PRIORITY || - LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_EMBED_NETWORK - ) { - continue; - } - - NewPtr->Data[NETIndex] = Ptr->Data[Index]; - NETIndex++; - } - NewNETPtr = NewPtr->Data; - - // - // copy BEV - // - Ptr = (LEGACY_DEV_ORDER_ENTRY *) (&Ptr->Data[Ptr->Length / sizeof (UINT16) - 1]); - NewPtr = (LEGACY_DEV_ORDER_ENTRY *) (&NewPtr->Data[NewPtr->Length / sizeof (UINT16) -1]); - NewPtr->BbsType = Ptr->BbsType; - NewPtr->Length = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16)); - for (Index = 0; Index < (INTN) (Ptr->Length / sizeof (UINT16) - 1); Index++) { - if (LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_IGNORE_ENTRY || - LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_DO_NOT_BOOT_FROM || - LocalBbsTable[Ptr->Data[Index] & 0xFF].BootPriority == BBS_LOWEST_PRIORITY || - LocalBbsTable[Ptr->Data[Index] & 0xFF].DeviceType != BBS_BEV_DEVICE - ) { - continue; - } - - NewPtr->Data[BEVIndex] = Ptr->Data[Index]; - BEVIndex++; - } - NewBEVPtr = NewPtr->Data; - - Print(L"About to enter another loop; BbsCount = %d\n", BbsCount); - for (Index = 0; Index < BbsCount; Index++) { -// Print(L" Looping: Index = %d\n", Index); - if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) || - (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM) - ) { - continue; - } - - switch (LocalBbsTable[Index].DeviceType) { - case BBS_FLOPPY: - Idx = &FDIndex; - NewDevPtr = NewFDPtr; - break; - - case BBS_HARDDISK: - Idx = &HDIndex; - NewDevPtr = NewHDPtr; - break; - - case BBS_CDROM: - Idx = &CDIndex; - NewDevPtr = NewCDPtr; - break; - - case BBS_EMBED_NETWORK: - Idx = &NETIndex; - NewDevPtr = NewNETPtr; - break; - - case BBS_BEV_DEVICE: - Idx = &BEVIndex; - NewDevPtr = NewBEVPtr; - break; - - default: - Idx = NULL; - break; - } - // - // at this point we have copied those valid indexes to new buffer - // and we should check if there is any new appeared boot device - // - Print(L" Checking for new devices\n"); - if (Idx != NULL) { - for (Index2 = 0; Index2 < *Idx; Index2++) { - if ((NewDevPtr[Index2] & 0xFF) == (UINT16) Index) { - break; - } - } - - if (Index2 == *Idx) { - // - // Index2 == *Idx means we didn't find Index - // so Index is a new appeared device's index in BBS table - // insert it before disabled indexes. - // - for (Index2 = 0; Index2 < *Idx; Index2++) { - if ((NewDevPtr[Index2] & 0xFF00) == 0xFF00) { - break; - } - } - CopyMem (&NewDevPtr[Index2 + 1], &NewDevPtr[Index2], (*Idx - Index2) * sizeof (UINT16)); - NewDevPtr[Index2] = (UINT16) (Index & 0xFF); - (*Idx)++; - } - } - } - - FreePool (DevOrder); - - Print(L"About to call SetVariable()\n"); - Status = gRT->SetVariable ( - VAR_LEGACY_DEV_ORDER, - &gEfiLegacyDevOrderVariableGuid, - VAR_FLAG, - TotalSize, - NewDevOrder - ); - FreePool (NewDevOrder); - - Print(L"Returning from BdsUpdateLegacyDevOrder()\n"); - return Status; -} - diff --git a/EfiLib/legacy.h b/EfiLib/legacy.h index 618c755..0c6ca06 100644 --- a/EfiLib/legacy.h +++ b/EfiLib/legacy.h @@ -18,6 +18,9 @@ #ifndef __LEGACY_H_ #define __LEGACY_H_ +#define BBS_MEDIA_PRESENT 0x0800 +#define BBS_MEDIA_MAYBE_PRESENT 0x0400 + typedef UINT8 BBS_TYPE; #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE @@ -64,20 +67,19 @@ BdsDeleteAllInvalidLegacyBootOptions ( VOID ); -/** - Add the legacy boot devices from BBS table into - the legacy device boot order. +BOOLEAN +BdsIsLegacyBootOption ( + IN UINT8 *BootOptionVar, + OUT BBS_TABLE **BbsEntry, + OUT UINT16 *BbsIndex +); - @retval EFI_SUCCESS The boot devices are added successfully. - @retval EFI_NOT_FOUND The legacy boot devices are not found. - @retval EFI_OUT_OF_RESOURCES Memmory or storage is not enough. - @retval EFI_DEVICE_ERROR Fail to add the legacy device boot order into EFI variable - because of hardware error. -**/ -EFI_STATUS -EFIAPI -BdsUpdateLegacyDevOrder ( - VOID - ); +VOID +BdsBuildLegacyDevNameString ( + IN BBS_TABLE *CurBBSEntry, + IN UINTN Index, + IN UINTN BufSize, + OUT CHAR16 *BootString +); #endif \ No newline at end of file diff --git a/NEWS.txt b/NEWS.txt index 1f1024d..cb27b89 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,5 +1,13 @@ -0.7.10 (?/??/2014): -------------------- +0.8.0 (5/4/2014): +----------------- + +- The "dont_scan_volumes" parameter now also works with legacy-boot + volumes. Unlike with EFI volumes, where the option you pass must exactly + match an entire volume name, when applied to legacy-boot volumes, it + matches any part of the description that appears beneath the item when + you select it in the rEFInd main menu. + +- Can now boot in legacy mode from second (and probably later) hard disks! - rEFInd now limits the length of the firmware name string shown in the system information screen to 65 characters. This is done because at least diff --git a/docs/refind/bootmode.html b/docs/refind/bootmode.html index fcea3df..d0a21e6 100644 --- a/docs/refind/bootmode.html +++ b/docs/refind/bootmode.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Originally written: 3/14/2012; last Web page update: -4/20/2014, referencing rEFInd 0.7.9

+5/4/2014, referencing rEFInd 0.8.0

This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!

@@ -156,7 +156,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Identifying Your Hardware's Capabilities

-

Let's get the easy case out of the way: If you have a Macintosh with an Intel CPU, it's got EFI capabilities, and you'll be able to use rEFInd. Earlier Macs with PowerPC CPUs use OpenFirmware, and rEFInd can't be used with them.

+

Let's get the easy case out of the way: If you have a Macintosh with an Intel CPU, it's got EFI capabilities, and you'll be able to use rEFInd. Earlier Macs with PowerPC CPUs use OpenFirmware, and rEFInd can't be used with them. If your computer shipped new with Windows 8 or later, it almost certainly supports EFI; Microsoft requires that computers that bear a Windows 8 logo support EFI, and boot in EFI mode.

For everything else, it can be harder to tell. Your best bet is to locate a PDF version of your computer's or motherboard's manual and search it for the string EFI. Checking your firmware's options via the firmware setup utility (typically access by pressing Del, F2, F10, or F12 at boot time) is also worth doing, but you'll need to check every option yourself. Most EFI-enabled PCs include at least one reference to an option you can set; however, manuals and firmware setup tools often don't make a big deal of this feature, particularly on boards with relatively primitive EFI support. For instance, the manual for a Gigabyte GA-78LMT-S2P motherboard includes the following paragraph, on p. 28:

diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index aa0bc96..fd341b5 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Originally written: 3/14/2012; last Web page update: -4/20/2014, referencing rEFInd 0.7.9

+5/4/2014, referencing rEFInd 0.8.0

This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!

@@ -168,11 +168,13 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Another way to hide a boot loader is to move it into rEFInd's own directory. In order to keep rEFInd from showing up in its own menu, it ignores boot loaders in its own directory. This obviously includes the rEFInd binary file itself, but also anything else you might store there.

+

You can also use the dont_scan_volumes, dont_scan_dirs, and dont_scan_files tokens in refind.conf to hide entire volumes, directories, and individual files, respectively. Note that dont_scan_volumes works with both EFI and legacy scans, whereas the other two options make sense for hiding only EFI-mode boot loaders.

+

Setting OS Icons

-

In addition to hiding boot loaders, you can adjust their icons. You can do this in any of six ways for auto-detected boot loaders:

+

In addition to hiding boot loaders, you can adjust their icons. You can do this in any of seven ways for auto-detected boot loaders: