From 5974a327d08ac6586b3eeb41e7cae1fd44fb9ce7 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sun, 30 Aug 2009 10:12:12 +0100 Subject: [PATCH] Various changes post sorting out some of the issues regarding task ordering. test0 cannot be the first task in the list as it must have a prior physical_base.lds in order to create test_exec_linker.lds. mm0 appears to have to precede fs0 for the tests to execute on start. This should be considered a bug. --- SConstruct | 2 +- containers/SConscript | 23 ++++++++++++++++++----- containers/posix/taskOrder.py | 12 +++++++----- containers/posix/test0/SConscript | 10 ++++++++++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/SConstruct b/SConstruct index 40bd9c6..062353c 100644 --- a/SConstruct +++ b/SConstruct @@ -34,7 +34,7 @@ cml2CompileRulesFile = buildDirectory + '/cml2Rules.out' cml2ConfigPropertiesFile = buildDirectory + '/cml2Config.out' cml2ConfigHeaderFile = buildDirectory + '/cml2Config.h' -configureHelpEntry = 'configure the build.' +configureHelpEntry = 'configure the build. This must be done before any other action is possible.' # The choice of which parts of the kernel to compile and include in the build depends on the configuration # which is managed using CML2. CML2 uses a base configuration file (currently #configs/arm.cml) to drive diff --git a/containers/SConscript b/containers/SConscript index 9be4d67..ccf518f 100644 --- a/containers/SConscript +++ b/containers/SConscript @@ -50,7 +50,7 @@ def buildTask(programName, sources, environment, previousImage, extraCppPath=Non Depends(objects, e['configFiles']) program = e.Program(programName, objects) environment['physicalBaseLinkerScript'] = Command('physical_base.lds', previousImage, 'tools/pyelf/readelf.py --first-free-page ' + previousImage[0].path + ' >> $TARGET') - Depends(program, [environment['physicalBaseLinkerScript']]) + Depends(program, environment['physicalBaseLinkerScript']) return program tasksEnvironment = environment.Clone() @@ -67,12 +67,25 @@ tasksEnvironment['posixServicesDirectory'] = 'containers/' + posixServicesDirect #### TODO: Why does the linker require crt0.o to be in the current directory and named as such. Is it #### because of the text in the linker script? #### - -#### taskNameList = [ f.name for f in Glob(posixServicesDirectory + '*') if f.name not in taskLibraryNames + ['bootdesc'] ] -#### imageOrderData = [(taskName, []) for taskName in taskNameList] -# Have to know the build is in build/containers, can't use '#' here. +## If the ordering of tasks is not important then we should just be able to pull in all non-library +## directories that are not bootdesc. If there needs to be a policy then either the directory names need to +## provide an order or a policy file presenting an order is needed. For now we have a policy file. Since +## we need to guarantee the ordering across many containers and many builds. + +## taskNameList = [ f.name for f in Glob(posixServicesDirectory + '*') if f.name not in taskLibraryNames + ['bootdesc'] ] +## imageOrderData = [(taskName, []) for taskName in taskNameList] + +# To get the policy file, we have to know the build is being executed in the build/containers directory, +# and that we can't use '#' as this is Python not SCons. + +#### +#### TODO: Task order (mm0, fs0, test0) works, but no other order does. This implies a bug in the SCons +#### code. +#### + execfile('../../containers/' + posixServicesDirectory + '/taskOrder.py') + imageOrderData = [(taskName, []) for taskName in taskOrder] imageOrderData[0][1].append(startAxf) tasks = [] diff --git a/containers/posix/taskOrder.py b/containers/posix/taskOrder.py index 34a8a13..a6aa6c5 100644 --- a/containers/posix/taskOrder.py +++ b/containers/posix/taskOrder.py @@ -20,10 +20,12 @@ # A sequence determining the order of tasks in the packing. #### -#### TODO: Why do the tests only run when the load order is mm0, fs0, test0 -- any other order and the tests -#### do not run. Worse if test0 is not last then there are problems with the compilation du to issues with -#### linker scripts. +#### TODO: Why do the tests only run when mm0 precedes fs0 in the load list? #### -taskOrder = ('mm0', 'fs0', 'test0') -#taskOrder = ('fs0', 'mm0', 'test0') +# NB test0 cannot be the first task in the list because of the processing of test_exec_linker.lds.in. + +#taskOrder = ('mm0', 'fs0', 'test0')# Works fine. +#taskOrder = ('fs0', 'mm0', 'test0')# Compiles, loads and executes fine, but does not execute the tests. +#taskOrder = ('fs0', 'test0', 'mm0')# Compiles, loads and executes fine, but does not execute the tests. +taskOrder = ('mm0', 'test0', 'fs0')# Works fine. diff --git a/containers/posix/test0/SConscript b/containers/posix/test0/SConscript index 970eedb..90af788 100644 --- a/containers/posix/test0/SConscript +++ b/containers/posix/test0/SConscript @@ -36,6 +36,16 @@ def createTestExecS(target, source, env): .align 4 ''' % ( source[0].path )) +try: + environment['physicalBaseLinkerScript'] +except KeyError: + print ''' +#### +#### The test0 task cannot be the first task in the list of tasks. +#### +''' + Exit ( 1 ) + testTaskEnvironment = environment.Clone() testTaskEnvironment.Append(CPPPATH=['#' + testTaskEnvironment['posixServicesDirectory'] +'/libposix/include/posix']) testExecLinkerScript = Command('#build/' + testTaskEnvironment['posixServicesDirectory'] +'/' + taskName + '/test_exec_linker.lds', ['test_exec_linker.lds.in', testTaskEnvironment['physicalBaseLinkerScript']], createTestExecLinkerScript)