- Update to the latest config.g
- Everything except if statements should work correctly git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1367 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
06feb88cc6
commit
b8a7578a12
|
@ -16,6 +16,7 @@ global_options = {}
|
||||||
global_options_by_order = []
|
global_options_by_order = []
|
||||||
global_option_values = {}
|
global_option_values = {}
|
||||||
global_uses_options = {}
|
global_uses_options = {}
|
||||||
|
global_exported_options = []
|
||||||
romimages = {}
|
romimages = {}
|
||||||
buildroms = []
|
buildroms = []
|
||||||
curimage = 0
|
curimage = 0
|
||||||
|
@ -249,9 +250,12 @@ class romimage:
|
||||||
# name of target directory specified by 'target' directive
|
# name of target directory specified by 'target' directive
|
||||||
self.target_dir = ''
|
self.target_dir = ''
|
||||||
|
|
||||||
# option values set in rom image
|
# option values used in rom image
|
||||||
self.values = {}
|
self.values = {}
|
||||||
|
|
||||||
|
# exported options
|
||||||
|
self.exported_options = []
|
||||||
|
|
||||||
def getname(self):
|
def getname(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
@ -481,53 +485,13 @@ class option:
|
||||||
def __init__ (self, name):
|
def __init__ (self, name):
|
||||||
self.name = name # name of option
|
self.name = name # name of option
|
||||||
self.loc = 0 # current location
|
self.loc = 0 # current location
|
||||||
self.set = 0 # option has been set
|
self.used = 0 # option has been used
|
||||||
self.used = 0 # option has been set
|
|
||||||
self.default = 0 # option has default value (otherwise
|
|
||||||
# it is undefined)
|
# it is undefined)
|
||||||
self.comment = '' # description of option
|
self.comment = '' # description of option
|
||||||
self.exportable = 0 # option is able to be exported
|
self.exportable = 0 # option is able to be exported
|
||||||
self.exported = 0 # option is exported
|
|
||||||
self.defined = 0 # option has a value
|
|
||||||
self.format = '%s' # option print format
|
self.format = '%s' # option print format
|
||||||
self.write = [] # parts that can set this option
|
self.write = [] # parts that can set this option
|
||||||
|
|
||||||
def setvalue(self, value, values, loc):
|
|
||||||
self.set = 1
|
|
||||||
self.defined = 1
|
|
||||||
self.loc = loc
|
|
||||||
#self.value = value
|
|
||||||
setdict(values, self.name, value)
|
|
||||||
|
|
||||||
def getvalue(self, image, values):
|
|
||||||
global curimage
|
|
||||||
v = getdict(values, self.name)
|
|
||||||
if (v == 0):
|
|
||||||
return 0
|
|
||||||
val = v.contents()
|
|
||||||
if (not (type(val) is types.StringType)):
|
|
||||||
return v
|
|
||||||
if (val == '' or val[0] != '{'):
|
|
||||||
return v
|
|
||||||
s = curimage
|
|
||||||
curimage = image
|
|
||||||
val = parse('delexpr', val)
|
|
||||||
curimage = s
|
|
||||||
# TODO: need to check for parse errors!
|
|
||||||
return option_value(val)
|
|
||||||
|
|
||||||
def setdefault(self, value, loc):
|
|
||||||
global global_option_values
|
|
||||||
setdict(global_option_values, self.name, value)
|
|
||||||
self.defined = 1
|
|
||||||
self.default = 1
|
|
||||||
self.loc = loc
|
|
||||||
|
|
||||||
def setnodefault(self, loc):
|
|
||||||
self.default = 1
|
|
||||||
self.defined = 0
|
|
||||||
self.loc = loc
|
|
||||||
|
|
||||||
def where(self):
|
def where(self):
|
||||||
return self.loc
|
return self.loc
|
||||||
|
|
||||||
|
@ -541,13 +505,8 @@ class option:
|
||||||
def setexportable(self):
|
def setexportable(self):
|
||||||
self.exportable = 1
|
self.exportable = 1
|
||||||
|
|
||||||
def setexported(self):
|
|
||||||
self.exportable = 1
|
|
||||||
self.exported = 1
|
|
||||||
|
|
||||||
def setnoexport(self):
|
def setnoexport(self):
|
||||||
self.exportable = 0
|
self.exportable = 0
|
||||||
self.exported = 0
|
|
||||||
|
|
||||||
def setformat(self, fmt):
|
def setformat(self, fmt):
|
||||||
self.format = fmt
|
self.format = fmt
|
||||||
|
@ -563,23 +522,47 @@ class option:
|
||||||
def setwrite(self, part):
|
def setwrite(self, part):
|
||||||
self.write.append(part)
|
self.write.append(part)
|
||||||
|
|
||||||
def isexported(self):
|
def isexportable(self):
|
||||||
return (self.exported and self.defined)
|
return self.exportable
|
||||||
|
|
||||||
def isset(self):
|
|
||||||
return (self.set)
|
|
||||||
|
|
||||||
def iswritable(self, part):
|
def iswritable(self, part):
|
||||||
return (part in self.write)
|
return (part in self.write)
|
||||||
|
|
||||||
class option_value:
|
class option_value:
|
||||||
"""Value of a configuration option"""
|
"""Value of a configuration option. The option has a default
|
||||||
def __init__(self, value):
|
value which can be changed at any time. Once an option has been
|
||||||
|
set the default value is no longer used."""
|
||||||
|
def __init__(self, name, prev):
|
||||||
|
self.name = name
|
||||||
|
self.value = ''
|
||||||
|
self.set = 0
|
||||||
|
if (prev):
|
||||||
|
self.value = prev.value
|
||||||
|
self.set = prev.set
|
||||||
|
|
||||||
|
|
||||||
|
def setvalue(self, value):
|
||||||
|
if ((self.set & 2) == 2):
|
||||||
|
warning("Changing option %s" % self.name)
|
||||||
|
else:
|
||||||
|
self.set |= 2
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
|
def setdefault(self, value):
|
||||||
|
if ((self.set & 1) == 1):
|
||||||
|
notice("Changing default value of %s" % self.name)
|
||||||
|
|
||||||
|
if ((self.set & 2) == 0):
|
||||||
|
self.value = value
|
||||||
|
self.set |= 1
|
||||||
|
|
||||||
def contents(self):
|
def contents(self):
|
||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
def isset(self):
|
||||||
|
return (self.set & 2) == 2
|
||||||
|
|
||||||
|
|
||||||
class partobj:
|
class partobj:
|
||||||
"""A configuration part"""
|
"""A configuration part"""
|
||||||
def __init__ (self, image, dir, parent, part, type_name, instance_name, link):
|
def __init__ (self, image, dir, parent, part, type_name, instance_name, link):
|
||||||
|
@ -787,11 +770,11 @@ class partobj:
|
||||||
o = getdict(global_options, name)
|
o = getdict(global_options, name)
|
||||||
if (o == 0):
|
if (o == 0):
|
||||||
fatal("can't use undefined option %s" % name)
|
fatal("can't use undefined option %s" % name)
|
||||||
o.setused()
|
|
||||||
o1 = getdict(self.uses_options, name)
|
o1 = getdict(self.uses_options, name)
|
||||||
if (o1):
|
if (o1):
|
||||||
return
|
return
|
||||||
setdict(self.uses_options, name, o)
|
setdict(self.uses_options, name, o)
|
||||||
|
exportoption(o, self.image.exported_options)
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# statements
|
# statements
|
||||||
|
@ -823,33 +806,60 @@ def newoption(name):
|
||||||
global global_options, global_options_by_order
|
global global_options, global_options_by_order
|
||||||
o = getdict(global_options, name)
|
o = getdict(global_options, name)
|
||||||
if (o):
|
if (o):
|
||||||
print "option %s already defined" % name
|
fatal("option %s already defined" % name)
|
||||||
sys.exit(1)
|
|
||||||
o = option(name)
|
o = option(name)
|
||||||
setdict(global_options, name, o)
|
setdict(global_options, name, o)
|
||||||
global_options_by_order.append(name)
|
global_options_by_order.append(name)
|
||||||
|
|
||||||
|
def newoptionvalue(name, image):
|
||||||
|
g = getdict(global_option_values, name)
|
||||||
|
v = option_value(name, g)
|
||||||
|
if (image):
|
||||||
|
setdict(image.getvalues(), name, v)
|
||||||
|
else:
|
||||||
|
setdict(global_option_values, name, v)
|
||||||
|
return v
|
||||||
|
|
||||||
|
def getoptionvalue(name, op, image):
|
||||||
|
global global_option_values
|
||||||
|
if (op == 0):
|
||||||
|
fatal("Option %s undefined (missing use command?)" % name)
|
||||||
|
if (image):
|
||||||
|
v = getdict(image.getvalues(), name)
|
||||||
|
else:
|
||||||
|
v = getdict(global_option_values, name)
|
||||||
|
return v
|
||||||
|
|
||||||
def getoption(name, image):
|
def getoption(name, image):
|
||||||
"""option must be declared before being used in a part
|
"""option must be declared before being used in a part
|
||||||
if we're not processing a part, then we must
|
if we're not processing a part, then we must
|
||||||
be at the top level where all options are available
|
be at the top level where all options are available"""
|
||||||
global global_uses_options, global_option_values"""
|
|
||||||
|
global global_uses_options, alloptions, curimage
|
||||||
|
|
||||||
curpart = partstack.tos()
|
curpart = partstack.tos()
|
||||||
if (curpart):
|
if (alloptions):
|
||||||
o = getdict(curpart.uses_options, name)
|
|
||||||
elif (alloptions):
|
|
||||||
o = getdict(global_options, name)
|
o = getdict(global_options, name)
|
||||||
|
elif (curpart):
|
||||||
|
o = getdict(curpart.uses_options, name)
|
||||||
else:
|
else:
|
||||||
o = getdict(global_uses_options, name)
|
o = getdict(global_uses_options, name)
|
||||||
if (o == 0 or not o.defined):
|
v = getoptionvalue(name, o, image)
|
||||||
error("Option %s undefined (missing use command?)" % name)
|
|
||||||
return
|
|
||||||
v = 0
|
|
||||||
if (image):
|
|
||||||
v = o.getvalue(image, image.getvalues())
|
|
||||||
if (v == 0):
|
if (v == 0):
|
||||||
v = o.getvalue(image, global_option_values)
|
v = getoptionvalue(name, o, 0)
|
||||||
return v.contents()
|
if (v == 0):
|
||||||
|
fatal("No value for option %s" % name)
|
||||||
|
val = v.contents()
|
||||||
|
if (not (type(val) is types.StringType)):
|
||||||
|
return v.contents()
|
||||||
|
if (val == '' or val[0] != '{'):
|
||||||
|
return v.contents()
|
||||||
|
s = curimage
|
||||||
|
curimage = image
|
||||||
|
val = parse('delexpr', val)
|
||||||
|
curimage = s
|
||||||
|
exitiferrors()
|
||||||
|
return val
|
||||||
|
|
||||||
def setoption(name, value, imp):
|
def setoption(name, value, imp):
|
||||||
"""Set an option from within a configuration file. Normally this
|
"""Set an option from within a configuration file. Normally this
|
||||||
|
@ -872,13 +882,16 @@ def setoption(name, value, imp):
|
||||||
o = getdict(global_uses_options, name)
|
o = getdict(global_uses_options, name)
|
||||||
if (not o):
|
if (not o):
|
||||||
fatal("Attempt to set nonexistent option %s (missing USES?)" % name)
|
fatal("Attempt to set nonexistent option %s (missing USES?)" % name)
|
||||||
if (o.isset()):
|
v = getoptionvalue(name, o, curimage)
|
||||||
warning("Changing option %s" % name)
|
if (v == 0):
|
||||||
v = option_value(value)
|
v = newoptionvalue(name, curimage)
|
||||||
if (curimage):
|
v.setvalue(value)
|
||||||
o.setvalue(v, curimage.getvalues(), loc)
|
|
||||||
else:
|
def exportoption(op, exported_options):
|
||||||
o.setvalue(v, global_option_values, loc)
|
if (not op.isexportable()):
|
||||||
|
return
|
||||||
|
if (not op in exported_options):
|
||||||
|
exported_options.append(op)
|
||||||
|
|
||||||
def setdefault(name, value, isdef):
|
def setdefault(name, value, isdef):
|
||||||
"""Set the default value of an option from within a configuration
|
"""Set the default value of an option from within a configuration
|
||||||
|
@ -887,12 +900,13 @@ def setdefault(name, value, isdef):
|
||||||
If 'isdef' is set, we're defining the option in Options.lb so
|
If 'isdef' is set, we're defining the option in Options.lb so
|
||||||
there is no need for 'uses'."""
|
there is no need for 'uses'."""
|
||||||
|
|
||||||
global loc, global_options
|
global loc, global_options, curimage
|
||||||
|
|
||||||
if (isdef):
|
if (isdef):
|
||||||
o = getdict(global_options, name)
|
o = getdict(global_options, name)
|
||||||
if (not o):
|
if (not o):
|
||||||
return
|
return
|
||||||
|
image = 0
|
||||||
else:
|
else:
|
||||||
curpart = partstack.tos()
|
curpart = partstack.tos()
|
||||||
if (curpart):
|
if (curpart):
|
||||||
|
@ -901,21 +915,22 @@ def setdefault(name, value, isdef):
|
||||||
o = getdict(global_uses_options, name)
|
o = getdict(global_uses_options, name)
|
||||||
if (not o):
|
if (not o):
|
||||||
fatal("Attempt to set default for nonexistent option %s (missing USES?)" % name)
|
fatal("Attempt to set default for nonexistent option %s (missing USES?)" % name)
|
||||||
|
image = curimage
|
||||||
|
|
||||||
if (o.defined):
|
v = getoptionvalue(name, o, image)
|
||||||
warning("Changing default value of %s" % name)
|
if (v == 0):
|
||||||
v = option_value(value)
|
v = newoptionvalue(name, image)
|
||||||
o.setdefault(v, loc)
|
v.setdefault(value)
|
||||||
|
|
||||||
def setnodefault(name):
|
def setnodefault(name):
|
||||||
global loc, global_options
|
global loc, global_options
|
||||||
o = getdict(global_options, name)
|
o = getdict(global_options, name)
|
||||||
if (not o):
|
if (not o):
|
||||||
return
|
return
|
||||||
if (o.default):
|
v = getdict(global_option_values, name)
|
||||||
print "setdefault: attempt to duplicate default for %s" % name
|
if (v != 0):
|
||||||
return
|
warning("removing default for %s" % name)
|
||||||
o.setnodefault(loc)
|
del global_option_values[name]
|
||||||
|
|
||||||
def setcomment(name, value):
|
def setcomment(name, value):
|
||||||
global loc, global_options
|
global loc, global_options
|
||||||
|
@ -929,7 +944,8 @@ def setexported(name):
|
||||||
o = getdict(global_options, name)
|
o = getdict(global_options, name)
|
||||||
if (not o):
|
if (not o):
|
||||||
fatal("setexported: %s not here" % name)
|
fatal("setexported: %s not here" % name)
|
||||||
o.setexported()
|
o.setexportable()
|
||||||
|
global_exported_options.append(o)
|
||||||
|
|
||||||
def setnoexport(name):
|
def setnoexport(name):
|
||||||
global global_options
|
global global_options
|
||||||
|
@ -937,6 +953,8 @@ def setnoexport(name):
|
||||||
if (not o):
|
if (not o):
|
||||||
fatal("setnoexport: %s not here" % name)
|
fatal("setnoexport: %s not here" % name)
|
||||||
o.setnoexport()
|
o.setnoexport()
|
||||||
|
if (o in global_exported_options):
|
||||||
|
global_exported_options.remove(o)
|
||||||
|
|
||||||
def setexportable(name):
|
def setexportable(name):
|
||||||
global global_options
|
global global_options
|
||||||
|
@ -955,15 +973,9 @@ def setformat(name, fmt):
|
||||||
def getformated(name, image):
|
def getformated(name, image):
|
||||||
global global_options, global_option_values
|
global global_options, global_option_values
|
||||||
o = getdict(global_options, name)
|
o = getdict(global_options, name)
|
||||||
if (o == 0 or not o.defined):
|
v = getoption(name, image)
|
||||||
fatal( "Option %s undefined." % name)
|
|
||||||
v = 0
|
|
||||||
if (image):
|
|
||||||
v = o.getvalue(image, image.getvalues())
|
|
||||||
if (v == 0):
|
|
||||||
v = o.getvalue(image, global_option_values)
|
|
||||||
f = o.getformat()
|
f = o.getformat()
|
||||||
return (f % v.contents())
|
return (f % v)
|
||||||
|
|
||||||
def setwrite(name, part):
|
def setwrite(name, part):
|
||||||
global global_options
|
global global_options
|
||||||
|
@ -972,22 +984,32 @@ def setwrite(name, part):
|
||||||
fatal("setwrite: %s not here" % name)
|
fatal("setwrite: %s not here" % name)
|
||||||
o.setwrite(part)
|
o.setwrite(part)
|
||||||
|
|
||||||
def isexported(name):
|
def hasvalue(name, image):
|
||||||
global global_options
|
global global_options
|
||||||
o = getdict(global_options, name)
|
o = getdict(global_options, name)
|
||||||
if (o):
|
if (o == 0):
|
||||||
return o.isexported()
|
return 0
|
||||||
return 0
|
v = 0
|
||||||
|
if (image):
|
||||||
|
v = getdict(image.getvalues(), name)
|
||||||
|
if (v == 0):
|
||||||
|
v = getdict(global_option_values, name)
|
||||||
|
return (v != 0)
|
||||||
|
|
||||||
def isset(name, part):
|
def isset(name, part):
|
||||||
global global_uses_options
|
global global_uses_options, global_option_values, curimage
|
||||||
if (part):
|
if (part):
|
||||||
o = getdict(part.uses_options, name)
|
o = getdict(part.uses_options, name)
|
||||||
else:
|
else:
|
||||||
o = getdict(global_uses_options, name)
|
o = getdict(global_uses_options, name)
|
||||||
if (o):
|
if (o == 0):
|
||||||
return o.isset()
|
return 0
|
||||||
return 0
|
v = 0
|
||||||
|
if (curimage):
|
||||||
|
v = getdict(curimage.getvalues(), name)
|
||||||
|
if (v == 0):
|
||||||
|
v = getdict(global_option_values, name)
|
||||||
|
return (v != 0 and v.isset())
|
||||||
|
|
||||||
def usesoption(name):
|
def usesoption(name):
|
||||||
global global_options, global_uses_options
|
global global_options, global_uses_options
|
||||||
|
@ -998,11 +1020,11 @@ def usesoption(name):
|
||||||
o = getdict(global_options, name)
|
o = getdict(global_options, name)
|
||||||
if (o == 0):
|
if (o == 0):
|
||||||
fatal("Can't use undefined option %s" % name)
|
fatal("Can't use undefined option %s" % name)
|
||||||
o.setused()
|
|
||||||
o1 = getdict(global_uses_options, name)
|
o1 = getdict(global_uses_options, name)
|
||||||
if (o1):
|
if (o1):
|
||||||
return
|
return
|
||||||
setdict(global_uses_options, name, o)
|
setdict(global_uses_options, name, o)
|
||||||
|
exportoption(o, global_exported_options)
|
||||||
|
|
||||||
def validdef(name, defval):
|
def validdef(name, defval):
|
||||||
global global_options
|
global global_options
|
||||||
|
@ -1068,9 +1090,6 @@ def payload(path):
|
||||||
global curimage
|
global curimage
|
||||||
curimage.setpayload(path)
|
curimage.setpayload(path)
|
||||||
adduserdefine("PAYLOAD:=%s"%path)
|
adduserdefine("PAYLOAD:=%s"%path)
|
||||||
# addrule('payload')
|
|
||||||
# adddep('payload', path)
|
|
||||||
# addaction('payload', 'cp $< $@')
|
|
||||||
|
|
||||||
def startromimage(name):
|
def startromimage(name):
|
||||||
global romimages, curimage, target_dir, target_name
|
global romimages, curimage, target_dir, target_name
|
||||||
|
@ -1092,11 +1111,11 @@ def endromimage():
|
||||||
|
|
||||||
def mainboard(path):
|
def mainboard(path):
|
||||||
full_path = os.path.join(treetop, 'src', 'mainboard', path)
|
full_path = os.path.join(treetop, 'src', 'mainboard', path)
|
||||||
setoption('MAINBOARD', full_path, 1)
|
|
||||||
vendor = re.sub("/.*", "", path)
|
vendor = re.sub("/.*", "", path)
|
||||||
part_number = re.sub("[^/]*/", "", path)
|
part_number = re.sub("[^/]*/", "", path)
|
||||||
setoption('MAINBOARD_VENDOR', vendor, 1)
|
setdefault('MAINBOARD', full_path, 0)
|
||||||
setoption('MAINBOARD_PART_NUMBER', part_number, 1)
|
setdefault('MAINBOARD_VENDOR', vendor, 0)
|
||||||
|
setdefault('MAINBOARD_PART_NUMBER', part_number, 0)
|
||||||
dodir('/config', 'Config.lb')
|
dodir('/config', 'Config.lb')
|
||||||
part('mainboard', path, 'Config.lb', 0, 0)
|
part('mainboard', path, 'Config.lb', 0, 0)
|
||||||
curimage.setroot(partstack.tos())
|
curimage.setroot(partstack.tos())
|
||||||
|
@ -1161,14 +1180,15 @@ def part(type, path, file, name, link):
|
||||||
|
|
||||||
def partpop():
|
def partpop():
|
||||||
global dirstack, partstack
|
global dirstack, partstack
|
||||||
curpart = partstack.pop()
|
curpart = partstack.tos()
|
||||||
if (curpart == 0):
|
if (curpart == 0):
|
||||||
fatal("Trying to pop non-existent part")
|
fatal("Trying to pop non-existent part")
|
||||||
print "End PART %s" % curpart.part
|
print "End PART %s" % curpart.part
|
||||||
# Warn if options are used without being set in this part
|
# Warn if options are used without being set in this part
|
||||||
for i in curpart.uses_options.keys():
|
for op in curpart.uses_options.keys():
|
||||||
if (not isset(i, curpart)):
|
if (not isset(op, curpart)):
|
||||||
notice("Option %s using default value %s" % (i, getformated(i, curpart.image)))
|
notice("Option %s using default value %s" % (op, getformated(op, curpart.image)))
|
||||||
|
partstack.pop()
|
||||||
dirstack.pop()
|
dirstack.pop()
|
||||||
|
|
||||||
def dodir(path, file):
|
def dodir(path, file):
|
||||||
|
@ -1190,9 +1210,7 @@ def dodir(path, file):
|
||||||
|
|
||||||
def lookup(name):
|
def lookup(name):
|
||||||
global curimage
|
global curimage
|
||||||
v = getoption(name, curimage)
|
return getoption(name, curimage)
|
||||||
exitiferrors()
|
|
||||||
return v
|
|
||||||
|
|
||||||
def addrule(id):
|
def addrule(id):
|
||||||
global curimage
|
global curimage
|
||||||
|
@ -1214,7 +1232,7 @@ def setarch(my_arch):
|
||||||
"""arch is 'different' ... darn it."""
|
"""arch is 'different' ... darn it."""
|
||||||
global curimage
|
global curimage
|
||||||
curimage.setarch(my_arch)
|
curimage.setarch(my_arch)
|
||||||
setoption('ARCH', my_arch, 1)
|
setdefault('ARCH', my_arch, 1)
|
||||||
part('arch', my_arch, 'Config.lb', 0, 0)
|
part('arch', my_arch, 'Config.lb', 0, 0)
|
||||||
|
|
||||||
def doconfigfile(path, confdir, file, rule):
|
def doconfigfile(path, confdir, file, rule):
|
||||||
|
@ -1244,7 +1262,7 @@ def tohex(name):
|
||||||
"""atoi is in the python library, but not strtol? Weird!"""
|
"""atoi is in the python library, but not strtol? Weird!"""
|
||||||
return eval('int(%s)' % name)
|
return eval('int(%s)' % name)
|
||||||
|
|
||||||
def IsInt( str ):
|
def IsInt(str):
|
||||||
""" Is the given string an integer?"""
|
""" Is the given string an integer?"""
|
||||||
try:
|
try:
|
||||||
num = long(str)
|
num = long(str)
|
||||||
|
@ -1601,9 +1619,7 @@ def writemakefileheader(file, fname):
|
||||||
|
|
||||||
def writemakefilesettings(path):
|
def writemakefilesettings(path):
|
||||||
""" Write Makefile.settings to seperate the settings
|
""" Write Makefile.settings to seperate the settings
|
||||||
from the actual makefile creation. In practice you need to
|
from the actual makefile creation."""
|
||||||
rerun NLBConfig.py to change these but in theory you shouldn't
|
|
||||||
need to."""
|
|
||||||
|
|
||||||
global treetop, target_dir
|
global treetop, target_dir
|
||||||
|
|
||||||
|
@ -1613,14 +1629,11 @@ def writemakefilesettings(path):
|
||||||
writemakefileheader(file, filename)
|
writemakefileheader(file, filename)
|
||||||
file.write("TOP:=%s\n" % (treetop))
|
file.write("TOP:=%s\n" % (treetop))
|
||||||
file.write("TARGET_DIR:=%s\n" % target_dir)
|
file.write("TARGET_DIR:=%s\n" % target_dir)
|
||||||
file.write("\n")
|
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
def writeimagesettings(image):
|
def writeimagesettings(image):
|
||||||
"""Write Makefile.settings to seperate the settings
|
"""Write Makefile.settings to seperate the settings
|
||||||
from the actual makefile creation. In practice you need to
|
from the actual makefile creation."""
|
||||||
rerun NLBConfig.py to change these but in theory you shouldn't
|
|
||||||
need to."""
|
|
||||||
|
|
||||||
global treetop
|
global treetop
|
||||||
global global_options_by_order
|
global global_options_by_order
|
||||||
|
@ -1631,13 +1644,22 @@ def writeimagesettings(image):
|
||||||
writemakefileheader(file, filename)
|
writemakefileheader(file, filename)
|
||||||
file.write("TOP:=%s\n" % (treetop))
|
file.write("TOP:=%s\n" % (treetop))
|
||||||
file.write("TARGET_DIR:=%s\n" % (image.gettargetdir()))
|
file.write("TARGET_DIR:=%s\n" % (image.gettargetdir()))
|
||||||
for i in global_options_by_order:
|
file.write("\n")
|
||||||
if (isexported(i)):
|
exported = []
|
||||||
file.write("export %s:=%s\n" % (i, getformated(i, image)))
|
for o in global_exported_options:
|
||||||
file.write("export VARIABLES := ")
|
exported.append(o)
|
||||||
for i in global_options_by_order:
|
for o in image.exported_options:
|
||||||
if (isexported(i)):
|
if (not o in exported):
|
||||||
file.write("%s " % i)
|
exported.append(o)
|
||||||
|
for o in exported:
|
||||||
|
file.write("export %s:=" % o.name)
|
||||||
|
if (hasvalue(o.name, image)):
|
||||||
|
file.write("%s" % getformated(o.name, image))
|
||||||
|
file.write("\n")
|
||||||
|
file.write("\n")
|
||||||
|
file.write("export VARIABLES :=\n")
|
||||||
|
for o in exported:
|
||||||
|
file.write("export VARIABLES += %s\n" % o.name)
|
||||||
file.write("\n")
|
file.write("\n")
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
@ -1803,6 +1825,7 @@ def writemakefile(path):
|
||||||
print "Creating", makefilepath
|
print "Creating", makefilepath
|
||||||
file = safe_open(makefilepath, 'w+')
|
file = safe_open(makefilepath, 'w+')
|
||||||
writemakefileheader(file, makefilepath)
|
writemakefileheader(file, makefilepath)
|
||||||
|
file.write("include Makefile.settings\n\n")
|
||||||
|
|
||||||
# main rule
|
# main rule
|
||||||
file.write("all: ")
|
file.write("all: ")
|
||||||
|
@ -1859,15 +1882,16 @@ def writeinitincludes(image):
|
||||||
outfile.close()
|
outfile.close()
|
||||||
|
|
||||||
def writeldoptions(image):
|
def writeldoptions(image):
|
||||||
"""Write Makefile.settings to seperate the settings
|
"""Write ldoptions file."""
|
||||||
from the actual makefile creation."""
|
|
||||||
|
|
||||||
filename = os.path.join(image.gettargetdir(), "ldoptions")
|
filename = os.path.join(image.gettargetdir(), "ldoptions")
|
||||||
print "Creating", filename
|
print "Creating", filename
|
||||||
file = safe_open(filename, 'w+')
|
file = safe_open(filename, 'w+')
|
||||||
for i in global_options.keys():
|
for o in global_exported_options:
|
||||||
if (isexported(i) and IsInt(getoption(i, image))):
|
if (hasvalue(o.name, image) and IsInt(getoption(o.name, image))):
|
||||||
file.write("%s = %s;\n" % (i, getformated(i, image)))
|
file.write("%s = %s;\n" % (o.name, getformated(o.name, image)))
|
||||||
|
for o in image.exported_options:
|
||||||
|
if (not o in global_exported_options and hasvalue(o.name, image) and IsInt(getoption(o.name, image))):
|
||||||
|
file.write("%s = %s;\n" % (o.name, getformated(o.name, image)))
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
def dumptree(part, lvl):
|
def dumptree(part, lvl):
|
||||||
|
@ -1919,11 +1943,21 @@ def gencode(part, file, pass_num):
|
||||||
kid = kid.siblings
|
kid = kid.siblings
|
||||||
debug.info(debug.gencode, "DONE GENCODE")
|
debug.info(debug.gencode, "DONE GENCODE")
|
||||||
|
|
||||||
def verifyparse(image):
|
def verifyparse():
|
||||||
"""Add any run-time checks to verify that parsing the configuration
|
"""Add any run-time checks to verify that parsing the configuration
|
||||||
was successful"""
|
was successful"""
|
||||||
if (image.newformat() and image.getinitfile() == ''):
|
|
||||||
fatal("An init file must be specified")
|
for image in romimages.values():
|
||||||
|
print("Verifying ROMIMAGE %s" % image.name)
|
||||||
|
if (image.newformat() and image.getinitfile() == ''):
|
||||||
|
fatal("An init file must be specified")
|
||||||
|
for op in image.exported_options:
|
||||||
|
if (getoptionvalue(op.name, op, image) == 0 and getoptionvalue(op.name, op, 0) == 0):
|
||||||
|
warning("Exported option %s has no value (check Options.lb)" % op.name);
|
||||||
|
print("Verifing global options")
|
||||||
|
for op in global_exported_options:
|
||||||
|
if (getoptionvalue(op.name, op, 0) == 0):
|
||||||
|
notice("Exported option %s has no value (check Options.lb)" % op.name);
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# MAIN PROGRAM
|
# MAIN PROGRAM
|
||||||
|
@ -1931,8 +1965,7 @@ def verifyparse(image):
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
from sys import argv
|
from sys import argv
|
||||||
if (len(argv) < 3):
|
if (len(argv) < 3):
|
||||||
print 'Args: <file> <path to linuxbios>'
|
fatal("Args: <file> <path to linuxbios>")
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
top_config_file = os.path.abspath(sys.argv[1])
|
top_config_file = os.path.abspath(sys.argv[1])
|
||||||
|
|
||||||
|
@ -1945,8 +1978,7 @@ if __name__=='__main__':
|
||||||
fatal("Could not parse file")
|
fatal("Could not parse file")
|
||||||
loc.pop()
|
loc.pop()
|
||||||
|
|
||||||
for image_name, image in romimages.items():
|
verifyparse()
|
||||||
verifyparse(image)
|
|
||||||
|
|
||||||
# no longer need to check if an options has been used
|
# no longer need to check if an options has been used
|
||||||
alloptions = 1
|
alloptions = 1
|
||||||
|
|
Loading…
Reference in New Issue