Upgrade config to be compatible with our i386 port, pull in 95% of the

changes that have been made in FreeBSD 1.x, except for possibly the nfs
diskless support this is a completed config.
This commit is contained in:
Rodney W. Grimes 1994-05-26 13:24:02 +00:00
parent d4d0967e5b
commit 4eaaddb7ff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=1566
9 changed files with 207 additions and 151 deletions

View File

@ -4,7 +4,7 @@ PROG= config
CFLAGS+=-I. -I${.CURDIR}
SRCS= config.c main.c lang.c mkioconf.c mkmakefile.c mkglue.c mkheaders.c \
mkswapconf.c
MAN8= config.0
MAN8= config.8
DPADD= ${LIBL}
LDADD= -ll
CLEANFILES+=y.tab.h lang.c config.c y.tab.c

View File

@ -39,17 +39,17 @@
.Nd build system configuration files
.Sh SYNOPSIS
.Nm config
.Op Fl p
.Ar system_name
.Op Fl gp
.Ar SYSTEM_NAME
.Sh DESCRIPTION
.Pp
This is the old version of the
.Nm config
program.
It understands the old autoconfiguration scheme
used on the HP300, DECstation, and derivative platforms.
used on the HP300, i386, DECstation, and derivative platforms.
The new version of config is used with the
SPARC and i386 platforms.
SPARC platform.
Only the version of
.Nm config
applicable to the architecture that you are running
@ -73,6 +73,12 @@ section below)
Available option and operand:
.Pp
.Bl -tag -width SYSTEM_NAME
.It Fl g
If the
.Fl g
option is supplied,
.Nm config
will configure a system for debugging.
.It Fl p
If the
.Fl p
@ -92,24 +98,22 @@ and other system parameters for one system configuration.
should be run from the
.Pa conf
subdirectory of the system source (usually
.Pa /sys/conf ) .
.Pa /sys/ARCH/conf ) .
.Nm Config
assumes the directory
.Pa ../SYSTEM_NAME
.Pa ../../compile/SYSTEM_NAME
exists and places all output files there.
The output of
.Nm config
consists of a number of files; for the
.Tn VAX ,
.Tn i386 ,
they are:
.Pa ioconf.c ,
a description
of what I/O devices are attached to the system;
.Pa ubglue.s ,
.Pa vector.h ,
a set of interrupt service routines for devices
attached to the
.Tn UNIBUS ;
.Pa ubvec.s ,
attached to the bus plus
offsets into a structure used for counting per-device interrupts;
.Pa Makefile ,
used by
@ -140,20 +144,20 @@ should be run again.
Attempts to compile a system that had configuration errors
are likely to fail.
.Sh FILES
.Bl -tag -width /sys/conf/Makefile.vax -compact
.It Pa /sys/conf/Makefile.vax
generic makefile for the
.Tn VAX
.Bl -tag -width /sys/i386/conf/Makefile.i386 -compact
.It Pa /sys/conf/files
list of common files system is built from
.It Pa /sys/conf/files.vax
.It Pa /sys/i386/conf/Makefile.i386
generic makefile for the
.Tn i386
.It Pa /sys/i386/conf/files.i386
list of
.Tn VAX
.Tn i386
specific files
.It Pa /sys/conf/devices.vax
.It Pa /sys/i386/conf/devices.i386
name to major device mapping file for the
.Tn VAX
.It Pa /sys/conf/files. Ns Em ERNIE
.Tn i386
.It Pa /sys/i386/conf/files. Ns Em ERNIE
list of files specific to
.Em ERNIE
system

View File

@ -203,10 +203,10 @@ struct file_list *ftab, *conf_list, **confp, *comp_list, **compp;
int zone, hadtz;
int dst;
int hz;
int profiling;
int debugging;
int maxusers;
u_int loadaddress;
#define eq(a,b) (!strcmp(a,b))

View File

@ -191,7 +191,7 @@ Config_spec:
System_spec
|
HZ NUMBER
= { hz = $2; }|
= { yyerror("HZ specification obsolete; delete"); } |
TIMEZONE NUMBER
= { zone = 60 * $2; check_tz(); } |
TIMEZONE NUMBER DST NUMBER
@ -235,12 +235,18 @@ System_parameter_list:
;
System_parameter:
swap_spec
addr_spec
| swap_spec
| root_spec
| dump_spec
| arg_spec
;
addr_spec:
AT NUMBER
= { loadaddress = $2; };
;
swap_spec:
SWAP optional_on swap_device_list
;

View File

@ -101,6 +101,7 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
exit(2);
}
loadaddress = -1;
dtab = NULL;
confp = &conf_list;
compp = &comp_list;

View File

