Changeset 9371c30 in mainline


Ignore:
Timestamp:
2005-12-06T20:53:03Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
36e7b6c3
Parents:
090e7ea1
Message:

Completely reworked configuration system.

Files:
5 deleted
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Makefile

    r090e7ea1 r9371c30  
    3737RELEASE = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
    3838
    39 ## Make some default assumptions
     39## Include configuration
    4040#
    4141
    42 ifndef ARCH
    43         ARCH = ia32
    44 endif
     42include Makefile.config
    4543
    4644## Common compiler flags
     
    5957#
    6058
    61 include Makefile.config
    6259include arch/$(ARCH)/Makefile.inc
    6360include genarch/Makefile.inc
  • arch/ia32/Makefile.inc

    r090e7ea1 r9371c30  
    3939#
    4040
    41 ifndef CPU
    42         CPU = pentium4
     41ifndef IA32_CPU
     42        IA32_CPU = pentium4
    4343endif
    4444
    45 DEFS += -D_CPU=${CPU}
     45DEFS += -D_CPU=${IA32_CPU}
    4646
    4747## Accepted CPUs
    4848#
    4949
    50 ifeq ($(CPU),athlon-xp)
     50ifeq ($(IA32_CPU),athlon-xp)
    5151        CFLAGS += -march=athlon-xp -mmmx -msse -m3dnow
    5252        DEFS += -DCONFIG_FENCES_P3
     
    5454        CONFIG_HT = n
    5555endif
    56 ifeq ($(CPU),athlon-mp)
     56ifeq ($(IA32_CPU),athlon-mp)
    5757        CFLAGS += -march=athlon-mp -mmmx -msse -m3dnow
    5858        DEFS += -DCONFIG_FENCES_P3
    5959        CONFIG_HT = n
    6060endif
    61 ifeq ($(CPU),pentium3)
     61ifeq ($(IA32_CPU),pentium3)
    6262        CFLAGS += -march=pentium3 -mmmx -msse
    6363        DEFS += -DCONFIG_FENCES_P3
    6464        CONFIG_HT = n
    6565endif
    66 ifeq ($(CPU),prescott)
     66ifeq ($(IA32_CPU),prescott)
    6767        CFLAGS += -march=pentium4 -mfpmath=sse -mmmx -msse -msse2 -msse3
    6868        DEFS += -DCONFIG_FENCES_P4
    6969endif
    70 ifeq ($(CPU),pentium4)
     70ifeq ($(IA32_CPU),pentium4)
    7171        CFLAGS += -march=pentium4 -mfpmath=sse -mmmx -msse -msse2
    7272        DEFS += -DCONFIG_FENCES_P4
  • arch/mips32/Makefile.inc

    r090e7ea1 r9371c30  
    3737#
    3838
    39 ifndef MACHINE
    40         MACHINE = msim
     39ifndef MIPS_MACHINE
     40        MIPS_MACHINE = msim
    4141endif
    4242
     
    4545INIT_SIZE = 65536
    4646CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss
    47 DEFS += -DMACHINE=${MACHINE} -DKERNEL_LOAD_ADDRESS=${KERNEL_LOAD_ADDRESS} -DINIT_ADDRESS=${INIT_ADDRESS} -DINIT_SIZE=${INIT_SIZE}
     47DEFS += -DMACHINE=${MIPS_MACHINE} -DKERNEL_LOAD_ADDRESS=${KERNEL_LOAD_ADDRESS} -DINIT_ADDRESS=${INIT_ADDRESS} -DINIT_SIZE=${INIT_SIZE}
    4848
    4949## Accepted MACHINEs
    5050#
    5151
    52 ifeq ($(MACHINE),indy)
     52ifeq ($(MIPS_MACHINE),indy)
    5353        # GCC 4.0.1 compiled for mipsEL has problems compiling in
    5454        # BigEndian mode with the swl/swr/lwl/lwr instructions.
     
    6262        CFLAGS += -EB -DBIG_ENDIAN -DHAVE_FPU -march=r4600
    6363endif
    64 ifeq ($(MACHINE),lgxemul)
     64ifeq ($(MIPS_MACHINE),lgxemul)
    6565        BFD_NAME=elf32-tradlittlemips
    6666        BFD = ecoff-littlemips
    6767        CFLAGS += -DHAVE_FPU -mips3
    6868endif
    69 ifeq ($(MACHINE),bgxemul)
     69ifeq ($(MIPS_MACHINE),bgxemul)
    7070        BFD_NAME=elf32-bigmips
    7171        BFD = ecoff-bigmips
     
    7474        CFLAGS += -EB -DBIG_ENDIAN -DHAVE_FPU -mips3
    7575endif
    76 ifeq ($(MACHINE),msim4kc)
     76ifeq ($(MIPS_MACHINE),msim4kc)
    7777        # MSIM needs lwl/swl patch & 4kc instruction patch to work
    7878        # otherwise add -mmemcpy -mips3
     
    8282        CFLAGS += -mhard-float -march=4kc
    8383endif
    84 ifeq ($(MACHINE),simics)
     84ifeq ($(MIPS_MACHINE),simics)
    8585        # SIMICS 4kc emulation is broken, although for instructions
    8686        # that do not bother us
     
    9090        CFLAGS += -mhard-float -mips3
    9191endif
    92 ifeq ($(MACHINE),msim)
     92ifeq ($(MIPS_MACHINE),msim)
    9393        BFD_NAME = elf32-tradlittlemips
    9494        BFD = binary
    9595        CFLAGS += -mhard-float -mips3
    9696endif
    97 
    98 ## Own configuration directives
    99 #
    100 
    101 CONFIG_OFW = y
    10297
    10398## Accepted configuration directives
  • kernel.config

    r090e7ea1 r9371c30  
    11## General configuration directives
     2
     3# Architecture
     4@ "ia32" Intel IA32
     5@ "amd64" Intel ET64/AMD64
     6@ "ia64" Intel IA64
     7@ "mips32" MIPS 32-bit
     8@ "ppc32" PowerPC 32-bit
     9@ "sparc64" Sun UltraSparc 64-bit
     10! ARCH (choice)
     11
     12%ASKDEFAULT
     13
     14# IA32 Compiler
     15@ "cross" Cross-compiler
     16@ "native" Native
     17! [ARCH=ia32] IA32_COMPILER (choice)
     18% [ARCH=ia32] SAVEAS IA32_COMPILER COMPILER
     19
     20# AMD64 Compiler
     21@ "cross" Cross-compiler
     22@ "native" Native
     23! [ARCH=amd64] AMD64_COMPILER (choice)
     24% [ARCH=amd64] SAVEAS AMD64_COMPILER COMPILER
     25
     26# Compiler
     27@ "cross" Cross-compiler
     28@ "native" Native
     29! [(ARCH!=amd64)&(ARCH!=ia32)] OTHER_COMPILER (choice)
     30% [(ARCH!=amd64)&(ARCH!=ia32)] SAVEAS OTHER_COMPILER COMPILER
     31
     32
     33# CPU type
     34@ "pentium4" Pentium 4
     35@ "pentium3" Pentium 3
     36@ "athlon-xp" Athlon XP
     37@ "athlon-mp" Athlon MP
     38@ "prescott" Prescott
     39! [ARCH=ia32] IA32_CPU (choice)
    240
    341# Support for SMP
     
    543
    644# Improved support for hyperthreading
    7 ! [ARCH=ia32|ARCH=amd64] CONFIG_HT (y/n)
     45! [(ARCH=ia32|ARCH=amd64)&CONFIG_SMP=y] CONFIG_HT (y/n)
    846
    947# Lazy FPU context switching
    1048! CONFIG_FPU_LAZY (y/n)
     49
     50# MIPS Machine Type
     51@ "msim" MSIM Simulator
     52@ "msim4kc" MSIM Simulator with 4kc instruction set
     53@ "simics" Virtutech Simics simulator
     54@ "lgxemul" GXEmul Little Endian
     55@ "bgxemul" GXEmul Big Endian
     56@ "indy" SGI Indy
     57! [ARCH=mips32] MIPS_MACHINE (choice)
    1158
    1259## Debugging configuration directives
  • tools/build

    r090e7ea1 r9371c30  
    33function syntax {
    44        echo "Syntax:"
    5         echo " build.<arch> [-compiler <compiler>] [-cpu <cpu>] [-machine <machine>]"
    6         echo
    7         echo "<arch>     ... amd64, ia32, ia64, mips32, ppc32, sparc64"
    8         echo "<compiler> ... native, *cross"
    9         echo "<cpu>      ... for ia32: athlon-xp, athlon-mp, pentium3, *pentium4, prescott"
    10         echo "<machine>  ... for mips32: *msim, msim4kc, simics, lgxemul, bgxemul, indy"
     5        echo " build "
    116        echo
    127}
    13 
    14 ARCH="`basename "$0" | awk -F. '{ if (NF > 1) print \$NF }'`"
    15 if [ -z "$ARCH" ]; then
    16         syntax
    17         exit 1
    18 fi
    198
    209ARGS=""
    2110while [ "$#" -gt 0 ]; do
    2211        case "$1" in
    23                 -compiler)
    24                         if [ -z "$2" ]; then
    25                                 syntax
    26                                 exit 1
    27                         fi
    28                         ARGS="$ARGS COMPILER=$2"
    29                         shift
    30                         ;;
    31                 -cpu)
    32                         if [ -z "$2" ]; then
    33                                 syntax
    34                                 exit 1
    35                         fi
    36                         ARGS="$ARGS CPU=$2"
    37                         shift
    38                         ;;
    39                 -machine)
    40                         if [ -z "$2" ]; then
    41                                 syntax
    42                                 exit 1
    43                         fi
    44                         ARGS="$ARGS MACHINE=$2"
    45                         shift
    46                         ;;
    4712                *)
    4813                        syntax
     
    6126fi
    6227
    63 tools/config.py $ARCH default
    64 make all "ARCH=$ARCH" "TAG=$TAG" $ARGS
     28tools/config.py default
     29make all "TAG=$TAG" $ARGS
  • tools/config.py

    r090e7ea1 r9371c30  
    187187
    188188def check_condition(text, defaults):
    189     "Check that the condition specified on input line is True"
    190     result = False
     189    result = True
     190    conds = text.split('&')
     191    for cond in conds:
     192        if cond.startswith('(') and cond.endswith(')'):
     193            cond = cond[1:-1]
     194        if not check_dnf(cond, defaults):
     195            return False
     196    return True
     197
     198def check_dnf(text, defaults):
     199    """
     200    Check that the condition specified on input line is True
     201
     202    only CNF is supported
     203    """
    191204    conds = text.split('|')
    192205    for cond in conds:
    193         condname,condval = cond.split('=')
     206        res = re.match(r'^(.*?)(!?=)(.*)$', cond)
     207        if not res:
     208            raise RuntimeError("Invalid condition: %s" % cond)
     209        condname = res.group(1)
     210        oper = res.group(2)
     211        condval = res.group(3)
    194212        if not defaults.has_key(condname):
    195213            raise RuntimeError("Condition var %s does not exist: %s" % \
    196                                (condname,line))
    197         # None means wildcard
    198         if defaults[condname] is None:
     214                               (condname,text))
     215
     216        if oper=='=' and  condval == defaults[condname]:
    199217            return True
    200         if  condval == defaults[condname]:
     218        if oper == '!=' and condval != defaults[condname]:
    201219            return True
    202220    return False
     
    214232    default = None
    215233    choices = []
    216     for line in f:       
     234    for line in f:
     235        if line.startswith('%'):
     236            res = re.match(r'^%\s*(?:\[(.*?)\])?\s*(.*)$', line)
     237            if not res:
     238                raise RuntimeError('Invalid command: %s' % line)
     239            if res.group(1):
     240                if not check_condition(res.group(1), defaults):
     241                    continue
     242            args = res.group(2).strip().split(' ')
     243            cmd = args[0].lower()
     244            args = args[1:]
     245            if cmd == 'askdefault':
     246                if isinstance(dlg, DefaultDialog):
     247                    continue
     248                res = dlg.noyes('Change kernel configuration')
     249                if res == 'n':
     250                    dlg = DefaultDialog(dlg)
     251            elif cmd == 'saveas':
     252                outf.write('%s = %s\n' % (args[1],defaults[args[0]]))
     253               
     254            continue
     255           
    217256        if line.startswith('!'):
    218257            # Ask a question
     
    229268                    if default is not None:
    230269                        outf.write('#!# %s = %s\n' % (varname, default))
     270                    # Clear cumulated values
     271                    comment = ''
     272                    default = None
     273                    choices = []
    231274                    continue
    232275
     
    278321
    279322def main():
    280     defaults = {'ARCH':None}
     323    defaults = {}
    281324    try:
    282325        dlg = Dialog()
     
    286329    # Default run will update the configuration file
    287330    # with newest options
    288     if len(sys.argv) >= 2:
    289         defaults['ARCH'] = sys.argv[1]
    290     if len(sys.argv) == 3 and sys.argv[2]=='default':
     331    if len(sys.argv) == 2 and sys.argv[1]=='default':
    291332        dlg = DefaultDialog(dlg)
    292333
Note: See TracChangeset for help on using the changeset viewer.