Merge branch 'buildDevel' of http://www.russel.org.uk/Git/Codezero into devel

Conflicts:

	loader/SConscript
This commit is contained in:
Bahadir Balban
2009-08-17 15:58:25 +03:00
2 changed files with 28 additions and 5 deletions

View File

@@ -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 ########################

View File

@@ -22,12 +22,21 @@ 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:
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
@@ -45,12 +54,18 @@ def ksymToLds(target, source, env):
.global %s
.type %s, function
.equ %s, %s
''' % (symbol, symbol, symbol, (hex(int(address, 16) - 0xf0000000))[:-1]))
''' % (symbol, symbol, symbol, convertAddress(address)))
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 +119,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)