Chameleon

Chameleon Commit Details

Date:2017-03-25 17:08:21 (2 years 3 months ago)
Author:ErmaC
Commit:2869
Parents: 2868
Message:Reworked how load kext from Extra subfolder, update project (Micky1979)
Changes:
M/branches/ErmaC/Enoch/i386/libsaio/saio_internal.h
M/branches/ErmaC/Enoch/i386/boot2/config.h
M/branches/ErmaC/Enoch/i386/boot2/drivers.c
M/branches/ErmaC/Enoch/Enoch.xcodeproj/project.pbxproj
M/branches/ErmaC/Enoch/i386/boot2/boot.c
M/branches/ErmaC/Enoch/i386/libsaio/disk.c

File differences

branches/ErmaC/Enoch/Enoch.xcodeproj/project.pbxproj
14171417
14181418
14191419
1420
14201421
14211422
14221423
E51057BF1BD174E0002FC0A7 /* IntelBdw.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = IntelBdw.txt; path = OptionalSettings/IntelBdw.txt; sourceTree = "<group>"; };
E51057C01BD174FE002FC0A7 /* IntelSkl.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = IntelSkl.txt; path = OptionalSettings/IntelSkl.txt; sourceTree = "<group>"; };
E51057C11BD17514002FC0A7 /* CrsActiveConfig.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = CrsActiveConfig.txt; path = OptionalSettings/CrsActiveConfig.txt; sourceTree = "<group>"; };
E511B6D21D187A3D00600004 /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
branches/ErmaC/Enoch/i386/libsaio/disk.c
22072207
22082208
22092209
2210
2210
22112211
22122212
22132213
......
22632263
22642264
22652265
2266
22662267
22672268
22682269
}
//==============================================================================
BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count, bool sch)
BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count)
{
BVRef chain = NULL;
BVRef bvr = NULL;
// Looking for "Hide Partition" entries in 'hd(x,y)|uuid|"label" hd(m,n)|uuid|"label"' format,
// to be able to hide foreign partitions from the boot menu.
if ( (newBVR->flags & kBVFlagForeignBoot) )
{
char *start, *next = val;
branches/ErmaC/Enoch/i386/libsaio/saio_internal.h
112112
113113
114114
115
115
116116
117117
118118
extern int diskIsCDROM(BVRef bvr);
extern int biosDevIsCDROM(int biosdev);
extern BVRef getBVChainForBIOSDev(int biosdev);
extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count, bool sch);
extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count);
extern int freeFilteredBVChain(const BVRef chain);
extern int rawDiskRead(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
extern int rawDiskWrite(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
branches/ErmaC/Enoch/i386/boot2/config.h
1313
1414
1515
16
17
18
19
1620
1721
1822
#define DEBUG_BOOT2 0
#define DEBUG_INTERRUPTS 0
////////////////////////////////// drivers.c
//////////////////////////////////
////////////////////////////////// hpet.c
#define DEBUG_HPET 0
branches/ErmaC/Enoch/i386/boot2/drivers.c
4646
4747
4848
49
50
4951
5052
5153
......
168170
169171
170172
173
174
171175
172176
173177
......
175179
176180
177181
182
178183
184
185
186
187
188
189
190
191
192
193
194
195
179196
180197
181198
......
201218
202219
203220
204
205
206
221
222
223
224
225
226
207227
208228
209229
210
211
230
212231
213
214
215
216
232
233
234
235
236
237
238
239
240
217241
218
219
220
221
222
223
242
243
244
245
246
247
248
249
250
251
252
253
254
224255
225256
226257
......
264295
265296
266297
267
298
268299
269300
270301
271302
272303
273
304
274305
275306
276307
......
344375
345376
346377
347
378
379
380
381
382
348383
349384
350385
......
503538
504539
505540
506
541
507542
508543
509544
#define DBG(x...)msglog(x)
#endif
bool gUseCommonAndOSdir = true;
struct Module {
struct Module *nextModule;
long willLoad;
long LoadDrivers( char *dirSpec )
{
char dirSpecExtra[1024];
long flags, ret=-1;
u_int32_t time;
if ( InitDriverSupport() != 0 )
{
}
// ========================================
gUseCommonAndOSdir = false; // old behavior
ret = GetFileInfo("bt(0,0)/Extra/Extensions/", "Common", &flags, &time);
// if the boot partition contains /Extra/Extensions/Common there is no need
// to look else where because users will have also /Extra/Extensions/10.x
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory))
{
gUseCommonAndOSdir = true;
verbose("/Extra/Extensions/Common and /Extra/Extensions/%s in use.\n", gBootVolume->OSVersion);
//getchar();
}
// ========================================
// Load extra drivers if a hook has been installed.
if (LoadExtraDrivers_p != NULL)
{
// verbose("Attempting to loading drivers from \"Extra\" repository:\n");
// =====================================================================
// Secondly try to load drivers from Common folder
sprintf(dirSpecExtra, "bt(0,0)/Extra/Common/");
FileLoadDrivers(dirSpecExtra, 0);
// Secondly try to load drivers from Common folder if in use
if (gUseCommonAndOSdir)
{
sprintf(dirSpecExtra, "bt(0,0)/Extra/Extensions/Common");
FileLoadDrivers(dirSpecExtra, 0);
}
// =====================================================================
// Next try to load Extra extensions from the selected root partition.
strlcpy(dirSpecExtra, "/Extra/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
if (gUseCommonAndOSdir)
{
// If failed, then try to load Extra extensions from the boot partition
// in case we have a separate booter partition or a bt(0,0) aliased ramdisk.
if ( !(gBIOSBootVolume->biosdev == gBootVolume->biosdev && gBIOSBootVolume->part_no == gBootVolume->part_no)
|| (gRAMDiskVolume && gRAMDiskBTAliased) )
sprintf(dirSpecExtra, "bt(0,0)/Extra/Extensions/%s", gBootVolume->OSVersion);
FileLoadDrivers(dirSpecExtra, 0);
//verbose("gUseCommonAndOSdir = %s\n", dirSpecExtra);
//getchar();
}
else
{
strlcpy(dirSpecExtra, "/Extra/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
// Next try a specfic OS version folder ie 10.5
sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion[0]);
if (FileLoadDrivers(dirSpecExtra, 0) != 0) {
// Next we'll try the base
strlcpy(dirSpecExtra, "bt(0,0)/Extra/", sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra, 0);
// If failed, then try to load Extra extensions from the boot partition
// in case we have a separate booter partition or a bt(0,0) aliased ramdisk.
if ( !(gBIOSBootVolume->biosdev == gBootVolume->biosdev && gBIOSBootVolume->part_no == gBootVolume->part_no)
|| (gRAMDiskVolume && gRAMDiskBTAliased) )
{
// Next try a specfic OS version folder ie 10.12
sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion[0]);
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
// Next we'll try the base
strlcpy(dirSpecExtra, "bt(0,0)/Extra/", sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra, 0);
}
}
}
}
{
verbose("\t- Third party extensions search path: /Library/Extensions\n");
strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") mean 4096 - 9 = 4087 */
strcat(gExtensionsSpec, "Library/");
strcat(gExtensionsSpec, gUseCommonAndOSdir ? "Library/Extensions" : "Library/");
FileLoadDrivers(gExtensionsSpec, 0);
}
verbose("\t- Apple extensions search path: /System/Library/Extensions\n");
strlcpy(gExtensionsSpec, dirSpec, 4080); /* 4096 - sizeof("System/Library/") mean 4096 -16 = 4080 */
strcat(gExtensionsSpec, "System/Library/");
strcat(gExtensionsSpec, gUseCommonAndOSdir ? "System/Library/Extensions" : "System/Library/");
FileLoadDrivers(gExtensionsSpec, 0);
}
return 0;
}
strcat(dirSpec, "Extensions");
if (!gUseCommonAndOSdir)
{
// means that we already provide a full path to the Extensions directory
strcat(dirSpec, "Extensions");
}
}
index = 0;
char*tmpBundlePath = 0;
longret = -1;
do{
do {
// Save the driver path.
if(name)
branches/ErmaC/Enoch/i386/boot2/boot.c
699699
700700
701701
702
702
703703
704704
705705
......
764764
765765
766766
767
767
768768
769769
770770
}
// Create a separated bvr chain using the specified filters.
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount, false);
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
gBootVolume = selectBootVolume(bvChain);
rescanBIOSDevice(gBIOSDev);
}
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount, false);
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
setBootGlobals(bvChain);
setupDeviceList(&bootInfo->themeConfig);
}

Archive Download the corresponding diff file

Revision: 2869