@ -338,31 +338,24 @@ vector() {
register struct device *dp, *mp;
int count;
fp = fopen(path("vector.s"), "w");
fp = fopen(path("vector.h"), "w");
if (fp == 0) {
perror(path("vector.s"));
perror(path("vector.h"));
exit(1);
}
fprintf(fp,"\
fprintf(fp, "\
/*\n\
* AT/386\n\
* Interrupt vector routines\n\
* Macros for interrupt vector routines\n\
* Generated by config program\n\
*/ \n\
\n\
#include \"i386/isa/isa.h\"\n\
#include \"i386/isa/icu.h\"\n\
\n\
#define VEC(name) .align 4; .globl _V/**/name; _V/**/name:\n\n");
*/\n\
\n");
fprintf(fp,"\
.globl _hardclock\n\
VEC(clk)\n\
INTR1(0, _highmask, 0)\n\
call _hardclock \n\
INTREXIT1\n\n\n");
fprintf(fp, "\
#define BUILD_VECTORS \\\n\
BUILD_VECTOR(clk, 0,0,0, _high_imask, _clkintr,1,1, al);\\\n");
count=0;
count=1;
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (mp != 0 && /* mp != (struct device *)-1 &&*/
@ -372,29 +365,36 @@ VEC(clk)\n\
for (id = dp->d_vec; id; id = id->id_next) {
for (id2 = dp->d_vec; id2; id2 = id2->id_next) {
if (id2 == id) {
if(dp->d_irq == -1) continue;
fprintf(fp,"\t.globl _%s, _%s%dmask\n\t.data\n",
id->id, dp->d_name, dp->d_unit);
fprintf(fp,"_%s%dmask:\t.long 0\n\t.text\n",
dp->d_name, dp->d_unit);
fprintf(fp,"VEC(%s%d)\n\tINTR%d(%d, ",
dp->d_name, dp->d_unit,
dp->d_irq / 8 + 1, dp->d_unit);
if(eq(dp->d_mask,"null"))
fprintf(fp,"_%s%dmask, ",
dp->d_name, dp->d_unit);
else
fprintf(fp,"_%smask, ",
dp->d_mask);
fprintf(fp,"%d)\n\tcall\t_%s\n\tINTREXIT%d\n\n\n",
++count, id->id, (dp->d_irq > 7)?2:1);
break;
build_vector(fp, dp, id, count);
count++;
if (!strcmp(id->id, id2->id))
break;
}
if (!strcmp(id->id, id2->id))
break;
}
}
}
}
fprintf(fp, "\n\n#define NR_REAL_INT_HANDLERS %d\n", count);
(void) fclose(fp);
}
build_vector(fp, dp, id, offset)
register FILE *fp;
register struct device *dp;
struct idlst *id;
int offset;
{
fprintf(fp, "\tBUILD_%sVECTOR(%s%d, %d,%d,%d",
strcmp(dp->d_name, "sio") == 0 ? "FAST_" : "",
dp->d_name, dp->d_unit, dp->d_unit, dp->d_irq, offset);
if (eq(dp->d_mask, "null"))
fprintf(fp, ", _%s%d_imask,", dp->d_name, dp->d_unit);
else
fprintf(fp, ", _%s_imask, ", dp->d_mask);
fprintf(fp, " _%s,%d,1", id->id, 1 + dp->d_irq / 8);
if (dp->d_irq < 8)
fprintf(fp, ", al");
else
fprintf(fp, "_AND_2, ah");
fprintf(fp, ");\\\n");
}

View File

