Moin!

> H.Heinold wrote:
> > yesterday I built the root.bin for mips and made an root.tat.gz wie the
> > nfsroot.sh. Then set up nfs-server unpacked the root.tar.gz booted the
> > kernel Hwith the rootnfs. The installer starts, but then busybox claims 
> > that it can not determine
> > the rootfs. Any suggestions? I know have too look a little bit in busybox
> > and look too what the nfsroot.sh really does.

Martin Schulze wrote:
> Check utilities/dbootstrap/block_device.c.  dbootstrap is trying to
> determine the device that contains the root-fs is but fails.
> block_device() is looking for an entry in /dev/ (as well), which may
> fail.
> 
> This information is required to be able to call an equivalent of
> "umount -a" without umounting the root filesystem.
> 
> We've just verified that, this is where it fails.  block_device gets
> 00:06 as st_dev, but converted into a string results in NULL.  I'll
> generate a patch which may solve this problem when I'm awake again.

If you like, you can try this patch:

Index: block_device.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/block_device.c,v
retrieving revision 1.6
diff -u -r1.6 block_device.c
--- block_device.c      2000/03/17 20:52:41     1.6
+++ block_device.c      2001/07/22 10:30:43
@@ -18,6 +18,42 @@
                return 0;
 }
 
+int is_nfs_root (const char *name)
+{
+  FILE *proc;
+  int match = FALSE;
+  char dev[80], dir[80], type[80];
+
+  if (name[0] != '/' && name[1] != '\0')
+    return FALSE;
+
+  proc = fopen ("/proc/mounts", "r");
+  if ( proc ==  NULL )
+  {
+    perrorBox(_("Can't read /proc/mounts"));
+    return -1;
+  }
+
+  /* Can't use is_fstype() from baseconfig.c because that one doesn't
+     compare the type.  -Joey
+  */
+  while ( EOF != fscanf (proc, "%s %s %s %*s %*i %*i\n",
+                 dev, dir, type))
+  {
+    if (!strncmp ("/dev/root", dev, 79)
+       && !strncmp (name, dir, 79)
+       && !strncmp ("nfs", type, 79))
+    {
+      match = TRUE;
+      break;
+    }
+  }
+
+  fclose (proc);
+
+  return match;
+}
+
 char *block_device(char *name)
 {
   struct stat s;
@@ -31,6 +67,10 @@
       /* recurse /dev to find the appropriate device for *name */  
   recursiveAction("/dev", TRUE, FALSE, FALSE, match_mount, NULL);
   
+  if (!my_device_name && is_nfs_root (name) == TRUE) {
+    my_device_name = strdup ("/dev/root");
+  }
+
   if(my_device_name) {
     buf=strdup(my_device_name);
     free(my_device_name);
@@ -39,3 +79,16 @@
 
        return (char *) NULL;
 }
+
+/*
+CAVEAT:
+
+  If the root filesystem is mounted as nfsroot, then st_dev seems to
+  be 6 (as in 00:06).  There is no device name found, so the string is
+  (null), which lets dbootstrap fail miserably.
+
+  Idea: if that's the case, and /proc/mounts contains something like
+  "/dev/root / nfs", then set the device name as "/dev/root" and pray
+  that dbootstrap won't break somewhere else.
+
+ */

Regards,

        Joey

-- 
Linux - the choice of a GNU generation.

Please always Cc to me when replying to me on the lists.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to