mirror of
https://github.com/drasko/codezero.git
synced 2026-01-27 02:03:14 +01:00
CML2 rule file is autogenerated from arm.cml and the containers template
Container rules are too many and repetitive for each container. With this change, the cml file is autogenerated from a container template cml and the architecture cml, e.g. arm.cml. -c option determines the number of containers. See build.py -h for more.
This commit is contained in:
37
build.py
37
build.py
@@ -13,6 +13,8 @@ from config.projpaths import *
|
||||
from config.configuration import *
|
||||
from scripts.conts import containers
|
||||
from configure import *
|
||||
from optparse import OptionParser
|
||||
from scripts.cml.generate_container_cml import *
|
||||
|
||||
# NOTE:
|
||||
# The scripts obtain all the configuration data (a set of class
|
||||
@@ -20,10 +22,43 @@ from configure import *
|
||||
# any arguments here.
|
||||
|
||||
def main():
|
||||
autogen_true = 0
|
||||
usage = "usage: %prog [options] arg"
|
||||
parser = OptionParser(usage)
|
||||
|
||||
parser.add_option("-a", "--arch", type = "string", dest = "arch",
|
||||
help = "Use configuration file for architecture")
|
||||
parser.add_option("-c", "--num-containers", type = "int", dest = "ncont",
|
||||
help = "Maximum number of containers available in configuration")
|
||||
parser.add_option("-f", "--use-file", dest = "cml_file",
|
||||
help = "Supply user-defined cml file"
|
||||
"(Use only if you want to override default)")
|
||||
parser.add_option("-w", "--wipeout-old-config", action = "store_true",
|
||||
default = False, dest = "wipeout",
|
||||
help = "Wipe out existing configuration file settings")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
autogen_true = len(sys.argv) > 1 or not os.path.exists(CML2_CML_FILE)
|
||||
|
||||
if autogen_true and not options.arch:
|
||||
print "No arch supplied (-a), using `arm' as default."
|
||||
options.arch = "arm"
|
||||
if autogen_true and not options.ncont:
|
||||
options.ncont = 4
|
||||
print "Max container count not supplied (-c), using %d as default." % options.ncont
|
||||
|
||||
# Regenerate cml file if options are supplied or the file doesn't exist.
|
||||
if autogen_true:
|
||||
generate_container_cml(options.arch, options.ncont)
|
||||
if options.wipeout == 1 and os.path.exists(CML2_OLDCONFIG_FILE):
|
||||
print "Deleting %s" % CML2_OLDCONFIG_FILE
|
||||
os.remove(CML2_OLDCONFIG_FILE)
|
||||
|
||||
#
|
||||
# Configure
|
||||
#
|
||||
configure_kernel(join(CML2_CONFIG_SRCDIR, 'arm.cml'))
|
||||
configure_kernel(CML2_CML_FILE)
|
||||
|
||||
#
|
||||
# Build the kernel
|
||||
|
||||
Reference in New Issue
Block a user