Switch to using a different strategy for building the kernel.

This commit is contained in:
Russel Winder
2009-08-27 16:43:47 +01:00
parent 34c2156bc4
commit 6ca0f2607a
12 changed files with 32 additions and 255 deletions

View File

@@ -83,8 +83,6 @@ else :
ENV = {'PATH': os.environ['PATH']},
configFiles = ('#' + cml2CompileRulesFile, '#' + cml2ConfigPropertiesFile, '#' + cml2ConfigHeaderFile))
kernelSConscriptPaths = ['generic', 'api', 'lib']
# It is assumed that the C code is assuming that the configuration file will be found at l4/config.h so create it there.
#
# Kernel code include config.h in a different way to all the other bits of code.
@@ -111,15 +109,10 @@ else :
if items[1] == 'SUBARCH':
subarch = items[2].lower()
if items[0] == 'DRIVER':
kernelSConscriptPaths.append('drivers/' + ('irq' if items[1] == 'IRQCTRL' else items[1].lower()) + '/' + items[2].lower())
configuration.env.Append(driverList = [('irq' if items[1] == 'IRQCTRL' else items[1].lower()) + '/' + items[2].lower()])
configuration.Define('__ARCH__', arch)
configuration.Define('__PLATFORM__', platform)
configuration.Define('__SUBARCH__', subarch)
kernelSConscriptPaths += [
'arch/' + arch,
'glue/' + arch,
'platform/' + platform,
'arch/' + arch + '/' + subarch]
configuration.env['ARCH'] = arch
configuration.env['PLATFORM'] = platform
configuration.env['SUBARCH'] = subarch
@@ -169,11 +162,8 @@ else :
CPPFLAGS = ['-include', 'config.h', '-include', 'cml2Config.h', '-include', 'macros.h', '-include', 'types.h', '-D__KERNEL__'])
kernelComponents = []
for scriptPath in ['src/' + path for path in kernelSConscriptPaths]:
kernelComponents.append(SConscript(scriptPath + '/SConscript', variant_dir = buildDirectory + '/' + scriptPath, duplicate = 0, exports = {'environment': kernelEnvironment}))
startAxf = kernelEnvironment.Program(buildDirectory + '/start.axf', kernelComponents)
Depends(kernelComponents + [startAxf], kernelEnvironment['configFiles'])
startAxf = SConscript('src/SConscript' , variant_dir = buildDirectory + '/kernel' , duplicate = 0, exports = {'environment': kernelEnvironment})
Depends(startAxf, kernelEnvironment['configFiles'])
Alias('kernel', startAxf)
@@ -276,6 +266,13 @@ else :
Alias('final', loader)
# The test does not terminate and Ctrl-C and Ctrl-Z have no effect. Run the job in the background so
# the initiating terminal retains control and allows the process to be killed from this terminal. Add
# the sleep to force SCons to wait until the test has run before it decides all targets are built and
# return to the prompt. Remind the user they have a running process in the background.
Command('runTest', loader, "qemu-system-arm -kernel $SOURCE -nographic -m 128 -M versatilepb & sleep 10 ; echo '####\\n#### You will need to kill the qemu-system-arm process\\n#### that is running in the background.\\n####\\n'")
########## Other rules. ########################
Default(crts.values() + libs.values() + [libelf, startAxf] + tasks + bootdesc + loader)

View File

@@ -19,6 +19,26 @@
Import('environment')
objects = environment.Object(Glob('*.c'))
# The fixed sources and easily selected ones.
Return('objects')
sources = \
Glob('api/*.[cS]') + \
Glob('generic/*.[cS]') + \
Glob('lib/*.[cS]') + \
Glob('arch/' + environment['ARCH'] + '/*.[cS]') + \
Glob('arch/' + environment['ARCH'] + '/' + environment['SUBARCH'] +'/*.[cS]') + \
Glob('glue/' + environment['ARCH'] + '/*.[cS]') + \
Glob('platform/' + environment['PLATFORM'] + '/*.[cS]')
# The not so easily selected sources.
for item in environment['driverList'] :
sources += Glob('drivers/' + item + '/*.[cS]')
objects = environment.Object(sources)
Depends(objects, environment['configFiles'])
startAxf = environment.Program('start.axf', objects)
Depends(startAxf, environment['configFiles'])
Return('startAxf')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c') + Glob('*.S'))
Return('objects')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c') + Glob('*.S'))
Return('objects')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c') + Glob('*.S'))
Return('objects')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c'))
Return('objects')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c'))
Return('objects')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c'))
Return('objects')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c'))
Return('objects')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c'))
Return('objects')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c'))
Return('objects')

View File

@@ -1,24 +0,0 @@
# -*- mode: python; coding: utf-8; -*-
# Codezero -- a microkernel for embedded systems.
#
# Copyright © 2009 B Labs Ltd
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# Author: Russel Winder
Import('environment')
objects = environment.Object(Glob('*.c') + Glob('*.S'))
Return('objects')