Do away with 'options SWAP_GENERIC' once and for all: I get ill

just thinking about it.

Two changes need to be made to allow 'config kernel swap generic' to
work properly without requiring any compile-time flags:

/usr/src/usr.sbin/config/mkswapconf.c: we need to define a dummy stub
for the setconf() function to replace the one in swapgeneric.c that
isn't available in non-generic configurations.

/usr/src/sys/i386/i386/autoconf.c: the -a boot flag causes setroot()
to be skipped and lets setconf() prompt the user for a root device.
If you skip setroot() in a non-generic kernel, you could get severely
hosed. To avoid this, we silently ignore the -a flag if rootdev != NODEV.
(rootdev is always initialized to NODEV in swapgeneric.c, so if
we find that rootdev is something other than NODEV, we know we're
not using a generic configuration.)
This commit is contained in:
wpaul 1995-02-18 18:05:35 +00:00
parent 6d90dafba0
commit 09b7a3d45c
3 changed files with 23 additions and 13 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.18 1995/01/11 17:51:26 jkh Exp $
* $Id: autoconf.c,v 1.19 1995/02/01 23:11:38 se Exp $
*/
/*
@ -111,13 +111,17 @@ configure()
#ifdef FFS
if (!mountroot) {
mountroot = ffs_mountroot;
#ifdef SWAP_GENERIC
if ((boothowto & RB_ASKNAME) == 0)
/*
* 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();
setconf();
#else
setroot();
#endif
}
#endif
if (!mountroot) {

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.18 1995/01/11 17:51:26 jkh Exp $
* $Id: autoconf.c,v 1.19 1995/02/01 23:11:38 se Exp $
*/
/*
@ -111,13 +111,17 @@ configure()
#ifdef FFS
if (!mountroot) {
mountroot = ffs_mountroot;
#ifdef SWAP_GENERIC
if ((boothowto & RB_ASKNAME) == 0)
/*
* 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();
setconf();
#else
setroot();
#endif
}
#endif
if (!mountroot) {

View File

@ -111,7 +111,9 @@ do_swap(fl)
} while (swap && swap->f_type == SWAPSPEC);
fprintf(fp, "\t{ NODEV, 0, 0 },\t/* for NFS diskless */\n");
fprintf(fp, "\t{ NODEV, 0, 0 }\n");
fprintf(fp, "};\n");
fprintf(fp, "};\n\n");
fprintf(fp, "/* Stub for when generic swap config is not used. */\n");
fprintf(fp, "void setconf(void) {};\n");
fclose(fp);
return (swap);
}