QUOTE (Slice @ Jun 21 2010, 10:03 AM)

Very thanks for this guide. Now I can compile Snow kernel!
The only problem, it doesn't work

It is loaded and go to blue screen. No idea what is wrong.
New kernel is 13Mb while vanilla is 18Mb because I have no PPC codes, only i386+x86_64.
Yeah thats annoying, it would load eventually. To work around this you need to disable com.apple.driver.AppleIntel*Profile kext. Use kaitek's blacklist patch.
CODE
diff -uNr xnu-1504.3.12/iokit/IOKit/IOCatalogue.h xnu-1504.3.12-atom/iokit/IOKit/IOCatalogue.h
--- xnu-1504.3.12/iokit/IOKit/IOCatalogue.h 2010-03-29 15:14:21.000000000 -0400
+++ xnu-1504.3.12-atom/iokit/IOKit/IOCatalogue.h 2010-04-03 12:39:29.000000000 -0400
@@ -269,4 +269,14 @@
extern const OSSymbol * gIOProbeScoreKey;
extern IOCatalogue * gIOCatalogue;
+extern "C" {
+ /* kaitek: see ::addDrivers() and StartIOKit() for more information about the built-in kernel
+ * kext blacklist. */
+ typedef struct {
+ const char *name;
+ uint32_t hits;
+ } blacklist_mod_t;
+ extern boolean_t blacklistEnabled;
+ extern blacklist_mod_t blacklistMods[];
+};
#endif /* ! _IOKIT_IOCATALOGUE_H */
diff -uNr xnu-1504.3.12/iokit/Kernel/IOCatalogue.cpp xnu-1504.3.12-atom/iokit/Kernel/IOCatalogue.cpp
--- xnu-1504.3.12/iokit/Kernel/IOCatalogue.cpp 2010-03-29 15:14:22.000000000 -0400
+++ xnu-1504.3.12-atom/iokit/Kernel/IOCatalogue.cpp 2010-04-03 12:39:29.000000000 -0400
@@ -347,6 +347,8 @@
OSOrderedSet * set = NULL; // must release
OSDictionary * dict = NULL; // do not release
OSArray * persons = NULL; // do not release
+ OSString * moduleName;
+ bool ret;
persons = OSDynamicCast(OSArray, drivers);
if (!persons) {
@@ -368,9 +370,38 @@
IOLockLock(lock);
while ( (dict = (OSDictionary *) iter->getNextObject()) ) {
-
- // xxx Deleted OSBundleModuleDemand check; will handle in other ways for SL
+ /* kaitek / qoopz: if the kext blacklist is enabled (which it is by default), then check
+ * if any of the personalities we are preparing for matching should be skipped. */
+ if (blacklistEnabled) {
+ OSString *modName = OSDynamicCast(OSString, dict->getObject(gIOModuleIdentifierKey));
+ const char *modNameStr = NULL;
+ if (modName)
+ modNameStr = modName->getCStringNoCopy();
+ if (modNameStr) {
+ boolean_t shouldMatch = TRUE;
+ for (uint32_t n = 0; blacklistMods[n].name; n++) {
+ if (strcmp(blacklistMods[n].name, modNameStr))
+ continue;
+ if (!blacklistMods[n].hits++)
+ printf("warning: skipping personalities in blacklisted kext %s\n",
+ modNameStr);
+ shouldMatch = FALSE;
+ }
+ if (!shouldMatch)
+ continue;
+ }
+ }
+
+ if ((moduleName = OSDynamicCast(OSString, dict->getObject("OSBundleModuleDemand"))))
+ {
+ IOLockUnlock( lock );
+ ret = OSKext::loadKextWithIdentifier(moduleName->getCStringNoCopy(), false);
+ IOLockLock( lock );
+ ret = true;
+ }
+else
+{
SInt count;
UniqueProperties(dict);
@@ -404,6 +435,7 @@
}
AddNewImports(set, dict);
+}
}
// Start device matching.
if (doNubMatching && (set->getCount() > 0)) {
diff -uNr xnu-1504.3.12/iokit/Kernel/IOPlatformExpert.cpp xnu-1504.3.12-atom/iokit/Kernel/IOPlatformExpert.cpp
--- xnu-1504.3.12/iokit/Kernel/IOPlatformExpert.cpp 2010-03-29 15:14:22.000000000 -0400
+++ xnu-1504.3.12-atom/iokit/Kernel/IOPlatformExpert.cpp 2010-04-03 12:39:29.000000000 -0400
@@ -765,10 +765,16 @@
boolean_t PEGetModelName( char * name, int maxLength )
{
- if( gIOPlatform)
- return( gIOPlatform->getModelName( name, maxLength ));
- else
- return( false );
+ OSData *prop;
+
+ /* Eureka: Get the model name directly from property instead of calling getModelName(). */
+ prop = (OSData *) IOService::getPlatform()->getProvider()->getProperty(gIODTModelKey);
+ if (prop) {
+ strlcpy(name, (const char *) prop->getBytesNoCopy(), maxLength - 1);
+ return true;
+ }
+
+ return false;
}
int PEGetPlatformEpoch(void)
diff -uNr xnu-1504.3.12/iokit/Kernel/IOStartIOKit.cpp xnu-1504.3.12-atom/iokit/Kernel/IOStartIOKit.cpp
--- xnu-1504.3.12/iokit/Kernel/IOStartIOKit.cpp 2010-03-29 15:14:22.000000000 -0400
+++ xnu-1504.3.12-atom/iokit/Kernel/IOStartIOKit.cpp 2010-04-03 12:44:13.000000000 -0400
@@ -91,7 +91,16 @@
{
IORegistryEntry * root;
OSObject * obj;
+ uint32_t bootArg;
+ /* kaitek: todo: implement some kind of mechanism whereby the user can specify a
+ * custom list of kexts to be blacklisted. perhaps categories with the current
+ * list designated "default" and additional categories like "gfx", etc. */
+
+if (PE_parse_boot_argn("blacklist", &bootArg, sizeof(&bootArg)) && !bootArg) {
+ blacklistEnabled = FALSE;
+ printf("warning: disabling kext blacklist\n");
+ }
root = IORegistryEntry::initialize();
assert( root );
IOService::initialize();
@@ -118,6 +127,17 @@
// From <osfmk/kern/debug.c>
extern int debug_mode;
+/* kaitek / qoopz: blacklist of common kexts that are known to be problematic or undesirable
+ * for virtually all non-apple hardware. see notes in StartIOKit(). */
+
+boolean_t blacklistEnabled = TRUE;
+blacklist_mod_t blacklistMods[] = {
+ { "com.apple.driver.AppleIntelMeromProfile", 0 },
+ { "com.apple.driver.AppleIntelNehalemProfile", 0 },
+ { "com.apple.driver.AppleIntelPenrynProfile", 0 },
+ { "com.apple.driver.AppleIntelYonahProfile", 0 },
+ { NULL, 0 }
+};
/*****
* Pointer into bootstrap KLD segment for functions never used past startup.
QUOTE
I am trying to build the kernel with the patch from topic.
I got two errors
CODE
ERROR: OSBoolean.cpp: failed to get mapping for tid 10706
ERROR: IOMemoryDescriptor.cpp: failed to get mapping for tid 65129
Is there anybody knows what is mean?
I just ordered an i7 build and plan to dig into this over the weekend.