- panic("IOFindBSDRoot: specified root memory device, %s, has not been configured\n", rdBootVar); /* Not there */
- }
- }
-
- if( look) {
- // from OpenFirmware path
- IOLog("From path: \"%s\", ", look);
-
- if (!matching) {
- if( forceNet || (0 == strncmp( look, "enet", strlen( "enet" ))) ) {
- matching = IONetworkMatching( look, str, kMaxPathBuf );
- } else {
- matching = IODiskMatching( look, str, kMaxPathBuf );
- }
- }
- }
-
- if( (!matching) && rdBootVar[0] ) {
- // by BSD name
- look = rdBootVar;
- if( look[0] == '*')
- look++;
-
- if ( strncmp( look, "en", strlen( "en" )) == 0 ) {
- matching = IONetworkNamePrefixMatching( "en" );
- } else if ( strncmp( look, "cdrom", strlen( "cdrom" )) == 0 ) {
- matching = IOCDMatching();
- findHFSChild = true;
- } else if ( strncmp( look, "uuid", strlen( "uuid" )) == 0 ) {
- char *uuid;
- OSString *uuidString;
-
- uuid = (char *)IOMalloc( kMaxBootVar );
-
- if ( uuid ) {
- if (!PE_parse_boot_argn( "boot-uuid", uuid, kMaxBootVar )) {
- panic( "rd=uuid but no boot-uuid=<value> specified" );
- }
- uuidString = OSString::withCString( uuid );
- if ( uuidString ) {
- IOService::publishResource( "boot-uuid", uuidString );
- uuidString->release();
- IOLog( "\nWaiting for boot volume with UUID %s\n", uuid );
- matching = IOUUIDMatching();
- mediaProperty = "boot-uuid-media";
- }
- IOFree( uuid, kMaxBootVar );
- }
+ panic("IOFindBSDRoot: specified root memory device, %s, has not been configured\n", rdBootVar); /* Not there */
+ }
+ }
+
+ if ((!matching) && rdBootVar[0]) {
+ // by BSD name
+ look = rdBootVar;
+ if (look[0] == '*') {
+ look++;
+ }
+
+ if (strncmp( look, "en", strlen( "en" )) == 0) {
+ matching = IONetworkNamePrefixMatching( "en" );
+ needNetworkKexts = true;
+ } else if (strncmp( look, "uuid", strlen( "uuid" )) == 0) {
+ char *uuid;
+ OSString *uuidString;
+
+ uuid = (char *)IOMalloc( kMaxBootVar );
+
+ if (uuid) {
+ if (!PE_parse_boot_argn( "boot-uuid", uuid, kMaxBootVar )) {
+ panic( "rd=uuid but no boot-uuid=<value> specified" );
+ }
+ uuidString = OSString::withCString( uuid );
+ if (uuidString) {
+ IOService::publishResource( "boot-uuid", uuidString );
+ uuidString->release();
+ IOLog( "\nWaiting for boot volume with UUID %s\n", uuid );
+ matching = IOUUIDMatching();
+ mediaProperty = "boot-uuid-media";
+ }
+ IOFree( uuid, kMaxBootVar );
+ }
+ } else {
+ matching = IOBSDNameMatching( look );
+ }
+ }
+
+ if (!matching) {
+ OSString * astring;
+ // Match any HFS media
+
+ matching = IOService::serviceMatching( "IOMedia" );
+ astring = OSString::withCStringNoCopy("Apple_HFS");
+ if (astring) {
+ matching->setObject("Content", astring);
+ astring->release();
+ }
+ }
+
+ if (gIOKitDebug & kIOWaitQuietBeforeRoot) {
+ IOLog( "Waiting for matching to complete\n" );
+ IOService::getPlatform()->waitQuiet();
+ }
+
+ if (true && matching) {
+ OSSerialize * s = OSSerialize::withCapacity( 5 );
+
+ if (matching->serialize( s )) {
+ IOLog( "Waiting on %s\n", s->text());
+ s->release();
+ }
+ }
+
+ char namep[8];
+ if (needNetworkKexts
+ || PE_parse_boot_argn("-s", namep, sizeof(namep))) {
+ IOService::startDeferredMatches();
+ }
+
+ do {
+ t.tv_sec = ROOTDEVICETIMEOUT;
+ t.tv_nsec = 0;
+ matching->retain();
+ service = IOService::waitForService( matching, &t );
+ if ((!service) || (mountAttempts == 10)) {
+ PE_display_icon( 0, "noroot");
+ IOLog( "Still waiting for root device\n" );
+
+ if (!debugInfoPrintedOnce) {
+ debugInfoPrintedOnce = true;
+ if (gIOKitDebug & kIOLogDTree) {
+ IOLog("\nDT plane:\n");
+ IOPrintPlane( gIODTPlane );
+ }
+ if (gIOKitDebug & kIOLogServiceTree) {
+ IOLog("\nService plane:\n");
+ IOPrintPlane( gIOServicePlane );
+ }
+ if (gIOKitDebug & kIOLogMemory) {
+ IOPrintMemory();
+ }
+ }
+ }
+ } while (!service);
+ matching->release();
+
+ if (service && mediaProperty) {
+ service = (IOService *)service->getProperty(mediaProperty);
+ }
+
+ mjr = 0;
+ mnr = 0;
+
+ // If the IOService we matched to is a subclass of IONetworkInterface,
+ // then make sure it has been registered with BSD and has a BSD name
+ // assigned.
+
+ if (service
+ && service->metaCast( "IONetworkInterface" )
+ && !IORegisterNetworkInterface( service )) {
+ service = NULL;
+ }
+
+ if (service) {
+ len = kMaxPathBuf;
+ service->getPath( str, &len, gIOServicePlane );
+ IOLog( "Got boot device = %s\n", str );
+
+ iostr = (OSString *) service->getProperty( kIOBSDNameKey );
+ if (iostr) {
+ strlcpy( rootName, iostr->getCStringNoCopy(), rootNameSize );
+ }
+ off = (OSNumber *) service->getProperty( kIOBSDMajorKey );
+ if (off) {
+ mjr = off->unsigned32BitValue();
+ }
+ off = (OSNumber *) service->getProperty( kIOBSDMinorKey );
+ if (off) {
+ mnr = off->unsigned32BitValue();
+ }
+
+ if (service->metaCast( "IONetworkInterface" )) {
+ flags |= 1;
+ }
+ } else {
+ IOLog( "Wait for root failed\n" );
+ strlcpy( rootName, "en0", rootNameSize );
+ flags |= 1;
+ }
+
+ IOLog( "BSD root: %s", rootName );
+ if (mjr) {
+ IOLog(", major %d, minor %d\n", mjr, mnr );