@ -599,6 +599,7 @@ hpbadslave(mp, dp)
#endif
#if MACHINE_I386
char *shandler();
char *sirq();
i386_ioconf()
@ -619,14 +620,14 @@ i386_ioconf()
fprintf(fp, "#include \"machine/pte.h\"\n");
fprintf(fp, "#include \"sys/param.h\"\n");
fprintf(fp, "#include \"sys/buf.h\"\n");
fprintf(fp, "#include \"sys/map.h\"\n");
fprintf(fp, "\n");
fprintf(fp, "#define V(s) __CONCAT(V,s)\n");
fprintf(fp, "#define V(s)\t__CONCAT(V,s)\n");
fprintf(fp, "#define C (caddr_t)\n\n");
/*
* First print the isa initialization structures
*/
if (seen_isa) {
int seen_wdc = 0, seen_fdc = 0;
fprintf(fp, "/*\n");
fprintf(fp, " * ISA devices\n");
@ -640,90 +641,109 @@ i386_ioconf()
if (mp == 0 || mp == TO_NEXUS ||
!eq(mp->d_name, "isa"))
continue;
fprintf(fp,
"extern struct isa_driver %sdriver; extern V(%s%d)();\n",
dp->d_name, dp->d_name, dp->d_unit);
fprintf(fp, "extern struct isa_driver %3.3sdriver;",
dp->d_name);
if(eq(dp->d_name, "wdc")) seen_wdc++;
if(eq(dp->d_name, "fdc")) seen_fdc++;
if (dp->d_irq == 2)
{
fprintf(stderr, "remapped irq 2 to irq 9, please update your config file\n");
dp->d_irq = 9;
}
if (dp->d_irq != -1)
fprintf(fp, " extern void %s();", shandler(dp));
fprintf(fp, "\n");
}
fprintf(fp, "\nstruct isa_device isa_devtab_bio[] = {\n");
fprintf(fp, "\
/* driver iobase irq drq maddr msiz intr unit */\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (dp->d_unit == QUES || mp == 0 ||
mp == TO_NEXUS || !eq(mp->d_name, "isa"))
continue;
if (!eq(dp->d_mask, "bio")) continue;
if (dp->d_port)
fprintf(fp, "{ &%sdriver, %8.8s,", dp->d_name, dp->d_port);
else
fprintf(fp, "{ &%sdriver, 0x%03x,", dp->d_name, dp->d_portn);
fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d, V(%s%d), %2d },\n",
sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
}
fprintf(fp, "0\n};\n");
fprintf(fp, "struct isa_device isa_devtab_tty[] = {\n");
fprintf(fp, "\
/* driver iobase irq drq maddr msiz intr unit */\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (dp->d_unit == QUES || mp == 0 ||
mp == TO_NEXUS || !eq(mp->d_name, "isa"))
continue;
if (!eq(dp->d_mask, "tty")) continue;
if (dp->d_port)
fprintf(fp, "{ &%sdriver, %8.8s,", dp->d_name, dp->d_port);
else
fprintf(fp, "{ &%sdriver, 0x%03x,", dp->d_name, dp->d_portn);
fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d, V(%s%d), %2d },\n",
sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
}
fprintf(fp, "0\n};\n\n");
fprintf(fp, "struct isa_device isa_devtab_net[] = {\n");
fprintf(fp, "\
/* driver iobase irq drq maddr msiz intr unit */\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (dp->d_unit == QUES || mp == 0 ||
mp == TO_NEXUS || !eq(mp->d_name, "isa"))
continue;
if (!eq(dp->d_mask, "net")) continue;
if (dp->d_port)
fprintf(fp, "{ &%sdriver, %8.8s,", dp->d_name, dp->d_port);
else
fprintf(fp, "{ &%sdriver, 0x%03x,", dp->d_name, dp->d_portn);
fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d, V(%s%d), %2d },\n",
sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
}
fprintf(fp, "0\n};\n\n");
fprintf(fp, "struct isa_device isa_devtab_null[] = {\n");
fprintf(fp, "\
/* driver iobase irq drq maddr msiz intr unit */\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (dp->d_unit == QUES || mp == 0 ||
mp == TO_NEXUS || !eq(mp->d_name, "isa"))
continue;
if (!eq(dp->d_mask, "null")) continue;
if (dp->d_port)
fprintf(fp, "{ &%sdriver, %8.8s,", dp->d_name, dp->d_port);
else
fprintf(fp, "{ &%sdriver, 0x%03x,", dp->d_name, dp->d_portn);
fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d, V(%s%d), %2d },\n",
sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
}
fprintf(fp, "0\n};\n\n");
isa_devtab(fp, "bio");
if(seen_wdc)
isa_biotab(fp, "wdc");
if(seen_fdc)
isa_biotab(fp, "fdc");
isa_devtab(fp, "tty");
isa_devtab(fp, "net");
isa_devtab(fp, "null");
}
pseudo_ioconf(fp);
/* XXX David did this differently!!! */
/* pseudo_ioconf(fp); */
(void) fclose(fp);
}
isa_biotab(fp, table)
FILE *fp;
char *table;
{
register struct device *dp, *mp;
fprintf(fp, "\n\nstruct isa_device isa_biotab_%s[] = {\n", table);
fprintf(fp, "\
/* driver iobase irq drq maddr msiz intr unit flags drive*/\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (dp->d_unit == QUES || mp == 0 ||
mp == TO_NEXUS || !eq(mp->d_name, table))
continue;
fprintf(fp, "{ &%3.3sdriver, %8.8s,",
mp->d_name, mp->d_port);
fprintf(fp, "%6.6s, %2d, C 0x%05X, %5d, %8.8s, %2d, 0x%04X, %2d },\n",
sirq(mp->d_irq), mp->d_drq, mp->d_maddr,
mp->d_msize, shandler(mp), dp->d_unit,
dp->d_flags, dp->d_drive);
}
fprintf(fp, "0\n};\n");
}
/*
* Generized routine for isa bus device table, instead of repeating
* all this 4 times, call this with the table argument.
*
* 4/26/93 rgrimes
*/
isa_devtab(fp, table)
FILE *fp;
char *table;
{
register struct device *dp, *mp;
fprintf(fp, "\n\nstruct isa_device isa_devtab_%s[] = {\n", table);
fprintf(fp, "\
/* driver iobase irq drq maddr msiz intr unit flags */\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (dp->d_unit == QUES || mp == 0 ||
mp == TO_NEXUS || !eq(mp->d_name, "isa"))
continue;
if (strcmp(dp->d_mask, table)) continue;
if (dp->d_port)
fprintf(fp, "{ &%3.3sdriver, %8.8s,",
dp->d_name, dp->d_port);
else
fprintf(fp, "{ &%3.3sdriver, 0x%04x,",
dp->d_name, dp->d_portn);
fprintf(fp, "%6.6s, %2d, C 0x%05X, %5d, %8.8s, %2d, 0x%04X },\n",
sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
dp->d_msize, shandler(dp), dp->d_unit,
dp->d_flags);
}
fprintf(fp, "0\n};\n");
}
/*
* XXX - there should be a general function to print devtabs instead of these
* little pieces of it.
*/
char *
shandler(dp)
register struct device *dp;
{
static char buf[32 + 20];
if (dp->d_irq == -1)
return ("NULL");
sprintf(buf, "V(%.32s%d)", dp->d_name, dp->d_unit);
return (buf);
}
char *
sirq(num)
{

View File

@ -153,6 +153,7 @@ makefile()
perror(path("Makefile"));
exit(1);
}
fprintf(ofp, "KERN_IDENT=%s\n", raise(ident));
fprintf(ofp, "IDENT=-D%s", raise(ident));
if (profiling)
fprintf(ofp, " -DGPROF");
@ -185,11 +186,11 @@ makefile()
maxusers = up->u_min;
} else if (maxusers > up->u_max)
printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers);
fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d",
fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d\n",
zone, dst, maxusers);
if (hz > 0)
fprintf(ofp, " -DHZ=%d", hz);
fprintf(ofp, "\n");
if (loadaddress != -1) {
fprintf(ofp, "LOAD_ADDRESS=%X\n", loadaddress);
}
for (op = mkopt; op; op = op->op_next)
fprintf(ofp, "%s=%s\n", op->op_name, op->op_value);
if (debugging)
@ -241,6 +242,10 @@ read_files()
perror(fname);
exit(1);
}
if(ident == NULL) {
printf("no ident line specified\n");
exit(1);
}
next:
/*
* filename [ standard | optional ] [ config-dependent ]
@ -266,6 +271,15 @@ read_files()
}
if (wd == 0)
goto next;
/*************************************************\
* If it's a comment ignore to the end of the line *
\*************************************************/
if(wd[0] == '#')
{
while( ((wd = get_word(fp)) != (char *)EOF) && wd)
;
goto next;
}
this = ns(wd);
next_word(fp, wd);
if (wd == 0) {
@ -584,7 +598,7 @@ do_systemspec(f, fl, first)
fprintf(f, "%s: ${SYSTEM_DEP} swap%s.o", fl->f_needs, fl->f_fn);
if (first)
fprintf(f, " newvers");
fprintf(f, " vers.o");
fprintf(f, "\n\t${SYSTEM_LD_HEAD}\n");
fprintf(f, "\t${SYSTEM_LD} swap%s.o\n", fl->f_fn);
fprintf(f, "\t${SYSTEM_LD_TAIL}\n\n");

View File

@ -193,6 +193,7 @@ devtoname(dev)
initdevtable()
{
char linebuf[256];
char buf[BUFSIZ];
int maj;
register struct devdescription **dp = &devtable;
@ -204,11 +205,21 @@ initdevtable()
fprintf(stderr, "config: can't open %s\n", buf);
exit(1);
}
while (fscanf(fp, "%s\t%d\n", buf, &maj) == 2) {
*dp = (struct devdescription *)malloc(sizeof (**dp));
(*dp)->dev_name = ns(buf);
(*dp)->dev_major = maj;
dp = &(*dp)->dev_next;
while(fgets(linebuf,256,fp)) {
/*******************************\
* Allow a comment *
\*******************************/
if(linebuf[0] == '#') continue;
if (sscanf(linebuf, "%s\t%d\n", buf, &maj) == 2) {
*dp = (struct devdescription *)malloc(sizeof (**dp));
(*dp)->dev_name = ns(buf);
(*dp)->dev_major = maj;
dp = &(*dp)->dev_next;
} else {
fprintf(stderr,"illegal line in devices file\n");
break;
}
}
*dp = 0;
fclose(fp);