aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1995-11-28 03:15:58 +0000
committerPeter Wemm <peter@FreeBSD.org>1995-11-28 03:15:58 +0000
commit018309ece7cd905ce69bc3cc7955be6769ca27c7 (patch)
tree2929374e3d1b0372e8551201d2a66749ee888e51
parent6884d2aae7f2978d578de6ff731eec0d23c44303 (diff)
Notes
-rw-r--r--sys/amd64/amd64/autoconf.c30
-rw-r--r--sys/i386/i386/autoconf.c30
-rw-r--r--sys/ufs/mfs/mfs_vfsops.c51
3 files changed, 66 insertions, 45 deletions
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c
index afa38fd448da..8acbe10e2b1f 100644
--- a/sys/amd64/amd64/autoconf.c
+++ b/sys/amd64/amd64/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.41 1995/11/05 04:43:11 gibbs Exp $
+ * $Id: autoconf.c,v 1.42 1995/11/20 12:09:54 phk Exp $
*/
/*
@@ -75,6 +75,9 @@ static void setroot(void);
*/
int dkn; /* number of iostat dk numbers assigned so far */
+#ifdef MFS_ROOT
+extern struct vfsops mfs_vfsops;
+#endif
#ifdef FFS
extern struct vfsops ufs_vfsops;
#endif
@@ -90,11 +93,6 @@ int cd9660_mountroot __P((void *));
#ifdef MSDOSFS
int msdosfs_mountroot __P((void *));
#endif
-#ifdef MFS_ROOT
-int mfs_initminiroot __P((u_char *));
-u_char mfs_root[MFS_ROOT*1024] = "MFS Filesystem goes here";
-u_char end_mfs_root[] = "MFS Filesystem had better STOP here";
-#endif
#include "eisa.h"
#include "isa.h"
@@ -199,10 +197,6 @@ configure(dummy)
cninit_finish();
-#ifdef MFS_ROOT
- mfs_initminiroot(mfs_root); /* XXX UGLY*/
-#endif /* MFS_ROOT */
-
#ifdef CD9660
if ((boothowto & RB_CDROM) && !mountroot)
mountroot = find_cdrom_root;
@@ -213,6 +207,22 @@ configure(dummy)
mountroot = nfs_mountroot;
#endif /* NFS */
+#ifdef MFS_ROOT
+ if (!mountroot) {
+ mountroot = vfs_mountroot; /* XXX goes away*/
+ mountrootvfsops = &mfs_vfsops;
+ /*
+ * Ignore the -a flag if this kernel isn't compiled
+ * with a generic root/swap configuration: if we skip
+ * setroot() and we aren't a generic kernel, chaos
+ * will ensue because setconf() will be a no-op.
+ * (rootdev is always initialized to NODEV in a
+ * generic configuration, so we test for that.)
+ */
+ if ((boothowto & RB_ASKNAME) == 0 || rootdev != NODEV)
+ setroot();
+ }
+#endif
#ifdef FFS
if (!mountroot) {
mountroot = vfs_mountroot; /* XXX goes away*/
diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c
index afa38fd448da..8acbe10e2b1f 100644
--- a/sys/i386/i386/autoconf.c
+++ b/sys/i386/i386/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.41 1995/11/05 04:43:11 gibbs Exp $
+ * $Id: autoconf.c,v 1.42 1995/11/20 12:09:54 phk Exp $
*/
/*
@@ -75,6 +75,9 @@ static void setroot(void);
*/
int dkn; /* number of iostat dk numbers assigned so far */
+#ifdef MFS_ROOT
+extern struct vfsops mfs_vfsops;
+#endif
#ifdef FFS
extern struct vfsops ufs_vfsops;
#endif
@@ -90,11 +93,6 @@ int cd9660_mountroot __P((void *));
#ifdef MSDOSFS
int msdosfs_mountroot __P((void *));
#endif
-#ifdef MFS_ROOT
-int mfs_initminiroot __P((u_char *));
-u_char mfs_root[MFS_ROOT*1024] = "MFS Filesystem goes here";
-u_char end_mfs_root[] = "MFS Filesystem had better STOP here";
-#endif
#include "eisa.h"
#include "isa.h"
@@ -199,10 +197,6 @@ configure(dummy)
cninit_finish();
-#ifdef MFS_ROOT
- mfs_initminiroot(mfs_root); /* XXX UGLY*/
-#endif /* MFS_ROOT */
-
#ifdef CD9660
if ((boothowto & RB_CDROM) && !mountroot)
mountroot = find_cdrom_root;
@@ -213,6 +207,22 @@ configure(dummy)
mountroot = nfs_mountroot;
#endif /* NFS */
+#ifdef MFS_ROOT
+ if (!mountroot) {
+ mountroot = vfs_mountroot; /* XXX goes away*/
+ mountrootvfsops = &mfs_vfsops;
+ /*
+ * Ignore the -a flag if this kernel isn't compiled
+ * with a generic root/swap configuration: if we skip
+ * setroot() and we aren't a generic kernel, chaos
+ * will ensue because setconf() will be a no-op.
+ * (rootdev is always initialized to NODEV in a
+ * generic configuration, so we test for that.)
+ */
+ if ((boothowto & RB_ASKNAME) == 0 || rootdev != NODEV)
+ setroot();
+ }
+#endif
#ifdef FFS
if (!mountroot) {
mountroot = vfs_mountroot; /* XXX goes away*/
diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c
index eafc84a22364..2b7ea253494e 100644
--- a/sys/ufs/mfs/mfs_vfsops.c
+++ b/sys/ufs/mfs/mfs_vfsops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mfs_vfsops.c 8.4 (Berkeley) 4/16/94
- * $Id: mfs_vfsops.c,v 1.14 1995/11/09 08:14:26 bde Exp $
+ * $Id: mfs_vfsops.c,v 1.15 1995/11/28 02:15:29 peter Exp $
*/
#include <sys/param.h>
@@ -88,32 +88,12 @@ struct vfsops mfs_vfsops = {
VFS_SET(mfs_vfsops, mfs, MOUNT_MFS, 0);
-/*
- * This is called early in boot to set the base address and size
- * of the mini-root.
- *
- * XXX THIS IS A DESIGN ERROR; THIS CODE SHOULD BE MOVED INTO
- * XXX THE ROOT MOUNT CODE IN "mfs_mount"!!!
- */
-int
-mfs_initminiroot(base)
- caddr_t base;
-{
- struct fs *fs = (struct fs *)(base + SBOFF);
+#ifdef MFS_ROOT
- /* check for valid super block */
- if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
- fs->fs_bsize < sizeof(struct fs))
- return (0);
- mountroot = vfs_mountroot; /* XXX goes away*/
- mountrootvfsops = &mfs_vfsops;
- mfs_rootbase = base;
- mfs_rootsize = fs->fs_fsize * fs->fs_size;
- rootdev = makedev(255, mfs_minor++);
- printf("rootfs is %ld Kbyte compiled in MFS\n",mfs_rootsize/1024);
- return (mfs_rootsize);
-}
+u_char mfs_root[MFS_ROOT*1024] = "MFS Filesystem goes here";
+u_char end_mfs_root[] = "MFS Filesystem had better STOP here";
+#endif /* MFS_ROOT */
/*
* mfs_mount
@@ -179,6 +159,23 @@ mfs_mount(mp, path, data, ndp, p)
***
*/
+#ifdef MFS_ROOT
+ /* Location of MFS/FFS superblock */
+ fs = (struct fs *)(mfs_root + SBOFF);
+
+ /* recheck for valid super block */
+ if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
+ fs->fs_bsize < sizeof(struct fs)) {
+ panic("MFS image is invalid!!");
+ }
+
+ mfs_rootbase = mfs_root;
+ mfs_rootsize = fs->fs_fsize * fs->fs_size;
+ rootdev = makedev(255, mfs_minor++);
+ printf("rootfs is %ld Kbyte compiled in MFS\n",
+ mfs_rootsize/1024);
+
+
/* Get vnode for root device*/
if( bdevvp( rootdev, &rootvp))
panic("mfs_mountroot: can't setup bdevvp for rootdev");
@@ -207,6 +204,10 @@ mfs_mount(mp, path, data, ndp, p)
}
goto dostatfs; /* success*/
+#else
+ /* you loose */
+ panic("mfs_mount: mount MFS as root: not configured!");
+#endif /* MFS_ROOT */
}
/*