Index: branches/ErmaC/Enoch/Enoch.xcodeproj/project.pbxproj =================================================================== --- branches/ErmaC/Enoch/Enoch.xcodeproj/project.pbxproj (revision 2868) +++ branches/ErmaC/Enoch/Enoch.xcodeproj/project.pbxproj (revision 2869) @@ -1417,6 +1417,7 @@ E51057BF1BD174E0002FC0A7 /* IntelBdw.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = IntelBdw.txt; path = OptionalSettings/IntelBdw.txt; sourceTree = ""; }; E51057C01BD174FE002FC0A7 /* IntelSkl.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = IntelSkl.txt; path = OptionalSettings/IntelSkl.txt; sourceTree = ""; }; E51057C11BD17514002FC0A7 /* CrsActiveConfig.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = CrsActiveConfig.txt; path = OptionalSettings/CrsActiveConfig.txt; sourceTree = ""; }; + E511B6D21D187A3D00600004 /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ Index: branches/ErmaC/Enoch/i386/libsaio/disk.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2868) +++ branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2869) @@ -2207,7 +2207,7 @@ } //============================================================================== -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; @@ -2263,6 +2263,7 @@ // 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; Index: branches/ErmaC/Enoch/i386/libsaio/saio_internal.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/saio_internal.h (revision 2868) +++ branches/ErmaC/Enoch/i386/libsaio/saio_internal.h (revision 2869) @@ -112,7 +112,7 @@ 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); Index: branches/ErmaC/Enoch/i386/boot2/config.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/config.h (revision 2868) +++ branches/ErmaC/Enoch/i386/boot2/config.h (revision 2869) @@ -13,6 +13,10 @@ #define DEBUG_BOOT2 0 #define DEBUG_INTERRUPTS 0 +////////////////////////////////// drivers.c + +////////////////////////////////// + ////////////////////////////////// hpet.c #define DEBUG_HPET 0 Index: branches/ErmaC/Enoch/i386/boot2/drivers.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/drivers.c (revision 2868) +++ branches/ErmaC/Enoch/i386/boot2/drivers.c (revision 2869) @@ -46,6 +46,8 @@ #define DBG(x...) msglog(x) #endif +bool gUseCommonAndOSdir = true; + struct Module { struct Module *nextModule; long willLoad; @@ -168,6 +170,8 @@ long LoadDrivers( char *dirSpec ) { char dirSpecExtra[1024]; + long flags, ret=-1; + u_int32_t time; if ( InitDriverSupport() != 0 ) { @@ -175,7 +179,20 @@ } // ======================================== + 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) { @@ -201,26 +218,40 @@ // 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); + } } } } @@ -264,13 +295,13 @@ { 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); } @@ -344,7 +375,11 @@ return 0; } - strcat(dirSpec, "Extensions"); + if (!gUseCommonAndOSdir) + { + // means that we already provide a full path to the Extensions directory + strcat(dirSpec, "Extensions"); + } } index = 0; @@ -503,7 +538,7 @@ char *tmpBundlePath = 0; long ret = -1; - do{ + do { // Save the driver path. if(name) Index: branches/ErmaC/Enoch/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2868) +++ branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2869) @@ -699,7 +699,7 @@ } // 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); @@ -764,7 +764,7 @@ rescanBIOSDevice(gBIOSDev); } - bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount, false); + bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount); setBootGlobals(bvChain); setupDeviceList(&bootInfo->themeConfig); }