From 8777333664d2f0882848c4bd889b86d09d96989f Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Wed, 12 Aug 2009 13:55:55 +0100 Subject: [PATCH 1/3] Some trivial changes to the comments. --- loader/SConscript | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/loader/SConscript b/loader/SConscript index 6057769..bcc00e0 100644 --- a/loader/SConscript +++ b/loader/SConscript @@ -27,7 +27,7 @@ def ksymToLds(target, source, env): with open(target[0].path, 'w') as asmFile: asmFile.write(''' /* - * %s autogenerated from %s + * %s autogenerated from %s. * * This file is included by the loader sources so that any * kernel symbol address can be known in advance and stopped @@ -50,7 +50,13 @@ def ksymToLds(target, source, env): def createKernelSFile(target, source, env): with open(target[0].path, 'w') as asmFile: asmFile.write(''' -/* This file defines kernel symbols extracted from the kernel image in their physical address */ +/* + * This file is autogenerated. + * + * This file defines kernel symbols extracted from the + * kernel image in their physical address. + */ + .include "%s" .section .kernel @@ -104,10 +110,16 @@ def createLinkerScript(target, source, env): outFile.write(inFile.read().replace('__LINKER_ITEMS_EDIT_MARKER__', linkerItems)) startAxfS = Command('start.axf.S', images[0], ksymToLds) -kernelS = Command('kernel.S', [startAxfS] + images, createKernelSFile) # Order of dependencies is crucial here. + +# In the following, it is crucially important that the order of the sources is as it is -- assumptions are +# made in the functions doing the processing. + +kernelS = Command('kernel.S', [startAxfS] + images, createKernelSFile) mainC = Command('main.c', ['main.c.in'] + images, createMainC) linkerScript = Command('linker.lds', ['linker.lds.in'] + images, createLinkerScript) +## TODO: deal with the situation where there are other .c and .S files in the directory. + objects = environment.Object(['arch.c' , kernelS, startAxfS, mainC]) Depends(objects, environment['configFiles']) Depends(objects, images) From 1c9dfe8030cd6c303edbf120f7ceaf696142e07d Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sat, 15 Aug 2009 08:05:28 +0100 Subject: [PATCH 2/3] Add the constructed config.h file as a dependency of the compiled objects so that it actually gets built. --- SConstruct | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 411be74..0b8f106 100644 --- a/SConstruct +++ b/SConstruct @@ -91,7 +91,8 @@ else : # # TODO: Decide if this is an issue or not. - configuration = Configure(baseEnvironment, config_h = buildDirectory + '/l4/config.h') + configHPath = buildDirectory + '/l4/config.h' + configuration = Configure(baseEnvironment, config_h = configHPath) configData = processCML2Config() arch = None platform = None @@ -123,6 +124,7 @@ else : configuration.env['PLATFORM'] = platform configuration.env['SUBARCH'] = subarch baseEnvironment = configuration.Finish() + baseEnvironment.Append(configFiles = ('#' + configHPath,)) ########## Build the libraries ######################## From 5d8a35ad4d6f08471fd97a09711dadd09b46e457 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sat, 15 Aug 2009 08:18:52 +0100 Subject: [PATCH 3/3] Make the address conversion for start.axf.S creation more sophisticated to deal with Python writing a Python literal. --- loader/SConscript | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/loader/SConscript b/loader/SConscript index bcc00e0..b74316b 100644 --- a/loader/SConscript +++ b/loader/SConscript @@ -22,6 +22,15 @@ import subprocess Import('environment', 'images') +def convertAddress(address): + '''Convert the string representation of the address given as parameter to a string representation of the + address without the top four bits set. The issue here is that Python has a penchant for adding L to the + end to create a Python literal. This is not wanted here.''' + value = hex(int(address, 16) - 0xf0000000) + if value[-1] in ['l', 'L']: + value = value[:-1] + return value + def ksymToLds(target, source, env): symbols = ['break_virtual'] with open(target[0].path, 'w') as asmFile: @@ -45,7 +54,7 @@ def ksymToLds(target, source, env): .global %s .type %s, function .equ %s, %s -''' % (symbol, symbol, symbol, (hex(int(address, 16) - 0xf0000000)))) +''' % (symbol, symbol, symbol, convertAddress(address))) def createKernelSFile(target, source, env): with open(target[0].path, 'w') as asmFile: