Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 567 → Rev 568

/kernel/trunk/tools/config.py
230,23 → 230,42
defaults[res.group(1)] = res.group(2)
f.close()
 
def check_condition(text, defaults):
result = True
conds = text.split('&')
def check_condition(text, defaults, asked_names):
seen_vars = [ x[0] for x in asked_names ]
ctype = 'cnf'
if ')|' in text or '|(' in text:
ctype = 'dnf'
if ctype == 'cnf':
conds = text.split('&')
else:
conds = text.split('|')
 
for cond in conds:
if cond.startswith('(') and cond.endswith(')'):
cond = cond[1:-1]
if not check_dnf(cond, defaults):
inside = check_inside(cond, defaults, ctype, seen_vars)
if ctype == 'cnf' and not inside:
return False
return True
if ctype == 'dnf' and inside:
return True
 
def check_dnf(text, defaults):
if ctype == 'cnf':
return True
return False
 
def check_inside(text, defaults, ctype, seen_vars):
"""
Check that the condition specified on input line is True
 
only CNF is supported
"""
conds = text.split('|')
if ctype == 'cnf':
conds = text.split('|')
else:
conds = text.split('&')
for cond in conds:
res = re.match(r'^(.*?)(!?=)(.*)$', cond)
if not res:
254,15 → 273,27
condname = res.group(1)
oper = res.group(2)
condval = res.group(3)
if condname not in seen_vars:
raise RuntimeError("Variable %s not defined before being asked." %\
condname)
if not defaults.has_key(condname):
raise RuntimeError("Condition var %s does not exist: %s" % \
(condname,text))
 
if oper=='=' and condval == defaults[condname]:
return True
if oper == '!=' and condval != defaults[condname]:
return True
return False
if ctype == 'cnf':
if oper == '=' and condval == defaults[condname]:
return True
if oper == '!=' and condval != defaults[condname]:
return True
else:
if oper== '=' and condval != defaults[condname]:
return False
if oper== '!=' and condval == defaults[condname]:
print 2
return False
if ctype=='cnf':
return False
return True
 
def parse_config(input, output, dlg, defaults={}, askonly=None):
"Parse configuration file and create Makefile.config on the fly"
304,7 → 335,8
if not res:
raise RuntimeError('Invalid command: %s' % line)
if res.group(1):
if not check_condition(res.group(1), defaults):
if not check_condition(res.group(1), defaults,
asked_names):
continue
args = res.group(2).strip().split(' ')
cmd = args[0].lower()
334,7 → 366,8
default = defaults.get(varname,None)
if res.group(1):
if not check_condition(res.group(1), defaults):
if not check_condition(res.group(1), defaults,
asked_names):
if default is not None:
outf.write('#!# %s = %s\n' % (varname, default))
# Clear cumulated values
365,7 → 398,8
if not res:
raise RuntimeError("Bad line: %s" % line)
if res.group(1):
if not check_condition(res.group(1),defaults):
if not check_condition(res.group(1),defaults,
asked_names):
continue
choices.append((res.group(2), res.group(3)))
continue
433,7 → 467,7
os.rename(TMPOUTPUT, OUTPUT)
if not defmode and dlg.yesno('Rebuild kernel?') == 'y':
os.execlp('make','make','clean','all')
os.execlp('make','make','clean','build')
 
if __name__ == '__main__':
main()
/kernel/trunk/kernel.config
36,18 → 36,8
@ "prescott" Prescott
! [ARCH=ia32] IA32_CPU (choice)
 
# Support for SMP
! CONFIG_SMP (y/n)
 
# Improved support for hyperthreading
! [(ARCH=ia32|ARCH=amd64)&CONFIG_SMP=y] CONFIG_HT (y/n)
 
# Lazy FPU context switching
! CONFIG_FPU_LAZY (y/n)
 
# MIPS Machine Type
@ "msim" MSIM Simulator
@ "msim4kc" MSIM Simulator with 4kc instruction set
@ "simics" Virtutech Simics simulator
@ "lgxemul" GXEmul Little Endian
@ "bgxemul" GXEmul Big Endian
54,6 → 44,15
@ "indy" SGI Indy
! [ARCH=mips32] MIPS_MACHINE (choice)
 
# Support for SMP
! [ARCH=ia32|ARCH=amd64] CONFIG_SMP (y/n)
 
# Improved support for hyperthreading
! [(ARCH=ia32|ARCH=amd64)&CONFIG_SMP=y] CONFIG_HT (y/n)
 
# Lazy FPU context switching
! [(ARCH=mips32&MIPS_MACHINE!=msim)|ARCH=amd64|ARCH=ia32] CONFIG_FPU_LAZY (y/n)
 
## Debugging configuration directives
 
# General debuging and assert checking
78,7 → 77,7
@ "synch/semaphore2" Sempahore test 2
@ [ARCH=ia32|ARCH=amd64] "fpu/fpu1" Intel fpu test 1
@ [ARCH=ia32|ARCH=amd64] "fpu/sse1" Intel Sse test 1
@ [ARCH=mips32&MIPS_MACHINE!=msim&MIPS_MACHINE!=msim4kc] "fpu/mips1" Mips FPU test 1
@ [ARCH=mips32&MIPS_MACHINE!=msim] "fpu/mips1" Mips FPU test 1
@ "print/print1" Printf test 1
@ "thread/trhead1" Thread test 1
@ "mm/mapping1" Mapping test 1
/kernel/trunk/Makefile
72,6 → 72,9
ifeq ($(CONFIG_USERSPACE),y)
DEFS += -DCONFIG_USERSPACE
endif
ifeq ($(CONFIG_FPU_LAZY),y)
DEFS += -DCONFIG_FPU_LAZY
endif
 
## Toolchain configuration
#
/kernel/trunk/arch/amd64/Makefile.inc
67,9 → 67,6
ifeq ($(CONFIG_HT),y)
DEFS += -DCONFIG_HT
endif
ifeq ($(CONFIG_FPU_LAZY),y)
DEFS += -DCONFIG_FPU_LAZY
endif
 
ARCH_SOURCES = \
arch/$(ARCH)/src/dummy.s \
/kernel/trunk/arch/mips32/Makefile.inc
73,14 → 73,6
TOOLCHAIN_DIR = /usr/local/mips/bin
CFLAGS += -EB -DBIG_ENDIAN -DHAVE_FPU -mips3
endif
ifeq ($(MIPS_MACHINE),msim4kc)
# MSIM needs lwl/swl patch & 4kc instruction patch to work
# otherwise add -mmemcpy -mips3
BFD_NAME = elf32-tradlittlemips
BFD = binary
CFLAGS += -mhard-float -march=4kc
endif
ifeq ($(MIPS_MACHINE),simics)
# SIMICS 4kc emulation is broken, although for instructions
# that do not bother us
95,13 → 87,7
CFLAGS += -mhard-float -mips3
endif
 
## Accepted configuration directives
#
 
ifeq ($(CONFIG_FPU_LAZY),y)
DEFS += -DCONFIG_FPU_LAZY
endif
 
ARCH_SOURCES = \
arch/$(ARCH)/src/start.S \
arch/$(ARCH)/src/context.S \
/kernel/trunk/arch/ia32/Makefile.inc
86,9 → 86,6
ifeq ($(CONFIG_HT),y)
DEFS += -DCONFIG_HT
endif
ifeq ($(CONFIG_FPU_LAZY),y)
DEFS += -DCONFIG_FPU_LAZY
endif
 
ARCH_SOURCES = \
arch/$(ARCH)/src/context.s \