| 7943 | } |
| 7944 | |
| 7945 | EFI_STATUS LOADER_ENTRY::SetFSInjection () |
| 7946 | { |
| 7947 | EFI_STATUS Status; |
| 7948 | FSINJECTION_PROTOCOL *FSInject; |
| 7949 | XStringW SrcDir; |
| 7950 | //BOOLEAN InjectionNeeded = FALSE; |
| 7951 | //BOOLEAN BlockCaches = FALSE; |
| 7952 | FSI_STRING_LIST *Blacklist = 0; |
| 7953 | FSI_STRING_LIST *ForceLoadKexts = NULL; |
| 7954 | |
| 7955 | MsgLog ("Beginning FSInjection\n"); |
| 7956 | |
| 7957 | // get FSINJECTION_PROTOCOL |
| 7958 | Status = gBS->LocateProtocol(&gFSInjectProtocolGuid, NULL, (void **)&FSInject); |
| 7959 | if (EFI_ERROR(Status)) { |
| 7960 | //Print (L"- No FSINJECTION_PROTOCOL, Status = %s\n", efiStrError(Status)); |
| 7961 | MsgLog (" - ERROR: gFSInjectProtocolGuid not found!\n"); |
| 7962 | return EFI_NOT_STARTED; |
| 7963 | } |
| 7964 | |
| 7965 | // check if blocking of caches is needed |
| 7966 | if ( OSFLAG_ISSET(Flags, OSFLAG_NOCACHES) || LoadOptions.contains("-f") ) { |
| 7967 | MsgLog ("Blocking kext caches\n"); |
| 7968 | // BlockCaches = TRUE; |
| 7969 | // add caches to blacklist |
| 7970 | Blacklist = FSInject->CreateStringList(); |
| 7971 | if (Blacklist == NULL) { |
| 7972 | MsgLog (" - ERROR: Not enough memory!\n"); |
| 7973 | return EFI_NOT_STARTED; |
| 7974 | } |
| 7975 | |
| 7976 | /* |
| 7977 | From 10.7 to 10.9, status of directly restoring ESD files or update from Appstore cannot block kernel cache. because there are boot.efi and kernelcache file without kernel file. |
| 7978 | After macOS installed, boot.efi can call kernel file from S/L/Kernels. |
| 7979 | For this reason, long time ago, chameleon's user restored Base System.dmg to made USB installer and added kernel file in root and custom kexts in S/L/E. then used "-f" option. |
| 7980 | From 10.10+, boot.efi call only prelinkedkernel file without kernel file. we can never block only kernelcache. |
| 7981 | The use of these block caches is meaningless in modern macOS. Unlike the old days, we do not have to do the tedious task of putting the files needed for booting into the S/L/E. |
| 7982 | Caution! Do not add this list. If add this list, will see "Kernel cache load error (0xe)". This is just a guideline. |
| 7983 | by Sherlocks, 2017.11 |
| 7984 | */ |
| 7985 | |
| 7986 | // Installed/createinstallmedia |
| 7987 | //FSInject->AddStringToList(Blacklist, L"\\System\\Library\\PrelinkedKernels\\prelinkedkernel"); // 10.10+/10.13.4+ |
| 7988 | |
| 7989 | // Recovery |
| 7990 | //FSInject->AddStringToList(Blacklist, L"\\com.apple.recovery.boot\\kernelcache"); // 10.7 - 10.10 |
| 7991 | //FSInject->AddStringToList(Blacklist, L"\\com.apple.recovery.boot\\prelinkedkernel"); // 10.11+ |
| 7992 | |
| 7993 | // BaseSytem/InstallESD |
| 7994 | //FSInject->AddStringToList(Blacklist, L"\\kernelcache"); // 10.7 - 10.9/(10.7/10.8) |
| 7995 | |
| 7996 | // 1st stage - createinstallmedia |
| 7997 | //FSInject->AddStringToList(Blacklist, L"\\.IABootFiles\\kernelcache"); // 10.9/10.10 |
| 7998 | //FSInject->AddStringToList(Blacklist, L"\\.IABootFiles\\prelinkedkernel"); // 10.11 - 10.13.3 |
| 7999 | |
| 8000 | // 2nd stage - InstallESD/AppStore/startosinstall |
| 8001 | //FSInject->AddStringToList(Blacklist, L"\\Mac OS X Install Data\\kernelcache"); // 10.7 |
| 8002 | //FSInject->AddStringToList(Blacklist, L"\\OS X Install Data\\kernelcache"); // 10.8 - 10.10 |
nothing calls this directly
no test coverage detected