| 1 |
2 |
drasko |
# -*- mode: python; coding: utf-8; -*-
|
| 2 |
|
|
#
|
| 3 |
|
|
# Codezero -- Virtualization microkernel for embedded systems.
|
| 4 |
|
|
#
|
| 5 |
|
|
# Copyright © 2009 B Labs Ltd
|
| 6 |
|
|
#
|
| 7 |
|
|
import os, shelve, sys
|
| 8 |
|
|
from os.path import *
|
| 9 |
|
|
|
| 10 |
|
|
PROJRELROOT = '../../'
|
| 11 |
|
|
|
| 12 |
|
|
sys.path.append(PROJRELROOT)
|
| 13 |
|
|
sys.path.append('../../../../')
|
| 14 |
|
|
|
| 15 |
|
|
from config.projpaths import *
|
| 16 |
|
|
from config.configuration import *
|
| 17 |
|
|
from config.lib import *
|
| 18 |
|
|
|
| 19 |
|
|
config = configuration_retrieve()
|
| 20 |
|
|
arch = config.arch
|
| 21 |
|
|
gcc_arch_flag = config.gcc_arch_flag
|
| 22 |
|
|
|
| 23 |
|
|
LIBL4_RELDIR = 'conts/libl4'
|
| 24 |
|
|
KERNEL_INCLUDE = join(PROJROOT, 'include')
|
| 25 |
|
|
LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR)
|
| 26 |
|
|
LIBL4_INCLUDE = join(LIBL4_DIR, 'include')
|
| 27 |
|
|
LIBL4_LIBPATH = join(BUILDDIR, LIBL4_RELDIR)
|
| 28 |
|
|
|
| 29 |
|
|
# Locally important paths are here
|
| 30 |
|
|
LIBC_RELDIR = 'conts/libc'
|
| 31 |
|
|
LIBC_DIR = join(PROJROOT, LIBC_RELDIR)
|
| 32 |
|
|
LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR)
|
| 33 |
|
|
LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \
|
| 34 |
|
|
join(LIBC_DIR, 'include/arch' + '/' + arch)]
|
| 35 |
|
|
|
| 36 |
|
|
LIBDEV_RELDIR = 'conts/libdev'
|
| 37 |
|
|
LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR)
|
| 38 |
|
|
LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace')
|
| 39 |
|
|
LIBDEV_INCLUDE = join(LIBDEV_DIR, 'uart/include')
|
| 40 |
|
|
|
| 41 |
|
|
LIBMEM_RELDIR = 'conts/libmem'
|
| 42 |
|
|
LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR)
|
| 43 |
|
|
LIBMEM_LIBPATH = join(BUILDDIR, LIBMEM_RELDIR)
|
| 44 |
|
|
LIBMEM_INCLUDE = LIBMEM_DIR
|
| 45 |
|
|
|
| 46 |
|
|
LIBPOSIX_RELDIR = 'conts/posix/libposix'
|
| 47 |
|
|
LIBPOSIX_DIR = join(PROJROOT, LIBPOSIX_RELDIR)
|
| 48 |
|
|
LIBPOSIX_INCLUDE_SERVER = join(LIBPOSIX_DIR, 'include')
|
| 49 |
|
|
LIBPOSIX_INCLUDE_USERSPACE = join(LIBPOSIX_DIR, 'include/posix')
|
| 50 |
|
|
LIBPOSIX_LIBPATH = join(BUILDDIR, LIBPOSIX_RELDIR)
|
| 51 |
|
|
|
| 52 |
|
|
env = Environment(CC = config.toolchain_userspace + 'gcc',
|
| 53 |
|
|
AR = config.toolchain_userspace + 'ar',
|
| 54 |
|
|
RANLIB = config.toolchain_userspace + 'ranlib',
|
| 55 |
|
|
CCFLAGS = ['-g','-nostdinc', '-nostdlib', '-ffreestanding',
|
| 56 |
|
|
'-march=' + gcc_arch_flag, '-std=gnu99', '-Wall', '-Werror'],
|
| 57 |
|
|
LINKFLAGS = ['-nostdlib'],
|
| 58 |
|
|
ASFLAGS = ['-D__ASSEMBLY__'],
|
| 59 |
|
|
PROGSUFFIX = '.elf',
|
| 60 |
|
|
ENV = {'PATH' : os.environ['PATH']},
|
| 61 |
|
|
LIBS = ['libl4', 'libdev-userspace', 'gcc', 'c-userspace', \
|
| 62 |
|
|
'gcc', 'libmm', 'libmc', 'libmalloc'],
|
| 63 |
|
|
CPPPATH = ['include', LIBDEV_INCLUDE, LIBC_INCLUDE, KERNEL_INCLUDE,
|
| 64 |
|
|
LIBL4_INCLUDE, LIBMEM_INCLUDE, LIBPOSIX_INCLUDE_USERSPACE],
|
| 65 |
|
|
LIBPATH = [LIBDEV_LIBPATH, LIBC_LIBPATH, LIBL4_LIBPATH,
|
| 66 |
|
|
LIBMEM_LIBPATH, LIBPOSIX_LIBPATH],
|
| 67 |
|
|
CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h')
|
| 68 |
|
|
|
| 69 |
|
|
contid = ARGUMENTS.get('cont', '0')
|
| 70 |
|
|
|
| 71 |
|
|
libposix_env = env.Clone()
|
| 72 |
|
|
libposix_env.Replace(CPPPATH = [LIBPOSIX_INCLUDE_USERSPACE, 'include', KERNEL_INCLUDE, LIBL4_INCLUDE, LIBMEM_INCLUDE, LIBC_INCLUDE])
|
| 73 |
|
|
libposix = SConscript('libposix/SConscript', \
|
| 74 |
|
|
exports = { 'config' : config, 'env' : libposix_env, 'contid' : contid}, duplicate = 0, \
|
| 75 |
|
|
variant_dir = join(BUILDDIR, 'conts' + '/posix' + '/libposix'))
|
| 76 |
|
|
|
| 77 |
|
|
mm0_env = env.Clone()
|
| 78 |
|
|
mm0_env.Append(CPPPATH = LIBPOSIX_INCLUDE_SERVER)
|
| 79 |
|
|
mm0 = SConscript('mm0/SConscript', \
|
| 80 |
|
|
exports = { 'config' : config, 'env' : mm0_env, 'contid' : contid }, duplicate = 0, \
|
| 81 |
|
|
variant_dir = join(BUILDDIR, 'cont' + str(contid) + '/posix' + '/mm0'))
|
| 82 |
|
|
|
| 83 |
|
|
rootfs = SConscript('rootfs/SConscript', \
|
| 84 |
|
|
exports = { 'config' : config, 'environment' : env, 'contid' : contid, 'previmage' : mm0 }, duplicate = 0, \
|
| 85 |
|
|
variant_dir = join(BUILDDIR, 'cont' + str(contid) + '/posix' + '/rootfs'))
|
| 86 |
|
|
|
| 87 |
|
|
# No libposix reference because it conflicts with the compiler C library + the cluncky libc we have.
|
| 88 |
|
|
test0_env = env.Clone()
|
| 89 |
|
|
test0_env.Replace(CPPPATH = ['include', KERNEL_INCLUDE, LIBL4_INCLUDE, LIBMEM_INCLUDE, LIBC_INCLUDE, LIBPOSIX_INCLUDE_USERSPACE])
|
| 90 |
|
|
test0 = SConscript('test0/SConscript', \
|
| 91 |
|
|
exports = { 'config' : config, 'environment' : test0_env, 'contid' : contid, 'previmage' : rootfs }, duplicate = 0, \
|
| 92 |
|
|
variant_dir = join(BUILDDIR, 'cont' + str(contid) + '/posix' + '/test0'))
|
| 93 |
|
|
|
| 94 |
|
|
images = [mm0, rootfs, test0]
|
| 95 |
|
|
bootdesc_env = env.Clone()
|
| 96 |
|
|
bootdesc_env['bootdesc_dir'] = 'bootdesc'
|
| 97 |
|
|
|
| 98 |
|
|
bootdesc = SConscript('bootdesc/SConscript', \
|
| 99 |
|
|
exports = { 'config' : config, 'environment' : bootdesc_env, \
|
| 100 |
|
|
'contid' : contid, 'images' : images }, duplicate = 0, \
|
| 101 |
|
|
variant_dir = join(BUILDDIR, 'cont' + str(contid) + '/posix' + '/bootdesc'))
|
| 102 |
|
|
|
| 103 |
|
|
Depends(mm0, libposix)
|
| 104 |
|
|
Depends(test0, libposix)
|
| 105 |
|
|
Depends(rootfs, mm0)
|
| 106 |
|
|
Depends(test0, rootfs)
|
| 107 |
|
|
Depends(bootdesc, [test0, mm0, rootfs])
|
| 108 |
|
|
|
| 109 |
|
|
Alias('libposix', libposix)
|
| 110 |
|
|
Alias('mm0', mm0)
|
| 111 |
|
|
Alias('test0', test0)
|
| 112 |
|
|
Alias('bootdesc', bootdesc)
|
| 113 |
|
|
Alias('rootfs', rootfs)
|
| 114 |
|
|
Default([mm0, libposix, test0, bootdesc])
|