mirror of
https://github.com/drasko/codezero.git
synced 2026-03-22 20:11:51 +01:00
Changes since April
Clean up of build directories. Simplifications to capability model.
This commit is contained in:
@@ -7,64 +7,51 @@
|
||||
import os, shelve, sys
|
||||
from os.path import *
|
||||
|
||||
PROJRELROOT = '../..'
|
||||
CONTS_XXX = '../..'
|
||||
BAREMETAL_CONTS_XXX = '../../..'
|
||||
sys.path.append(CONTS_XXX)
|
||||
sys.path.append(BAREMETAL_CONTS_XXX)
|
||||
|
||||
sys.path.append(PROJRELROOT)
|
||||
|
||||
from config.projpaths import *
|
||||
from config.configuration import *
|
||||
from configure import *
|
||||
from scripts.config.projpaths import *
|
||||
from scripts.config.configuration import *
|
||||
from scripts.conts.containers import *
|
||||
from scripts.config.config_invoke import *
|
||||
|
||||
config = configuration_retrieve()
|
||||
arch = config.arch
|
||||
platform = config.platform
|
||||
gcc_arch_flag = config.gcc_arch_flag
|
||||
|
||||
# Wrapper library for system calls
|
||||
LIBL4_RELDIR = 'conts/libl4'
|
||||
KERNEL_INCLUDE = join(PROJROOT, 'include')
|
||||
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
|
||||
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
|
||||
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
|
||||
cid = int(ARGUMENTS.get('cid', 0))
|
||||
cont = find_container_from_cid(cid)
|
||||
|
||||
# Some user-space libraries
|
||||
LIBC_RELDIR = 'conts/libc'
|
||||
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
|
||||
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
|
||||
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
|
||||
join(LIBC_DIR, 'include/arch' + '/' + arch)]
|
||||
builddir = join(join(BUILDDIR, 'cont') + str(cid), cont.name)
|
||||
|
||||
LIBDEV_RELDIR = 'conts/libdev'
|
||||
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR)
|
||||
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace')
|
||||
LIBDEV_INCLUDE = join(LIBDEV_DIR, 'include')
|
||||
|
||||
LIBMEM_RELDIR = 'conts/libmem'
|
||||
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
||||
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
||||
LIBMEM_INCLUDE = LIBMEM_DIR
|
||||
# linker.lds is generated either in conts/xxx or build/contx/include
|
||||
if cont.duplicate == 0:
|
||||
linker_lds = join(builddir, 'include/linker.lds')
|
||||
else:
|
||||
linker_lds = 'include/linker.lds'
|
||||
|
||||
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
||||
# 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' + "include/linker.lds", "-u_start"],\
|
||||
ASFLAGS = ['-D__ASSEMBLY__'], \
|
||||
PROGSUFFIX = '.elf', # The suffix to use for final executable
|
||||
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
|
||||
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', \
|
||||
'libmm', 'libmc', 'libmalloc', 'gcc', 'c-userspace'],
|
||||
# libgcc.a - This is required for division routines.
|
||||
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, \
|
||||
LIBC_INCLUDE, LIBMEM_INCLUDE],
|
||||
LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
|
||||
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
|
||||
# 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' + linker_lds, '-u_start'],
|
||||
ASFLAGS = ['-D__ASSEMBLY__'],
|
||||
PROGSUFFIX = '.elf', # The suffix to use for final executable
|
||||
ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path
|
||||
LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace',
|
||||
'libmem', 'gcc', 'c-userspace'],
|
||||
# libgcc.a - This is required for division routines.
|
||||
CPPPATH = ["#include", KERNEL_HEADERS, LIBL4_INCLUDE, LIBDEV_INCLUDE,
|
||||
LIBC_INCLUDE, LIBMEM_INCLUDE, join(builddir, 'include')],
|
||||
LIBPATH = [LIBL4_LIBPATH, LIBDEV_USER_LIBPATH, LIBC_LIBPATH, LIBMEM_LIBPATH],
|
||||
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
|
||||
|
||||
src = Glob('*.[cS]')
|
||||
src += Glob('src/*.[cS]')
|
||||
src += Glob('src/arch/*.[cS]')
|
||||
objs = SConscript('SConscript', exports = { 'env' : env },
|
||||
duplicate=0, build_dir = builddir)
|
||||
|
||||
objs = env.Object(src)
|
||||
prog = env.Program('main.elf', objs)
|
||||
Depends(prog, 'include/linker.lds')
|
||||
Depends(objs, join(PROJROOT, CONFIG_H))
|
||||
|
||||
prog = env.Program(join(builddir, 'main.elf'), objs)
|
||||
Depends(prog, linker_lds)
|
||||
|
||||
Reference in New Issue
Block a user