+
+
+//
+// See if we have a RAMDisk property in /chosen/memory-map. If so, make it into a device.
+// It will become /dev/mdx, where x is 0-f.
+//
+
+ if(!didRam) { /* Have we already build this ram disk? */
+ didRam = 1; /* Remember we did this */
+ if((regEntry = IORegistryEntry::fromPath( "/chosen/memory-map", gIODTPlane ))) { /* Find the map node */
+ data = (OSData *)regEntry->getProperty("RAMDisk"); /* Find the ram disk, if there */
+ if(data) { /* We found one */
+
+ ramdParms = (UInt32 *)data->getBytesNoCopy(); /* Point to the ram disk base and size */
+ (void)mdevadd(-1, ramdParms[0] >> 12, ramdParms[1] >> 12, 0); /* Initialize it and pass back the device number */
+ }
+ regEntry->release(); /* Toss the entry */
+ }
+ }
+
+//
+// Now check if we are trying to root on a memory device
+//
+
+ if((rdBootVar[0] == 'm') && (rdBootVar[1] == 'd') && (rdBootVar[3] == 0)) {
+ dchar = xchar = rdBootVar[2]; /* Get the actual device */
+ if((xchar >= '0') && (xchar <= '9')) xchar = xchar - '0'; /* If digit, convert */
+ else {
+ xchar = xchar & ~' '; /* Fold to upper case */
+ if((xchar >= 'A') && (xchar <= 'F')) { /* Is this a valid digit? */
+ xchar = (xchar & 0xF) + 9; /* Convert the hex digit */
+ dchar = dchar | ' '; /* Fold to lower case */
+ }
+ else xchar = -1; /* Show bogus */
+ }
+ if(xchar >= 0) { /* Do we have a valid memory device name? */
+ *root = mdevlookup(xchar); /* Find the device number */
+ if(*root >= 0) { /* Did we find one? */
+
+ rootName[0] = 'm'; /* Build root name */
+ rootName[1] = 'd'; /* Build root name */
+ rootName[2] = dchar; /* Build root name */
+ rootName[3] = 0; /* Build root name */
+ IOLog("BSD root: %s, major %d, minor %d\n", rootName, major(*root), minor(*root));
+ *oflags = 0; /* Show that this is not network */
+ goto iofrootx; /* Join common exit... */
+ }
+ panic("IOFindBSDRoot: specified root memory device, %s, has not been configured\n", rdBootVar); /* Not there */
+ }
+ }
+