Got symbol importing working and decision making carried over to the tree

This commit is contained in:
Bahadir Balban
2009-09-11 11:28:41 +03:00
parent 9f69ba060f
commit 13363939ac
2 changed files with 37 additions and 27 deletions

View File

@@ -5,7 +5,8 @@
# Copyright © 2009 B Labs Ltd # Copyright © 2009 B Labs Ltd
# #
import os, shelve import os, shelve
from configure import configure_kernel import configure
from configure import *
env = Environment(CC = 'arm-none-eabi-gcc', env = Environment(CC = 'arm-none-eabi-gcc',
# We don't use -nostdinc because sometimes we need standard headers, # We don't use -nostdinc because sometimes we need standard headers,
@@ -20,26 +21,33 @@ env = Environment(CC = 'arm-none-eabi-gcc',
CPPPATH = "#include", CPPPATH = "#include",
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h -D__KERNEL__') CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h -D__KERNEL__')
config_shelve = shelve.open("build/configdata/configuration") config_shelve = shelve.open(CONFIG_SHELVE)
configuration = config_shelve["cml2_config"] #symbols = config_shelve["config_symbols"]
cf = configuration arch = config_shelve["arch"]
subarch = config_shelve["subarch"]
platform = config_shelve["platform"]
all_syms = config_shelve["all_symbols"]
print all_syms
sources = \ sources = \
Glob('src/api/*.[cS]') + \ Glob('src/api/*.[cS]') + \
Glob('src/generic/*.[cS]') + \ Glob('src/generic/*.[cS]') + \
Glob('src/lib/*.[cS]') + \ Glob('src/lib/*.[cS]') + \
Glob('src/arch/' + cf['ARCH'] + '/*.[cS]') + \ Glob('src/arch/' + arch + '/*.[cS]') + \
Glob('src/arch/' + cf['ARCH'] + '/' + cf['SUBARCH'] +'/*.[cS]') + \ Glob('src/arch/' + arch + '/' + subarch +'/*.[cS]') + \
Glob('src/glue/' + cf['ARCH'] + '/*.[cS]') + \ Glob('src/glue/' + arch + '/*.[cS]') + \
Glob('src/platform/' + cf['PLATFORM'] + '/*.[cS]') Glob('src/platform/' + platform + '/*.[cS]')
for item in cf['DRIVER'] : drivers = SConscript('src/drivers/SConscript', duplicate = 0, \
path = 'src/drivers/' + item exports = {'symbols' : all_syms, 'env' : env})
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) #for item in cf['DRIVER'] :
startAxf = env.Program('start.axf', objects) # 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)

View File

@@ -12,9 +12,9 @@ CML2RULES = join(BUILDDIR, "cml2_rules.out")
CML2_CONFIG_PROPERTIES = join(BUILDDIR, "cml2_config.out") CML2_CONFIG_PROPERTIES = join(BUILDDIR, "cml2_config.out")
CML2_CONFIG_H = join(BUILDDIR, "cml2_config.h") CML2_CONFIG_H = join(BUILDDIR, "cml2_config.h")
CONFIG_H = join("include/l4/config.h") CONFIG_H = join("include/l4/config.h")
CONFIG_DATA_DIR = join(BUILDDIR, "configdata") CONFIG_SHELVE_DIR = join(BUILDDIR, "configdata")
CONFIG_DATA_FILENAME = "configuration" CONFIG_SHELVE_FILENAME = "configuration"
CONFIG_DATA = join(CONFIG_DATA_DIR, CONFIG_DATA_FILENAME) CONFIG_SHELVE = join(CONFIG_SHELVE_DIR, CONFIG_SHELVE_FILENAME)
configuration = {} configuration = {}
class config_symbols: class config_symbols:
@@ -87,12 +87,16 @@ def cml2_configure(cml2_config_file):
os.mkdir("build/l4") os.mkdir("build/l4")
shutil.copy(CML2_CONFIG_H, CONFIG_H) shutil.copy(CML2_CONFIG_H, CONFIG_H)
def save_configuration(configuration): def save_configuration():
if not os.path.exists(CONFIG_DATA_DIR): if not os.path.exists(CONFIG_SHELVE_DIR):
os.mkdir(CONFIG_DATA_DIR) os.mkdir(CONFIG_SHELVE_DIR)
config_shelve = shelve.open(CONFIG_DATA) 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
config_shelve["all_symbols"] = symbols.all
config_shelve.close() config_shelve.close()
def configure_kernel(cml_file): def configure_kernel(cml_file):
@@ -102,9 +106,7 @@ def configure_kernel(cml_file):
cml2_configure(cml_file) cml2_configure(cml_file)
cml2_header_to_symbols(CML2_CONFIG_H) cml2_header_to_symbols(CML2_CONFIG_H)
cml2_update_config_h(symbols, CONFIG_H) cml2_update_config_h(symbols, CONFIG_H)
save_configuration(configuration) save_configuration()
return configuration
if __name__ == "__main__": if __name__ == "__main__":
configure_kernel("configs/arm.cml") configure_kernel("configs/arm.cml")