Index: branches/cparm/TODO =================================================================== --- branches/cparm/TODO (revision 1930) +++ branches/cparm/TODO (revision 1931) @@ -2,19 +2,18 @@ ==================================== - update cpu_intel_amd -- update project with corehash - - -- Implement the bundles +- split nvidia, gma and ati code into separate modules +- implement cpu topology - Backport cconfig from the trunk - move winfs, bsdfs, ext2fs, befs and lspci into modules +- Implement a Host like in bits to avoid some return issues +- update project with corehash - Implement a pool allocator, so each module will run and allocate memory in there own pool, de-alloc all allocated memory by the module, will be done simply by destroying the pool - Try to sync our prf() with the apple/mach __doprnt() (in Xnu/osfmk/kern/printf.c) to normalize the formating in our printf, sprintf, etc ..., and facilitate bug fixes -- Implement a Host like in bits to avoid some return issues - Implement snprintf to avoid buffer overflow in some case Index: branches/cparm/CHANGES =================================================================== --- branches/cparm/CHANGES (revision 1930) +++ branches/cparm/CHANGES (revision 1931) @@ -1,3 +1,7 @@ +- Implemented the Runtime Bundles Modules +- Updated nvidia and ati device id +- Small security fixes + - Stability fixes - Added mountain lion auto_installer compatibility - Changed md5c.c to the Xnu's md5.c Index: branches/cparm/i386/libsaio/allocate.c =================================================================== --- branches/cparm/i386/libsaio/allocate.c (revision 1930) +++ branches/cparm/i386/libsaio/allocate.c (revision 1931) @@ -32,13 +32,8 @@ #define kPageSize 4096 #define RoundPage(x) ((((unsigned)(x)) + kPageSize - 1) & ~(kPageSize - 1)) -#if UNUSED long -AllocateMemoryRange(char * rangeName, long start, long length, long type) -#else -long AllocateMemoryRange(char * rangeName, long start, long length) -#endif { char *nameBuf; uint32_t *buffer; @@ -62,21 +57,21 @@ AllocateKernelMemory( long inSize ) { long addr; - + if (gImageLastKernelAddr == 0) { gImageLastKernelAddr = RoundPage( bootArgs->kaddr + - bootArgs->ksize ); + bootArgs->ksize ); } addr = gImageLastKernelAddr; gImageLastKernelAddr += RoundPage(inSize); - + if ( gImageLastKernelAddr >= (KERNEL_ADDR + KERNEL_LEN) ) { stop ("AllocateKernelMemory error"); } - + bootArgs->ksize = gImageLastKernelAddr - bootArgs->kaddr; - + return addr; } Index: branches/cparm/i386/libsaio/Makefile =================================================================== --- branches/cparm/i386/libsaio/Makefile (revision 1930) +++ branches/cparm/i386/libsaio/Makefile (revision 1931) @@ -14,9 +14,7 @@ CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fno-stack-protector \ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ - -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions \ - -march=pentium4 -msse2 -mfpmath=sse -msoft-float + -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) -march=pentium4 -msse2 -msoft-float -ffreestanding -mpreferred-stack-boundary=2 -fno-align-functions -mfpmath=sse DEFINES= CONFIG = hd @@ -41,7 +39,7 @@ cpu.o platform.o \ fake_efi.o \ device_inject.o pci_root.o \ - convert.o acpi_tools.o smbios.o smp-imps.o uterror.o lzss.o + convert.o acpi_tools.o smbios.o uterror.o lzss.o # example for AcpiCodec #SAIO_OBJS += acpi_codec.o acpicode.o ACPICodec.o acpidecode.o @@ -71,6 +69,9 @@ #CFLAGS += -DNO_HAIKU_SUPPORT # -256 bytes SAIO_OBJS += befs.o +#CFLAGS += -DNO_SMP_SUPPORT +SAIO_OBJS += smp-imps.o + # Options disabled by default: #CFLAGS += -DUFS_SUPPORT # +3616 bytes Index: branches/cparm/i386/libsaio/modules.c =================================================================== --- branches/cparm/i386/libsaio/modules.c (revision 1930) +++ branches/cparm/i386/libsaio/modules.c (revision 1931) @@ -2,6 +2,13 @@ * Copyright 2010 Evan Lojewski. All rights reserved. * */ + +/* + * Copyright 2012 Cadet-petit Armel . All rights reserved. + * + * Cleaned, Added (runtime) bundles module support, based on a dylib environement. + * + */ #include "libsaio.h" #include "bootstruct.h" #include "modules.h" @@ -21,10 +28,10 @@ unsigned long long textSection = 0; moduleHook_t* moduleCallbacks = NULL; -moduleList_t* loadedModules = NULL; symbolList_t* moduleSymbols = NULL; unsigned int (*lookup_symbol)(const char*, int(*strcmp_callback)(const char*, const char*)) = NULL; moduleHook_t* get_callback(const char* name); +static unsigned int load_module(char * name, char* module); #if DEBUG_MODULES VOID print_hook_list() @@ -52,70 +59,165 @@ } #endif +#if DYLIB_SUPPORT +typedef struct dylbList_t +{ + char* dylib_name; + struct dylbList_t* next; +} dylbList_t; + +dylbList_t* loadedDylib = NULL; + + +static EFI_STATUS is_system_loaded(void) +{ + msglog("* Attempting to load system module\n"); + + + if((UInt32)lookup_symbol != 0xFFFFFFFF) + { +#if DEBUG_MODULES == 2 + printf("System successfully Loaded.\n"); + getc(); +#endif + return EFI_SUCCESS; + } + + +#if DEBUG_MODULES == 2 + printf("Failed to load system module\n"); + getc(); +#endif + return EFI_LOAD_ERROR; +} + /* - * Initialize the module system by loading the Symbols.dylib module. - * Once loaded, locate the _lookup_symbol function so that internal - * symbols can be resolved. + * print out the information about the loaded module */ -EFI_STATUS init_module_system(void) +static VOID add_dylib(const char* name) { - msglog("* Attempting to load system module\n"); - - // Intialize module system - EFI_STATUS status = load_module(SYMBOLS_MODULE); - if((status == EFI_SUCCESS) || (status == EFI_ALREADY_STARTED)/*should never happen*/ ) + dylbList_t* new_entry = malloc(sizeof(dylbList_t)); + if (new_entry) + { + new_entry->next = loadedDylib; + + loadedDylib = new_entry; + + new_entry->dylib_name = (char*)name; + } +} + +static EFI_STATUS is_dylib_loaded(const char* name) +{ + dylbList_t* entry = loadedDylib; + while(entry) { - lookup_symbol = (void*)lookup_all_symbols(SYMBOLS_MODULE,SYMBOL_LOOKUP_SYMBOL); - - if((UInt32)lookup_symbol != 0xFFFFFFFF) + DBG("Comparing %s with %s\n", name, entry->dylib_name); + char *fullname = newStringWithFormat("%s.dylib",name); + if(fullname && ((strcmp(entry->dylib_name, name) == 0) || (strcmp(entry->dylib_name, fullname) == 0))) { + free(fullname); + DBG("Located module %s\n", name); return EFI_SUCCESS; } + else + { + entry = entry->next; + } } + DBG("Module %s not found\n", name); - return EFI_LOAD_ERROR; + return EFI_NOT_FOUND; } +/* + * Load a dylib + * + * ex: load_dylib("/Extra/modules/", "AcpiCodec.dylib"); + */ +VOID load_dylib(const char * dylib_path, const char * name) +{ + void (*module_start)(void); + char *tmp = newStringWithFormat("%s%s",dylib_path, name); + if (!tmp) { + return; + } + char *dylib_name = newString(name); + if (!dylib_name) { + free(tmp); + return; + } + msglog("* Attempting to load module: %s\n", tmp); + module_start = (void*)load_module(dylib_name,tmp); + + if(module_start && ( module_start != (void*)0xFFFFFFFF)) + { + add_dylib(name); + module_start(); + } + else + { + // failed to load or already loaded + free(tmp); + free(dylib_name); + + } +} + /* - * Load all modules in the /Extra/modules/ directory - * Module depencdies will be loaded first - * MOdules will only be loaded once. When loaded a module must - * setup apropriete function calls and hooks as required. - * NOTE: To ensure a module loads after another you may - * link one module with the other. For dyld to allow this, you must - * reference at least one symbol within the module. + * Load all dylib in the /Extra/modules/ directory */ -VOID load_all_modules(void) +VOID load_all_dylib(void) { char* name; long flags; long time; + + if (is_system_loaded() != EFI_SUCCESS) return; + struct dirstuff* moduleDir = opendir("/Extra/modules/"); + void (*module_start)(void); while(readdir(moduleDir, (const char**)&name, &flags, &time) >= 0) { - if ((strcmp(SYMBOLS_MODULE,name)) == 0) continue; // if we found Symbols.dylib, just skip it + if ((strcmp("Symbols.dylib",name)) == 0) continue; // if we found Symbols.dylib, just skip it - int len = strlen(name); + if (is_dylib_loaded(name) == EFI_SUCCESS) continue; + + int len = strlen(name); int ext_size = sizeof("dylib"); if (len >= ext_size) { if(strcmp(&name[len - ext_size], ".dylib") == 0) { - char *tmp = newString(name); + char *tmp = newStringWithFormat("/Extra/modules/%s",name); if (!tmp) { continue; } - msglog("* Attempting to load module: %s\n", tmp); - if(load_module(tmp) != EFI_SUCCESS) + char *dylib_name = newString(name); + if (!dylib_name) { + free(tmp); + continue; + } + msglog("* Attempting to load module: %s\n", tmp); + module_start = (void*)load_module(dylib_name,tmp); + + if(module_start && ( module_start != (void*)0xFFFFFFFF)) { - // failed to load or already loaded - //free(tmp); + add_dylib(name); + module_start(); } + else + { + // failed to load or already loaded + free(tmp); + free(dylib_name); + + } } #if DEBUG_MODULES else @@ -144,42 +246,29 @@ #endif } +#endif + /* - * Load a module file in /Extra/modules - * TODO: verify version number of module + * Load a module file */ -EFI_STATUS load_module(char* module) +static unsigned int load_module(char * name, char* module) { - void (*module_start)(void) = NULL; + unsigned int module_start = 0xFFFFFFFF; + + int fh = -1; - // Check to see if the module has already been loaded - if(is_module_loaded(module) == EFI_SUCCESS) - { - msglog("Module %s already registred\n", module); - return EFI_ALREADY_STARTED; - } - - int fh = -1; - char *modString=NULL; - modString = newStringWithFormat( "/Extra/modules/%s", module); - if (!modString) { - printf("Unable to allocate module name : /Extra/modules/%s\n", module); - return EFI_OUT_OF_RESOURCES; - } - fh = open(modString); + fh = open(module); if(fh < 0) { #if DEBUG_MODULES - DBG("Unable to locate module %s\n", modString); + DBG("Unable to locate module %s\n", module); getc(); #else - msglog("Unable to locate module %s\n", modString); + msglog("Unable to locate module %s\n", module); #endif - free(modString); - return EFI_OUT_OF_RESOURCES; + return 0xFFFFFFFF; } - EFI_STATUS ret = EFI_SUCCESS; { int moduleSize = file_size(fh); @@ -194,27 +283,11 @@ if (module_base && read(fh, module_base, moduleSize) == moduleSize) { - DBG("Module %s read in.\n", modString); + DBG("Module %s read in.\n", module); // Module loaded into memory, parse it - module_start = parse_mach(module, module_base, &load_module, &add_symbol); - - if(module_start && (module_start != (void*)0xFFFFFFFF)) - { - module_loaded(module); - // Notify the system that it was laoded - (*module_start)(); // Start the module - msglog("%s successfully Loaded.\n", module); - } - else - { - // The module does not have a valid start function - printf("Unable to start %s\n", module); - ret = EFI_NOT_STARTED; -#if DEBUG_MODULES - getc(); -#endif - } + module_start = parse_mach(name, module_base, &add_symbol); + } else { @@ -222,12 +295,11 @@ #if DEBUG_MODULES getc(); #endif - ret = EFI_LOAD_ERROR; + module_start = 0xFFFFFFFF; } } close(fh); - free(modString); - return ret; + return module_start; } moduleHook_t* get_callback(const char* name) @@ -351,12 +423,12 @@ * symbols will still be available (TODO: fix this). This should not * happen as all dependencies are verified before the sybols are read in. */ -void* parse_mach(char *module, void* binary, EFI_STATUS(*dylib_loader)(char*), long long(*symbol_handler)(char*, char*, long long, char)) // TODO: add param to specify valid archs +unsigned int parse_mach(char *module, void* binary, long long(*symbol_handler)(char*, char*, long long, char)) // TODO: add param to specify valid archs { char is64 = false; - void (*module_start)(void) = NULL; + unsigned int module_start = 0xFFFFFFFF; EFI_STATUS bind_status = EFI_SUCCESS; - + // TODO convert all of the structs to a union struct dyld_info_command* dyldInfoCommand = NULL; struct symtab_command* symtabCommand = NULL; @@ -384,7 +456,7 @@ { printf("Modules: Invalid mach magic\n"); getc(); - return NULL; + return 0xFFFFFFFF; } @@ -515,45 +587,11 @@ case LC_LOAD_DYLIB: case LC_LOAD_WEAK_DYLIB ^ LC_REQ_DYLD: - { - struct dylib_command* dylibCommand = binary + binaryIndex; - char* weak_module = binary + binaryIndex + ((UInt32)*((UInt32*)&dylibCommand->dylib.name)); - - char *name=NULL; - name = newStringWithFormat( "%s.dylib", weak_module); - if (!name) { - printf("Unable to allocate module name : %s\n", weak_module); - return NULL; - } - if(dylib_loader) - { - EFI_STATUS statue = dylib_loader(weak_module); - - if( statue != EFI_SUCCESS) - { - if (statue != EFI_ALREADY_STARTED) - { - // Unable to load dependancy - //free(weak_module); - return NULL; - } - - } - - } - //free(weak_module); - - break; - } + break; + case LC_ID_DYLIB: - { - /*struct dylib_command* dylibCommand = binary + binaryIndex; - moduleName = binary + binaryIndex + ((UInt32)*((UInt32*)&dylibCommand->dylib.name)); - moduleVersion = dylibCommand->dylib.current_version; - moduleCompat = dylibCommand->dylib.compatibility_version; - */ - } - break; + break; + case LC_DYLD_INFO: // Bind and rebase info is stored here @@ -578,7 +616,7 @@ } // bind_macho uses the symbols. - module_start = (void*)handle_symtable(module, (UInt32)binary, symtabCommand, symbol_handler, is64); + module_start = handle_symtable(module, (UInt32)binary, symtabCommand, symbol_handler, is64); // Rebase the module before binding it. if(dyldInfoCommand && dyldInfoCommand->rebase_off) @@ -605,7 +643,7 @@ } if (bind_status != EFI_SUCCESS) { - module_start = (void*)0xFFFFFFFF; + module_start = 0xFFFFFFFF; } return module_start; @@ -898,7 +936,7 @@ #if DEBUG_MODULES==2 DBG("BIND_OPCODE_SET_ADDEND_SLEB: %d\n", addend); #endif - + break; case BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB: @@ -950,7 +988,7 @@ #if DEBUG_MODULES==2 DBG("BIND_OPCODE_ADD_ADDR_ULEB: 0x%X\n", segmentAddress); #endif - + break; case BIND_OPCODE_DO_BIND: @@ -990,7 +1028,7 @@ } while(bind_stream[i] & 0x80); - + if(symbolAddr != 0xFFFFFFFF) { address = segmentAddress + (UInt32)base; @@ -1004,7 +1042,7 @@ goto error; } - + segmentAddress += tmp + sizeof(void*); @@ -1155,56 +1193,16 @@ } -/* - * print out the information about the loaded module - */ -VOID module_loaded(const char* name) -{ - moduleList_t* new_entry = malloc(sizeof(moduleList_t)); - if (new_entry) - { - new_entry->next = loadedModules; - - loadedModules = new_entry; - - new_entry->module = (char*)name; - } -} - -EFI_STATUS is_module_loaded(const char* name) -{ - moduleList_t* entry = loadedModules; - while(entry) - { - DBG("Comparing %s with %s\n", name, entry->module); - char *fullname = newStringWithFormat("%s.dylib",name); - if(fullname && ((strcmp(entry->module, name) == 0) || (strcmp(entry->module, fullname) == 0))) - { - free(fullname); - DBG("Located module %s\n", name); - return EFI_SUCCESS; - } - else - { - entry = entry->next; - } - - } - DBG("Module %s not found\n", name); - - return EFI_NOT_FOUND; -} - // Look for symbols using the Smbols moduel function. // If non are found, look through the list of module symbols unsigned int lookup_all_symbols(const char* module, const char* name) { unsigned int addr = 0xFFFFFFFF; - + do { - if ((module != NULL) && (strcmp(module,SYMBOLS_MODULE) != 0)) + if ((module != NULL) && (strcmp(module,SYMBOLS_BUNDLE) != 0)) break; if(lookup_symbol && (UInt32)lookup_symbol != 0xFFFFFFFF) @@ -1218,8 +1216,8 @@ } } while (0); - - + + { symbolList_t* entry = moduleSymbols; while(entry) @@ -1240,7 +1238,7 @@ { entry = entry->next; } - + } } @@ -1253,7 +1251,7 @@ #endif out: return addr; - + } @@ -1379,7 +1377,7 @@ EFI_STATUS replace_system_function(const char* symbol, void* newAddress) { - return replace_function(SYMBOLS_MODULE,symbol,newAddress); + return replace_function(SYMBOLS_BUNDLE,symbol,newAddress); } @@ -1389,3 +1387,695 @@ return replace_function(NULL,symbol,newAddress); } +/* + * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights + * Reserved. This file contains Original Code and/or Modifications of + * Original Code as defined in and that are subject to the Apple Public + * Source License Version 2.0 (the 'License'). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource and read it before using + * this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * drivers.c - Driver Loading Functions. + * + * Copyright (c) 2000 Apple Computer, Inc. + * + * DRI: Josh de Cesare + */ + +/* + * Copyright 2012 Cadet-petit Armel . All rights reserved. + * + * Cleaned, Added (runtime) bundles support. + * + */ +#include +#include +#include + +#include "sl.h" +#include "xml.h" + +struct Module { + struct Module *nextModule; + long willLoad; + TagPtr dict; + TagPtr personalities; + char *plistAddr; + long plistLength; + char *executablePath; + char *bundlePath; + long bundlePathLength; +}; +typedef struct Module Module, *ModulePtr; + + +enum { + kCFBundleType2, + kCFBundleType3 +}; + +enum { + BundlePriorityNull = 0, + BundlePriorityInit = 1, + BundlePrioritySystem = 2, + BundlePrioritySystemLib = 3, + BundlePriorityNormalPriority = 4, + BundlePriorityLowestPriority = 99, + BundlePriorityEnd = 100 // can not be assigned + +}; + +static ModulePtr gModuleHead; +static char * gModulesSpec; +static char * gDriverSpec; +static char * gFileSpec; +static char * gTempSpec; +static char * gFileName; +static int gLowestLoadPriority; + +static long ParseXML(char *buffer, ModulePtr *module); +static ModulePtr FindBundle( char * bundle_id ); + +static void +FreeBundleSupport( void ) +{ + + if ( gModulesSpec ) free(gModulesSpec); + if ( gDriverSpec) free(gDriverSpec); + if ( gFileSpec ) free(gFileSpec); + if ( gTempSpec ) free(gTempSpec); + if ( gFileName ) free(gFileName); +} + +//========================================================================== +// InitBundleSupport + +long +InitBundleSupport( void ) +{ + DBG("InitBundleSupport\n"); + + static bool BundleSet = false; + + if (BundleSet == true) return 0; + + gModulesSpec = malloc( 4096 ); + gDriverSpec = malloc( 4096 ); + gFileSpec = malloc( 4096 ); + gTempSpec = malloc( 4096 ); + gFileName = malloc( 4096 ); + + if ( !gModulesSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName ) + goto error; + + BundleSet = true; + + return 0; +error: + FreeBundleSupport(); + return 1; +} + +//========================================================================== +// LoadBundles + +long LoadBundles( char * dirSpec ) +{ + DBG("LoadBundles\n"); + + if ( InitBundleSupport() != 0 ) + return 1; + + + strlcpy(gModulesSpec, dirSpec, 4096); + strlcat(gModulesSpec, "Modules", 4096 - 1); + FileLoadBundles(gModulesSpec, 0); + + + MatchBundlesLibraries(); + + LoadMatchedBundles(); + + DBG("LoadBundles Finished\n"); + + return 0; +} + +//========================================================================== +// FileLoadBundles +long +FileLoadBundles( char * dirSpec, long plugin ) +{ + long ret, length, flags, time, bundleType; + long long index; + long result = -1; + const char * name; + + DBG("FileLoadBundles in %s\n",dirSpec); + + index = 0; + while (1) { + ret = GetDirEntry(dirSpec, &index, &name, &flags, &time); + if (ret == -1) break; + + // Make sure this is a directory. + if ((flags & kFileTypeMask) != kFileTypeDirectory) continue; + + // Make sure this is a kext. + length = strlen(name); + if (strcmp(name + length - 7, ".bundle")) continue; + + // Save the file name. + strlcpy(gFileName, name, 4096); + DBG("Load Bundles %s\n",gFileName); + + // Determine the bundle type. + sprintf(gTempSpec, "%s/%s", dirSpec, gFileName); + ret = GetFileInfo(gTempSpec, "Contents", &flags, &time); + if (ret == 0) bundleType = kCFBundleType2; + else bundleType = kCFBundleType3; + + DBG("Bundles type = %d\n",bundleType); + + if (!plugin) + sprintf(gDriverSpec, "%s/%s/%sPlugIns", dirSpec, gFileName, + (bundleType == kCFBundleType2) ? "Contents/" : ""); + + ret = LoadBundlePList( dirSpec, gFileName, bundleType); + + if (result != 0) + result = ret; + + if (!plugin) + FileLoadBundles(gDriverSpec, 1); + } + + return result; +} + + +static void add_bundle(ModulePtr module,char* name) +{ + ModulePtr new_entry= malloc(sizeof(Module)); + DBG("Adding bundle %s \n", name ); + if (new_entry) + { + new_entry->nextModule = gModuleHead; + + gModuleHead = new_entry; + + new_entry->executablePath = module->executablePath; + new_entry->bundlePath = module->bundlePath; + new_entry->bundlePathLength = module->bundlePathLength; + new_entry->plistAddr = module->plistAddr; + new_entry->willLoad = module->willLoad; + new_entry->dict = module->dict; + new_entry->plistLength = module->plistLength; + new_entry->personalities = module->personalities; + + } + +} + +//========================================================================== +// LoadBundlePList + +long +LoadBundlePList( char * dirSpec, char * name, long bundleType ) +{ + long length, executablePathLength, bundlePathLength; + ModulePtr module = 0; + char * buffer = 0; + char * tmpExecutablePath = 0; + char * tmpBundlePath = 0; + long ret = -1; + DBG("LoadBundlePList\n"); + + do { + // Save the driver path. + + sprintf(gFileSpec, "%s/%s/%s", dirSpec, name, + (bundleType == kCFBundleType2) ? "Contents/MacOS/" : ""); + executablePathLength = strlen(gFileSpec) + 1; + + tmpExecutablePath = malloc(executablePathLength); + if (tmpExecutablePath == 0) break; + + strlcpy(tmpExecutablePath, gFileSpec, executablePathLength); + + sprintf(gFileSpec, "%s/%s", dirSpec, name); + bundlePathLength = strlen(gFileSpec) + 1; + + tmpBundlePath = malloc(bundlePathLength); + if (tmpBundlePath == 0) break; + + strlcpy(tmpBundlePath, gFileSpec, bundlePathLength); + + + // Construct the file spec to the plist, then load it. + + sprintf(gFileSpec, "%s/%s/%sInfo.plist", dirSpec, name, + (bundleType == kCFBundleType2) ? "Contents/" : ""); + + DBG("Loading Bundle PList %s\n",gFileSpec); + + length = LoadFile(gFileSpec); + if (length == -1) break; + + length = length + 1; + buffer = malloc(length); + if (buffer == 0) break; + + strlcpy(buffer, (char *)kLoadAddr, length); + + // Parse the plist. + + ret = ParseXML(buffer, &module); + if (ret != 0 ) { printf("Unable to read plist of %s",name); break; } + + if (!module) break; // Should never happen but it will make the compiler happy + + // Allocate memory for the driver path and the plist. + + module->executablePath = tmpExecutablePath; + module->bundlePath = tmpBundlePath; + module->bundlePathLength = bundlePathLength; + module->plistAddr = malloc(length); + + if ((module->executablePath == 0) || (module->bundlePath == 0) || (module->plistAddr == 0)) + { + if ( module->plistAddr ) free(module->plistAddr); + ret = -1; + break; + } + + // Add the plist to the module. + + strlcpy(module->plistAddr, (char *)kLoadAddr, length); + module->plistLength = length; + + // Add the module to the module list. + + add_bundle(module, name); + + + ret = 0; + } + while (0); + + if ( buffer ) free( buffer ); + if ( module ) free( module ); + + if (ret != 0) { + if ( tmpExecutablePath ) free( tmpExecutablePath ); + if ( tmpBundlePath ) free( tmpBundlePath ); + } + return ret; +} + +#define WillLoadBundles \ +module = gModuleHead; \ +while (module != NULL) \ +{ \ +if (module->willLoad == willLoad) \ +{ \ +prop = XMLGetProperty(module->dict, kPropCFBundleExecutable); \ +\ +if (prop != 0) \ +{ \ +fileName = prop->string; \ +sprintf(gFileSpec, "%s%s", module->executablePath, fileName); \ +\ +module_start = (void*)load_module((char*)fileName,gFileSpec); \ +if(!module_start || (*module_start == (void*)0xFFFFFFFF)) \ +{ \ +if (module->willLoad > BundlePrioritySystemLib) \ +{ \ +module->willLoad = BundlePriorityNull ; \ +printf("Unable to start %s\n", gFileSpec); \ +} \ +} else module_start(); \ +if (module->willLoad == BundlePrioritySystem) \ +{ \ +lookup_symbol = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,SYMBOL_LOOKUP_SYMBOL); \ +if((UInt32)lookup_symbol != 0xFFFFFFFF) \ +{ \ +msglog("%s successfully Loaded.\n", gFileSpec); \ +} else return -1; \ +} \ +} \ +} \ +module = module->nextModule; \ +} + +//========================================================================== +// LoadMatchedBundles + +long LoadMatchedBundles( void ) +{ + TagPtr prop; + ModulePtr module; + char *fileName; + void (*module_start)(void); + long willLoad; + + DBG("LoadMatchedBundles\n"); + + int priority_end = MIN(gLowestLoadPriority+1, BundlePriorityEnd); + + for (willLoad = BundlePrioritySystem; willLoad < priority_end ; willLoad++) + { + + WillLoadBundles ; + + } + + return 0; +} + +//========================================================================== +// MatchBundlesLibraries + +long MatchBundlesLibraries( void ) +{ + + TagPtr prop, prop2; + ModulePtr module, module2,dummy_module; + + // Check for active modules with the same Bundle IDs or same principal class, only one must remain (except for type 3 aka system libs) + { + module = gModuleHead; + + while (module != 0) + { + if (!(module->willLoad > BundlePriorityInit)) // if the module load priority is not higher than initialized, continue + { + module = module->nextModule; + continue; + } + + prop = XMLGetProperty(module->dict, kPropNSPrincipalClass); + prop2 = XMLGetProperty(module->dict, kPropCFBundleIdentifier); + + if (prop != 0 && prop2 != 0) + { + module2 = gModuleHead; + + TagPtr prop3,prop4; + + while (module2 != 0) + { + prop3 = XMLGetProperty(module2->dict, kPropNSPrincipalClass); + prop4 = XMLGetProperty(module2->dict, kPropCFBundleIdentifier); + + if ((prop3 != 0) && (prop4 != 0) && (module != module2)) + { + + if ((module2->willLoad == BundlePrioritySystemLib) && ((strcmp(prop2->string, prop4->string)!= 0) /*&& (!strcmp(prop->string, prop3->string))*/)) { + continue; + } + + if ((!strcmp(prop2->string, prop4->string)) || (!strcmp(prop->string, prop3->string))) { + if (module2->willLoad > BundlePriorityNull) module2->willLoad = BundlePriorityNull; + } + + } + module2 = module2->nextModule; + } + + } + + module = module->nextModule; + } + } + + // Check for dependencies (it works in most cases, still a little buggy but should be sufficient for what we have to do, + // clearly the Achilles' heel of this implementation, please use dependencies with caution !!!) + dummy_module = gModuleHead; + while (dummy_module != 0) + { + module = gModuleHead; + + while (module != 0) + { + if (module->willLoad > BundlePrioritySystemLib) + { + prop = XMLGetProperty(module->dict, kPropOSBundleLibraries); + if (prop != 0) + { + prop = prop->tag; + while (prop != 0) + { + module2 = gModuleHead; + while (module2 != 0) + { + prop2 = XMLGetProperty(module2->dict, kPropCFBundleIdentifier); + if ((prop2 != 0) && (!strncmp(prop->string, prop2->string, strlen( prop->string)))) + { + // found a parent + + if (module2->willLoad > BundlePriorityInit) + { + // parent is active + if (module->willLoad == BundlePriorityNull) { + module->willLoad = BundlePriorityNormalPriority; + } + + // Check if the version of the parent >= version of the child + if (strtol(XMLCastString ( XMLGetProperty(module2->dict,"CFBundleShortVersionString") ), NULL, 10) >= strtol(XMLCastString( prop->tag ), NULL, 10)) { + + if ((module2->willLoad >= module->willLoad) && (module->willLoad > BundlePrioritySystemLib)) + module->willLoad = MIN(MAX(module->willLoad, module2->willLoad+1), BundlePriorityLowestPriority); // child must be loaded after the parent, this allow the to find symbols of the parent while we bind the child. + + } else { + module->willLoad = BundlePriorityNull; + goto nextmodule; + } + break; + } + + } + if (module->willLoad != BundlePriorityNull) module->willLoad = BundlePriorityNull; + module2 = module2->nextModule; + } + if (module->willLoad == BundlePriorityNull) goto nextmodule; + prop = prop->tagNext; + } + } + } + nextmodule: + module = module->nextModule; + } + + dummy_module = dummy_module->nextModule; + } + + // Get the lowest load priority + { + gLowestLoadPriority = BundlePriorityNormalPriority; + module = gModuleHead; + + while (module != 0) + { + if (module->willLoad > BundlePriorityInit) + { + gLowestLoadPriority = MIN(module->willLoad, BundlePriorityLowestPriority); + } + module = module->nextModule; + } + } + + return 0; +} + + +//========================================================================== +// FindBundle + +static ModulePtr +FindBundle( char * bundle_id ) +{ + ModulePtr module; + TagPtr prop; + DBG("FindBundle %s\n",bundle_id); + + module = gModuleHead; + + while (module != 0) + { + prop = XMLGetProperty(module->dict, kPropCFBundleIdentifier); + if ((prop != 0) && !strcmp(bundle_id, prop->string)) break; + module = module->nextModule; + } + + return module; +} + +//========================================================================== +// GetBundleDict + +void * +GetBundleDict( char * bundle_id ) +{ + ModulePtr module; + DBG("GetBundleDict %s\n",bundle_id); + + module = FindBundle( bundle_id ); + + if (module != 0) + { + return (void *)module->dict; + } + + return 0; +} + +//========================================================================== +// GetBundlePersonality + +void * +GetBundlePersonality( char * bundle_id ) +{ + ModulePtr module; + DBG("GetBundlePersonalities %s\n",bundle_id); + + module = FindBundle( bundle_id ); + + if (module != 0) + { + return (void *)module->personalities; + } + + return 0; +} + +//========================================================================== +// GetBundlePath + +char * +GetBundlePath( char * bundle_id ) +{ + ModulePtr module; + DBG("GetBundlePath %s\n",bundle_id); + + module = FindBundle( bundle_id ); + + if (module != 0) + { + return module->bundlePath; + } + + return 0; +} + +//========================================================================== +// ParseXML + +static long +ParseXML( char * buffer, ModulePtr * module ) +{ + long length, pos; + TagPtr moduleDict, prop; + ModulePtr tmpModule; + + pos = 0; + DBG("ParseXML\n"); + + if (!module) { + return -1; + } + + while (1) + { + length = XMLParseNextTag(buffer + pos, &moduleDict); + if (length == -1) break; + + pos += length; + + if (moduleDict == 0) continue; + if (moduleDict->type == kTagTypeDict) break; + + XMLFreeTag(moduleDict); + } + + if (length == -1) + { + return -1; + } + + + tmpModule = malloc(sizeof(Module)); + if (tmpModule == 0) + { + XMLFreeTag(moduleDict); + return -1; + } + tmpModule->dict = moduleDict; + + do { + prop = XMLGetProperty(moduleDict, kPropOSBundleEnabled); + if ((prop != 0) && prop->string) + { + if ( (strlen(prop->string) >= 1) && (prop->string[0] == 'N' || prop->string[0] == 'n') ) + { + tmpModule->willLoad = 0; + break; + } + } + prop = XMLGetProperty(moduleDict, kPropNSPrincipalClass); + if ((prop != 0) && prop->string) + { + if (!strcmp(prop->string,SYSLIB_CLASS)) + { + tmpModule->willLoad = BundlePrioritySystemLib; + break; + } + if (!strcmp(prop->string,SYS_CLASS)) + { + tmpModule->willLoad = BundlePrioritySystem; + break; + } + } + + prop = XMLGetProperty(moduleDict, kPropOSBundlePriority); + if ((prop != 0) && prop->string) + { + int tmpwillLoad; + if ((tmpwillLoad = strtoul(prop->string, NULL, 10)) > BundlePrioritySystemLib ) + { + tmpModule->willLoad = MIN(tmpwillLoad, BundlePriorityLowestPriority); + break; + + } + + } + + tmpModule->willLoad = BundlePriorityNormalPriority; + + } while (0); + + // Get the personalities. + tmpModule->personalities = XMLGetProperty(moduleDict, kPropIOKitPersonalities); + + *module = tmpModule; + + + + return 0; +} Index: branches/cparm/i386/libsaio/modules.h =================================================================== --- branches/cparm/i386/libsaio/modules.h (revision 1930) +++ branches/cparm/i386/libsaio/modules.h (revision 1931) @@ -4,6 +4,13 @@ * */ +/* + * Copyright 2012 Cadet-petit Armel . All rights reserved. + * + * Cleaned, Added bundles support. + * + */ + // There is a bug with the module system / rebasing / binding // that causes static variables to be incorrectly rebased or bound // Disable static variables for the moment @@ -27,13 +34,6 @@ struct symbolList_t* next; } symbolList_t; -typedef struct moduleList_t -{ - char* module; - //struct moduleHook_t* hook_list; - struct moduleList_t* next; -} moduleList_t; - typedef struct callbackList_t { void(*callback)(void*, void*, void*, void*, void*, void*); @@ -47,7 +47,7 @@ struct moduleHook_t* next; } moduleHook_t; -#define SYMBOLS_MODULE "Symbols.dylib" +#define SYMBOLS_BUNDLE "Symbols" #define SYMBOL_DYLD_STUB_BINDER "dyld_stub_binder" #define SYMBOL_LOOKUP_SYMBOL "_lookup_symbol" @@ -56,9 +56,12 @@ #define SECT_NON_LAZY_SYMBOL_PTR "__nl_symbol_ptr" #define SECT_SYMBOL_STUBS "__symbol_stub" -EFI_STATUS init_module_system(void); -VOID load_all_modules(void); +#define SYS_CLASS "SYMS" +#define SYSLIB_CLASS "SYS_LIB" +#define BundleHighPriority "high" +#define BundleNormalPriority "normal" +#define BundleLowPriority "low" /* * Modules Interface * execute_hook @@ -77,14 +80,9 @@ void rebase_macho(void* base, char* rebase_stream, UInt32 size); EFI_STATUS bind_macho(char* module, void* base, char* bind_stream, UInt32 size); -EFI_STATUS load_module(char* module); - -EFI_STATUS is_module_loaded(const char* name); -VOID module_loaded(const char* name); - long long add_symbol(char* module,char* symbol, long long addr, char is64); -void* parse_mach(char *module, void* binary, EFI_STATUS(*dylib_loader)(char*), long long(*symbol_handler)(char*, char*, long long, char)); +unsigned int parse_mach(char *module, void* binary, long long(*symbol_handler)(char*, char*, long long, char)); unsigned int handle_symtable(char *module, UInt32 base, struct symtab_command* symtabCommand, @@ -107,7 +105,7 @@ long MatchBundlesLibraries(void); long LoadBundles( char * dirSpec ); void * GetBundleDict( char * bundle_id ); -void * GetBundlePersonalities( char * bundle_id ); +void * GetBundlePersonality( char * bundle_id ); char * GetBundlePath( char * bundle_id ); #endif /* __BOOT_MODULES_H */ \ No newline at end of file Index: branches/cparm/i386/libsaio/sys.c =================================================================== --- branches/cparm/i386/libsaio/sys.c (revision 1930) +++ branches/cparm/i386/libsaio/sys.c (revision 1931) @@ -119,11 +119,8 @@ static BVRef newBootVolumeRef( int biosdev, int partno ); static int GetFreeFd(void); static struct iob * iob_from_fdesc(int fdesc); -#if UNUSED -static int open_bvr(BVRef bvr, const char *filePath, int flags); -#else + static int open_bvr(BVRef bvr, const char *filePath); -#endif //========================================================================== // LoadVolumeFile - LOW-LEVEL FILESYSTEM FUNCTION. @@ -383,11 +380,8 @@ //========================================================================== // open() - Open the file specified by 'path' for reading. -#if UNUSED -static int open_bvr(BVRef bvr, const char *filePath, int flags) -#else + static int open_bvr(BVRef bvr, const char *filePath) -#endif { struct iob *io; int fdesc; @@ -423,31 +417,22 @@ return fdesc; } -#if UNUSED -int open(const char *path, int flags) -#else + int open(const char *path) -#endif { const char *filepath; BVRef bvr; // Resolve the boot volume from the file spec. if ((bvr = getBootVolumeRef(path, &filepath)) != NULL) { -#if UNUSED - return open_bvr(bvr, filepath, flags); -#else + return open_bvr(bvr, filepath); -#endif } return -1; } -#if UNUSED -int open_bvdev(const char *bvd, const char *path, int flags) -#else + int open_bvdev(const char *bvd, const char *path) -#endif { const struct devsw *dp; const char *cp; @@ -486,11 +471,8 @@ } } bvr = newBootVolumeRef(dp->biosdev + unit, partition); -#if UNUSED - return open_bvr(bvr, path, flags); -#else + return open_bvr(bvr, path); -#endif } } return -1; @@ -811,11 +793,8 @@ } //========================================================================== -#if UNUSED -void scanDisks(int biosdev, int *count) -#else + void scanDisks(void) -#endif { #define MAX_HDD_COUNT 32 int bvCount; @@ -848,7 +827,7 @@ if (chain->filtered) filteredChain = true; int gBIOSDev = (int)get_env(envgBIOSDev); - + #if UNUSED if (multiboot_partition_set) for (bvr = chain; bvr < (BVRef)ULONG_MAX; bvr = bvr->next) { @@ -918,7 +897,7 @@ } } } - + /* * Use the standrad method for selecting the boot volume. */ Index: branches/cparm/i386/libsaio/stringTable.c =================================================================== --- branches/cparm/i386/libsaio/stringTable.c (revision 1930) +++ branches/cparm/i386/libsaio/stringTable.c (revision 1931) @@ -539,6 +539,12 @@ *size = overrideSize; return true; } + else if (getValueForConfigTableKey(&bootInfo->bootConfig, key, &overrideVal, &overrideSize) && overrideSize) + { + *val = overrideVal; + *size = overrideSize; + return true; + } } return ret; Index: branches/cparm/i386/libsaio/fake_efi.c =================================================================== --- branches/cparm/i386/libsaio/fake_efi.c (revision 1930) +++ branches/cparm/i386/libsaio/fake_efi.c (revision 1931) @@ -20,7 +20,10 @@ #include "sl.h" #include "modules.h" #include "vers.h" + +#ifndef NO_SMP_SUPPORT #include "smp-imps.h" +#endif #ifndef DEBUG_EFI #define DEBUG_EFI 0 @@ -87,7 +90,7 @@ #endif return NULL; } - + efi_guid_unparse_upper(pGuid, string); return string; } @@ -106,7 +109,7 @@ /* Info About the current Firmware */ #define FIRMWARE_MAINTENER "cparm, armelcadetpetit@gmail.com" -static EFI_CHAR16 const FIRMWARE_NAME[] = {'C','u','p','e','r','t','i','n','o', 0}; +static EFI_CHAR16 const FIRMWARE_NAME[] = {'M','a','s','h','e','r','b','r','u','m','-','2', 0}; static EFI_UINT32 const FIRMWARE_REVISION = 0x00010800; //1.8 static EFI_UINT32 const DEVICE_SUPPORTED = 0x00000001; @@ -137,16 +140,22 @@ 0x8868e871, 0xe4f1, 0x11d3, { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ } +#ifndef NO_SMP_SUPPORT #define EFI_MPS_TABLE_GUID \ { \ 0xeb9d2d2f,0x2d88,0x11d3,{0x9a,0x16,0x0,0x90,0x27,0x3f,0xc1,0x4d} \ } +#endif + /* From Foundation/Efi/Guid/Smbios/SmBios.c */ EFI_GUID const gEfiSmbiosTableGuid = EFI_SMBIOS_TABLE_GUID; EFI_GUID gEfiAcpiTableGuid = EFI_ACPI_TABLE_GUID; EFI_GUID gEfiAcpi20TableGuid = EFI_ACPI_20_TABLE_GUID; + +#ifndef NO_SMP_SUPPORT EFI_GUID gEfiMpsTableGuid = EFI_MPS_TABLE_GUID; +#endif EFI_UINT32 gNumTables32 = 0; EFI_UINT64 gNumTables64 = 0; @@ -295,10 +304,12 @@ { sprintf(id, "%s", "RSD2"); } +#ifndef NO_SMP_SUPPORT else if (memcmp(&Guid, &gEfiMpsTableGuid, sizeof(EFI_GUID)) == 0) { sprintf(id, "%s", "_MP_"); } +#endif msglog("table [%d]:%s , 32Bit addr : 0x%x\n",i,id,table); @@ -710,24 +721,18 @@ size = sizeof(appleClut8); long clut = AllocateKernelMemory(size); bcopy(&appleClut8, (void*)clut, size); -#if UNUSED - AllocateMemoryRange( "BootCLUT", clut, size,-1); - -#else + AllocateMemoryRange( "BootCLUT", clut, size); -#endif } { #include "failedboot.h" size = 32 + kFailedBootWidth * kFailedBootHeight; long bootPict = AllocateKernelMemory(size); -#if UNUSED - AllocateMemoryRange( "Pict-FailedBoot", bootPict, size,-1); -#else + AllocateMemoryRange( "Pict-FailedBoot", bootPict, size); -#endif + ((boot_progress_element *)bootPict)->width = kFailedBootWidth; ((boot_progress_element *)bootPict)->height = kFailedBootHeight; ((boot_progress_element *)bootPict)->yOffset = kFailedBootOffset; @@ -991,7 +996,7 @@ { if (smbios_p) addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL); - +#ifndef NO_SMP_SUPPORT if (get_env(envVendor) == CPUID_VENDOR_INTEL ) { int num_cpus; @@ -1012,7 +1017,7 @@ } #endif } - +#endif // PM_Model if (get_env(envIsServer)) { Index: branches/cparm/i386/libsaio/saio_internal.h =================================================================== --- branches/cparm/i386/libsaio/saio_internal.h (revision 1930) +++ branches/cparm/i386/libsaio/saio_internal.h (revision 1931) @@ -159,13 +159,10 @@ /* memory.c */ long AllocateKernelMemory( long inSize ); -#if UNUSED + long -AllocateMemoryRange(char * rangeName, long start, long length, long type); -#else -long AllocateMemoryRange(char * rangeName, long start, long length); -#endif + /* misc.c */ extern void enableA20(void); extern void turnOffFloppy(void); @@ -254,16 +251,10 @@ extern long GetFSUUID(char *spec, char *uuidStr); extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr); extern int openmem(char *buf, int len); -#if UNUSED -extern int open(const char *path, int flags); -#else + extern int open(const char *path); -#endif -#if UNUSED -extern int open_bvdev(const char *bvd, const char *path, int flags); -#else extern int open_bvdev(const char *bvd, const char *path); -#endif + extern int close(int fdesc); extern int file_size(int fdesc); extern int read(int fdesc, char *buf, int count); @@ -281,11 +272,9 @@ long * time, FinderInfo *finderInfo, long *infoValid); extern void flushdev(void); extern void scanBootVolumes(int biosdev, int *count); -#if UNUSED -extern void scanDisks(int biosdev, int *count); -#else + extern void scanDisks(void); -#endif + extern BVRef selectBootVolume(BVRef chain); extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose); extern void setRootVolume(BVRef volume); Index: branches/cparm/i386/boot2/graphics.c =================================================================== --- branches/cparm/i386/boot2/graphics.c (revision 1930) +++ branches/cparm/i386/boot2/graphics.c (revision 1931) @@ -291,11 +291,8 @@ //========================================================================== // setVESAGraphicsMode -#if UNUSED -int __setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate ) -#else + int __setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel) -#endif { VBEModeInfoBlock minfo; unsigned short mode; @@ -507,9 +504,9 @@ unsigned char bitsPerPixel ) { VBEModeInfoBlock minfo; - minfo.XResolution = 0; + minfo.XResolution = 0; minfo.YResolution = 0; - + unsigned short mode = modeEndOfList; if ( (cols != 80) || (rows != 25) ) // not 80x25 mode @@ -601,24 +598,17 @@ if ( params[2] == 256 ) params[2] = 8; if ( params[2] == 555 ) params[2] = 16; if ( params[2] == 888 ) params[2] = 32; -#if UNUSED - return __setVESAGraphicsMode( params[0], params[1], params[2], params[3] ); -#else + return __setVESAGraphicsMode( params[0], params[1], params[2] ); -#endif } //========================================================================== // setVideoMode // // Set the video mode to VGA_TEXT_MODE or GRAPHICS_MODE. -#if UNUSED + void -__setVideoMode( int mode, int drawgraphics) -#else -void __setVideoMode( int mode) -#endif { unsigned long params[4]; int count; Index: branches/cparm/i386/boot2/boot.c =================================================================== --- branches/cparm/i386/boot2/boot.c (revision 1930) +++ branches/cparm/i386/boot2/boot.c (revision 1931) @@ -57,9 +57,7 @@ #include "libsa.h" #include "platform.h" #include "graphics.h" -#ifndef OPTION_ROM #include "appleboot.h" -#endif #include "modules.h" #include "xml.h" #include "options.h" @@ -143,14 +141,6 @@ } #endif -#if 0 -static inline void exception_error(char *msg, int nb) -{ - printf("\r\nException number = %d\r\nmessage = %s\r\n\r\n", nb, msg); - asm volatile ("hlt"); -} -#endif - BVRef getBvChain(void) { return bvChain; @@ -164,9 +154,6 @@ { zeroBSS(); malloc_init(0, 0, 0, malloc_error); -#if 0 - exception_init(exception_error); -#endif } static void init_pic(void) @@ -181,7 +168,7 @@ outb(0x21, 0x01); outb(0xA1, 0x01); - //outb(0x70, inb(0x70)|0x80); /* Disable NMI */ is this really necessary ? + //outb(0x70, inb(0x70)|0x80); /* Disable NMI */ outb(0x21, 0xff); /* Maskout all interrupts Pic1 */ outb(0xa1, 0xff); /* Maskout all interrupts Pic2 */ @@ -287,13 +274,8 @@ if ((execute_hook("GUI_ExecKernel", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS)) // (bootArgs->Video.v_display == VGA_TEXT_MODE) { -#if UNUSED - __setVideoMode( GRAPHICS_MODE, 0 ); -#else - __setVideoMode( GRAPHICS_MODE ); -#endif + __setVideoMode( GRAPHICS_MODE ); -#ifndef OPTION_ROM if(!gVerboseMode) { @@ -325,7 +307,6 @@ } } -#endif } finalizeEFIConfigTable(); @@ -470,7 +451,7 @@ setBootGlobals(bvChain); // Load Booter boot.plist config file - /*status =*/ loadBooterConfig(); + loadBooterConfig(); { bool isServer = false; @@ -499,7 +480,6 @@ } { -#ifndef OPTION_ROM bool ScanSingleDrive = false; // Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config. if (getBoolForKey(kScanSingleDriveKey, &ScanSingleDrive, DEFAULT_BOOT_CONFIG) && ScanSingleDrive) @@ -513,13 +493,8 @@ scanBootVolumes(BIOSDev, &bvCount); } else -#endif { -#if UNUSED - scanDisks(BIOSDev, &bvCount); -#else scanDisks(); -#endif } } @@ -531,24 +506,13 @@ gBootVolume = selectBootVolume(bvChain); - { - // Intialize module system - EFI_STATUS sysinit = init_module_system(); - if((sysinit == EFI_SUCCESS) || (sysinit == EFI_ALREADY_STARTED) /*should never happen*/ ) - { - load_all_modules(); - } - } - + LoadBundles("/Extra/"); + load_all_internal_modules(); // Loading preboot ramdisk if exists. execute_hook("loadPrebootRAMDisk", NULL, NULL, NULL, NULL, NULL, NULL); -#ifndef OPTION_ROM - - - { // Disable rescan option by default bool CDROMRescan = false; @@ -571,9 +535,7 @@ { safe_set_env(envgEnableCDROMRescan, promptForRescanOption()); } - } - -#endif + } #if DEBUG printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags); @@ -621,10 +583,9 @@ if(gBootVolume == NULL) { freeFilteredBVChain(bvChain); -#ifndef OPTION_ROM + if (get_env(envgEnableCDROMRescan)) rescanBIOSDevice((int)get_env(envgBIOSDev)); -#endif bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &devcnt); safe_set_env(envgDeviceCount,devcnt); @@ -843,11 +804,9 @@ { if (getVideoMode() == GRAPHICS_MODE) { // if we are already in graphics-mode, -#if UNUSED - __setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode -#else + __setVideoMode(VGA_TEXT_MODE); // switch back to text mode -#endif + } } #ifdef NBP_SUPPORT Index: branches/cparm/i386/boot2/graphics.h =================================================================== --- branches/cparm/i386/boot2/graphics.h (revision 1930) +++ branches/cparm/i386/boot2/graphics.h (revision 1931) @@ -28,11 +28,8 @@ const unsigned char *imageData, unsigned char **newImageData ); -#if UNUSED -int __setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate ); -#else + int __setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel); -#endif int __getNumberArrayFromProperty( const char * propKey, unsigned long numbers[], @@ -48,13 +45,7 @@ VBEModeInfoBlock * outModeInfo, unsigned short * vesaVersion ); - -#if UNUSED void -__setVideoMode( int mode, int drawgraphics); -#else -void __setVideoMode( int mode); -#endif #endif /* !__BOOT_GRAPHICS_H */ Index: branches/cparm/i386/boot2/drivers.c =================================================================== --- branches/cparm/i386/boot2/drivers.c (revision 1930) +++ branches/cparm/i386/boot2/drivers.c (revision 1931) @@ -168,20 +168,19 @@ if ( gBootFileType == kBlockDeviceType ) { // First try to load Extra extensions from the ramdisk if isn't aliased as bt(0,0). -#ifndef OPTION_ROM + // First try a specfic OS version folder ie 10.5 step = 1; execute_hook("ramDiskLoadDrivers", &step, NULL, NULL, NULL, NULL, NULL); -#endif // First try a specfic OS version folder ie 10.5 sprintf(dirSpecExtra, "/Extra/%s/", (char*)gBootVolume->OSVersion); if (FileLoadDrivers(dirSpecExtra, 0) != 0) { // Next try to load Extra extensions from the selected root partition. - strcpy(dirSpecExtra, "/Extra/"); + strlcpy(dirSpecExtra, "/Extra/", sizeof(dirSpecExtra)); if (FileLoadDrivers(dirSpecExtra, 0) != 0) { // If failed, then try to load Extra extensions from the boot partition @@ -193,14 +192,14 @@ if (FileLoadDrivers(dirSpecExtra, 0) != 0) { // Next we'll try the base - strcpy(dirSpecExtra, "bt(0,0)/Extra/"); + strlcpy(dirSpecExtra, "bt(0,0)/Extra/", sizeof(dirSpecExtra)); FileLoadDrivers(dirSpecExtra, 0); } } -#ifndef OPTION_ROM + step = 2; execute_hook("ramDiskLoadDrivers", &step, NULL, NULL, NULL, NULL, NULL); -#endif + } } @@ -209,13 +208,13 @@ // Also try to load Extensions from boot helper partitions. if (gBootVolume->flags & kBVFlagBooter) { - strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/"); + strlcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/", sizeof(dirSpecExtra)); if (FileLoadDrivers(dirSpecExtra, 0) != 0) { - strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/"); + strlcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/", sizeof(dirSpecExtra)); if (FileLoadDrivers(dirSpecExtra, 0) != 0) { - strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/"); + strlcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/", sizeof(dirSpecExtra)); FileLoadDrivers(dirSpecExtra, 0); } } @@ -233,7 +232,7 @@ } else { - strcpy(gExtensionsSpec, dirSpec); + strlcpy(gExtensionsSpec, dirSpec, 4096); strcat(gExtensionsSpec, "System/Library/"); FileLoadDrivers(gExtensionsSpec, 0); } @@ -315,7 +314,7 @@ if (strcmp(name + length - 5, ".kext")) continue; // Save the file name. - strcpy(gFileName, name); + strlcpy(gFileName, name, 4096); // Determine the bundle type. sprintf(gTempSpec, "%s/%s", dirSpec, gFileName); @@ -417,12 +416,7 @@ // Add the MKext to the memory map. sprintf(segName, "DriversPackage-%lx", driversAddr); -#if UNUSED - AllocateMemoryRange(segName, driversAddr, driversLength, - kBootDriverTypeMKEXT); -#else AllocateMemoryRange(segName, driversAddr, driversLength); -#endif return 0; } @@ -451,15 +445,15 @@ tmpExecutablePath = malloc(executablePathLength); if (tmpExecutablePath == 0) break; - strcpy(tmpExecutablePath, gFileSpec); - + strlcpy(tmpExecutablePath, gFileSpec, executablePathLength); + sprintf(gFileSpec, "%s/%s", dirSpec, name); bundlePathLength = strlen(gFileSpec) + 1; tmpBundlePath = malloc(bundlePathLength); if (tmpBundlePath == 0) break; - strcpy(tmpBundlePath, gFileSpec); + strlcpy(tmpBundlePath, gFileSpec, bundlePathLength); // Construct the file spec to the plist, then load it. @@ -542,7 +536,6 @@ return ret; } - //========================================================================== // LoadMatchedModules @@ -582,12 +575,7 @@ if ((length != -1) && executableAddr) { - //driverModuleAddr = (void *)kLoadAddr; - //if (length != 0) - //{ - // ThinFatFile(&driverModuleAddr, &length); - //} - + // Make make in the image area. execute_hook("LoadMatchedModules", module, &length, executableAddr, NULL, NULL, NULL); @@ -615,21 +603,17 @@ driver->bundlePathLength = module->bundlePathLength; // Save the plist, module and bundle. - strcpy(driver->plistAddr, module->plistAddr); + strlcpy(driver->plistAddr, module->plistAddr,driver->plistLength); if (length != 0) { memcpy(driver->executableAddr, executableAddr, length); } - strcpy(driver->bundlePathAddr, module->bundlePath); + strlcpy(driver->bundlePathAddr, module->bundlePath, module->bundlePathLength); // Add an entry to the memory map. sprintf(segName, "Driver-%lx", (unsigned long)driver); -#if UNUSED - AllocateMemoryRange(segName, driverAddr, driverLength, - kBootDriverTypeKEXT); -#else + AllocateMemoryRange(segName, driverAddr, driverLength); -#endif } } @@ -837,7 +821,7 @@ if (ret == 0 && len == 0 && archCpuType==CPU_TYPE_X86_64) { archCpuType=CPU_TYPE_I386; - /*ret =*/ ThinFatFile(&binary, &len); + ThinFatFile(&binary, &len); } ret = DecodeMachO(binary, rentry, raddr, rsize); @@ -848,6 +832,6 @@ ret = DecodeMachO(binary, rentry, raddr, rsize); } } - + return ret; } \ No newline at end of file Index: branches/cparm/i386/boot2/options.c =================================================================== --- branches/cparm/i386/boot2/options.c (revision 1930) +++ branches/cparm/i386/boot2/options.c (revision 1931) @@ -199,13 +199,12 @@ clearBootArgs(); if (visible) { -#ifndef OPTION_ROM + if (get_env(envgEnableCDROMRescan)) { printf( "%s",bootRescanPrompt ); } else -#endif { printf( "%s",bootPrompt ); } @@ -489,7 +488,6 @@ return kn; } -#ifndef OPTION_ROM //========================================================================== void printMemoryInfo(void) @@ -569,7 +567,6 @@ setActiveDisplayPage(0); } } -#endif //========================================================================== @@ -852,7 +849,6 @@ /* * TODO: this needs to be refactored. */ -#ifndef OPTION_ROM #if UNUSED if (strcmp( booterCommand, "video" ) == 0) { @@ -889,7 +885,6 @@ { showHelp(); } -#endif key = 0; showBootPrompt(nextRow, showPrompt); break; @@ -902,7 +897,7 @@ case kEscapeKey: clearBootArgs(); break; -#ifndef OPTION_ROM + case kF5Key: // New behavior: // Clear gBootVolume to restart the loop @@ -916,15 +911,13 @@ case kF10Key: safe_set_env(envgScanSingleDrive, false); -#if UNUSED - scanDisks((int)get_env(envgBIOSDev), &bvCount); -#else + scanDisks(); -#endif + gBootVolume = NULL; clearBootArgs(); break; -#endif + default: key = 0; break; @@ -1042,8 +1035,7 @@ loadSystemConfig(); #if virtualM || PCI_FIX // we can simply make an option for this fix - addBootArg("npci=0x2000"); - + addBootArg("npci=0x2000"); #endif #if verbose addBootArg("-v"); @@ -1157,8 +1149,6 @@ return 0; } -#ifndef OPTION_ROM - //========================================================================== // Load the help file and display the file contents on the screen. @@ -1298,9 +1288,7 @@ showTextBuffer(buf, size); free(buf); } -#endif -#ifndef OPTION_ROM bool promptForRescanOption(void) { printf("\nWould you like to enable media rescan option?\nPress ENTER to enable or any key to skip.\n"); @@ -1310,4 +1298,3 @@ return false; } } -#endif Index: branches/cparm/i386/boot2/Makefile =================================================================== --- branches/cparm/i386/boot2/Makefile (revision 1930) +++ branches/cparm/i386/boot2/Makefile (revision 1931) @@ -8,6 +8,21 @@ DIR = boot2 include ../MakePaths.dir +SYMBOLS_BUNDLE = Symbols + +BUNDLE_NAME = $(SYMBOLS_BUNDLE) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_ID = com.boot.SYSTEM.SYMS +BUNDLE_INFO = +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = SYMS +BUNDLE_CLASS_PROVIDER = SYSTEM + OPTIM = -Os -Oz CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror -fno-stack-protector \ -fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \ @@ -53,17 +68,6 @@ BOOT2ADDR = 20200 MAXBOOTSIZE = 458240 - -# -# Strings used to retrieve the start location for the Symbols.dylib module -# -SYMBOLS_MODULE = Symbols.dylib -SYMBOL_START= _symbols_module_start -SYMBOL_ADDR = $(shell printf "%d" 0x`nm -s __DATA __data $(SYMROOT)/boot_embeded.sys | grep " $(SYMBOL_START)$$" | cut -f 1 -d " "`) -DATA_OFFSET = $(shell otool -l $(SYMROOT)/boot_embeded.sys | grep __data -A 4 | grep __DATA -A 3 | tail -n 1 | cut -f 6 -d " ") -DATA_ADDR = $(shell printf "%d" `otool -l $(SYMROOT)/boot_embeded.sys | grep __data -A 4 | grep __DATA -A 3 | head -n 2 | tail -n 1 | cut -f 8 -d " "`) -PATCH_ADDR = $(shell echo ${SYMBOL_ADDR}-${DATA_ADDR}+${DATA_OFFSET} | bc) - #CFLAGS += -DSAFE_MALLOC # CFLAGS += -DBOOT_HELPER_SUPPORT # +992 bytes @@ -72,25 +76,41 @@ all embedtheme: $(DIRS_NEEDED) boot -boot: embedded.h machOconv $(OBJS) $(LIBDEP) +boot: embedded.h machOconv $(OBJS) $(LIBDEP) @echo "\t[LD] boot.sys" - @$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \ + @$(CC) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \ -nostdlib -arch i386 -Wl,-segalign,20 \ - -o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) #-e boot2 + -o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) #-e boot2 @echo "\t[MACHOCONV] boot" @$(SYMROOT)/machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot &> /dev/null - @make Symbols.dylib + @make Symbols + @rm -rf $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle + @mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle + @mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents + @mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents/MacOS + @mv $(SYMROOT)/Symbols.plist $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' - @##echo "\t[LD] boot_embeded.sys" - @##$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \ - -nostdlib -arch i386 -Wl,-segalign,20 \ - -Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \ - -o $(SYMROOT)/boot_embeded.sys $(filter %.o,$^) $(LIBS) -lcc_kext - @##make embed_symbols # this is done in a sub process after boot.sys exists so the strings are populated correctly + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist - @##${RM} $(SYMROOT)/${SYMBOLS_MODULE} - @##size $(SYMROOT)/boot.sys @ls -l $(SYMROOT)/boot @( size=`ls -l $(SYMROOT)/boot | awk '{ print $$5}'` ; \ @@ -101,18 +121,11 @@ exit 1;\ fi) -embed_symbols: machOconv - @echo ================= Embedding Symbols.dylib ================= - @echo ******* Patching at $(PATCH_ADDR) ****** - @stat -f%z $(SYMROOT)/boot | perl -ane "print pack('V',@F[0]);" | dd conv=notrunc of=${SYMROOT}/boot_embeded.sys bs=1 count=4 seek=$(PATCH_ADDR) &> /dev/null - @echo "\t[MACHOCONV] boot_embeded" - @$(SYMROOT)/machOconv $(SYMROOT)/boot_embeded.sys $(SYMROOT)/boot_embeded - embedded.h: @cd $(SYMROOT)/../../doc && xxd -i BootHelp.txt > $(SYMROOT)/embedded.h -Symbols.dylib: Symbols.o - @echo ================= Compiling ${SYMBOLS_MODULE} ================= +Symbols: Symbols.o + @echo ================= Compiling ${BUNDLE_EXEC} ================= @echo "start" >> ${OBJROOT}/Symbols.save @echo "_lookup_symbol" >> ${OBJROOT}/Symbols.save @@ -130,10 +143,11 @@ -macosx_version_min 10.6 \ -exported_symbols_list ${OBJROOT}/Symbols.save \ ${OBJROOT}/Symbols.o \ - -o $(SYMROOT)/${SYMBOLS_MODULE} + -o $(SYMROOT)/${BUNDLE_EXEC} - @##size $(SYMROOT)/${SYMBOLS_MODULE} + @##size $(SYMROOT)/${BUNDLE_EXEC} +##deprecated ?? Symbols.o: Symbols.plist @rm -rf $(SYMROOT)/Symbols.h @echo "typedef struct {" >> $(SYMROOT)/Symbols.h Index: branches/cparm/i386/modules/NetbookInstaller/NBI.c =================================================================== --- branches/cparm/i386/modules/NetbookInstaller/NBI.c (revision 1930) +++ branches/cparm/i386/modules/NetbookInstaller/NBI.c (revision 1931) @@ -41,17 +41,10 @@ extern long InitDriverSupport(void); extern long GetDriverGbl(void); -#define kEnableNBI "EnableNBIModule" - void NetbookInstaller_start(void); void NetbookInstaller_start(void) -{ - bool enable = true; - getBoolForKey(kEnableNBI, &enable, DEFAULT_BOOT_CONFIG) ; - - if (enable) +{ register_hook_callback("PreBoot", &NBI_PreBoot_hook); - } void NBI_PreBoot_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6) @@ -175,11 +168,9 @@ // Read new ramdisk image contents in kernel memory. if (read(fh, (char*) ramdiskPtr.base, ramdiskPtr.size) == ramdiskPtr.size) { -#if UNUSED - AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size, kBootDriverTypeInvalid); -#else + AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size); -#endif + Node* node = DT__FindNode("/chosen/memory-map", false); if(node != NULL) { Index: branches/cparm/i386/modules/NetbookInstaller/Makefile =================================================================== --- branches/cparm/i386/modules/NetbookInstaller/Makefile (revision 1930) +++ branches/cparm/i386/modules/NetbookInstaller/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.FDISK.RAMDISK_NBI.netbootinstaller +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = RAMDISK_NBI +BUNDLE_CLASS_PROVIDER = FDISK + DIR = NetbookInstaller include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${NBI_OBJS} dylib +all embedtheme: ${NBI_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -72,9 +85,31 @@ -final_output $(MODULE_NAME) \ -macosx_version_min 10.6 \ $(OBJROOT)/*.o \ - -weak_library $(SYMROOT)/Symbols.dylib \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist stack_protector.o: Index: branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c =================================================================== --- branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c (revision 1930) +++ branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c (revision 1931) @@ -3,7 +3,7 @@ * Chameleon * * Created by cparm on 05/12/10. - * Copyright 2010. All rights reserved. + * Copyright 2010,2012. All rights reserved. * */ @@ -15,7 +15,6 @@ #include "disk.h" -#define kEnableEDL "EnableRamDiskLoader" void loadPrebootRAMDisk_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void md0Ramdisk_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void processRAMDiskCommand_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); @@ -135,19 +134,13 @@ void RamDiskLoader_start(void); void RamDiskLoader_start(void) { - bool enable = true; - getBoolForKey(kEnableEDL, &enable, DEFAULT_BOOT_CONFIG) ; - - if (enable) - { - register_hook_callback("loadPrebootRAMDisk", &loadPrebootRAMDisk_hook); - register_hook_callback("md0Ramdisk", &md0Ramdisk_hook); - register_hook_callback("processRAMDiskCommand", &processRAMDiskCommand_hook); - register_hook_callback("ramDiskLoadDrivers", &ramDiskLoadDrivers_hook); - register_hook_callback("newRamDisk_BVR", &newRamDisk_BVR_hook); - register_hook_callback("p_get_ramdisk_info", &p_get_ramdisk_info_hook); - register_hook_callback("p_ramdiskReadBytes", &p_ramdiskReadBytes_hook); - register_hook_callback("isRamDiskRegistred", &is_Ram_Disk_Registred_Hook); - } + register_hook_callback("loadPrebootRAMDisk", &loadPrebootRAMDisk_hook); + register_hook_callback("md0Ramdisk", &md0Ramdisk_hook); + register_hook_callback("processRAMDiskCommand", &processRAMDiskCommand_hook); + register_hook_callback("ramDiskLoadDrivers", &ramDiskLoadDrivers_hook); + register_hook_callback("newRamDisk_BVR", &newRamDisk_BVR_hook); + register_hook_callback("p_get_ramdisk_info", &p_get_ramdisk_info_hook); + register_hook_callback("p_ramdiskReadBytes", &p_ramdiskReadBytes_hook); + register_hook_callback("isRamDiskRegistred", &is_Ram_Disk_Registred_Hook); } \ No newline at end of file Index: branches/cparm/i386/modules/RamDiskLoader/ramdisk.c =================================================================== --- branches/cparm/i386/modules/RamDiskLoader/ramdisk.c (revision 1930) +++ branches/cparm/i386/modules/RamDiskLoader/ramdisk.c (revision 1931) @@ -96,11 +96,9 @@ // Read new ramdisk image contents in kernel memory. if (read(fh, (char*) ramdiskPtr.base, ramdiskPtr.size) == ramdiskPtr.size) { -#if UNUSED - AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size, kBootDriverTypeInvalid); -#else + AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size); -#endif + Node* node = DT__FindNode("/chosen/memory-map", false); if(node != NULL) { Index: branches/cparm/i386/modules/RamDiskLoader/Makefile =================================================================== --- branches/cparm/i386/modules/RamDiskLoader/Makefile (revision 1930) +++ branches/cparm/i386/modules/RamDiskLoader/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.FDISK.RAMDISK.ramdiskloader +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = RAMDISK +BUNDLE_CLASS_PROVIDER = FDISK + DIR = RamDiskLoader include ../../MakePaths.dir @@ -57,10 +70,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${RDL_OBJS} dylib +all embedtheme: ${RDL_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -73,8 +86,31 @@ $(OBJROOT)/stack_protector.o \ $(OBJROOT)/ramdisk.o \ $(OBJROOT)/RamDiskLoader.o \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist stack_protector.o: Index: branches/cparm/i386/modules/YellowIconFixer/YellowIconFixer.c =================================================================== --- branches/cparm/i386/modules/YellowIconFixer/YellowIconFixer.c (revision 1930) +++ branches/cparm/i386/modules/YellowIconFixer/YellowIconFixer.c (revision 1931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 cparm . All rights reserved. + * Copyright (c) 2011,2012 cparm . All rights reserved. * */ @@ -19,7 +19,6 @@ #define DBG(x...) #endif -#define kEnableSATA "EnableSATAModule" void SATA_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); uint8_t default_SATA_ID[]= { @@ -62,12 +61,6 @@ void YellowIconFixer_start(void); void YellowIconFixer_start(void) { - bool enable = true; - getBoolForKey(kEnableSATA, &enable, DEFAULT_BOOT_CONFIG) ; - - if (enable) - { - register_hook_callback("PCIDevice", &SATA_hook); - } + register_hook_callback("PCIDevice", &SATA_hook); } Index: branches/cparm/i386/modules/YellowIconFixer/Makefile =================================================================== --- branches/cparm/i386/modules/YellowIconFixer/Makefile (revision 1930) +++ branches/cparm/i386/modules/YellowIconFixer/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.DTREE.SATA_EFI.yellowiconfixer +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = SATA_EFI +BUNDLE_CLASS_PROVIDER = DTREE + DIR = YellowIconFixer include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${SATA_OBJS} dylib +all embedtheme: ${SATA_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -71,8 +84,31 @@ -current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \ -final_output $(MODULE_NAME) \ -macosx_version_min 10.6 \ - $(OBJROOT)/stack_protector.o $(OBJROOT)/YellowIconFixer.o -o $(SYMROOT)/$(MODULE_NAME).dylib + $(OBJROOT)/stack_protector.o $(OBJROOT)/YellowIconFixer.o -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist stack_protector.o: Index: branches/cparm/i386/modules/ACPIPatcher/AcpiPatcher.c =================================================================== --- branches/cparm/i386/modules/ACPIPatcher/AcpiPatcher.c (revision 1930) +++ branches/cparm/i386/modules/ACPIPatcher/AcpiPatcher.c (revision 1931) @@ -4,7 +4,7 @@ */ /* - * Copyright (c) 2010 cparm . All rights reserved. + * Copyright (c) 2010,2012 cparm . All rights reserved. * */ @@ -14,23 +14,8 @@ #include "pci_root.h" #include "acpi_patcher.h" -#define kEnableAcpi "EnableAcpiModule" void AcpiPatcher_start(void); -void is_ACPI_Patcher_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); -void is_ACPI_Patcher_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6){} - void AcpiPatcher_start(void) { - bool enable = true; - - getBoolForKey(kEnableAcpi, &enable, DEFAULT_BOOT_CONFIG); - - enable = (execute_hook("isACPIRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS); - - if (enable) { - replace_system_function("_setup_acpi",&setupAcpi); - - register_hook_callback("isACPIRegistred", &is_ACPI_Patcher_Registred_Hook); - - } + replace_system_function("_setup_acpi",&setupAcpi); } \ No newline at end of file Index: branches/cparm/i386/modules/ACPIPatcher/Makefile =================================================================== --- branches/cparm/i386/modules/ACPIPatcher/Makefile (revision 1930) +++ branches/cparm/i386/modules/ACPIPatcher/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.ACPI.ACPIPLATFORM.acpipatcher +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = ACPIPLATFORM +BUNDLE_CLASS_PROVIDER = ACPI + DIR = AcpiPatcher include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${ACPI_PATCHER_OBJS} dylib +all embedtheme: ${ACPI_PATCHER_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -75,8 +88,32 @@ $(OBJROOT)/AcpiPatcher.o \ $(OBJROOT)/aml_generator.o \ $(OBJROOT)/acpi_patcher.o \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist + AcpiPatcher.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "AcpiPatcher.c" $(INC) -o "$(OBJROOT)/AcpiPatcher.o" Index: branches/cparm/i386/modules/GUI/graphic_utils.h =================================================================== --- branches/cparm/i386/modules/GUI/graphic_utils.h (revision 1930) +++ branches/cparm/i386/modules/GUI/graphic_utils.h (revision 1931) @@ -68,11 +68,8 @@ unsigned long numbers[], unsigned long maxArrayCount ); -#if UNUSED -int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate ); -#else + int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel); -#endif void getGraphicModeParams(unsigned long params[]); char *getVBEModeInfoString(void); @@ -99,11 +96,9 @@ unsigned short height, unsigned char colorIndex ); -#if UNUSED -void setVideoMode(int mode, int drawgraphics); -#else + void setVideoMode(int mode); -#endif + char * decodeRLE( const void * rleData, int rleBlocks, int outBytes ); Index: branches/cparm/i386/modules/GUI/gui.c =================================================================== --- branches/cparm/i386/modules/GUI/gui.c (revision 1930) +++ branches/cparm/i386/modules/GUI/gui.c (revision 1931) @@ -89,13 +89,10 @@ static int dprintf( window_t * window, const char * fmt, ...); #endif static void sputc(int c, struct putc_info * pi); -#if UNUSED + static inline -void vramwrite (void *data, int width, int height); -#else -static inline void vramwrite (void *data, int width); -#endif + static void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected); static int startGUI(void); static void free_theme_list(); @@ -1105,8 +1102,8 @@ if (!dummybool) { return 1; } - getMemoryInfoString = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_getMemoryInfoString"); - showHelp = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showHelp"); + getMemoryInfoString = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_getMemoryInfoString"); + showHelp = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showHelp"); getBoolForKey("RandomTheme", &theme_ran, DEFAULT_BOOT_CONFIG); @@ -1303,11 +1300,8 @@ // lets copy the screen into the back buffer memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); -#if UNUSED - setVideoMode( GRAPHICS_MODE, 0 ); -#else setVideoMode( GRAPHICS_MODE ); -#endif + gui.initialised = true; return 0; } @@ -1619,13 +1613,9 @@ return; } -#if UNUSED + static inline -void vramwrite (void *data, int width, int height) -#else -static inline void vramwrite (void *data, int width) -#endif { if (VIDEO (depth) == 0x20 /*32*/ && VIDEO (rowBytes) == (unsigned long)gui.backbuffer->width * 4) memcpy((uint8_t *)vram, gui.backbuffer->pixels, VIDEO (rowBytes)*VIDEO (height)); @@ -1678,11 +1668,9 @@ if (gui.infobox.draw) blend( gui.infobox.pixmap, gui.backbuffer, gui.infobox.pos ); } -#if UNUSED - vramwrite ( gui.backbuffer->pixels, gui.backbuffer->width, gui.backbuffer->height ); -#else + vramwrite ( gui.backbuffer->pixels, gui.backbuffer->width ); -#endif + if (gui.redraw) { memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); @@ -2573,11 +2561,9 @@ if (getVideoMode() == VGA_TEXT_MODE || (screen_params[0] != (uint32_t)oldScreenWidth && screen_params[1] != (uint32_t)oldScreenHeight) ) { -#if UNUSED - setVideoMode(GRAPHICS_MODE, 0); -#else + setVideoMode(GRAPHICS_MODE); -#endif + } if (getValueForKey("-checkers", &dummyVal, &length, DEFAULT_BOOT_CONFIG)) { @@ -2644,11 +2630,8 @@ if ( params[2] == 555 ) params[2] = 16; if ( params[2] == 888 ) params[2] = 32; -#if UNUSED - return setVESAGraphicsMode( params[0], params[1], params[2], params[3] ); -#else return setVESAGraphicsMode( params[0], params[1], params[2] ); -#endif + } Index: branches/cparm/i386/modules/GUI/GUI_module.c =================================================================== --- branches/cparm/i386/modules/GUI/GUI_module.c (revision 1930) +++ branches/cparm/i386/modules/GUI/GUI_module.c (revision 1931) @@ -257,15 +257,15 @@ register_hook_callback("GUI_PreBoot", &GUI_PreBoot_hook); - getBvChain = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_getBvChain"); - getMemoryInfoString = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_getMemoryInfoString"); + getBvChain = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_getBvChain"); + getMemoryInfoString = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_getMemoryInfoString"); - printMemoryInfo = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_printMemoryInfo"); - lspci = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_lspci"); - showHelp = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showHelp"); - showTextFile = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showTextFile"); - showMessage = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showMessage"); - showTextBuffer = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showTextBuffer"); + printMemoryInfo = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_printMemoryInfo"); + lspci = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_lspci"); + showHelp = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showHelp"); + showTextFile = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showTextFile"); + showMessage = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showMessage"); + showTextBuffer = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showTextBuffer"); safe_set_env(envgBootArgs,(uint32_t)gBootArgs); msglog("* GUI successfully Displayed\n"); Index: branches/cparm/i386/modules/GUI/Makefile =================================================================== --- branches/cparm/i386/modules/GUI/Makefile (revision 1930) +++ branches/cparm/i386/modules/GUI/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.UI.GUI.gui +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = GUI +BUNDLE_CLASS_PROVIDER = UI + DIR = GUI include ../../MakePaths.dir @@ -69,10 +82,10 @@ #CFLAGS += -DBOOT_HELPER_SUPPORT -all: ${GUI_OBJS} dylib +all: ${GUI_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -87,8 +100,32 @@ $(OBJROOT)/gui.o \ $(OBJROOT)/picopng.o \ $(OBJROOT)/graphic_utils.o \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist + stack_protector.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o" Index: branches/cparm/i386/modules/GUI/graphic_utils.c =================================================================== --- branches/cparm/i386/modules/GUI/graphic_utils.c (revision 1930) +++ branches/cparm/i386/modules/GUI/graphic_utils.c (revision 1931) @@ -630,6 +630,9 @@ minfo.YResolution = 0; unsigned short mode = modeEndOfList; + minfo.XResolution = 0; + minfo.YResolution = 0; + if ( (cols != 80) || (rows != 25) ) // not 80x25 mode { mode = getVESAModeWithProperties( cols, rows, bitsPerPixel, @@ -668,13 +671,9 @@ // setVideoMode // // Set the video mode to VGA_TEXT_MODE or GRAPHICS_MODE. -#if UNUSED + void -setVideoMode( int mode, int drawgraphics) -#else -void setVideoMode( int mode) -#endif { unsigned long params[4]; int count; @@ -730,11 +729,8 @@ //========================================================================== // setVESAGraphicsMode -#if UNUSED -int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate ) -#else + int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel) -#endif { VBEModeInfoBlock minfo; unsigned short mode; Index: branches/cparm/i386/modules/KernelPatcher/kernel_patcher.c =================================================================== --- branches/cparm/i386/modules/KernelPatcher/kernel_patcher.c (revision 1930) +++ branches/cparm/i386/modules/KernelPatcher/kernel_patcher.c (revision 1931) @@ -226,7 +226,7 @@ static int locate_symbols(void* kernelData) { char is64 = 1; - parse_mach("VirtualXnuSyms",kernelData, NULL, symbol_handler); + parse_mach("VirtualXnuSyms",kernelData, symbol_handler); //handle_symtable((UInt32)kernelData, symtableData, &symbol_handler, determineKernelArchitecture(kernelData) == KERNEL_64); return 1 << is64; } Index: branches/cparm/i386/modules/KernelPatcher/Makefile =================================================================== --- branches/cparm/i386/modules/KernelPatcher/Makefile (revision 1930) +++ branches/cparm/i386/modules/KernelPatcher/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.kernelpatcher +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = +BUNDLE_CLASS_PROVIDER = + DIR = KernelPatcher include ../../MakePaths.dir @@ -58,9 +71,9 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${KERN_OBJS} dylib +all embedtheme: ${KERN_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -72,9 +85,31 @@ $(OBJROOT)/stack_protector.o \ $(OBJROOT)/kernel_patcher.o \ -macosx_version_min 10.6 \ - -weak_library $(SYMROOT)/Symbols.dylib \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist stack_protector.o: Index: branches/cparm/i386/modules/Networking/Networking.c =================================================================== --- branches/cparm/i386/modules/Networking/Networking.c (revision 1930) +++ branches/cparm/i386/modules/Networking/Networking.c (revision 1931) @@ -20,7 +20,6 @@ #endif #define kEnableWifi "EnableWifi" #define kEthernetBuiltIn "EthernetBuiltIn" -#define kEnableNetworking "EnableNetworkModule" static void set_eth_builtin(pci_dt_t *eth_dev); static void set_wifi_airport(pci_dt_t *wlan_dev); @@ -62,13 +61,8 @@ void Networking_start(void); void Networking_start(void) -{ - bool enable = true; - getBoolForKey(kEnableNetworking, &enable, DEFAULT_BOOT_CONFIG) ; - - if (enable) { - register_hook_callback("PCIDevice", &Networking_hook); - } +{ + register_hook_callback("PCIDevice", &Networking_hook); } /* a fine place for this code */ Index: branches/cparm/i386/modules/Networking/Makefile =================================================================== --- branches/cparm/i386/modules/Networking/Makefile (revision 1930) +++ branches/cparm/i386/modules/Networking/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.DTREE.NET_EFI.networking +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = NET_EFI +BUNDLE_CLASS_PROVIDER = DTREE + DIR = Networking include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${NET_OBJS} dylib +all embedtheme: ${NET_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -71,8 +84,32 @@ -current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \ -final_output $(MODULE_NAME) \ -macosx_version_min 10.6 \ - $(OBJROOT)/stack_protector.o $(OBJROOT)/Networking.o -o $(SYMROOT)/$(MODULE_NAME).dylib + $(OBJROOT)/stack_protector.o $(OBJROOT)/Networking.o -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist + stack_protector.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o" Index: branches/cparm/i386/modules/GraphicsEnabler/GraphicsEnabler.c =================================================================== --- branches/cparm/i386/modules/GraphicsEnabler/GraphicsEnabler.c (revision 1930) +++ branches/cparm/i386/modules/GraphicsEnabler/GraphicsEnabler.c (revision 1931) @@ -14,21 +14,12 @@ #include "modules.h" -#define kGraphicsEnabler "EnableGFXModule" - void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void GraphicsEnabler_start(void); void GraphicsEnabler_start(void) { - bool enable = true; - getBoolForKey(kGraphicsEnabler, &enable, DEFAULT_BOOT_CONFIG); - - - if (enable) - { - register_hook_callback("PCIDevice", &GraphicsEnabler_hook); - } + register_hook_callback("PCIDevice", &GraphicsEnabler_hook); } void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6) Index: branches/cparm/i386/modules/GraphicsEnabler/nvidia.c =================================================================== --- branches/cparm/i386/modules/GraphicsEnabler/nvidia.c (revision 1930) +++ branches/cparm/i386/modules/GraphicsEnabler/nvidia.c (revision 1931) @@ -19,8 +19,8 @@ /* * Alternatively you can choose to comply with APSL */ - - + + /* * DCB-Table parsing is based on software (nouveau driver) originally distributed under following license: * @@ -90,11 +90,9 @@ #define NVCAP_LEN ( sizeof(default_NVCAP) / sizeof(uint8_t) ) +//TODO: once the bundles will be implemented, add a plist reader so there will be no need anymore to hardcode the device ids of each cards, each one will be able to add his own device ids in the plist, it willl work great if the card is supported by the apple's drivers struct nv_chipsets_t NVKnownChipsets[] = { { 0x00000000, "Unknown" }, - // temporary placement - { 0x10DE0DF4, "GeForce GT 450M" }, //Azi + issue #99 - { 0x10DE1251, "GeForce GTX 560M" }, // Asus G74SX //======================================== // 0040 - 004F { 0x10DE0040, "GeForce 6800 Ultra" }, @@ -270,7 +268,7 @@ { 0x10DE0325, "GeForce FX Go5250" }, { 0x10DE0326, "GeForce FX 5500" }, { 0x10DE0328, "GeForce FX Go5200 32M / 64M" }, - { 0x10DE032A, "Quadro NVS 55/280 PCI" }, + { 0x10DE032A, "Quadro NVS 55 / 280 PCI" }, { 0x10DE032B, "Quadro FX 500 / 600 PCI" }, { 0x10DE032C, "GeForce FX Go53xx Series" }, { 0x10DE032D, "GeForce FX Go5100" }, @@ -433,8 +431,10 @@ { 0x10DE061B, "Quadro VX 200" }, { 0x10DE061C, "Quadro FX 3600M" }, { 0x10DE061D, "Quadro FX 2800M" }, + { 0x10DE061E, "Quadro FX 3700M" }, { 0x10DE061F, "Quadro FX 3800M" }, // 0620 - 062F + { 0x10DE0621, "GeForce GT 230" }, { 0x10DE0622, "GeForce 9600 GT" }, { 0x10DE0623, "GeForce 9600 GS" }, { 0x10DE0625, "GeForce 9600 GSO 512"}, @@ -442,6 +442,7 @@ { 0x10DE0627, "GeForce GT 140" }, { 0x10DE0628, "GeForce 9800M GTS" }, { 0x10DE062A, "GeForce 9700M GTS" }, + { 0x10DE062B, "GeForce 9800M GS" }, { 0x10DE062C, "GeForce 9800M GTS" }, { 0x10DE062D, "GeForce 9600 GT" }, { 0x10DE062E, "GeForce 9600 GT" }, @@ -471,6 +472,7 @@ { 0x10DE0652, "GeForce GT 130M" }, { 0x10DE0653, "GeForce GT 120M" }, { 0x10DE0654, "GeForce GT 220M" }, + { 0x10DE0655, "GeForce GT 120" }, { 0x10DE0656, "GeForce 9650 S" }, { 0x10DE0658, "Quadro FX 380" }, { 0x10DE0659, "Quadro FX 580" }, @@ -500,6 +502,7 @@ { 0x10DE06DD, "Quadro 4000" }, { 0x10DE06DE, "Tesla M2050 / M2070" }, // TODO: sub-device id for the M2050: 0x0846 // 0x10DE06DE also applies to misc S2050, X2070, M2050, M2070 + { 0x10DE06DF, "Tesla M2070-Q" }, // 06E0 - 06EF { 0x10DE06E0, "GeForce 9300 GE" }, { 0x10DE06E1, "GeForce 9300 GS" }, @@ -516,11 +519,13 @@ { 0x10DE06EC, "GeForce G 105M" }, { 0x10DE06EF, "GeForce G 103M" }, // 06F0 - 06FF + { 0x10DE06F1, "GeForce G105M" }, { 0x10DE06F8, "Quadro NVS 420" }, { 0x10DE06F9, "Quadro FX 370 LP" }, { 0x10DE06FA, "Quadro NVS 450" }, { 0x10DE06FB, "Quadro FX 370M" }, { 0x10DE06FD, "Quadro NVS 295" }, + { 0x10DE06FF, "HICx16 + Graphics" }, // 0700 - 070F // 0710 - 071F // 0720 - 072F @@ -547,6 +552,7 @@ // 0820 - 082F // 0830 - 083F // 0840 - 084F + { 0x10DE0840, "GeForce 8200M" }, { 0x10DE0844, "GeForce 9100M G" }, { 0x10DE0845, "GeForce 8200M G" }, { 0x10DE0846, "GeForce 9200" }, @@ -569,6 +575,7 @@ { 0x10DE0866, "GeForce 9400M G" }, { 0x10DE0867, "GeForce 9400" }, { 0x10DE0868, "nForce 760i SLI" }, + { 0x10DE0869, "GeForce 9400" }, { 0x10DE086A, "GeForce 9400" }, { 0x10DE086C, "GeForce 9300 / nForce 730i" }, { 0x10DE086D, "GeForce 9200" }, @@ -588,6 +595,9 @@ // 0880 - 088F // 0890 - 089F // 08A0 - 08AF + { 0x10DE08A0, "GeForce 320M" }, + { 0x10DE08A4, "GeForce 320M" }, + { 0x10DE08A5, "GeForce 320M" }, // 08B0 - 08BF // 08C0 - 08CF // 08D0 - 08DF @@ -615,6 +625,8 @@ { 0x10DE0A20, "GeForce GT220" }, { 0x10DE0A22, "GeForce 315" }, { 0x10DE0A23, "GeForce 210" }, + { 0x10DE0A26, "GeForce 405" }, + { 0x10DE0A27, "GeForce 405" }, { 0x10DE0A28, "GeForce GT 230M" }, { 0x10DE0A29, "GeForce GT 330M" }, { 0x10DE0A2A, "GeForce GT 230M" }, @@ -624,6 +636,7 @@ // 0A30 - 0A3F { 0x10DE0A34, "GeForce GT 240M" }, { 0x10DE0A35, "GeForce GT 325M" }, + { 0x10DE0A38, "Quadro 400" }, { 0x10DE0A3C, "Quadro FX 880M" }, // 0A40 - 0A4F // 0A50 - 0A5F @@ -648,7 +661,9 @@ { 0x10DE0A73, "GeForce 305M" }, { 0x10DE0A74, "GeForce G210M" }, { 0x10DE0A75, "GeForce G310M" }, + { 0x10DE0A76, "ION" }, { 0x10DE0A78, "Quadro FX 380 LP" }, + { 0x10DE0A7A, "GeForce 315M" }, { 0x10DE0A7C, "Quadro FX 380M" }, // 0A80 - 0A8F // 0A90 - 0A9F @@ -689,10 +704,11 @@ { 0x10DE0CA2, "GeForce GT 320" }, { 0x10DE0CA3, "GeForce GT 240" }, { 0x10DE0CA4, "GeForce GT 340" }, + { 0x10DE0CA5, "GeForce GT 220" }, { 0x10DE0CA7, "GeForce GT 330" }, { 0x10DE0CA8, "GeForce GTS 260M" }, { 0x10DE0CA9, "GeForce GTS 250M" }, - { 0x10DE0CAC, "GeForce 315" }, + { 0x10DE0CAC, "GeForce GT 220" }, { 0x10DE0CAF, "GeForce GT 335M" }, // 0CB0 - 0CBF { 0x10DE0CB0, "GeForce GTS 350M" }, @@ -722,26 +738,40 @@ { 0x10DE0DC5, "GeForce GTS 450" }, { 0x10DE0DC6, "GeForce GTS 450" }, { 0x10DE0DCA, "GF10x" }, + { 0x10DE0DCD, "GeForce GT 555M" }, + { 0x10DE0DCE, "GeForce GT 555M" }, // 0DD0 - 0DDF { 0x10DE0DD1, "GeForce GTX 460M" }, { 0x10DE0DD2, "GeForce GT 445M" }, { 0x10DE0DD3, "GeForce GT 435M" }, + { 0x10DE0DD6, "GeForce GT 550M" }, { 0x10DE0DD8, "Quadro 2000" }, + { 0x10DE0DDA, "Quadro 2000M" }, { 0x10DE0DDE, "GF106-ES" }, { 0x10DE0DDF, "GF106-INT" }, // 0DE0 - 0DEF { 0x10DE0DE0, "GeForce GT 440" }, { 0x10DE0DE1, "GeForce GT 430" }, { 0x10DE0DE2, "GeForce GT 420" }, + { 0x10DE0DE4, "GeForce GT 520" }, { 0x10DE0DE5, "GeForce GT 530" }, + { 0x10DE0DE9, "GeForce GT 630M" }, { 0x10DE0DEB, "GeForce GT 555M" }, + { 0x10DE0DEC, "GeForce GT 525M" }, + { 0x10DE0DED, "GeForce GT 520M" }, { 0x10DE0DEE, "GeForce GT 415M" }, // 0DF0 - 0DFF { 0x10DE0DF0, "GeForce GT 425M" }, { 0x10DE0DF1, "GeForce GT 420M" }, { 0x10DE0DF2, "GeForce GT 435M" }, { 0x10DE0DF3, "GeForce GT 420M" }, + { 0x10DE0DF4, "GeForce GT 540M" }, + { 0x10DE0DF5, "GeForce GT 525M" }, + { 0x10DE0DF6, "GeForce GT 550M" }, + { 0x10DE0DF7, "GeForce GT 520M" }, { 0x10DE0DF8, "Quadro 600" }, + { 0x10DE0DFA, "Quadro 1000M" }, + { 0x10DE0DFC, "NVS 5200M" }, { 0x10DE0DFE, "GF108 ES" }, { 0x10DE0DFF, "GF108 INT" }, // 0E00 - 0E0F @@ -754,7 +784,10 @@ { 0x10DE0E25, "D12U-50" }, // 0E30 - 0E3F { 0x10DE0E30, "GeForce GTX 470M" }, + { 0x10DE0E31, "GeForce GTX 485M" }, { 0x10DE0E38, "GF104GL" }, + { 0x10DE0E3A, "Quadro 3000M" }, + { 0x10DE0E3B, "Quadro 4000M" }, { 0x10DE0E3E, "GF104-ES" }, { 0x10DE0E3F, "GF104-INT" }, // 0E40 - 0E4F @@ -790,29 +823,91 @@ // 1020 - 102F // 1030 - 103F // 1040 - 104F - { 0x10DE1040, "GeForce GT 520" }, + { 0x10DE1040, "GeForce GT 520" }, + { 0x10DE1042, "GeForce 510" }, + { 0x10DE1049, "GeForce GT 620" }, // 1050 - 105F { 0x10DE1050, "GeForce GT 520M" }, + { 0x10DE1051, "GeForce GT 520MX" }, + { 0x10DE1054, "GeForce GT 410M" }, + { 0x10DE1055, "GeForce 410M" }, + { 0x10DE1056, "Quadro NVS 4200M" }, + { 0x10DE1057, "Quadro NVS 4200M" }, // 1060 - 106F // 1070 - 107F + { 0x10DE107F, "NVIDIA GF119-ES" }, // 1080 - 108F { 0x10DE1080, "GeForce GTX 580" }, { 0x10DE1081, "GeForce GTX 570" }, { 0x10DE1082, "GeForce GTX 560 Ti" }, { 0x10DE1083, "D13U" }, + { 0x10DE1084, "GeForce GTX 560" }, + { 0x10DE1086, "GeForce GTX 570" }, + { 0x10DE1087, "GeForce GTX 560 Ti 448 Cores" }, { 0x10DE1088, "GeForce GTX 590" }, + { 0x10DE1089, "GeForce GTX 580" }, + { 0x10DE108B, "GeForce GTX 590" }, // 1090 - 109F + { 0x10DE1091, "Tesla M2090" }, + { 0x10DE1094, "Tesla M2075" }, + { 0x10DE1096, "Tesla C2075" }, { 0x10DE1098, "D13U" }, - { 0x10DE109A, "N12E-Q5" }, + { 0x10DE109A, "Quadro 5010M" }, + { 0x10DE109B, "Quadro 7000" }, // 10A0 - 10AF // 10B0 - 10BF // 10C0 - 10CF + { 0x10DE10C0, "GeForce 9300 GS" }, { 0x10DE10C3, "GeForce 8400 GS" }, { 0x10DE10C5, "GeForce 405" }, - // 1200 - + // 10D0 - 10DF + { 0x10DE10D8, "NVS 300" }, + // 10E0 - 10EF + // 10F0 - 10FF + // 1100 - 110F + // 1110 - 111F + // 1120 - 112F + // 1130 - 113F + // 1140 - 114F + // 1150 - 115F + // 1160 - 116F + // 1170 - 117F + // 1180 - 118F + { 0x10DE1180, "GeForce GTX 680" }, + // 1190 - 119F + // 11A0 - 11AF + // 11B0 - 11BF + // 11C0 - 11CF + // 11D0 - 11DF + // 11E0 - 11EF + // 11F0 - 11FF + // 1200 - 120F { 0x10DE1200, "GeForce GTX 560 Ti" }, + { 0x10DE1201, "GeForce GTX 560" }, + { 0x10DE1203, "GeForce GTX 460 SE v2" }, + // 1210 - 121F + { 0x10DE1210, "GeForce GTX 570M" }, + { 0x10DE1211, "GeForce GTX 580M" }, + // 1220 - 122F + // 1230 - 123F + // 1240 - 124F + { 0x10DE1241, "GeForce GT 545" }, + { 0x10DE1243, "GeForce GT 545" }, { 0x10DE1244, "GeForce GTX 550 Ti" }, - { 0x10DE1245, "GeForce GTS 450" } + { 0x10DE1245, "GeForce GTS 450" }, + { 0x10DE1247, "GeForce GT 555M" }, + // 1250 - 125F + { 0x10DE1251, "GeForce GTX 560M" } + // 1260 - 126F + // 1270 - 127F + // 1280 - 128F + // 1290 - 129F + // 12A0 - 12AF + // 12B0 - 12BF + // 12C0 - 12CF + // 12D0 - 12DF + // 12E0 - 12EF + // 12F0 - 12FF }; static uint16_t swap16(uint16_t x); static uint16_t read16(uint8_t *ptr, uint16_t offset); @@ -876,8 +971,8 @@ printf("no dcb table found\n"); return PATCH_ROM_FAILED; }/* else - printf("dcb table at offset 0x%04x\n", dcbptr); - */ + printf("dcb table at offset 0x%04x\n", dcbptr); + */ uint8_t *dcbtable = &rom[dcbptr]; uint8_t dcbtable_version = dcbtable[0]; uint8_t headerlength = 0; @@ -939,7 +1034,7 @@ entries[num_outputs].type = connection & 0xf; entries[num_outputs].index = num_outputs; entries[num_outputs++].heads = (uint8_t*)&(dcbtable[(headerlength + recordlength * i) + 1]); - + } int has_lvds = false; @@ -1047,7 +1142,7 @@ static char *get_nvidia_model(uint32_t id) { unsigned int i; - + for (i=1; i< (sizeof(NVKnownChipsets) / sizeof(NVKnownChipsets[0])); i++) { if (NVKnownChipsets[i].device == id) { return NVKnownChipsets[i].name; @@ -1060,7 +1155,7 @@ { int fd; int size; - + if ((fd = open_bvdev("bt(0,0)", filename)) < 0) { return 0; } @@ -1077,10 +1172,10 @@ static int devprop_add_nvidia_template(struct DevPropDevice *device) { char tmp[16]; - + if(!device) return 0; - + if(!DP_ADD_TEMP_VAL(device, nvidia_compatible_0)) return 0; if(!DP_ADD_TEMP_VAL(device, nvidia_device_type_0)) @@ -1100,7 +1195,7 @@ sprintf(tmp, "Slot-%x",devices_number); devprop_add_value(device, "AAPL,slot-name", (uint8_t *) tmp, strlen(tmp)); devices_number++; - + return 1; } @@ -1109,12 +1204,12 @@ char *p; int i; char buf[3]; - + if (hex == NULL || bin == NULL || len <= 0 || strlen(hex) != len * 2) { printf("[ERROR] bin2hex input error\n"); return -1; } - + buf[2] = '\0'; p = (char *) hex; for (i=0; idevice_id) { card->info = &radeon_cards[i]; - if (radeon_cards[i].subsys_id == 0x00000000) - { - radeon_cards[i].subsys_id = pci_dev->subsys_id.subsys_id; + if ((radeon_cards[i].subsys_id == 0x00000000) || + (radeon_cards[i].subsys_id == pci_dev->subsys_id.subsys_id)) break; - } - else if (radeon_cards[i].subsys_id == pci_dev->subsys_id.subsys_id) - break; } } - if (!card->info->device_id || !card->info->cfg_name) + // if (!card->info->device_id || !card->info->cfg_name) + if (!card->info->device_id) { verbose("Unsupported ATI card! Device ID: [%04x:%04x] Subsystem ID: [%08x] \n", pci_dev->vendor_id, pci_dev->device_id, pci_dev->subsys_id.subsys_id); @@ -1386,34 +1484,36 @@ { // use cfg_name on radeon_cards, to retrive the default name from card_configs, card->cfg_name = card_configs[card->info->cfg_name].name; - // and leave ports alone! - // card->ports = card_configs[card->info->cfg_name].ports; + // Uncommented the following line and added verbose for debugging AtiPorts issues on some cards + card->ports = card_configs[card->info->cfg_name].ports; + // Report number of ports card reports + verbose("Card reported ports: %d\n", card->ports); // which means one of the fb's or kNull - verbose("Framebuffer set to device's default: %s\n", card->cfg_name); + verbose("Framebuffer set to: %s using device's default.\n", card->cfg_name); } else { // else, use the fb name returned by AtiConfig. - verbose("(AtiConfig) Framebuffer set to: %s\n", card->cfg_name); + verbose("Framebuffer set to: %s using AtiConfig=%s\n", card->cfg_name, card->cfg_name); } - + // Check AtiPorts key for nr of ports, card->ports = getIntForKey(kAtiPorts, &n_ports, DEFAULT_BOOT_CONFIG); // if a value bigger than 0 ?? is found, (do we need >= 0 ?? that's null FB on card_configs) if (n_ports > 0) { card->ports = n_ports; // use it. - verbose("(AtiPorts) Nr of ports set to: %d\n", card->ports); + verbose("Number of ports set to: %d using AtiPorts=%d\n", card->ports, card->ports); } else// if (card->cfg_name > 0) // do we want 0 ports if fb is kNull or mistyped ? { - // else, match cfg_name with card_configs list and retrive default nr of ports. + // else, match fb name with card_configs list and retrive default nr of ports. for (i = 0; i < kCfgEnd; i++) if (strcmp(card->cfg_name, card_configs[i].name) == 0) card->ports = card_configs[i].ports; // default - verbose("Nr of ports set to framebuffer's default: %d\n", card->ports); + verbose("Number of ports set to: %d using framebuffer's default.\n", card->ports); } // else // card->ports = 2/1 ?; // set a min if 0 ports ? @@ -1474,11 +1574,11 @@ stringlength = string->length; // ------------------------------------------------- - verbose("ATI %s %s %dMB (%s) [%04x:%04x] (subsys [%04x:%04x]):: %s\n", - chip_family_name[card->info->chip_family], card->info->model_name, - (uint32_t)(card->vram_size / (1024 * 1024)), card->cfg_name, + verbose("%s %dMB [%04x:%04x] (subsys [%04x:%04x]) (%s:%s) :: %s\n", + card->info->model_name, (uint32_t)(card->vram_size / (1024 * 1024)), ati_dev->vendor_id, ati_dev->device_id, ati_dev->subsys_id.subsys.vendor_id, ati_dev->subsys_id.subsys.device_id, + chip_family_name[card->info->chip_family], card->cfg_name, devicepath); free(card); Index: branches/cparm/i386/modules/SMBiosGetters/SMBiosGetters.c =================================================================== --- branches/cparm/i386/modules/SMBiosGetters/SMBiosGetters.c (revision 1930) +++ branches/cparm/i386/modules/SMBiosGetters/SMBiosGetters.c (revision 1931) @@ -1,5 +1,5 @@ /* - * Copyright 2011 cparm . All rights reserved. + * Copyright 2011,2012 cparm . All rights reserved. */ #include "libsaio.h" #include "bootstruct.h" @@ -8,11 +8,9 @@ #include "efi.h" #include "mysmbios.h" -#define kEnableSMBIOSGetters "EnableSMBIOSGetters" void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void getProductName_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void getboardproduct_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); -void is_SMB_Getters_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6) { @@ -22,16 +20,11 @@ SMBEntryPoint *patched_smb = setupSMBIOSTable(getSmbiosOriginal()); if (patched_smb != NULL) - //smbios_p = ((uint64_t)((uint32_t)patched_smb)); Register_Smbios_Efi(patched_smb); - else { verbose("Error: Could not get patched SMBIOS, fallback to original SMBIOS !!\n"); - - //struct SMBEntryPoint *smbios_o = getSmbiosOriginal(); - //smbios_p = ((uint64_t)((uint32_t)smbios_o)); - + Register_Smbios_Efi(getSmbiosOriginal()); } @@ -45,11 +38,9 @@ const char *val = 0; if (getValueForKey("SMproductname", &val, &len, DEFAULT_SMBIOS_CONFIG)) { - //gPlatformName = (char *)val; SetgPlatformName(val); } else { - //gPlatformName = (char *)getDefaultSMBproductName(); SetgPlatformName(getDefaultSMBproductName()); } @@ -63,30 +54,18 @@ const char *val = 0; if (getValueForKey("SMboardproduct", &val, &len, DEFAULT_SMBIOS_CONFIG)) { - //gboardproduct = (char *)val; Setgboardproduct(val); } else { - //gboardproduct = (char *)getDefaultSMBBoardProduct(); Setgboardproduct(getDefaultSMBBoardProduct()); } } -void is_SMB_Getters_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6){} - void SMBiosGetters_start(void); void SMBiosGetters_start(void) { - bool enable = true; - getBoolForKey(kEnableSMBIOSGetters, &enable, DEFAULT_BOOT_CONFIG) ; - - enable = (execute_hook("isSMBIOSRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS); - - if (enable) { - register_hook_callback("getSmbiosPatched", &getSmbiosPatched_hook); - register_hook_callback("getProductNamePatched", &getProductName_hook); - register_hook_callback("getboardproductPatched", &getboardproduct_hook); - register_hook_callback("isSMBIOSRegistred", &is_SMB_Getters_Registred_Hook); - } + register_hook_callback("getSmbiosPatched", &getSmbiosPatched_hook); + register_hook_callback("getProductNamePatched", &getProductName_hook); + register_hook_callback("getboardproductPatched", &getboardproduct_hook); } Index: branches/cparm/i386/modules/SMBiosGetters/Makefile =================================================================== --- branches/cparm/i386/modules/SMBiosGetters/Makefile (revision 1930) +++ branches/cparm/i386/modules/SMBiosGetters/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.SMBIOS.SMBIOSPLATFORM.smbiosgetters +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = SMBIOSPLATFORM +BUNDLE_CLASS_PROVIDER = SMBIOS + DIR = SMBiosGetters include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${SMBiosGetters_OBJS} dylib +all embedtheme: ${SMBiosGetters_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -76,8 +89,31 @@ $(OBJROOT)/smbios_getters.o \ $(OBJROOT)/smbios_decode.o \ -macosx_version_min 10.6 \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist stack_protector.o: Index: branches/cparm/i386/modules/HibernateEnabler/resume.c =================================================================== --- branches/cparm/i386/modules/HibernateEnabler/resume.c (revision 1930) +++ branches/cparm/i386/modules/HibernateEnabler/resume.c (revision 1931) @@ -368,11 +368,8 @@ Unforutnaltely I cannot find a note why to switch back to text mode for nVidia cards only and because it check_vga_nvidia does not work (cards normally are behind a bridge) I will remove it completely*/ -#if UNUSED - setVideoMode(VGA_TEXT_MODE, 0); -#else + setVideoMode(VGA_TEXT_MODE); -#endif #endif } Index: branches/cparm/i386/modules/HibernateEnabler/graphic_utils.h =================================================================== --- branches/cparm/i386/modules/HibernateEnabler/graphic_utils.h (revision 1930) +++ branches/cparm/i386/modules/HibernateEnabler/graphic_utils.h (revision 1931) @@ -20,11 +20,8 @@ void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or); -#if UNUSED + void -setVideoMode( int mode, int drawgraphics); -#else -void setVideoMode( int mode); -#endif + #endif//H_GRAPHIC_UTILS_H Index: branches/cparm/i386/modules/HibernateEnabler/HibernateEnabler.c =================================================================== --- branches/cparm/i386/modules/HibernateEnabler/HibernateEnabler.c (revision 1930) +++ branches/cparm/i386/modules/HibernateEnabler/HibernateEnabler.c (revision 1931) @@ -14,7 +14,7 @@ #define kWake "Wake" /* boot.c */ #define kForceWake "ForceWake" /* boot.c */ #define kWakeImage "WakeImage" /* boot.c */ -#define kEnableHibernate "EnableHibernateModule" + void HibernateEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void HibernateEnabler_start(void); @@ -78,12 +78,6 @@ void HibernateEnabler_start(void) { - bool enable = true; - getBoolForKey(kEnableHibernate, &enable, DEFAULT_BOOT_CONFIG) ; - - if (enable) - { - register_hook_callback("PreBoot", &HibernateEnabler_hook); - register_hook_callback("spinActivity_hook", &spinActivityIndicator_hook); - } + register_hook_callback("PreBoot", &HibernateEnabler_hook); + register_hook_callback("spinActivity_hook", &spinActivityIndicator_hook); } \ No newline at end of file Index: branches/cparm/i386/modules/HibernateEnabler/Makefile =================================================================== --- branches/cparm/i386/modules/HibernateEnabler/Makefile (revision 1930) +++ branches/cparm/i386/modules/HibernateEnabler/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.VM.WAKE.hibernateenabler +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = WAKE +BUNDLE_CLASS_PROVIDER = VM + DIR = HibernateEnabler include ../../MakePaths.dir @@ -57,10 +70,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${H_ENAB_OBJS} dylib +all embedtheme: ${H_ENAB_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -74,8 +87,31 @@ $(OBJROOT)/resume.o \ $(OBJROOT)/HibernateEnabler.o \ -macosx_version_min 10.6 \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist HibernateEnabler.o: Index: branches/cparm/i386/modules/HibernateEnabler/graphic_utils.c =================================================================== --- branches/cparm/i386/modules/HibernateEnabler/graphic_utils.c (revision 1930) +++ branches/cparm/i386/modules/HibernateEnabler/graphic_utils.c (revision 1931) @@ -25,11 +25,9 @@ int previewTotalSectors = 0; uint8_t *previewSaveunder = 0; int previewLoadedSectors = 0; -#if UNUSED -static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate ); -#else + + static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel); -#endif void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or) @@ -136,11 +134,8 @@ if ( params[2] == 256 ) params[2] = 8; if ( params[2] == 555 ) params[2] = 16; if ( params[2] == 888 ) params[2] = 32; -#if UNUSED - return setVESAGraphicsMode( params[0], params[1], params[2], params[3] ); -#else + return setVESAGraphicsMode( params[0], params[1], params[2] ); -#endif } //========================================================================== @@ -315,11 +310,8 @@ //========================================================================== // setVESAGraphicsMode -#if UNUSED -static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate ) -#else + static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel) -#endif { VBEModeInfoBlock minfo; unsigned short mode; @@ -438,6 +430,9 @@ minfo.YResolution = 0; unsigned short mode = modeEndOfList; + minfo.XResolution = 0; + minfo.YResolution = 0; + if ( (cols != 80) || (rows != 25) ) // not 80x25 mode { mode = getVESAModeWithProperties( cols, rows, bitsPerPixel, @@ -476,13 +471,9 @@ // setVideoMode // // Set the video mode to VGA_TEXT_MODE or GRAPHICS_MODE. -#if UNUSED + void -setVideoMode( int mode, int drawgraphics) -#else -void setVideoMode( int mode) -#endif { unsigned long params[4]; int count; @@ -601,11 +592,8 @@ if (src && (uncomp=DecompressData(src, &origwidth, &origheight, &origbpx))) { -#if UNUSED - if (!setVESAGraphicsMode(origwidth, origheight, origbpx, 0)) -#else + if (!setVESAGraphicsMode(origwidth, origheight, origbpx)) -#endif if (initGraphicsMode () != errSuccess) return; screen = (uint8_t *) VIDEO (baseAddr); Index: branches/cparm/i386/modules/Keymapper/Keylayout.c =================================================================== --- branches/cparm/i386/modules/Keymapper/Keylayout.c (revision 1930) +++ branches/cparm/i386/modules/Keymapper/Keylayout.c (revision 1931) @@ -66,11 +66,8 @@ char magic[KEYBOARD_LAYOUTS_MAGIC_SIZE]; uint32_t version; -#if UNUSED - if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0) { -#else + if ((fd = open_bvdev("bt(0,0)", filename)) < 0) { -#endif goto fail; // fail } Index: branches/cparm/i386/modules/Keymapper/Makefile =================================================================== --- branches/cparm/i386/modules/Keymapper/Makefile (revision 1930) +++ branches/cparm/i386/modules/Keymapper/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.KEY.KEYMAP.keymapper +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 0.1 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 0.1 +BUNDLE_CLASS = KEYMAP +BUNDLE_CLASS_PROVIDER = KEY + DIR = Keymapper include ../../MakePaths.dir @@ -57,10 +70,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${KEY_MAPPER_OBJS} dylib +all embedtheme: ${KEY_MAPPER_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -73,10 +86,35 @@ $(OBJROOT)/stack_protector.o \ $(OBJROOT)/Keymapper.o \ $(OBJROOT)/Keylayout.o \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist + + Keymapper.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "Keymapper.c" $(INC) -o "$(OBJROOT)/Keymapper.o" Index: branches/cparm/i386/modules/Keymapper/Keymapper.c =================================================================== --- branches/cparm/i386/modules/Keymapper/Keymapper.c (revision 1930) +++ branches/cparm/i386/modules/Keymapper/Keymapper.c (revision 1931) @@ -13,7 +13,6 @@ #include "modules.h" #include "Keylayout.h" -#define kEnableKeyMap "EnableKeyMapper" static int AZERTY_switch(int c); void Keymapper_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); int Keymapper_getc(void); @@ -240,29 +239,22 @@ void Keymapper_start(void); void Keymapper_start(void) { - - bool enable = true; - getBoolForKey(kEnableKeyMap, &enable, DEFAULT_BOOT_CONFIG) ; - - if (enable) - { - if (Keylayout_real_start()) - { - return; - } - + if (Keylayout_real_start()) + { + return; + } + #ifdef TRUNK - if (!replace_system_function("_getchar", &Keymapper_getc)) - { - printf("no function getchar() to replace. Keymapper will not be used ! \n"); - - } + if (!replace_system_function("_getchar", &Keymapper_getc)) + { + printf("no function getchar() to replace. Keymapper will not be used ! \n"); + + } #else - if (replace_system_function("_getc", &Keymapper_getc) != EFI_SUCCESS) - { - printf("no function getc() to replace. Keymapper will not be used ! \n"); - } + if (replace_system_function("_getc", &Keymapper_getc) != EFI_SUCCESS) + { + printf("no function getc() to replace. Keymapper will not be used ! \n"); + } #endif - - } + } \ No newline at end of file Index: branches/cparm/i386/modules/USBFix/USBFix.c =================================================================== --- branches/cparm/i386/modules/USBFix/USBFix.c (revision 1930) +++ branches/cparm/i386/modules/USBFix/USBFix.c (revision 1931) @@ -8,8 +8,6 @@ #include "pci.h" #include "bootstruct.h" -#define kEnableUSBMod "EnableUSBModule" - extern int usb_loop(void); extern void notify_usb_dev(pci_dt_t *pci_dev); @@ -34,14 +32,7 @@ void USBFix_start(void); void USBFix_start(void) { - bool enable = true; - getBoolForKey(kEnableUSBMod, &enable, DEFAULT_BOOT_CONFIG) ; - - if (enable) { - register_hook_callback("PCIDevice", &USBFix_pci_hook); - register_hook_callback("Kernel Start", &USBFix_start_hook); - } - - + register_hook_callback("PCIDevice", &USBFix_pci_hook); + register_hook_callback("Kernel Start", &USBFix_start_hook); } Index: branches/cparm/i386/modules/USBFix/Makefile =================================================================== --- branches/cparm/i386/modules/USBFix/Makefile (revision 1930) +++ branches/cparm/i386/modules/USBFix/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.HWDRV.USB.usbfix +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = USB +BUNDLE_CLASS_PROVIDER = HWDRV + DIR = USBFix include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${USB_OBJS} dylib +all embedtheme: ${USB_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -74,8 +87,31 @@ $(OBJROOT)/USBFix.o \ $(OBJROOT)/usb.o \ -macosx_version_min 10.6 \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist stack_protector.o: Index: branches/cparm/i386/modules/HPET/HPET.c =================================================================== --- branches/cparm/i386/modules/HPET/HPET.c (revision 1930) +++ branches/cparm/i386/modules/HPET/HPET.c (revision 1931) @@ -37,11 +37,8 @@ void HPET_start(void); void HPET_start(void) { - bool enable = true; - getBoolForKey(EnableHPETModule, &enable, DEFAULT_BOOT_CONFIG); - if (enable) - register_hook_callback("PCIDevice", &HPET_hook); + register_hook_callback("PCIDevice", &HPET_hook); } /* Index: branches/cparm/i386/modules/HPET/hpet.h =================================================================== --- branches/cparm/i386/modules/HPET/hpet.h (revision 1930) +++ branches/cparm/i386/modules/HPET/hpet.h (revision 1931) @@ -8,7 +8,6 @@ #include "libsaio.h" #define REG32(base, reg) ((volatile uint32_t *)base)[(reg) >> 2] -#define EnableHPETModule "EnableHPETModule" //void force_enable_hpet(pci_dt_t *lpc_dev); Index: branches/cparm/i386/modules/HPET/Makefile =================================================================== --- branches/cparm/i386/modules/HPET/Makefile (revision 1930) +++ branches/cparm/i386/modules/HPET/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.HWDRV.HPET.hpet +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = HPET +BUNDLE_CLASS_PROVIDER = HWDRV + DIR = HPET include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${HPET_OBJS} dylib +all embedtheme: ${HPET_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -71,10 +84,32 @@ -current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \ -final_output $(MODULE_NAME) \ -macosx_version_min 10.6 \ - $(OBJROOT)/stack_protector.o $(OBJROOT)/HPET.o -o $(SYMROOT)/$(MODULE_NAME).dylib + $(OBJROOT)/stack_protector.o $(OBJROOT)/HPET.o -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist - stack_protector.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o" Index: branches/cparm/i386/modules/SMBiosPatcher/SMBiosPatcher.c =================================================================== --- branches/cparm/i386/modules/SMBiosPatcher/SMBiosPatcher.c (revision 1930) +++ branches/cparm/i386/modules/SMBiosPatcher/SMBiosPatcher.c (revision 1931) @@ -1,5 +1,5 @@ /* - * Copyright 2011 cparm. All rights reserved. + * Copyright 2011,2012 cparm. All rights reserved. */ #include "libsaio.h" #include "bootstruct.h" @@ -20,13 +20,10 @@ #define DBG(x...) #endif -#define kEnableSMBIOSPatcher "EnableSMBIOSPatcher" void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void getProductName_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void getboardproduct_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); -void is_SMB_Patcher_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); - void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6) { struct SMBEntryPoint *patched_smb = NULL; @@ -86,20 +83,12 @@ } -void is_SMB_Patcher_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6){} - void SMBiosPatcher_start(void); void SMBiosPatcher_start(void) { - bool enable = true; - getBoolForKey(kEnableSMBIOSPatcher, &enable, DEFAULT_BOOT_CONFIG) ; - - enable = (execute_hook("isSMBIOSRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS); - if (enable) { register_hook_callback("getSmbiosPatched", &getSmbiosPatched_hook); register_hook_callback("getProductNamePatched", &getProductName_hook); register_hook_callback("getboardproductPatched", &getboardproduct_hook); - register_hook_callback("isSMBIOSRegistred", &is_SMB_Patcher_Registred_Hook); - } + } Index: branches/cparm/i386/modules/SMBiosPatcher/Makefile =================================================================== --- branches/cparm/i386/modules/SMBiosPatcher/Makefile (revision 1930) +++ branches/cparm/i386/modules/SMBiosPatcher/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.SMBIOS.SMBIOSPLATFORM.smbiospatcher +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = SMBIOSPLATFORM +BUNDLE_CLASS_PROVIDER = SMBIOS + DIR = SMBiosPatcher include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${SMBiosPatcher_OBJS} dylib +all embedtheme: ${SMBiosPatcher_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -74,8 +87,31 @@ $(OBJROOT)/stack_protector.o \ $(OBJROOT)/SMBiosPatcher.o \ $(OBJROOT)/smbios_patcher.o \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist stack_protector.o: Index: branches/cparm/i386/modules/Resolution/Resolution.c =================================================================== --- branches/cparm/i386/modules/Resolution/Resolution.c (revision 1930) +++ branches/cparm/i386/modules/Resolution/Resolution.c (revision 1931) @@ -8,18 +8,10 @@ #include "modules.h" #include "bootstruct.h" -#define kEnableResolution "EnableResolutionModule" - void Resolution_start(void); void Resolution_start(void) { - bool enable = true; - getBoolForKey(kEnableResolution, &enable, DEFAULT_BOOT_CONFIG) ; - - if (enable) { - register_hook_callback("getResolution_hook", &getResolutionHook); - patchVideoBios(); - } - + register_hook_callback("getResolution_hook", &getResolutionHook); + patchVideoBios(); } Index: branches/cparm/i386/modules/Resolution/Makefile =================================================================== --- branches/cparm/i386/modules/Resolution/Makefile (revision 1930) +++ branches/cparm/i386/modules/Resolution/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.UI.GUI.RESOLUTION.resolution +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = RESOLUTION +BUNDLE_CLASS_PROVIDER = GUI + DIR = Resolution include ../../MakePaths.dir @@ -57,10 +70,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${RESOLUTION_OBJS} dylib +all embedtheme: ${RESOLUTION_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -74,9 +87,33 @@ $(OBJROOT)/edid.o \ $(OBJROOT)/915resolution.o \ $(OBJROOT)/Resolution.o \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' - + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "OSBundleLibraries" -dict "com.boot.GUI.GUI" '0' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist + stack_protector.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o" Index: branches/cparm/i386/modules/CPUfreq/CPUfreq.c =================================================================== --- branches/cparm/i386/modules/CPUfreq/CPUfreq.c (revision 1930) +++ branches/cparm/i386/modules/CPUfreq/CPUfreq.c (revision 1931) @@ -1,5 +1,5 @@ /* - * Copyright 2010,2011 valv, cparm . All rights reserved. + * Copyright 2010,2011,2012 valv, cparm . All rights reserved. */ #include "libsaio.h" #include "bootstruct.h" @@ -223,18 +223,12 @@ void CPUfreq_start(void); void CPUfreq_start(void) { - bool enable = true; - getBoolForKey(kEnableCPUfreq, &enable, DEFAULT_BOOT_CONFIG) ; - - if (enable) - { - if (get_env(envFeatures) & CPUID_FEATURE_MSR) - { - register_hook_callback("PreBoot", &CPUfreq_hook); - } - else - { - verbose ("Unsupported CPU: CPUfreq disabled !!!\n"); - } - } + if (get_env(envFeatures) & CPUID_FEATURE_MSR) + { + register_hook_callback("PreBoot", &CPUfreq_hook); + } + else + { + verbose ("Unsupported CPU: CPUfreq disabled !!!\n"); + } } Index: branches/cparm/i386/modules/CPUfreq/Makefile =================================================================== --- branches/cparm/i386/modules/CPUfreq/Makefile (revision 1930) +++ branches/cparm/i386/modules/CPUfreq/Makefile (revision 1931) @@ -5,6 +5,18 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.CPU.CPU_ENV.cpufreq +BUNDLE_COPYRIGHT = Copyright 2010,2011 valv, cparm . All rights reserved. +BUNDLE_LICENCE = +BUNDLE_VERSION = 0.1 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = CPU_ENV +BUNDLE_CLASS_PROVIDER = CPU DIR = CPUfreq include ../../MakePaths.dir @@ -58,10 +70,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${CPUfreq_OBJS} dylib +all embedtheme: ${CPUfreq_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -71,8 +83,33 @@ -current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \ -final_output $(MODULE_NAME) \ -macosx_version_min 10.6 \ - $(OBJROOT)/stack_protector.o $(OBJROOT)/CPUfreq.o -o $(SYMROOT)/$(MODULE_NAME).dylib + $(OBJROOT)/stack_protector.o $(OBJROOT)/CPUfreq.o -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist + + stack_protector.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o" Index: branches/cparm/i386/modules/Memory/spd.c =================================================================== --- branches/cparm/i386/modules/Memory/spd.c (revision 1930) +++ branches/cparm/i386/modules/Memory/spd.c (revision 1931) @@ -421,11 +421,9 @@ } return false; } -#if UNUSED -void scan_spd(PlatformInfo_t *p, pci_dt_t* smbus_controller_dev) -#else + + void scan_spd(pci_dt_t* smbus_controller_dev) -#endif { int i = 0; for ( ; (unsigned)i < sizeof(smbus_controllers) / sizeof(smbus_controllers[0]); i++ ) Index: branches/cparm/i386/modules/Memory/Memory.c =================================================================== --- branches/cparm/i386/modules/Memory/Memory.c (revision 1930) +++ branches/cparm/i386/modules/Memory/Memory.c (revision 1931) @@ -14,8 +14,6 @@ #include "bootstruct.h" #include "modules.h" -#define kEnableMemory "EnableMemoryModule" - pci_dt_t * dram_controller_dev = NULL; pci_dt_t * smbus_controller_dev = NULL; @@ -28,22 +26,15 @@ void Memory_start(void); void Memory_start(void) -{ - - bool enable = true; - - getBoolForKey(kEnableMemory, &enable, DEFAULT_BOOT_CONFIG); - +{ + if (pci_config_read16(PCIADDR(0, 0x00, 0), 0x00) != 0x8086) - enable = false; + return; + + register_hook_callback("PCIDevice", &Memory_PCIDevice_hook); + register_hook_callback("ScanMemory", &Memory_hook); + register_hook_callback("isMemoryRegistred", &is_Memory_Registred_Hook); - enable = (execute_hook("isMemoryRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS); - - if (enable) { - register_hook_callback("PCIDevice", &Memory_PCIDevice_hook); - register_hook_callback("ScanMemory", &Memory_hook); - register_hook_callback("isMemoryRegistred", &is_Memory_Registred_Hook); - } } void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6) @@ -69,11 +60,9 @@ if(smbus_controller_dev) { -#if UNUSED - scan_spd(Platform, smbus_controller_dev); -#else + scan_spd(smbus_controller_dev); -#endif + } } \ No newline at end of file Index: branches/cparm/i386/modules/Memory/spd.h =================================================================== --- branches/cparm/i386/modules/Memory/spd.h (revision 1930) +++ branches/cparm/i386/modules/Memory/spd.h (revision 1931) @@ -11,11 +11,9 @@ #include "libsaio.h" bool is_smbus_controller(pci_dt_t* pci_dt); -#if UNUSED -void scan_spd(PlatformInfo_t *p, pci_dt_t* smbus_controller_dev); -#else + void scan_spd(pci_dt_t* smbus_controller_dev); -#endif + struct smbus_controllers_t { uint32_t vendor; uint32_t device; Index: branches/cparm/i386/modules/Memory/Makefile =================================================================== --- branches/cparm/i386/modules/Memory/Makefile (revision 1930) +++ branches/cparm/i386/modules/Memory/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.SMBIOS.SMBIOSPLATFORM.MEMORY.memory +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = MEMORY +BUNDLE_CLASS_PROVIDER = SMBIOSPLATFORM + DIR = Memory include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${MEMORY_OBJS} dylib +all embedtheme: ${MEMORY_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -76,9 +89,36 @@ $(OBJROOT)/spd.o \ $(OBJROOT)/Memory.o \ -macosx_version_min 10.6 \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "OSBundleLibraries" -dict "com.boot.SMBIOS.SMBIOSPLATFORM" '0' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist + + + stack_protector.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o" Index: branches/cparm/i386/modules/ACPICodec/acpi_codec.c =================================================================== --- branches/cparm/i386/modules/ACPICodec/acpi_codec.c (revision 1930) +++ branches/cparm/i386/modules/ACPICodec/acpi_codec.c (revision 1931) @@ -49,6 +49,7 @@ #include "pci_root.h" #include "sl.h" #include "convert.h" +#include "modules.h" U64 rsd_p; ACPI_TABLES acpi_tables; @@ -190,6 +191,22 @@ __RES(pss, long) __RES(cst, int) +static config_file_t *personality = (config_file_t*)0; +static void initPersonality (void) +{ + TagPtr dict = GetBundlePersonality( __BUNDLE_ID__ ); + if (dict) { + + if ((personality = (config_file_t*)malloc(sizeof(config_file_t)))) + { + memset(personality, 0, sizeof(config_file_t)); + personality->dictionary = dict; + personality->canOverride = true; + + } + } + +} static ACPI_TABLE_HEADER * get_new_table_in_list(U32 *new_table_list, U32 Signature, U8 *retIndex ) { @@ -370,7 +387,7 @@ printf("\n"); #endif int method = 0; - getIntForKey(kAcpiMethod, &method, DEFAULT_BOOT_CONFIG); + getIntForKey(kAcpiMethod, &method, personality); if (method != 0x2) @@ -477,7 +494,7 @@ printf("\n"); #endif int method = 0; - getIntForKey(kAcpiMethod, &method, DEFAULT_BOOT_CONFIG); + getIntForKey(kAcpiMethod, &method, personality); if (method != 0x2) @@ -995,12 +1012,12 @@ U32 temp32 = 0; U64 temp64= 0; int tdp; - if (getIntForKey("TDP", &tdp, DEFAULT_BOOT_CONFIG)) + if (getIntForKey("TDP", &tdp, personality)) { temp32 = (U32) (tdp*8) ; int tdc; - if (getIntForKey("TDC", &tdc, DEFAULT_BOOT_CONFIG)) + if (getIntForKey("TDC", &tdc, personality)) { temp32 = (U32) (temp32) | tdc<<16 ; @@ -1115,6 +1132,12 @@ cpu->max_ratio_as_cfg = (U32) ((U32)platform_info >> 8) & 0xff; cpu->min_ratio = (U32) ((platform_info >> 40) & 0xff); + cpu->tdc_tdp_limits_for_turbo_flag = (platform_info & (1ULL << 29)) ? 1 : 0; + cpu->ratio_limits_for_turbo_flag = (platform_info & (1ULL << 28)) ? 1 : 0; + cpu->xe_available = cpu->tdc_tdp_limits_for_turbo_flag | cpu->ratio_limits_for_turbo_flag; + + + if (is_sandybridge() || is_jaketown()) { cpu->package_power_limit = rdmsr64(MSR_PKG_RAPL_POWER_LIMIT); @@ -1491,7 +1514,7 @@ } // Generating Pstate PKG - if (p_states_count) + if (p_states_count > 0) { U32 fsb = (U32)get_env(envFSBFreq); U8 minPSratio = (p_states[p_states_count-1].Frequency / (fsb / 10000000 )); @@ -1511,7 +1534,7 @@ { int user_max_ratio = 0; - getIntForKey(kMaxRatio, &user_max_ratio, DEFAULT_BOOT_CONFIG); + getIntForKey(kMaxRatio, &user_max_ratio, personality); if (user_max_ratio >= minPSratio && maxPSratio >= user_max_ratio) { @@ -1530,7 +1553,7 @@ { int user_min_ratio = 0; - getIntForKey(kMinRatio, &user_min_ratio, DEFAULT_BOOT_CONFIG); + getIntForKey(kMinRatio, &user_min_ratio, personality); if (user_min_ratio >= minPSratio && cpu_ratio >= user_min_ratio) { @@ -1553,26 +1576,39 @@ if (maxPSratio >= cpu_ratio && cpu_ratio >= minPSratio) maxPSratio = cpu_ratio; { - TagPtr personality = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"P-States")); // TODO: fix me int base = 16; U8 expert = 0; /* Default: 0 , mean mixed mode * expert mode : 1 , mean add only p-states found in boot.plist */ - - + + TagPtr PstateTag; + U32 pstate_tag_count = 0; + { - if (personality) + + + if (personality->dictionary) + { + PstateTag = XMLCastDict(XMLGetProperty(personality->dictionary, (const char*)"P-States")); + if (PstateTag) pstate_tag_count = XMLTagCount(PstateTag) ; + } + + if (!pstate_tag_count) + if ((PstateTag = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"P-States")))) pstate_tag_count = XMLTagCount(PstateTag); + + + if ((pstate_tag_count > 0) && PstateTag) { - char *tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Mode")); + char *tmpstr = XMLCastString(XMLGetProperty(PstateTag, (const char*)"Mode")); if (strcmp(tmpstr,"Expert") == 0) { - p_states_count = XMLTagCount(personality) - 1 ; // - 1 = - ("Mode" tag) + p_states_count = pstate_tag_count - 1 ; // - 1 = - ("Mode" tag) expert = 1; } - if ((tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Base")))) + if ((tmpstr = XMLCastString(XMLGetProperty(PstateTag, (const char*)"Base")))) { if (expert) p_states_count--; // -= ("Base" tag) @@ -1598,12 +1634,12 @@ { char *Lat1 = NULL, *clk = NULL, *Pw = NULL, *Lat2 = NULL, *Ctrl = NULL ; - if (personality) + if ((pstate_tag_count > 0) && PstateTag) { sprintf(MatchStat, "%d",i); - TagPtr match_Status = XMLGetProperty(personality, (const char*)MatchStat); + TagPtr match_Status = XMLGetProperty(PstateTag, (const char*)MatchStat); - if (match_Status) + if (match_Status && (XMLTagCount(match_Status) > 0)) { clk = XMLCastString(XMLGetProperty(match_Status, (const char*)"CoreFreq")); @@ -1619,7 +1655,7 @@ unsigned long Frequency = 0x00000000; - if (!expert || !personality) Frequency = p_states[i].Frequency; + if (!expert || !pstate_tag_count) Frequency = p_states[i].Frequency; if (clk) Frequency = strtoul((const char *)clk, NULL,base); @@ -1677,7 +1713,7 @@ { U32 Control = 0 /*encode_pstate(curr_ratio)*/ ; - if (!expert || !personality) Control = p_states[i].Control; + if (!expert || !pstate_tag_count) Control = p_states[i].Control; pstate->control = resolve_pss(Control, Ctrl, base); // Control } @@ -1721,30 +1757,44 @@ //----------------------------------------------------------------------------- static U32 BuildCstateInfo(CPU_DETAILS * cpu, U32 pmbase) { - { - TagPtr personality = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"C-States")); // TODO :fix me - - if (personality) + { + + TagPtr CstateTag; + U32 entry_count = 0; + + if (personality->dictionary) + { + CstateTag = XMLCastDict(XMLGetProperty(personality->dictionary, (const char*)"C-States")); + if (CstateTag) entry_count = XMLTagCount(CstateTag); + } + + if (!entry_count) + CstateTag = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"C-States")); + + + if (CstateTag) { int base = 16; - U32 entry_count = XMLTagCount(personality); - char *tmpstr =NULL; + entry_count = XMLTagCount(CstateTag); - if ((tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Base")))) - { + if (entry_count > 0) + { + { + char *tmpstr; + + if ((tmpstr = XMLCastString(XMLGetProperty(CstateTag, (const char*)"Base")))) + { + + entry_count--; // -= ("Base" tag) + + int mybase = strtol(tmpstr, NULL, 10); + + if (mybase == 8 || mybase == 10 || mybase == 16 ) + base = mybase; + } + } - entry_count--; // -= ("Base" tag) - - int mybase = strtol(tmpstr, NULL, 10); - - if (mybase == 8 || mybase == 10 || mybase == 16 ) - base = mybase; - } - - if (entry_count) - { - cpu->pkg_io_cstates.num_cstates = 0; cpu->pkg_mwait_cstates.num_cstates = 0; U32 num_cstates = 0; @@ -1758,7 +1808,7 @@ char *Lat = NULL, *Pw = NULL, *BWidth= NULL, *BOffset= NULL, *Address= NULL, *AccessSize= NULL, *index= NULL; sprintf(MatchStat, "C%d",i); - TagPtr match_Status = XMLGetProperty(personality, (const char*)MatchStat); + TagPtr match_Status = XMLGetProperty(CstateTag, (const char*)MatchStat); if (match_Status) { Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power")); @@ -1896,14 +1946,14 @@ bool tmpval; - if (getBoolForKey(kEnableC2State, &tmpval, DEFAULT_BOOT_CONFIG)) + if (getBoolForKey(kEnableC2State, &tmpval, personality)) { c2_enabled = tmpval; } - if (!getIntForKey("C3StateOption", &c3_enabled, DEFAULT_BOOT_CONFIG)) + if (!getIntForKey("C3StateOption", &c3_enabled, personality)) { - c3_enabled = (getBoolForKey(kEnableC3State, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval) ? 3 : 0; + c3_enabled = (getBoolForKey(kEnableC3State, &tmpval, personality)&&tmpval) ? 3 : 0; } if (c3_enabled == 6) { @@ -1911,10 +1961,10 @@ } else { - c4_enabled = (getBoolForKey(kEnableC4State, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval) ? 1 : 0; + c4_enabled = (getBoolForKey(kEnableC4State, &tmpval, personality)&&tmpval) ? 1 : 0; } - c6_enabled = (getBoolForKey(kEnableC6State, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval) ? 1 : 0; - c7_enabled = (getBoolForKey(kEnableC7State, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval) ? 1 : 0; + c6_enabled = (getBoolForKey(kEnableC6State, &tmpval, personality)&&tmpval) ? 1 : 0; + c7_enabled = (getBoolForKey(kEnableC7State, &tmpval, personality)&&tmpval) ? 1 : 0; } cpu->pkg_mwait_cstates.num_cstates = 0; @@ -2407,7 +2457,7 @@ { bool tmpval; - oem_apic=getBoolForKey(kOEMAPIC, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; + oem_apic=getBoolForKey(kOEMAPIC, &tmpval, personality)&&tmpval; } if (oem_apic == true) @@ -3669,7 +3719,7 @@ cstates_enabled = BuildCstateInfo(&cpu, pmbase); if (cstates_enabled) { - getBoolForKey(KEnableMwait, &enable_mwait, DEFAULT_BOOT_CONFIG); + getBoolForKey(KEnableMwait, &enable_mwait, personality); } } @@ -3680,7 +3730,7 @@ pstates_enabled = BuildPstateInfo(&cpu); if (pstates_enabled) { - const char *str = getStringForKey(KAcpiCoordType, DEFAULT_BOOT_CONFIG); + const char *str = getStringForKey(KAcpiCoordType, personality); U8 tmp = (U8)strtoul(str, NULL,16); if ((tmp == ACPI_COORD_TYPE_SW_ALL) || (tmp == ACPI_COORD_TYPE_SW_ANY) || (tmp == ACPI_COORD_TYPE_HW_ALL) ) { @@ -3998,7 +4048,7 @@ if (get_env(envVendor) == CPUID_VENDOR_INTEL) { fix_restart = true; - getBoolForKey(kRestartFix, &fix_restart, DEFAULT_BOOT_CONFIG); + getBoolForKey(kRestartFix, &fix_restart, personality); } else { verbose ("Not an Intel platform: Restart Fix disabled !!!\n"); @@ -4139,7 +4189,7 @@ if (fadt_mod->PreferredProfile != get_env(envType)) { bool val = false; - getBoolForKey("PreferInternalProfileDetect", &val, DEFAULT_BOOT_CONFIG); // if true Give prior to the profile resolved trought the CPU model + getBoolForKey("PreferInternalProfileDetect", &val, personality); // if true Give prior to the profile resolved trought the CPU model val = get_env(envIsServer) ; @@ -4155,7 +4205,7 @@ } // Set PM_Profile and System-type if user wanted this value to be forced - if ( (value=getStringForKey("SystemType", DEFAULT_BOOT_CONFIG))!=NULL) + if ( (value=getStringForKey("SystemType", personality))!=NULL) { if ((Type = (unsigned char) strtoul(value, NULL, 10) ) <= MaxSupportedPMProfile) { @@ -4173,7 +4223,7 @@ } else printf("Error: system-type must be 0..6. Defaulting to %d !\n", (U8)get_env(envType)); } - getBoolForKey(KIntelFADT, &intelfadtspec, DEFAULT_BOOT_CONFIG); + getBoolForKey(KIntelFADT, &intelfadtspec, personality); if ((pmbase == 0) && (cpu_map_error == 0) && (intelfadtspec == true)) { ACPI_TABLE_DSDT *DsdtPointer ; @@ -4200,7 +4250,7 @@ fadt_mod->Flags|= 0x400; int type = PCI_RESET_TYPE; - getIntForKey(KResetType, &type, DEFAULT_BOOT_CONFIG); + getIntForKey(KResetType, &type, personality); if (type == KEYBOARD_RESET_TYPE) { //Azi: keyboard reset; http://forum.voodooprojects.org/index.php/topic,1056.msg9802.html#msg9802 @@ -4264,7 +4314,19 @@ static U32 process_xsdt (ACPI_TABLE_RSDP *rsdp_mod , U32 *new_table_list) { - TagPtr DropTables_p = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"ACPIDropTables")); // TODO: fix me + TagPtr DropTables_p = 0; + int DropTables_tag_count = 0; + + if (personality->dictionary) + { + DropTables_p = XMLCastDict(XMLGetProperty(personality->dictionary, (const char*)"ACPIDropTables")); + if (DropTables_p) DropTables_tag_count = XMLTagCount(DropTables_p) ; + } + + if (!DropTables_tag_count) + if ((DropTables_p = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"ACPIDropTables")))) DropTables_tag_count = XMLTagCount(DropTables_p); + + U32 new_table = 0ul; U8 new_table_index = 0, table_added = 0; ACPI_TABLE_XSDT *xsdt = (void*)0ul, *xsdt_mod = (void*)0ul; @@ -4310,7 +4372,7 @@ } int method = 0; - getIntForKey(kAcpiMethod, &method, DEFAULT_BOOT_CONFIG); + getIntForKey(kAcpiMethod, &method, personality); if (method != 0x2) @@ -4340,7 +4402,7 @@ bool oem = false; char oemOption[OEMOPT_SIZE]; sprintf(oemOption, "oem%s",tableSig ); - if (getBoolForKey(oemOption, &oem, DEFAULT_BOOT_CONFIG) && oem) // This method don't work for DSDT and FACS + if (getBoolForKey(oemOption, &oem, personality) && oem) // This method don't work for DSDT and FACS { DBG(" %s required\n", oemOption); @@ -4352,12 +4414,13 @@ } } + if ((DropTables_tag_count > 0) && DropTables_p) { TagPtr match_drop = XMLGetProperty(DropTables_p, (const char*)tableSig); if ( match_drop ) { char *tmp = XMLCastString(match_drop); - if (strcmp(tmp,"No") != 0) + if (tmp && (strcmp(tmp,"No") != 0)) { dropoffset++; DBG(" %s table dropped\n",tableSig); @@ -4443,7 +4506,18 @@ static U32 process_rsdt(ACPI_TABLE_RSDP *rsdp_mod , bool gen_xsdt, U32 *new_table_list) { - TagPtr DropTables_p = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"ACPIDropTables")); // TODO: fix me + TagPtr DropTables_p = 0; + int DropTables_tag_count = 0; + + if (personality->dictionary) + { + DropTables_p = XMLCastDict(XMLGetProperty(personality->dictionary, (const char*)"ACPIDropTables")); + if (DropTables_p) DropTables_tag_count = XMLTagCount(DropTables_p) ; + } + + if (!DropTables_tag_count) + if ((DropTables_p = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"ACPIDropTables")))) DropTables_tag_count = XMLTagCount(DropTables_p); + U32 new_table = 0ul; U8 new_table_index = 0, table_added = 0; U32 dropoffset=0, index; @@ -4478,7 +4552,7 @@ { int method = 0; - getIntForKey(kAcpiMethod, &method, DEFAULT_BOOT_CONFIG); + getIntForKey(kAcpiMethod, &method, personality); if (method != 0x2) @@ -4507,7 +4581,7 @@ bool oem = false; char oemOption[OEMOPT_SIZE]; sprintf(oemOption, "oem%s",tableSig ); - if (getBoolForKey(oemOption, &oem, DEFAULT_BOOT_CONFIG) && oem) // This method don't work for DSDT and FACS + if (getBoolForKey(oemOption, &oem, personality) && oem) // This method don't work for DSDT and FACS { DBG(" %s required\n", oemOption); @@ -4518,6 +4592,7 @@ } } + if ((DropTables_tag_count > 0) && DropTables_p) { TagPtr match_drop = XMLGetProperty(DropTables_p, (const char*)tableSig); if ( match_drop ) @@ -4639,6 +4714,8 @@ getc(); return EFI_NOT_FOUND; } + + initPersonality(); { U8 i; @@ -4649,20 +4726,20 @@ } bool tmpval; - oem_dsdt=getBoolForKey(kOEMDSDT, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; - oem_fadt=getBoolForKey(kOEMFADT, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; + oem_dsdt=getBoolForKey(kOEMDSDT, &tmpval, personality)&&tmpval; + oem_fadt=getBoolForKey(kOEMFADT, &tmpval, personality)&&tmpval; - gen_csta=getBoolForKey(kGenerateCStates, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; - gen_psta=getBoolForKey(kGeneratePStates, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; - gen_ssdt=getBoolForKey(KForceSSDT, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; - update_acpi=getBoolForKey(kUpdateACPI, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; + gen_csta=getBoolForKey(kGenerateCStates, &tmpval, personality)&&tmpval; + gen_psta=getBoolForKey(kGeneratePStates, &tmpval, personality)&&tmpval; + gen_ssdt=getBoolForKey(KForceSSDT, &tmpval, personality)&&tmpval; + update_acpi=getBoolForKey(kUpdateACPI, &tmpval, personality)&&tmpval; - speed_step=getBoolForKey(kSpeedstep, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; - turbo_enabled=(U32)getBoolForKey(kCoreTurbo, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; + speed_step=getBoolForKey(kSpeedstep, &tmpval, personality)&&tmpval; + turbo_enabled=(U32)getBoolForKey(kCoreTurbo, &tmpval, personality)&&tmpval; #if BUILD_ACPI_TSS - gen_tsta=(U32)getBoolForKey(kGenerateTStates, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; + gen_tsta=(U32)getBoolForKey(kGenerateTStates, &tmpval, personality)&&tmpval; #endif - checkOem=getBoolForKey(kOnlySignedAml, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; + checkOem=getBoolForKey(kOnlySignedAml, &tmpval, personality)&&tmpval; } { @@ -4971,7 +5048,7 @@ MADT_INFO madt_info; bool strip_madt = true; - getBoolForKey(kSTRIPAPIC, &strip_madt, DEFAULT_BOOT_CONFIG); + getBoolForKey(kSTRIPAPIC, &strip_madt, personality); if ((strip_madt == false) || (!buildMADT(new_table_list, DsdtPtr, &madt_info ))) { @@ -4982,7 +5059,7 @@ { bool tmpval; - oem_apic=getBoolForKey(kOEMAPIC, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval; + oem_apic=getBoolForKey(kOEMAPIC, &tmpval, personality)&&tmpval; } if ((madt_file = (ACPI_TABLE_MADT *)get_new_table_in_list(new_table_list, NAMESEG("APIC"), &new_table_index)) != (void *)0ul) Index: branches/cparm/i386/modules/ACPICodec/ACPICodec.c =================================================================== --- branches/cparm/i386/modules/ACPICodec/ACPICodec.c (revision 1930) +++ branches/cparm/i386/modules/ACPICodec/ACPICodec.c (revision 1931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 cparm . All rights reserved. + * Copyright (c) 2010,2012 cparm . All rights reserved. * */ @@ -9,25 +9,8 @@ #include "pci_root.h" #include "acpi_codec.h" -#define kEnableAcpi "EnableAcpiModule" - -void is_ACPI_Codec_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6); void ACPICodec_start(void); - -void is_ACPI_Codec_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6){} - void ACPICodec_start(void) -{ - bool enable = true; - getBoolForKey(kEnableAcpi, &enable, DEFAULT_BOOT_CONFIG) ; - - enable = (execute_hook("isACPIRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS); - - if (enable) - { - replace_system_function("_setup_acpi",&setupAcpi); - - register_hook_callback("isACPIRegistred", &is_ACPI_Codec_Registred_Hook); - - } +{ + replace_system_function("_setup_acpi",&setupAcpi); } \ No newline at end of file Index: branches/cparm/i386/modules/ACPICodec/Makefile =================================================================== --- branches/cparm/i386/modules/ACPICodec/Makefile (revision 1930) +++ branches/cparm/i386/modules/ACPICodec/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.ACPI.ACPIPLATFORM.cparm.acpicodec +BUNDLE_COPYRIGHT = Copyright 2012, cparm +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = ACPIPLATFORM +BUNDLE_CLASS_PROVIDER = ACPI + DIR = ACPICodec include ../../MakePaths.dir @@ -28,7 +41,7 @@ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ -mpreferred-stack-boundary=2 -fno-align-functions \ - -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common + -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common -D__BUNDLE_ID__=\"$(BUNDLE_ID)\" DEFINES= CONFIG = hd @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${ACPI_CODEC_OBJS} dylib +all embedtheme: ${ACPI_CODEC_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -76,8 +89,35 @@ $(OBJROOT)/acpidecode.o \ $(OBJROOT)/ACPICodec.o \ $(OBJROOT)/acpi_codec.o \ - -o $(SYMROOT)/$(MODULE_NAME).dylib + -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOKitPersonalities" -dict "ResetType" '0' "IntelFADTSpec" 'Yes' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist + + + stack_protector.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o" Index: branches/cparm/i386/modules/HelloWorld/Makefile =================================================================== --- branches/cparm/i386/modules/HelloWorld/Makefile (revision 1930) +++ branches/cparm/i386/modules/HelloWorld/Makefile (revision 1931) @@ -5,6 +5,19 @@ MODULE_START = _$(MODULE_NAME)_start MODULE_DEPENDENCIES = +BUNDLE_NAME = $(MODULE_NAME) +BUNDLE_EXEC = $(BUNDLE_NAME) +BUNDLE_LIBS = +BUNDLE_INFO = +BUNDLE_ID = com.boot.TEST.TEST.hello +BUNDLE_COPYRIGHT = +BUNDLE_LICENCE = +BUNDLE_VERSION = 1.0 +BUNDLE_ICON = +BUNDLE_SHORT_VERSION = 1 +BUNDLE_CLASS = TEST +BUNDLE_CLASS_PROVIDER = TEST + DIR = HelloWorld include ../../MakePaths.dir @@ -58,10 +71,10 @@ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -all embedtheme: ${HELLO_WORLD_OBJS} dylib +all embedtheme: ${HELLO_WORLD_OBJS} bundle -dylib: +bundle: ld -arch i386 \ -undefined dynamic_lookup \ -alias $(MODULE_START) start \ @@ -71,10 +84,33 @@ -current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \ -final_output $(MODULE_NAME) \ -macosx_version_min 10.6 \ - $(OBJROOT)/stack_protector.o $(OBJROOT)/HelloWorld.o -o $(SYMROOT)/$(MODULE_NAME).dylib + $(OBJROOT)/stack_protector.o $(OBJROOT)/HelloWorld.o -o $(SYMROOT)/$(BUNDLE_EXEC) + @rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources + @mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + @mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS + @#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns + + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)' + @defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)' + @plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist - + stack_protector.o: $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o" Index: branches/cparm/i386/libsa/Makefile =================================================================== --- branches/cparm/i386/libsa/Makefile (revision 1930) +++ branches/cparm/i386/libsa/Makefile (revision 1931) @@ -10,8 +10,7 @@ OPTIM = -Os -Oz CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror -fno-stack-protector \ -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions \ - -march=pentium4 -msse2 -mfpmath=sse -msoft-float + -march=pentium4 -msse2 -msoft-float -ffreestanding -mpreferred-stack-boundary=2 -fno-align-functions -mfpmath=sse INC = -I. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSAIODIR) ifneq "" "$(wildcard /bin/mkdirs)" Index: branches/cparm/xcode3_sym.zip =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream