Index: branches/meklort/i386/boot2/boot.c =================================================================== --- branches/meklort/i386/boot2/boot.c (revision 734) +++ branches/meklort/i386/boot2/boot.c (revision 735) @@ -193,12 +193,13 @@ execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL); // Notify modules that the kernel is about to be started - if (bootArgs->Video.v_display == VGA_TEXT_MODE) + if (bootArgs->Video.v_display == VGA_TEXT_MODE || gVerboseMode) { - setVideoMode( GRAPHICS_MODE, 0 ); // Draw gray screen. NOTE: no boot image, that's in the gui module #ifndef OPTION_ROM if(!gVerboseMode) drawColorRectangle(0, 0, DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 0x01); + setVideoMode( GRAPHICS_MODE, 0 ); + #endif } @@ -319,15 +320,10 @@ gBootVolume = selectBootVolume(bvChain); - // Intialize module system - if(init_module_system()) - { - load_all_modules(); - } + // Intialize module system, module sytem will + init_module_system(); - execute_hook("ModulesLoaded", NULL, NULL, NULL, NULL); - #ifndef OPTION_ROM // Loading preboot ramdisk if exists. loadPrebootRAMDisk(); Index: branches/meklort/i386/boot2/modules.c =================================================================== --- branches/meklort/i386/boot2/modules.c (revision 734) +++ branches/meklort/i386/boot2/modules.c (revision 735) @@ -72,6 +72,7 @@ if((UInt32)lookup_symbol != 0xFFFFFFFF) { + execute_hook("ModulesLoaded", NULL, NULL, NULL, NULL); return 1; } } Index: branches/meklort/i386/modules/KextPatcher/kext_patcher.c =================================================================== --- branches/meklort/i386/modules/KextPatcher/kext_patcher.c (revision 734) +++ branches/meklort/i386/modules/KextPatcher/kext_patcher.c (revision 735) @@ -40,6 +40,7 @@ bool patch_kext(TagPtr plist, char* plistbuffer, void* start); bool patch_gma_kexts(TagPtr plist, char* plistbuffer, void* start); bool patch_bcm_kext(TagPtr plist, char* plistbuffer, void* start); +bool patch_atheros_kext(TagPtr plist, char* plistbuffer, void* start); bool patch_hda_kext(TagPtr plist, char* plistbuffer, void* start); bool patch_hda_controller(TagPtr plist, char* plistbuffer, void* start); @@ -50,11 +51,12 @@ uint16_t patch_gma_deviceid = 0; uint16_t patch_bcm_deviceid = 0; +uint16_t patch_atheros_deviceid = 0; // TODO: add detection code uint16_t patch_hda_codec = 0x00; -#define NEEDS_PATCHING (patch_bcm_deviceid || patch_gma_deviceid || patch_hda_codec) +#define NEEDS_PATCHING (patch_bcm_deviceid || patch_gma_deviceid || patch_hda_codec || patch_atheros_deviceid) typedef struct z_mem { uint32_t alloc_size; @@ -396,6 +398,10 @@ return patch_hda_controller(plist, plistbuffer, start); } + else if(patch_atheros_deviceid && strcmp(bundleID, "com.apple.driver.AirPort.Atheros21") == 0) + { + return patch_atheros_kext(plist, plistbuffer, start); + } return false; } @@ -430,6 +436,10 @@ { patch_bcm_deviceid = current->device_id; } + else if(current->vendor_id == 0x168C && current->device_id == 0x002B) + { + patch_atheros_deviceid = current->device_id; + } break; } } @@ -585,7 +595,43 @@ return true; } +bool patch_atheros_kext(TagPtr plist, char* plistbuffer, void* start) +{ + TagPtr personality; + personality = XMLCastDict(XMLGetProperty(plist, kPropIOKitPersonalities)); + personality = XMLGetProperty(personality, (const char*)"Atheros Wireless LAN PCI"); + TagPtr match_names =XMLCastArray(XMLGetProperty(personality, (const char*)"IONameMatch")); + + char* new_str = malloc(sizeof("pci168c,xxxx")); + sprintf(new_str, "pci168c,%02x", patch_atheros_deviceid); + // Check to see if we *really* need to modify the plist, if not, return false + // so that *if* this were going ot be the only modified kext, the repacking code + // won't need to be executed. + int count = XMLTagCount(match_names); + while(count) + { + count--; + TagPtr replace = XMLGetElement(match_names, count); // Modify the second entry + char* orig_string = XMLCastString(replace); + if(strcmp(orig_string, new_str) == 0) return false; + } + + + + TagPtr replace = XMLGetElement(match_names, 0); // Modify the second entry + char* orig_string = XMLCastString(replace); + + verbose("Patching AirPortAtheros21.kext, replacing %s with %s\n", orig_string, new_str); + + // TODO: verify string doesn't exist first. + + replace_string(orig_string, new_str, plistbuffer + XMLCastStringOffset(replace), 10240); + return true; + +} + + bool patch_bcm_kext(TagPtr plist, char* plistbuffer, void* start) { TagPtr personality; @@ -609,7 +655,8 @@ if(strcmp(orig_string, new_str) == 0) return false; } - + verbose("Patching AppleAirPortBrcm4311.kext with %s\n", new_str); + TagPtr replace = XMLGetElement(match_names, 1); // Modify the second entry char* orig_string = XMLCastString(replace); @@ -678,15 +725,17 @@ if(XMLGetProperty(personality, (const char*)"Intel915")) { - verbose("Patching AppleIntelGMA950.kext\n"); - //getc(); + if((patch_gma_deviceid & 0xFF00) != 0xA000) // GMA3150 + { + verbose("Patching AppleIntelGMA950.kext\n"); + //getc(); - personality = XMLGetProperty(personality, (const char*)"Intel915"); - // IOAccelerator kext + personality = XMLGetProperty(personality, (const char*)"Intel915"); // IOAccelerator kext - offset = XMLCastStringOffset(XMLGetProperty(personality, (const char*)"IOPCIPrimaryMatch")); - replace_string("0x27A28086", newstring, plistbuffer + offset, 10240); - replace_word(0x27A28086, 0x8086 | (patch_gma_deviceid << 16), executable, zstream.total_out); + offset = XMLCastStringOffset(XMLGetProperty(personality, (const char*)"IOPCIPrimaryMatch")); + replace_string("0x27A28086", newstring, plistbuffer + offset, 10240); + replace_word(0x27A28086, 0x8086 | (patch_gma_deviceid << 16), executable, zstream.total_out); + } } else if(XMLGetProperty(personality, (const char*)"AppleIntelIntegratedFramebuffer")) Index: branches/meklort/i386/modules/GUI/gui.c =================================================================== --- branches/meklort/i386/modules/GUI/gui.c (revision 734) +++ branches/meklort/i386/modules/GUI/gui.c (revision 735) @@ -739,7 +739,7 @@ // set our screen structure with the mode width & height gui.screen.width = screen_params[0]; gui.screen.height = screen_params[1]; - + // load graphics otherwise fail and return if (loadGraphics() == 0) { loadThemeValues(&bootInfo->themeConfig); Index: branches/meklort/i386/modules/GUI/GUI_module.c =================================================================== --- branches/meklort/i386/modules/GUI/GUI_module.c (revision 734) +++ branches/meklort/i386/modules/GUI/GUI_module.c (revision 735) @@ -21,7 +21,6 @@ bool useGUI; -void GUI_Kernel_Start_hook(void* kernelEntry, void* arg2, void* arg3, void* arg4); void GUI_PreBoot_hook(void* arg1, void* arg2, void* arg3, void* arg4); void GUI_ModulesLoaded_hook(void* arg1, void* arg2, void* arg3, void* arg4); @@ -72,20 +71,21 @@ // Note: shouldn't be needed, but just in case drawBootGraphics(); } - else + else if(!useGUI) { + // When gui mode is enabled, this causes a flicker. Do this later, when the display is blanked out setVideoMode( GRAPHICS_MODE, 0 ); - } } + /** ** A boot option has been selected, disable the graphical elements on screen. **/ void GUI_PreBoot_hook(void* arg1, void* arg2, void* arg3, void* arg4) { // Turn off any GUI elements - if( bootArgs->Video.v_display == GRAPHICS_MODE ) + if( useGUI ) { gui.devicelist.draw = false; gui.bootprompt.draw = false; @@ -99,7 +99,6 @@ { // Disable outputs, they will still show in the boot log. replace_function("_printf", &GUI_verbose); - drawBootGraphics(); } } @@ -116,7 +115,7 @@ // initGUI() returned with an error, disabling GUI. useGUI = false; } - else + else if(useGUI) { replace_function("_initGraphicsMode", &GUI_initGraphicsMode); replace_function("_getBootOptions", &GUI_getBootOptions); @@ -126,7 +125,11 @@ replace_function("_printf", &GUI_printf); replace_function("_verbose", &GUI_verbose); replace_function("_error", &GUI_error); - replace_function("_stop", &GUI_stop); + replace_function("_stop", &GUI_stop); + + setVideoMode( GRAPHICS_MODE, 0 ); + drawBackground(); + } } @@ -138,8 +141,6 @@ **/ void GUI_start() { - // Hoot for the boot screen - //ExecKernel register_hook_callback("Kernel Start", &GUI_Kernel_Start_hook); register_hook_callback("ExecKernel", &GUI_ExecKernel_hook); register_hook_callback("PreBoot", &GUI_PreBoot_hook); register_hook_callback("ModulesLoaded", &GUI_ModulesLoaded_hook); Index: branches/meklort/i386/modules/GUI/graphic_utils.c =================================================================== --- branches/meklort/i386/modules/GUI/graphic_utils.c (revision 734) +++ branches/meklort/i386/modules/GUI/graphic_utils.c (revision 735) @@ -312,7 +312,7 @@ unsigned short vesaVersion; unsigned short mode = modeEndOfList; - + getNumberArrayFromProperty( kGraphicsModeKey, params, 4); mode = getVESAModeWithProperties( params[0], params[1], params[2], Index: branches/meklort/i386/modules/Resolution/915resolution.c =================================================================== --- branches/meklort/i386/modules/Resolution/915resolution.c (revision 734) +++ branches/meklort/i386/modules/Resolution/915resolution.c (revision 735) @@ -40,8 +40,7 @@ close_vbios(map); } - } - + } } Index: branches/meklort/i386/util/dyldsymboltool.c =================================================================== --- branches/meklort/i386/util/dyldsymboltool.c (revision 734) +++ branches/meklort/i386/util/dyldsymboltool.c (revision 735) @@ -17,7 +17,7 @@ #define DYLIB_NAME "Symbols" -#define VOID_SYMBOL "dyld_void_start" +#define VOID_SYMBOL "_load_all_modules" #define START_SYMBOL "start" typedef struct symbols_dylib