Allow more flexible use of MFS root.

Submitted by:	peter
This commit is contained in:
Jordan K. Hubbard 1998-10-10 08:12:24 +00:00
parent c9a5e21100
commit a33b93ff31
3 changed files with 48 additions and 36 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.106 1998/09/15 10:03:42 gibbs Exp $
* $Id: autoconf.c,v 1.108 1998/10/05 21:09:21 obrien Exp $
*/
/*
@ -173,6 +173,10 @@ find_cdrom_root()
extern void xpt_init __P((void));
#ifdef MFS_ROOT
extern u_char *mfs_getimage __P((void));
#endif
static void
configure_start()
{
@ -326,17 +330,20 @@ cpu_rootconf()
if (!mountrootfsname) {
if (bootverbose)
printf("Considering MFS root f/s.\n");
mountrootfsname = "mfs";
/*
* 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();
if (mfs_getimage()) {
mountrootfsname = "mfs";
/*
* 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();
} else if (bootverbose)
printf("No MFS image available as root f/s.\n");
}
#endif

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.106 1998/09/15 10:03:42 gibbs Exp $
* $Id: autoconf.c,v 1.108 1998/10/05 21:09:21 obrien Exp $
*/
/*
@ -173,6 +173,10 @@ find_cdrom_root()
extern void xpt_init __P((void));
#ifdef MFS_ROOT
extern u_char *mfs_getimage __P((void));
#endif
static void
configure_start()
{
@ -326,17 +330,20 @@ cpu_rootconf()
if (!mountrootfsname) {
if (bootverbose)
printf("Considering MFS root f/s.\n");
mountrootfsname = "mfs";
/*
* 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();
if (mfs_getimage()) {
mountrootfsname = "mfs";
/*
* 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();
} else if (bootverbose)
printf("No MFS image available as root f/s.\n");
}
#endif

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mfs_vfsops.c 8.11 (Berkeley) 6/19/95
* $Id: mfs_vfsops.c,v 1.48 1998/10/09 06:21:12 jkh Exp $
* $Id: mfs_vfsops.c,v 1.49 1998/10/09 23:37:37 peter Exp $
*/
@ -100,17 +100,20 @@ static struct vfsops mfs_vfsops = {
VFS_SET(mfs_vfsops, mfs, 0);
#ifdef MFS_ROOT
#ifdef MFS_ROOT_SIZE
#ifdef MFS_ROOT_SIZE
/* Image was already written into mfs_root */
static u_char mfs_root[MFS_ROOT_SIZE*1024] = "MFS Filesystem goes here";
static u_char end_mfs_root[] = "MFS Filesystem had better STOP here";
#endif
#else /* load it from preload area */
static u_char *
u_char *
mfs_getimage(void)
{
#ifdef MFS_ROOT_SIZE
/* Get it from compiled-in code */
return mfs_root;
#else
caddr_t p;
vm_offset_t *q;
@ -121,9 +124,9 @@ mfs_getimage(void)
if (!q)
return NULL;
return (u_char *)*q;
#endif
}
#endif /* MFS_ROOT_SIZE */
#endif /* MFS_ROOT */
/*
@ -192,15 +195,10 @@ mfs_mount(mp, path, data, ndp, p)
*/
#ifdef MFS_ROOT
#ifdef MFS_ROOT_SIZE
/* Get it from compiled-in code */
base = mfs_root;
#else
/* Get it from preload area */
base = mfs_getimage();
if (!base)
panic("No module of type mfs_root loaded; can't continue!");
#endif /* MFS_ROOT_SIZE */
panic("No mfs_root image loaded; can't continue!");
fs = (struct fs *)(base + SBOFF);
/* check for valid super block */
if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||