More progress on build scripts

Created a config directory for configuration files.
Moved all absolute path variables to a projpaths.py file
All scripts can now universally learn absolute paths via projpaths.py
Moved the config_symbols class to the configuration.py file.
Moved libs to loader since they are only referred by the loader
This commit is contained in:
Bahadir Balban
2009-09-12 13:42:30 +03:00
parent 8ffd4537ea
commit 59f30a175a
152 changed files with 1037 additions and 248 deletions

View File

@@ -3,61 +3,8 @@
import os, sys, shelve, shutil
from os.path import join
PROJROOT = os.getcwd()
BUILDDIR = join(PROJROOT, "build")
TOOLSDIR = join(PROJROOT, "tools")
CML2TOOLSDIR = join(TOOLSDIR, "cml2-tools")
CML2RULES = join(BUILDDIR, "cml2_rules.out")
CML2_CONFIG_PROPERTIES = join(BUILDDIR, "cml2_config.out")
CML2_CONFIG_H = join(BUILDDIR, "cml2_config.h")
CONFIG_H = join("include/l4/config.h")
CONFIG_SHELVE_DIR = join(BUILDDIR, "configdata")
CONFIG_SHELVE_FILENAME = "configuration"
CONFIG_SHELVE = join(CONFIG_SHELVE_DIR, CONFIG_SHELVE_FILENAME)
configuration = {}
class config_symbols:
arch = None
subarch = None
platform = None
kbuild = []
all = []
# Get all name value symbols
def get_all(self, name, val):
self.all.append([name, val])
# Convert line to name value pair, if possible
def line_to_name_value(self, line):
parts = line.split()
if len(parts) > 0:
if parts[0] == "#define":
return parts[1], parts[2]
return None
# Extract architecture from a name value pair
def get_arch(self, name, val):
if name[:len("CONFIG_ARCH_")] == "CONFIG_ARCH_":
parts = name.split("_", 3)
self.arch = parts[2].lower()
# Extract subarch from a name value pair
def get_subarch(self, name, val):
if name[:len("CONFIG_SUBARCH_")] == "CONFIG_SUBARCH_":
parts = name.split("_", 3)
self.subarch = parts[2].lower()
# Extract platform from a name value pair
def get_platform(self, name, val):
if name[:len("CONFIG_PLATFORM_")] == "CONFIG_PLATFORM_":
parts = name.split("_", 3)
self.platform = parts[2].lower()
# Extract number of containers
def get_ncontainers(self, name, val):
if name[:len("CONFIG_CONTAINERS")] == "CONFIG_CONTAINERS":
self.ncontainers = val
from config.projpaths import *
from config.configuration import *
symbols = config_symbols()
@@ -92,7 +39,7 @@ def save_configuration():
os.mkdir(CONFIG_SHELVE_DIR)
config_shelve = shelve.open(CONFIG_SHELVE)
#config_shelve["config_symbols"] = symbols
config_shelve["config_symbols"] = symbols
config_shelve["arch"] = symbols.arch
config_shelve["subarch"] = symbols.subarch
config_shelve["platform"] = symbols.platform
@@ -109,4 +56,4 @@ def configure_kernel(cml_file):
save_configuration()
if __name__ == "__main__":
configure_kernel("configs/arm.cml")
configure_kernel(join(CML2_CONFIG_SRCDIR, "arm.cml"))