Index: branches/ErmaC/Enoch/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2832) +++ branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2833) @@ -153,81 +153,17 @@ entry_t kernelEntry; bootArgs->kaddr = bootArgs->ksize = 0; - // =============================================================================== - // OS X Mountain Lion 10.8 - if ( MacOSVerCurrent >= MacOSVer2Int("10.8") ) // Mountain Lion and Up! - { - // cparm - bool KPRebootOption = false; - bool HiDPIOption = false; - getBoolForKey(kRebootOnPanic, &KPRebootOption, &bootInfo->chameleonConfig); - if ( KPRebootOption ) - { - bootArgs->flags |= kBootArgsFlagRebootOnPanic; - } +// =============================================================================== - // cparm - getBoolForKey(kEnableHiDPI, &HiDPIOption, &bootInfo->chameleonConfig); + gMacOSVersion[0] = 0; + // TODO identify sierra as macOS + verbose("Booting on %s %s (%s)\n", (MacOSVerCurrent < MacOSVer2Int("10.8")) ? "Mac OS X" : "OS X", gBootVolume->OSFullVer, gBootVolume->OSBuildVer ); - if ( HiDPIOption ) - { - bootArgs->flags |= kBootArgsFlagHiDPI; - } - } + setupBooterArgs(); - // OS X Yosemite 10.10 - if ( MacOSVerCurrent >= MacOSVer2Int("10.10") ) // Yosemite and Up! - { - // Pike R. Alpha - bool FlagBlackOption = false; - getBoolForKey(kBlackMode, &FlagBlackOption, &bootInfo->chameleonConfig); - if ( FlagBlackOption ) - { - //bootArgs->flags |= kBootArgsFlagBlack; - bootArgs->flags |= kBootArgsFlagBlackBg; // Micky1979 - } - } +// =============================================================================== - // OS X El Capitan 10.11 - if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan and Up! - { - // ErmaC - int csrValue; - -#if 0 - /* - * A special BootArgs flag "kBootArgsFlagCSRBoot" - * is set in the Recovery or Installation environment. - * This flag is kind of overkill by turning off all the protections - */ - - if (isRecoveryHD) - { - // SIP can be controlled with or without FileNVRAM.kext (Pike R. Alpha) - bootArgs->flags |= (kBootArgsFlagCSRActiveConfig + kBootArgsFlagCSRConfigMode + kBootArgsFlagCSRBoot); - } -#endif - - bootArgs->flags |= kBootArgsFlagCSRActiveConfig; - - // Set limit to 7bit - if ( getIntForKey(kCsrActiveConfig, &csrValue, &bootInfo->chameleonConfig) && (csrValue >= 0 && csrValue <= 127) ) - { - bootArgs->csrActiveConfig = csrValue; - } - else - { - // zenith432 - bootArgs->csrActiveConfig = 0x67; - } - verbose("CsrActiveConfig set to 0x%x\n", bootArgs->csrActiveConfig); - bootArgs->csrCapabilities = CSR_VALID_FLAGS; - bootArgs->boot_SMC_plimit = 0; - } - - // =============================================================================== - execute_hook("ExecKernel", (void *)binary, NULL, NULL, NULL); ret = DecodeKernel(binary, @@ -962,9 +898,97 @@ } +// ========================================================================= +// +void setupBooterArgs() +{ + bool KPRebootOption = false; + bool HiDPIOption = false; + bool FlagBlackOption = false; + + // OS X Mountain Lion 10.8 + if ( MacOSVerCurrent >= MacOSVer2Int("10.8") ) // Mountain Lion and Up! + { + // cparm + getBoolForKey(kRebootOnPanic, &KPRebootOption, &bootInfo->chameleonConfig); + if ( KPRebootOption ) + { + bootArgs->flags |= kBootArgsFlagRebootOnPanic; + } + + // cparm + getBoolForKey(kEnableHiDPI, &HiDPIOption, &bootInfo->chameleonConfig); + + if ( HiDPIOption ) + { + bootArgs->flags |= kBootArgsFlagHiDPI; + } + } + + // OS X Yosemite 10.10 + if ( MacOSVerCurrent >= MacOSVer2Int("10.10") ) // Yosemite and Up! + { + // Pike R. Alpha + getBoolForKey(kBlackMode, &FlagBlackOption, &bootInfo->chameleonConfig); + if ( FlagBlackOption ) + { + // bootArgs->flags |= kBootArgsFlagBlack; + bootArgs->flags |= kBootArgsFlagBlackBg; // Micky1979 + } + } + + // OS X El Capitan 10.11 + if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan and Up! + { + // ErmaC + verbose("\n"); + int csrValue; + +#if 0 + /* + * A special BootArgs flag "kBootArgsFlagCSRBoot" + * is set in the Recovery or Installation environment. + * This flag is kind of overkill by turning off all the protections + */ + + if (isRecoveryHD) + { + // SIP can be controlled with or without FileNVRAM.kext (Pike R. Alpha) + bootArgs->flags |= (kBootArgsFlagCSRActiveConfig + kBootArgsFlagCSRConfigMode + kBootArgsFlagCSRBoot); + } +#endif + + bootArgs->flags |= kBootArgsFlagCSRActiveConfig; + + + // Set limit to 7bit + if ( getIntForKey(kCsrActiveConfig, &csrValue, &bootInfo->chameleonConfig) && (csrValue >= 0 && csrValue <= 127) ) + { + bootArgs->csrActiveConfig = csrValue; + + } + else + { + // zenith432 + bootArgs->csrActiveConfig = 0x67; + + } + +// =============================================================================== + verbose("CsrActiveConfig set to 0x%x\n", bootArgs->csrActiveConfig); + +// =============================================================================== + + bootArgs->csrCapabilities = CSR_VALID_FLAGS; + bootArgs->boot_SMC_plimit = 0; + } +} + // ========================================================================= +// ========================================================================= + /*! Selects a new BIOS device, taking care to update the global state appropriately. */ Index: branches/ErmaC/Enoch/i386/boot2/boot.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2832) +++ branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2833) @@ -354,9 +354,15 @@ void *work); */ -bool FlagBlackOption; +/* + * boot.c + */ +bool FlagBlackOption; // <-- This is first set in boot.c into setupBooterArgs function bool HiDPIOption; +void setupBooterArgs(void); +void csrInfo(int csrValue, bool custom); + struct compressed_kernel_header { u_int32_t signature; u_int32_t compress_type;