From 13363939ac78d5e3ccda4d92fb09e789ae80d776 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Fri, 11 Sep 2009 11:28:41 +0300 Subject: [PATCH] Got symbol importing working and decision making carried over to the tree --- SConstruct | 40 ++++++++++++++++++++++++---------------- configure.py | 24 +++++++++++++----------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/SConstruct b/SConstruct index 53cdaa5..cc0bbcc 100644 --- a/SConstruct +++ b/SConstruct @@ -5,7 +5,8 @@ # Copyright © 2009 B Labs Ltd # import os, shelve -from configure import configure_kernel +import configure +from configure import * env = Environment(CC = 'arm-none-eabi-gcc', # We don't use -nostdinc because sometimes we need standard headers, @@ -20,26 +21,33 @@ env = Environment(CC = 'arm-none-eabi-gcc', CPPPATH = "#include", CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h -D__KERNEL__') -config_shelve = shelve.open("build/configdata/configuration") -configuration = config_shelve["cml2_config"] -cf = configuration +config_shelve = shelve.open(CONFIG_SHELVE) +#symbols = config_shelve["config_symbols"] +arch = config_shelve["arch"] +subarch = config_shelve["subarch"] +platform = config_shelve["platform"] +all_syms = config_shelve["all_symbols"] +print all_syms sources = \ Glob('src/api/*.[cS]') + \ Glob('src/generic/*.[cS]') + \ Glob('src/lib/*.[cS]') + \ - Glob('src/arch/' + cf['ARCH'] + '/*.[cS]') + \ - Glob('src/arch/' + cf['ARCH'] + '/' + cf['SUBARCH'] +'/*.[cS]') + \ - Glob('src/glue/' + cf['ARCH'] + '/*.[cS]') + \ - Glob('src/platform/' + cf['PLATFORM'] + '/*.[cS]') + Glob('src/arch/' + arch + '/*.[cS]') + \ + Glob('src/arch/' + arch + '/' + subarch +'/*.[cS]') + \ + Glob('src/glue/' + arch + '/*.[cS]') + \ + Glob('src/platform/' + platform + '/*.[cS]') -for item in cf['DRIVER'] : - path = 'src/drivers/' + item - if not os.path.isdir(path): - feature , device = item.split ( '/' ) - raise ValueError, 'Driver ' + device + ' for ' + feature + ' not available.' - sources += Glob(path + '/*.[cS]') +drivers = SConscript('src/drivers/SConscript', duplicate = 0, \ + exports = {'symbols' : all_syms, 'env' : env}) -objects = env.Object(sources) -startAxf = env.Program('start.axf', objects) +#for item in cf['DRIVER'] : +# path = 'src/drivers/' + item +# if not os.path.isdir(path): +# feature , device = item.split ( '/' ) +# raise ValueError, 'Driver ' + device + ' for ' + feature + ' not available.' +# sources += Glob(path + '/*.[cS]') + +objects = env.Object(sources + drivers) +#startAxf = env.Program('start.axf', objects) diff --git a/configure.py b/configure.py index ab45b48..00e9cf4 100755 --- a/configure.py +++ b/configure.py @@ -12,9 +12,9 @@ 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_DATA_DIR = join(BUILDDIR, "configdata") -CONFIG_DATA_FILENAME = "configuration" -CONFIG_DATA = join(CONFIG_DATA_DIR, CONFIG_DATA_FILENAME) +CONFIG_SHELVE_DIR = join(BUILDDIR, "configdata") +CONFIG_SHELVE_FILENAME = "configuration" +CONFIG_SHELVE = join(CONFIG_SHELVE_DIR, CONFIG_SHELVE_FILENAME) configuration = {} class config_symbols: @@ -87,12 +87,16 @@ def cml2_configure(cml2_config_file): os.mkdir("build/l4") shutil.copy(CML2_CONFIG_H, CONFIG_H) -def save_configuration(configuration): - if not os.path.exists(CONFIG_DATA_DIR): - os.mkdir(CONFIG_DATA_DIR) +def save_configuration(): + if not os.path.exists(CONFIG_SHELVE_DIR): + os.mkdir(CONFIG_SHELVE_DIR) - config_shelve = shelve.open(CONFIG_DATA) - config_shelve["config_symbols"] = symbols + config_shelve = shelve.open(CONFIG_SHELVE) + #config_shelve["config_symbols"] = symbols + config_shelve["arch"] = symbols.arch + config_shelve["subarch"] = symbols.subarch + config_shelve["platform"] = symbols.platform + config_shelve["all_symbols"] = symbols.all config_shelve.close() def configure_kernel(cml_file): @@ -102,9 +106,7 @@ def configure_kernel(cml_file): cml2_configure(cml_file) cml2_header_to_symbols(CML2_CONFIG_H) cml2_update_config_h(symbols, CONFIG_H) - save_configuration(configuration) - - return configuration + save_configuration() if __name__ == "__main__": configure_kernel("configs/arm.cml")