Top-level SConsctruct can now retrive shelved configuration

By moving shelve retrieval details to configuration_retrieve()
into configuration.py, the top-level SConstruct can now get full
configuration object from shelve.
This commit is contained in:
Bahadir Balban
2009-09-14 11:52:01 +03:00
parent 2f8df84cf2
commit dd04734491
4 changed files with 39 additions and 36 deletions

View File

@@ -7,6 +7,7 @@
import os, shelve
import configure
from configure import *
from os.path import *
env = Environment(CC = 'arm-none-eabi-gcc',
# We don't use -nostdinc because sometimes we need standard headers,
@@ -21,12 +22,12 @@ 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(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"]
config = configuration_retrieve()
arch = config.arch
subarch = config.subarch
platform = config.platform
all_syms = config.all
objects = []
objects += SConscript('src/drivers/SConscript', exports = {'symbols' : all_syms, 'env' : env})
@@ -40,4 +41,6 @@ objects += SConscript('src/api/SConscript', exports = {'symbols' : all_syms, 'en
kernel_elf = env.Program(BUILDDIR + '/kernel.elf', objects)
#libl4 = SConscript('conts/libl4/SConscript', \
# exports = { 'arch' : arch }, duplicate = 0, \
# variant_dir = join(BUILDDIR, os.path.relpath('conts/libl4', PROJROOT)))

View File

@@ -16,11 +16,11 @@ class Container:
class configuration:
def __init__(self):
self.containers = []
self.arch = None
self.subarch = None
self.platform = None
self.all = []
self.containers = []
# Get all name value symbols
def get_all(self, name, val):
@@ -115,14 +115,10 @@ def configuration_save(config):
config_shelve = shelve.open(CONFIG_SHELVE)
config_shelve["configuration"] = config
# Save containers explicitly
# for i, c in zip(range(len(config.containers)), config.containers):
# config_shelve["container" + str(i)] = c
# config_shelve["arch"] = configuration.arch
# config_shelve["subarch"] = configuration.subarch
# config_shelve["platform"] = configuration.platform
# config_shelve["all_symbols"] = configuration.all
config_shelve["arch"] = config.arch
config_shelve["subarch"] = config.subarch
config_shelve["platform"] = config.platform
config_shelve["all_symbols"] = config.all
config_shelve.close()
@@ -130,12 +126,4 @@ def configuration_retrieve():
# Get configuration information
config_shelve = shelve.open(CONFIG_SHELVE)
config = config_shelve["configuration"]
# Retrieve and append containers explicitly
# for i in range(int(config.ncontainers)):
# config.containers.append(config_shelve["container" + str(i)])
#config.containers.sort()
return config

View File

@@ -44,11 +44,6 @@ def configure_kernel(cml_file):
cml2_header_to_symbols(CML2_CONFIG_H, config)
cml2_update_config_h(CONFIG_H, config)
configuration_save(config)
# config2 = configuration_retrieve()
# print "containers: " + config2.ncontainers
# for c in config2.containers:
# print c.type
# print c.id
if __name__ == "__main__":
configure_kernel(join(CML2_CONFIG_SRCDIR, "arm.cml"))

View File

@@ -17,16 +17,33 @@
#
# Author: Russel Winder
Import('environment')
import os, sys
e = environment.Clone()
e.Append(CPPPATH = ['include'])
PROJRELROOT = '../..'
sys.path.append(PROJRELROOT)
from config.projpaths import *
Import('arch')
env = Environment(CC = 'arm-none-linux-gnueabi-gcc',
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'],
LINKFLAGS = ['-nostdlib'],
ASFLAGS = ['-D__ASSEMBLY__'],
ENV = {'PATH' : os.environ['PATH']},
LIBS = 'gcc',
CPPPATH = ['#include', '#include/l4lib/arch', join(PROJROOT,'include') ])
def create_symlinks(arch):
if not os.path.exists("include/l4lib/arch"):
os.system("ln -s %s %s" % ("arch-" + arch, "include/l4lib/arch"))
# TODO: There are errors in this code that -Werror gives problems with.
e['CCFLAGS'] = ['-g', '-nostdlib', '-Wall', '-ffreestanding', '-std=gnu99']
objects = e.StaticObject(Glob('src/*.c') + Glob('src/' + e['ARCH'] + '/*.[cS]'))
library = e.StaticLibrary('l4', objects)
create_symlinks(arch)
objects = env.StaticObject(Glob('src/*.c') + Glob('src/' + arch + '/*.[cS]'))
library = env.StaticLibrary('l4', objects)
Return('library')