mirror of
https://github.com/drasko/codezero.git
synced 2026-01-17 21:33:15 +01:00
Changes since April
Clean up of build directories. Simplifications to capability model.
This commit is contained in:
143
SConstruct
143
SConstruct
@@ -4,21 +4,23 @@
|
||||
#
|
||||
# Copyright © 2009 B Labs Ltd
|
||||
#
|
||||
import os, shelve
|
||||
import configure
|
||||
from configure import *
|
||||
# This Script is mainly concerned with(in the same order):
|
||||
# 1. Generating linker script for kernel.
|
||||
# 2. Generating cinfo.c file based on generated containers.
|
||||
# 3. Calling scons recursively over various kernel subdirectories.
|
||||
#
|
||||
import os
|
||||
from os.path import *
|
||||
from scripts.config.config_invoke import *
|
||||
|
||||
config = configuration_retrieve()
|
||||
arch = config.arch
|
||||
subarch = config.subarch
|
||||
platform = config.platform
|
||||
gcc_arch_flag = config.gcc_arch_flag
|
||||
all_syms = config.all
|
||||
builddir='build/codezero/'
|
||||
config = configuration_retrieve()
|
||||
arch = config.arch
|
||||
subarch = config.subarch
|
||||
platform = config.platform
|
||||
gcc_arch_flag = config.gcc_arch_flag
|
||||
builddir = join(BUILDDIR, 'kernel')
|
||||
|
||||
|
||||
# Generate kernel linker script at runtime using template file.
|
||||
# Generate kernel linker script at runtime using template file
|
||||
def generate_kernel_linker_script(target, source, env):
|
||||
linker_in = source[0]
|
||||
linker_out = target[0]
|
||||
@@ -28,86 +30,95 @@ def generate_kernel_linker_script(target, source, env):
|
||||
('include', 'l4/platform/'+ platform + '/offsets.h', \
|
||||
'l4/glue/' + arch + '/memlayout.h', linker_in, linker_out)
|
||||
os.system(cmd)
|
||||
|
||||
create_kernel_linker = Command(join(builddir, 'include/l4/arch/arm/linker.lds'), \
|
||||
join(PROJROOT, 'include/l4/arch/arm/linker.lds.in'), \
|
||||
generate_kernel_linker_script)
|
||||
return None
|
||||
|
||||
'''
|
||||
# Generate linker file with physical addresses,
|
||||
# to be used for debug purpose only
|
||||
# Generate kernel linker file with physical addresses
|
||||
# (to be used for debug purpose only)
|
||||
def generate_kernel_phys_linker_script(target, source, env):
|
||||
phys_linker_in = source[0]
|
||||
phys_linker_out = target[0]
|
||||
|
||||
cmd = config.toolchain_kernel + "cpp -D__CPP__ " + \
|
||||
cmd = config.toolchain_kernel + "cpp -D__CPP__ -Dkernel_offset=0 " + \
|
||||
"-I%s -imacros l4/macros.h -imacros %s -imacros %s -C -P %s -o %s" % \
|
||||
('include', 'l4/platform/'+ platform + '/offsets.h', \
|
||||
'l4/glue/' + arch + '/memlayout.h', phys_linker_in, phys_linker_out)
|
||||
os.system(cmd)
|
||||
|
||||
create_kernel_phys_linker = Command(join(builddir, 'include/physlink.lds'), \
|
||||
join(PROJROOT, 'include/l4/arch/arm/linker.lds.in'), \
|
||||
generate_kernel_phys_linker_script)
|
||||
return None
|
||||
'''
|
||||
|
||||
# Kernel build environment
|
||||
env = Environment(CC = config.toolchain_kernel + 'gcc',
|
||||
AR = config.toolchain_kernel + 'ar',
|
||||
RANLIB = config.toolchain_kernel + 'ranlib',
|
||||
# We don't use -nostdinc because sometimes we need standard headers,
|
||||
# such as stdarg.h e.g. for variable args, as in printk().
|
||||
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99', '-Wall', \
|
||||
'-Werror', '-march=' + gcc_arch_flag],
|
||||
LINKFLAGS = ['-nostdlib', '-T' + join(builddir, 'include/l4/arch/arm/linker.lds')],
|
||||
ASFLAGS = ['-D__ASSEMBLY__', '-march=' + gcc_arch_flag],
|
||||
PROGSUFFIX = '.elf', # The suffix to use for final executable
|
||||
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
|
||||
LIBS = 'gcc', # libgcc.a - This is required for division routines.
|
||||
CPPPATH = ["#include"],
|
||||
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h -D__KERNEL__')
|
||||
AR = config.toolchain_kernel + 'ar',
|
||||
RANLIB = config.toolchain_kernel + 'ranlib',
|
||||
# We don't use -nostdinc because sometimes we need standard headers,
|
||||
# such as stdarg.h e.g. for variable args, as in printk().
|
||||
CCFLAGS = ['-g', '-nostdlib', '-ffreestanding', '-std=gnu99',
|
||||
'-Wall', '-Werror', '-march=' + gcc_arch_flag],
|
||||
LINKFLAGS = ['-nostdlib',
|
||||
'-T' + join(builddir, 'include/l4/arch/arm/linker.lds')],
|
||||
ASFLAGS = ['-D__ASSEMBLY__', '-march=' + gcc_arch_flag],
|
||||
# The suffix to use for final executable
|
||||
PROGSUFFIX = '.elf',
|
||||
# Inherit shell path
|
||||
ENV = {'PATH' : os.environ['PATH']},
|
||||
# libgcc.a - This is required for division routines.
|
||||
LIBS = 'gcc',
|
||||
CPPPATH = KERNEL_HEADERS,
|
||||
CPPFLAGS = '-include l4/config.h -include l4/macros.h \
|
||||
-include l4/types.h -D__KERNEL__')
|
||||
|
||||
objects = []
|
||||
|
||||
objects += SConscript('src/generic/SConscript',
|
||||
exports = {'symbols' : all_syms, 'env' : env},
|
||||
duplicate=0, build_dir=builddir + 'generic')
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
build_dir = join(builddir, 'generic'))
|
||||
|
||||
objects += SConscript('src/glue/' + arch + '/SConscript',
|
||||
exports = {'symbols' : all_syms, 'env' : env},
|
||||
duplicate=0, build_dir=builddir + 'glue' + '/' + arch)
|
||||
objects += SConscript(join(join('src/glue', arch), 'SConscript'),
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
build_dir = join(builddir, join('glue',arch)))
|
||||
|
||||
objects += SConscript('src/arch/' + arch + '/SConscript',
|
||||
exports = {'symbols' : all_syms, 'env' : env},
|
||||
duplicate=0, build_dir=builddir + 'arch/' + arch)
|
||||
objects += SConscript(join(join('src/arch', arch), 'SConscript'),
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
build_dir = join(builddir, join('arch', arch)))
|
||||
|
||||
objects += SConscript('src/arch/' + arch + '/' + subarch + '/SConscript',
|
||||
exports = {'symbols' : all_syms, 'env' : env},
|
||||
duplicate=0, build_dir=builddir + 'arch/' + arch + '/' + subarch)
|
||||
objects += SConscript(join(join('src/arch', arch), join(subarch, 'SConscript')),
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
build_dir = join(builddir, join(join('arch',arch), subarch)))
|
||||
|
||||
objects += SConscript('src/lib/SConscript',
|
||||
exports = {'symbols' : all_syms, 'env' : env},
|
||||
duplicate=0, build_dir=builddir + 'lib')
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
build_dir = join(builddir, 'lib'))
|
||||
|
||||
objects += SConscript('src/api/SConscript',
|
||||
exports = {'symbols' : all_syms, 'env' : env},
|
||||
duplicate=0, build_dir=builddir + 'api')
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
build_dir = join(builddir, 'api'))
|
||||
|
||||
objects += SConscript('src/drivers/SConscript',
|
||||
exports = {'symbols' : all_syms, 'env' : env, 'platform' : platform,'bdir' : 'driver/'},
|
||||
duplicate=0, build_dir=builddir)
|
||||
exports = { 'env' : env, 'bdir' : 'driver/'}, duplicate = 0,
|
||||
build_dir = join(builddir, 'driver'))
|
||||
|
||||
objects += SConscript('src/platform/' + platform + '/SConscript',
|
||||
exports = {'symbols' : all_syms, 'env' : env,'platform' : platform}, duplicate=0,
|
||||
build_dir=builddir + 'platform' + '/' +platform)
|
||||
objects += SConscript(join(join('src/platform', platform), 'SConscript'),
|
||||
exports = { 'env' : env }, duplicate = 0,
|
||||
build_dir = join(builddir, join('platform', platform)))
|
||||
|
||||
kernel_elf = env.Program(BUILDDIR + '/kernel.elf', objects)
|
||||
#env_phys = env.Clone()
|
||||
#env_phys.Replace(LINKFLAGS = ['-nostdlib', '-T' + join(builddir, 'include/physlink.lds')])
|
||||
#env_phys.Program(BUILDDIR + '/kernel_phys.elf', objects)
|
||||
|
||||
Alias('kernel', kernel_elf)
|
||||
Depends(kernel_elf, objects)
|
||||
Depends(objects, create_kernel_linker)
|
||||
#Depends(objects, create_kernel_phys_linker)
|
||||
Depends(objects, 'include/l4/config.h')
|
||||
# Add builders for generating kernel linker scripts
|
||||
kernel_linker = Builder(action = generate_kernel_linker_script)
|
||||
env.Append(BUILDERS = {'KERNEL_LINKER' : kernel_linker})
|
||||
env.KERNEL_LINKER(join(builddir, 'include/l4/arch/arm/linker.lds'),
|
||||
[join(PROJROOT, 'include/l4/arch/arm/linker.lds.in'), CONFIG_H])
|
||||
|
||||
'''
|
||||
kernel_phys_linker = Builder(action = generate_kernel_phys_linker_script)
|
||||
env_phys = env.Clone()
|
||||
env_phys.Replace(LINKFLAGS = ['-nostdlib', '-T' + join(builddir, 'include/physlink.lds')])
|
||||
env_phys.Append(BUILDERS = {'KERNEL_LINKER' : kernel_phys_linker})
|
||||
env_phys.KERNEL_LINKER(join(builddir, 'include/physlink.lds'),
|
||||
join(PROJROOT, 'include/l4/arch/arm/linker.lds.in'), CONFIG_H)
|
||||
|
||||
kernel_phys_elf = env_phys.Program(join(BUILDDIR, 'kernel_phys.elf'), objects)
|
||||
Depends(kernel_phys_elf, objects)
|
||||
'''
|
||||
|
||||
kernel_elf = env.Program(KERNEL_ELF, objects)
|
||||
Depends(objects, CONFIG_H)
|
||||
|
||||
Reference in New Issue
Block a user