]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/bsddev/IOKitBSDInit.cpp
xnu-792.25.20.tar.gz
[apple/xnu.git] / iokit / bsddev / IOKitBSDInit.cpp
index d93930dd02a55715d1cff92008f61fc5f2992dcf..1d9f9af62d326b9cf66f9b73ea697f0fa09c0f9b 100644 (file)
@@ -465,6 +465,14 @@ kern_return_t IOFindBSDRoot( char * rootName,
 
     do {
        if( (regEntry = IORegistryEntry::fromPath( "/chosen", gIODTPlane ))) {
+            data = OSDynamicCast(OSData, regEntry->getProperty( "root-matching" ));
+            if (data) {
+               matching = OSDynamicCast(OSDictionary, OSUnserializeXML((char *)data->getBytesNoCopy()));
+                if (matching) {
+                    continue;
+                }
+            }
+
            data = (OSData *) regEntry->getProperty( "boot-uuid" );
            if( data) {
                uuidStr = (const char*)data->getBytesNoCopy();
@@ -564,10 +572,12 @@ kern_return_t IOFindBSDRoot( char * rootName,
        // from OpenFirmware path
        IOLog("From path: \"%s\", ", look);
 
-       if( forceNet || (0 == strncmp( look, "enet", strlen( "enet" ))) ) {
-            matching = IONetworkMatching( look, str, kMaxPathBuf );
-        } else {
-            matching = IODiskMatching( look, str, kMaxPathBuf );
+        if (!matching) {
+            if( forceNet || (0 == strncmp( look, "enet", strlen( "enet" ))) ) {
+                matching = IONetworkMatching( look, str, kMaxPathBuf );
+            } else {
+                matching = IODiskMatching( look, str, kMaxPathBuf );
+            }
         }
     }
     
@@ -669,7 +679,7 @@ kern_return_t IOFindBSDRoot( char * rootName,
         IOService * subservice = IOFindMatchingChild( service );
         if ( subservice ) service = subservice;
     } else if ( service && mediaProperty ) {
-        service = service->getProperty(mediaProperty);
+        service = (IOService *)service->getProperty(mediaProperty);
     }
 
     major = 0;