Remove the USERCONFIG_BOOT option. Userconfig script data is searched

for in a loaded module of type "userconfig_script".  The RB_CONFIG
flag will always result in the user being left inside userconfig at
the end of the script's execution, regardless of 'quit' commands in
the script.  If the RB_CONFIG flag is not specified, the user will
never be left inside userconfig, even if the script does not have an
explicit exit command.

Add the INTRO_USERCONFIG option.  This option forces the userconfig 'intro'
screen (after a script has optionally been executed).  There is no longer
a need to queue an 'intro' command.
This commit is contained in:
Mike Smith 1998-11-03 21:07:51 +00:00
parent 86854f0360
commit ec2a20b046
6 changed files with 121 additions and 96 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.115 1998/10/09 23:36:25 peter Exp $
* $Id: locore.s,v 1.116 1998/10/10 13:37:16 kato Exp $
*
* originally from: locore.s, by William F. Jolitz
*
@ -599,15 +599,6 @@ olddiskboot:
movl 12(%ebp),%eax
movl %eax,R(_bootdev)
#if defined(USERCONFIG_BOOT) && defined(USERCONFIG)
movl $0x10200, %esi
movl $R(_userconfig_from_boot),%edi
movl $512,%ecx
cld
rep
movsb
#endif /* USERCONFIG_BOOT */
ret

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.115 1998/10/09 23:36:25 peter Exp $
* $Id: locore.s,v 1.116 1998/10/10 13:37:16 kato Exp $
*
* originally from: locore.s, by William F. Jolitz
*
@ -599,15 +599,6 @@ olddiskboot:
movl 12(%ebp),%eax
movl %eax,R(_bootdev)
#if defined(USERCONFIG_BOOT) && defined(USERCONFIG)
movl $0x10200, %esi
movl $R(_userconfig_from_boot),%edi
movl $512,%ecx
cld
rep
movsb
#endif /* USERCONFIG_BOOT */
ret

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.313 1998/10/09 23:36:26 peter Exp $
* $Id: machdep.c,v 1.314 1998/10/30 05:41:14 msmith Exp $
*/
#include "apm.h"
@ -433,14 +433,7 @@ cpu_startup(dummy)
}
#if defined(USERCONFIG)
#if defined(USERCONFIG_BOOT)
if (1) {
#else
if (boothowto & RB_CONFIG) {
#endif
userconfig();
cninit(); /* the preferred console may have changed */
}
userconfig();
#endif
printf("avail memory = %d (%dK bytes)\n", ptoa(cnt.v_free_count),

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.115 1998/10/09 23:36:25 peter Exp $
* $Id: locore.s,v 1.116 1998/10/10 13:37:16 kato Exp $
*
* originally from: locore.s, by William F. Jolitz
*
@ -599,15 +599,6 @@ olddiskboot:
movl 12(%ebp),%eax
movl %eax,R(_bootdev)
#if defined(USERCONFIG_BOOT) && defined(USERCONFIG)
movl $0x10200, %esi
movl $R(_userconfig_from_boot),%edi
movl $512,%ecx
cld
rep
movsb
#endif /* USERCONFIG_BOOT */
ret

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.313 1998/10/09 23:36:26 peter Exp $
* $Id: machdep.c,v 1.314 1998/10/30 05:41:14 msmith Exp $
*/
#include "apm.h"
@ -433,14 +433,7 @@ cpu_startup(dummy)
}
#if defined(USERCONFIG)
#if defined(USERCONFIG_BOOT)
if (1) {
#else
if (boothowto & RB_CONFIG) {
#endif
userconfig();
cninit(); /* the preferred console may have changed */
}
userconfig();
#endif
printf("avail memory = %d (%dK bytes)\n", ptoa(cnt.v_free_count),

View File

@ -46,7 +46,7 @@
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** $Id: userconfig.c,v 1.112 1998/10/12 23:14:28 jkh Exp $
** $Id: userconfig.c,v 1.113 1998/10/18 16:24:33 wpaul Exp $
**/
/**
@ -113,6 +113,7 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/reboot.h>
#include <sys/linker.h>
#include <machine/cons.h>
#include <machine/md_var.h>
@ -131,36 +132,108 @@ static MALLOC_DEFINE(M_DEVL, "isa_devlist", "isa_device lists in userconfig()");
static struct isa_device *isa_devlist; /* list read by dset to extract changes */
#ifdef USERCONFIG_BOOT
char userconfig_from_boot[512] = "";
static int userconfig_boot_parsing; /* set if we are reading from the boot instructions */
#define putchar(x) cnputc(x)
/*
** Obtain command input.
**
** Initially, input is read from a possibly-loaded script.
** At the end of the script, or if no script is supplied,
** behaviour is determined by the RB_CONFIG (-c) flag. If
** the flag is set, user input is read from the console; if
** unset, the 'quit' command is invoked and userconfig
** will exit.
**
** Note that quit commands encountered in the script will be
** ignored if the RB_CONFIG flag is supplied.
*/
static int
getchar(void)
{
static char *next = userconfig_from_boot;
if (next == userconfig_from_boot) {
if (strncmp(next, "USERCONFIG\n", 11)) {
next++;
strcpy(next, "intro\n");
} else {
next += 11;
static const char *asp;
static int assize; /* use of int for -ve magic value */
static int autocheck = 0, signon = 0;
caddr_t autoentry, autoattr;
int c;
static int intro = 0;
/* Look for loaded userconfig script */
if (autocheck == 0)
{
autocheck = 1;
autoentry = preload_search_by_type("userconfig_script");
if (autoentry != NULL)
{
/* We have one, get size and data */
assize = 0;
if ((autoattr = preload_search_info(autoentry, MODINFO_SIZE)) != NULL)
assize = (size_t)*(u_int32_t *)autoattr;
asp = NULL;
if ((autoattr = preload_search_info(autoentry, MODINFO_ADDR)) != NULL)
asp = *(const char **)autoattr;
/* sanity check */
if ((assize == 0) || (asp == NULL)) {
assize = 0;
asp = NULL;
}
}
}
if (*next) {
userconfig_boot_parsing = 1;
return (*next++);
} else {
userconfig_boot_parsing = 0;
return cngetc();
printf("autocheck gives assize=%d asp=%p\n", assize, asp);
cngetc();
}
}
#else /* !USERCONFIG_BOOT */
#define getchar() cngetc()
#endif /* USERCONFIG_BOOT */
#define putchar(x) cnputc(x)
if (assize > 0)
{
/* Consume character from loaded userconfig script, display */
userconfig_boot_parsing = 1;
c = *asp;
asp++;
assize--;
} else if (assize == 0) {
/* Finished parsing script/no script */
userconfig_boot_parsing = 0;
#ifdef INTRO_USERCONFIG
if (intro == 0)
{
printf("do intro\n");
cngetc();
intro = 1;
c = 'i';
asp = "ntro\n";
assize = strlen(asp);
#else
if (!(boothowto & RB_CONFIG))
{
/* don't want to drop to interpreter */
printf("do quit\n");
cngetc();
c = 'q';
asp = "uit\n";
assize = strlen(asp);
#endif
} else {
/* Only display signon banner if we are about to go interactive */
if (!intro)
printf("\nFreeBSD Kernel Configuration Utility - Version 1.2\n"
" Type \"help\" for help"
#ifdef VISUAL_USERCONFIG
" or \"visual\" to go to the visual\n"
" configuration interface (requires MGA/VGA display or\n"
" serial terminal capable of displaying ANSI graphics)"
#endif
".\n");
assize = -1;
}
}
if (assize < 0) {
/* No script, read from the keyboard */
c = cngetc();
}
return(c);
}
#ifndef FALSE
#define FALSE (0)
@ -2387,7 +2460,7 @@ visuserconfig(void)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: userconfig.c,v 1.112 1998/10/12 23:14:28 jkh Exp $
* $Id: userconfig.c,v 1.113 1998/10/18 16:24:33 wpaul Exp $
*/
#include "scbus.h"
@ -2440,7 +2513,7 @@ static int set_device_enable(CmdParm *);
static int set_device_disable(CmdParm *);
static int quitfunc(CmdParm *);
static int helpfunc(CmdParm *);
#if defined(USERCONFIG_BOOT)
#if defined(INTRO_USERCONFIG)
static int introfunc(CmdParm *);
#endif
@ -2501,7 +2574,7 @@ static Cmd CmdList[] = {
{ "ex", quitfunc, NULL }, /* exit (quit) */
{ "f", set_device_flags, int_parms }, /* flags dev mask */
{ "h", helpfunc, NULL }, /* help */
#if defined(USERCONFIG_BOOT)
#if defined(INTRO_USERCONFIG)
{ "intro", introfunc, NULL }, /* intro screen */
#endif
{ "iom", set_device_mem, addr_parms }, /* iomem dev addr */
@ -2530,16 +2603,6 @@ userconfig(void)
int rval;
Cmd *cmd;
printf("\nFreeBSD Kernel Configuration Utility - Version 1.1\n"
" Type \"help\" for help"
#ifdef VISUAL_USERCONFIG
" or \"visual\" to go to the visual\n"
" configuration interface (requires MGA/VGA display or\n"
" serial terminal capable of displaying ANSI graphics)"
#endif
".\n");
while (1) {
printf("config> ");
cngets(input, 80);
@ -2849,7 +2912,6 @@ set_num_eisa_slots(CmdParm *parms)
static int
quitfunc(CmdParm *parms)
{
#ifdef USERCONFIG_BOOT
/*
* If kernel config supplied, and we are parsing it, and -c also supplied,
* ignore a quit command, This provides a safety mechanism to allow
@ -2857,7 +2919,6 @@ quitfunc(CmdParm *parms)
*/
if ((boothowto & RB_CONFIG) && userconfig_boot_parsing)
return 0;
#endif
return 1;
}
@ -2900,7 +2961,7 @@ helpfunc(CmdParm *parms)
return 0;
}
#if defined(USERCONFIG_BOOT)
#if defined(INTRO_USERCONFIG)
#if defined (VISUAL_USERCONFIG)
static void
@ -3035,6 +3096,7 @@ introfunc(CmdParm *parms)
else {
putxy(0, 1, "Type \"help\" for help or \"quit\" to exit.");
move (0, 3);
boothowto |= RB_CONFIG; /* force -c */
return 0;
}
break;
@ -3063,12 +3125,14 @@ lspnp ()
"mem 0x%x 0x%x 0x%x 0x%x";
char buf[256];
if (lineno >= 23) {
printf("<More> ");
if (getchar() == 'q') {
printf("quit\n");
return (1);
if (!userconfig_boot_parsing) {
printf("<More> ");
if (getchar() == 'q') {
printf("quit\n");
return (1);
}
printf("\n");
}
printf("\n");
lineno = 0;
}
if (lineno == 0 || first)
@ -3114,11 +3178,13 @@ lsdevtab(struct isa_device *dt)
if (lineno >= 23) {
printf("<More> ");
if (getchar() == 'q') {
printf("quit\n");
return (1);
if (!userconfig_boot_parsing) {
if (getchar() == 'q') {
printf("quit\n");
return (1);
}
printf("\n");
}
printf("\n");
lineno = 0;
}
if (lineno == 0) {