mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-25 17:38:22 +08:00
Add hack for broken NVRAM store sizes in Apple images
This commit is contained in:
parent
47637ef152
commit
1e1d5c6e17
@ -1279,6 +1279,17 @@ USTATUS FfsParser::findNextRawAreaItem(const UModelIndex & index, const UINT32 l
|
|||||||
nextItemType = Types::Volume;
|
nextItemType = Types::Volume;
|
||||||
nextItemSize = (UINT32)volumeHeader->FvLength;
|
nextItemSize = (UINT32)volumeHeader->FvLength;
|
||||||
nextItemOffset = offset - EFI_FV_SIGNATURE_OFFSET;
|
nextItemOffset = offset - EFI_FV_SIGNATURE_OFFSET;
|
||||||
|
|
||||||
|
// Hack for Apple images with an extra zero typo in NVRAM volume size.
|
||||||
|
uint32_t appleWrongSize = 0x2F0000;
|
||||||
|
uint32_t appleRightSize = 0x2EFC0;
|
||||||
|
if ((volumeHeader->FvLength == appleWrongSize)
|
||||||
|
&& UByteArray((const char *)&volumeHeader->FileSystemGuid, sizeof(EFI_GUID)) == NVRAM_MAIN_STORE_VOLUME_GUID
|
||||||
|
&& UByteArray((const char *)volumeHeader + appleRightSize + sizeof(EFI_GUID), sizeof(EFI_GUID)) == APPLE_UNKNOWN_STORE_VOLUME_GUID) {
|
||||||
|
msg(usprintf("%s: hack, fixing up NVRAM volume size from %Xh to %Xh", __FUNCTION__, volumeHeader->FvLength, appleRightSize), index);
|
||||||
|
nextItemSize = appleRightSize;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,10 @@ const UByteArray NVRAM_MAIN_STORE_VOLUME_GUID
|
|||||||
const UByteArray NVRAM_ADDITIONAL_STORE_VOLUME_GUID
|
const UByteArray NVRAM_ADDITIONAL_STORE_VOLUME_GUID
|
||||||
("\x24\x46\x50\x00\x59\x8A\xEB\x4E\xBD\x0F\x6B\x36\xE9\x61\x28\xE0", 16);
|
("\x24\x46\x50\x00\x59\x8A\xEB\x4E\xBD\x0F\x6B\x36\xE9\x61\x28\xE0", 16);
|
||||||
|
|
||||||
|
// TODO: Explore
|
||||||
|
const UByteArray APPLE_UNKNOWN_STORE_VOLUME_GUID
|
||||||
|
("\xE4\x0E\x81\x0A\x93\xBF\x59\x4B\xDD\xBC\xA2\x9D\xB4\x4B\x4A\x95", 16);
|
||||||
|
|
||||||
#define NVRAM_VSS_STORE_SIGNATURE 0x53535624 // $VSS
|
#define NVRAM_VSS_STORE_SIGNATURE 0x53535624 // $VSS
|
||||||
#define NVRAM_APPLE_SVS_STORE_SIGNATURE 0x53565324 // $SVS
|
#define NVRAM_APPLE_SVS_STORE_SIGNATURE 0x53565324 // $SVS
|
||||||
#define NVRAM_APPLE_NSS_STORE_SIGNATURE 0x53534E24 // $NSS
|
#define NVRAM_APPLE_NSS_STORE_SIGNATURE 0x53534E24 // $NSS
|
||||||
|
Loading…
Reference in New Issue
Block a user