Kconfig: rename machine to architecture, ident to board.

Make timezone and maxusers parameters optional.

Enable kernel options UCB_METER, EXEC_AOUT, EXEC_ELF and EXEC_SCRIPT
by default.
This commit is contained in:
Serge Vakulenko
2015-09-03 12:51:56 -07:00
parent fc9d89eff2
commit 94c02410e4
18 changed files with 97 additions and 163 deletions

View File

@@ -122,15 +122,14 @@ struct config {
};
/*
* Config has a global notion of which machine type is
* being used.
* Config has a global notion of which architecture is being used.
*/
int machine;
char *machinename;
#define MACHINE_PIC32 1
int arch;
char *archname;
#define ARCH_PIC32 1
/*
* For each machine, a set of CPU's may be specified as supported.
* For each architecture, a set of CPU's may be specified as supported.
* These and the options (below) are put in the C flags in the makefile.
*/
struct cputype {
@@ -149,7 +148,7 @@ struct opt {
struct opt *op_next;
} *opt, *mkopt;
char *ident;
char *board;
char *ldscript;
int do_trace;
@@ -163,6 +162,7 @@ struct file_list *ftab, *conf_list, **confp, *comp_list, **compp;
int zone, hadtz;
int dst;
int hz;
int debugging;
int maxusers;

View File

@@ -7,7 +7,9 @@
%token AND
%token ANY
%token ARCHITECTURE
%token AT
%token BOARD
%token COMMA
%token CONFIG
%token CONTROLLER
@@ -21,9 +23,7 @@
%token EQUALS
%token FLAGS
%token HZ
%token IDENT
%token LDSCRIPT
%token MACHINE
%token MAJOR
%token MASTER
%token MAXUSERS
@@ -139,13 +139,13 @@ Spec:
;
Config_spec:
MACHINE Save_id
ARCHITECTURE Save_id
= {
if (strcmp($2, "pic32") == 0) {
machine = MACHINE_PIC32;
machinename = "pic32";
arch = ARCH_PIC32;
archname = "pic32";
} else
yyerror("Unknown machine type");
yyerror("Unknown architecture");
}
|
CPU Save_id
@@ -162,8 +162,8 @@ Config_spec:
|
MAKEOPTIONS Mkopt_list
|
IDENT ID
= { ident = strdup($2); }
BOARD ID
= { board = strdup($2); }
|
LDSCRIPT ID
= { ldscript = strdup($2); }
@@ -758,9 +758,9 @@ void check_nexus(dev, num)
register struct device *dev;
int num;
{
switch (machine) {
switch (arch) {
case MACHINE_PIC32:
case ARCH_PIC32:
break;
}
}

View File

@@ -18,7 +18,7 @@ A second file tells
.Nm kconfig
what files are needed to generate a kernel and
can be augmented by configuration specific set of files
that give alternate files for a specific machine.
that give alternate files for a specific architecture.
(see the
.Sx FILES
section below)
@@ -39,7 +39,7 @@ and other system parameters for one kernel configuration.
.El
.Pp
.Nm Kconfig
should be run from the machine and board specific
should be run from the architecture and board specific
subdirectory of the system source (like
.Pa sys/pic32/max32 ) .
.Nm Kconfig

View File

@@ -64,9 +64,9 @@ static struct kt key_words[] = {
{ "dumps", DUMPS },
{ "flags", FLAGS },
{ "hz", HZ },
{ "ident", IDENT },
{ "board", BOARD },
{ "ldscript", LDSCRIPT },
{ "machine", MACHINE },
{ "architecture", ARCHITECTURE },
{ "major", MAJOR },
{ "makeoptions", MAKEOPTIONS },
{ "master", MASTER },

View File

@@ -76,14 +76,14 @@ usage: fputs("usage: kconfig [-gp] sysname\n", stderr);
if (yyparse())
exit(3);
switch (machine) {
switch (arch) {
case MACHINE_PIC32:
case ARCH_PIC32:
pic32_ioconf();
break;
default:
printf("Specify machine type, e.g. ``machine pic32''\n");
printf("Specify architecture, e.g. ``architecture pic32''\n");
exit(1);
}
makefile(); /* build Makefile */

View File

@@ -65,7 +65,7 @@ wnum(num)
return (errbuf);
}
#if MACHINE_PIC32
#if ARCH_PIC32
void pic32_ioconf()
{
register struct device *dp, *mp;

View File

@@ -34,7 +34,7 @@
/*
* Build the makefile for the system, from
* the information in the files files and the
* additional files for the machine being compiled to.
* additional files for the architecture being compiled to.
*/
#include <ctype.h>
#include "y.tab.h"
@@ -108,15 +108,6 @@ new_fent()
return (fp);
}
static struct users {
int u_default;
int u_min;
int u_max;
} users[] = {
{ 2, 1, 16 }, /* MACHINE_PIC32 */
};
#define NUSERS (sizeof (users) / sizeof (users[0]))
int opteq(cp, dp)
char *cp, *dp;
{
@@ -164,7 +155,7 @@ next:
if (wd == (char *)EOF) {
(void) fclose(fp);
if (first == 1) {
(void) sprintf(fname, "files.%s", raise(ident));
(void) sprintf(fname, "files.%s", raise(board));
first++;
fp = fopen(fname, "r");
if (fp != 0)
@@ -348,7 +339,7 @@ void do_cfiles(fp)
}
if (eq(fl->f_fn, "generic"))
fprintf(fp, "$A/%s/%s ",
machinename, swapname);
archname, swapname);
else
fprintf(fp, "%s ", swapname);
lpos += len + 1;
@@ -418,12 +409,11 @@ void makefile()
FILE *ifp, *ofp;
char line[BUFSIZ];
struct opt *op;
struct users *up;
struct cputype *cp;
read_files();
strcpy(line, "../Makefile.kconf");
//(void) strcat(line, machinename);
//strcat(line, archname);
ifp = fopen(line, "r");
if (ifp == 0) {
perror(line);
@@ -434,7 +424,7 @@ void makefile()
perror("Makefile");
exit(1);
}
fprintf(ofp, "PARAM = -D%s\n", raise(ident));
fprintf(ofp, "PARAM = -D%s\n", raise(board));
if (cputype == 0) {
printf("cpu type must be specified\n");
exit(1);
@@ -448,25 +438,14 @@ void makefile()
else
fprintf(ofp, "PARAM += -D%s\n", op->op_name);
}
if (hadtz == 0)
printf("timezone not specified; gmt assumed\n");
if ((unsigned)machine > NUSERS) {
printf("maxusers config info isn't present, using pic32\n");
up = &users[MACHINE_PIC32-1];
} else
up = &users[machine-1];
if (maxusers == 0) {
printf("maxusers not specified; %d assumed\n", up->u_default);
maxusers = up->u_default;
} else if (maxusers < up->u_min) {
printf("minimum of %d maxusers assumed\n", up->u_min);
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\n", zone);
fprintf(ofp, "PARAM += -DDST=%d\n", dst);
fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers);
if (hadtz) {
fprintf(ofp, "PARAM += -DTIMEZONE=%d\n", zone);
fprintf(ofp, "PARAM += -DDST=%d\n", dst);
}
if (maxusers > 0)
fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers);
if (hz > 0)
fprintf(ofp, "PARAM += -DHZ=%d\n", hz);
if (ldscript)
fprintf(ofp, "LDSCRIPT = \"%s\"\n", ldscript);
@@ -519,8 +498,7 @@ void do_swapspec(f, name)
if (!eq(name, "generic"))
fprintf(f, "swap%s.o: swap%s.c\n", name, name);
else
fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n",
machinename);
fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n", archname);
fprintf(f, "\t${COMPILE_C}\n\n");
}