Index: branches/meklort/i386/boot2/boot.c =================================================================== --- branches/meklort/i386/boot2/boot.c (revision 582) +++ branches/meklort/i386/boot2/boot.c (revision 583) @@ -139,7 +139,6 @@ int ret; bootArgs->kaddr = bootArgs->ksize = 0; - execute_hook("ExecKernel", (void*)binary, NULL, NULL, NULL); ret = DecodeKernel(binary, @@ -405,8 +404,6 @@ // Other status (e.g. 0) means that we should proceed with boot. - // Notify moduals that we are attempting to boot - execute_hook("PreBoot", NULL, NULL, NULL, NULL); // Find out which version mac os we're booting. getOSVersion(gMacOSVersion); @@ -422,6 +419,9 @@ } } + // Notify moduals that we are attempting to boot + execute_hook("PreBoot", NULL, NULL, NULL, NULL); + if (!getBoolForKey (kWake, &tryresume, &bootInfo->bootConfig)) { tryresume = true; tryresumedefault = true; Index: branches/meklort/i386/boot2/modules.c =================================================================== --- branches/meklort/i386/boot2/modules.c (revision 582) +++ branches/meklort/i386/boot2/modules.c (revision 583) @@ -134,7 +134,7 @@ if (moduleSize && read(fh, module_base, moduleSize) == moduleSize) { - //printf("Module %s read in.\n", modString); + DBG("Module %s read in.\n", modString); // Module loaded into memory, parse it module_start = parse_mach(module_base, &load_module, &add_symbol); @@ -331,13 +331,13 @@ // Parse through the load commands if(((struct mach_header*)binary)->magic == MH_MAGIC) { - is64 = 0; + is64 = false; binaryIndex += sizeof(struct mach_header); } else if(((struct mach_header_64*)binary)->magic == MH_MAGIC_64) { // NOTE: modules cannot be 64bit... - is64 = 1; + is64 = true; binaryIndex += sizeof(struct mach_header_64); } else Index: branches/meklort/i386/boot2/drivers.c =================================================================== --- branches/meklort/i386/boot2/drivers.c (revision 582) +++ branches/meklort/i386/boot2/drivers.c (revision 583) @@ -160,30 +160,36 @@ FileLoadDrivers(dirSpecExtra, 0); } #endif - // Next try to load Extra extensions from the selected root partition. - strcpy(dirSpecExtra, "/Extra/"); + + // First try a specfic OS version folder ie 10.5 + sprintf(dirSpecExtra, "/Extra/%s/", &gMacOSVersion); if (FileLoadDrivers(dirSpecExtra, 0) != 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) + { + // Next try to load Extra extensions from the selected root partition. + strcpy(dirSpecExtra, "/Extra/"); + if (FileLoadDrivers(dirSpecExtra, 0) != 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) #ifndef OPTION_ROM - || (gRAMDiskVolume && gRAMDiskBTAliased) ) + || (gRAMDiskVolume && gRAMDiskBTAliased) ) #else - ) + ) #endif - { - // First try a specfic OS version folder ie 10.5 - sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - // Next we'll try the base - strcpy(dirSpecExtra, "bt(0,0)/Extra/"); - FileLoadDrivers(dirSpecExtra, 0); + { + // First try a specfic OS version folder ie 10.5 + sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion); + if (FileLoadDrivers(dirSpecExtra, 0) != 0) + { + // Next we'll try the base + strcpy(dirSpecExtra, "bt(0,0)/Extra/"); + FileLoadDrivers(dirSpecExtra, 0); + } } } - } - + + } // TODO: fix this, the order does matter, and it's not correct now. // Also try to load Extensions from boot helper partitions. if (gBootVolume->flags & kBVFlagBooter) Index: branches/meklort/i386/modules/NetbookInstaller/NBI.c =================================================================== --- branches/meklort/i386/modules/NetbookInstaller/NBI.c (revision 582) +++ branches/meklort/i386/modules/NetbookInstaller/NBI.c (revision 583) @@ -49,7 +49,15 @@ void NetbookInstaller_start() { + //else printf("Unable to locate Extra/SystemVersion.LastPatched.plist\n"); + register_hook_callback("PreBoot", &NBI_PreBoot_hook); + +} + +void NBI_PreBoot_hook(void* arg1, void* arg2, void* arg3, void* arg4) +{ + bool dummyVal = 0; config_file_t systemVersion; char valid = false; @@ -81,7 +89,6 @@ ) { runNetbookInstaller = 1; - archCpuType = CPU_TYPE_I386; } else { @@ -103,27 +110,25 @@ - //else printf("Unable to locate Extra/SystemVersion.LastPatched.plist\n"); - register_hook_callback("PreBoot", &NBI_PreBoot_hook); -} - -void NBI_PreBoot_hook(void* arg1, void* arg2, void* arg3, void* arg4) -{ - extern bool usePngImage; - bool dummyVal = 0; - if (getBoolForKey("recovery", &dummyVal, &bootInfo->bootConfig) && dummyVal) + if (!runNetbookInstaller && getBoolForKey("recovery", &dummyVal, &bootInfo->bootConfig) && dummyVal) { if(dummyVal) runNetbookInstaller = 2; } if(runNetbookInstaller) { + replace_function("_LoadDrivers", &NBI_LoadDrivers); - replace_function("_md0Ramdisk", &NBI_md0Ramdisk); - replace_function("_loadBootGraphics", &NBI_loadBootGraphics); - usePngImage = true; + if(runNetbookInstaller == 1) + { + replace_function("_md0Ramdisk", &NBI_md0Ramdisk); + } + + // Force arch=i386 + -v + archCpuType = CPU_TYPE_I386; + gVerboseMode = true; } } @@ -254,36 +259,3 @@ return 0; } - - -extern int loadPngImage(const char *filename, uint16_t *width, uint16_t *height, uint8_t **imageData); - -//========================================================================== -// loadBootGraphics -void NBI_loadBootGraphics(void) -{ - extern uint8_t *bootImageData; - extern uint16_t bootImageWidth; - extern uint16_t bootImageHeight; - - extern const char* theme_name; - extern bool usePngImage; - - if (bootImageData != NULL) { - return; - } - - char dirspec[256]; - - if ((strlen(theme_name) + 24) > sizeof(dirspec)) { - usePngImage = false; - return; - } - sprintf(dirspec, "/Extra/Themes/%s/NBI.png", theme_name); - if (loadPngImage(dirspec, &bootImageWidth, &bootImageHeight, &bootImageData) != 0) { -#ifdef EMBED_THEME - if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, &bootImageWidth, &bootImageHeight, &bootImageData)) != 0) -#endif - usePngImage = false; - } -} Index: branches/meklort/i386/modules/KextPatcher/kext_patcher.c =================================================================== --- branches/meklort/i386/modules/KextPatcher/kext_patcher.c (revision 582) +++ branches/meklort/i386/modules/KextPatcher/kext_patcher.c (revision 583) @@ -42,15 +42,14 @@ **/ void kext_loaded(void* moduletmp, void* lengthprt, void* executableAddr, void* arg3) { - /* + ModulePtr module = moduletmp; long length = *(long*)lengthprt; //long length2 = strlen(module->plistAddr); // *(long*)lengthprt = length2 + 5 * 1024 * 1024; - printf("Loading %s, lenght is %d (%d), executable is 0x%X\n", module->plistAddr, length, length2, executableAddr); + printf("Loading %s, lenght is %d, executable is 0x%X\n", module->plistAddr, length, executableAddr); getc(); - */ } /** @@ -62,11 +61,10 @@ void mkext_loaded(void* filespec, void* packagetmp, void* length, void* arg3) { - /* - DriversPackage * package = packagetmp; + + //DriversPackage * package = packagetmp; printf("Loading %s, length %d\n", filespec, length); getc(); - */ } void KextPatcher_hook(void* arg1, void* arg2, void* arg3, void* arg4) Index: branches/meklort/i386/modules/GUI/gui.c =================================================================== --- branches/meklort/i386/modules/GUI/gui.c (revision 582) +++ branches/meklort/i386/modules/GUI/gui.c (revision 583) @@ -1821,7 +1821,7 @@ uint16_t bootImageWidth = 0; uint16_t bootImageHeight = 0; uint8_t *bootImageData = NULL; -bool usePngImage = true; +char usePngImage = 0; //========================================================================== // loadBootGraphics @@ -1834,7 +1834,7 @@ char dirspec[256]; if ((strlen(theme_name) + 24) > sizeof(dirspec)) { - usePngImage = false; + usePngImage = 0; return; } sprintf(dirspec, "/Extra/Themes/%s/boot.png", theme_name); @@ -1842,7 +1842,7 @@ #ifdef EMBED_THEME if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, &bootImageWidth, &bootImageHeight, &bootImageData)) != 0) #endif - usePngImage = false; + usePngImage = 0; } } @@ -1855,6 +1855,11 @@ const char *dummyVal; int oldScreenWidth, oldScreenHeight; uint16_t x, y; + bool legacy_logo = false; + if (getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->bootConfig) && !legacy_logo) + { + usePngImage = 1; + } if (usePngImage && bootImageData == NULL) { loadBootGraphics(); Index: branches/meklort/i386/modules/GUI/GUI_module.c =================================================================== --- branches/meklort/i386/modules/GUI/GUI_module.c (revision 582) +++ branches/meklort/i386/modules/GUI/GUI_module.c (revision 583) @@ -75,7 +75,7 @@ { setVideoMode( GRAPHICS_MODE, 0 ); - } + } } /** @@ -84,8 +84,7 @@ void GUI_PreBoot_hook(void* arg1, void* arg2, void* arg3, void* arg4) { bool legacy_logo; - extern bool usePngImage; - + // Turn off any GUI elements if( bootArgs->Video.v_display == GRAPHICS_MODE ) { @@ -95,7 +94,7 @@ gui.infobox.draw = false; gui.logo.draw = false; drawBackground(); - updateVRAM(); + //updateVRAM(); if(!gVerboseMode) { @@ -105,10 +104,6 @@ } } - - if (getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->bootConfig) && legacy_logo) { - usePngImage = false; - } } /** Index: branches/meklort/i386/modules/KernelPatcher/kernel_patcher.c =================================================================== --- branches/meklort/i386/modules/KernelPatcher/kernel_patcher.c (revision 582) +++ branches/meklort/i386/modules/KernelPatcher/kernel_patcher.c (revision 583) @@ -279,7 +279,7 @@ if(symbol == 0 || symbol->addr == 0) { - printf("Unable to locate _cpuid_set_info\n"); + verbose("Unable to locate _cpuid_set_info\n"); return; } @@ -410,7 +410,7 @@ if(symbol == 0 || symbol->addr == 0) { - printf("Unable to locate _cpuid_set_info\n"); + verbose("Unable to locate _cpuid_set_info\n"); return; }