diff --git a/conts/test/SConstruct b/conts/test/SConstruct new file mode 100644 index 0000000..db8f9f7 --- /dev/null +++ b/conts/test/SConstruct @@ -0,0 +1,46 @@ +# -*- mode: python; coding: utf-8; -*- +# +# Codezero -- Virtualization microkernel for embedded systems. +# +# Copyright © 2009 B Labs Ltd +# +import os, shelve, sys +from os.path import * + +PROJRELROOT = '../..' + +sys.path.append(PROJRELROOT) + +from config.projpaths import * +from config.configuration import * + +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) + +config = configuration_retrieve() + +arch = config.arch + +env = Environment(CC = 'arm-none-linux-gnueabi-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', '-mcpu=arm926ej-s', '-nostdlib', '-ffreestanding', \ + '-std=gnu99', '-Wall', '-Werror'], + LINKFLAGS = ['-nostdlib', '-T' + "include/linker.lds"], + ASFLAGS = ['-D__ASSEMBLY__'], + PROGSUFFIX = '.elf', # The suffix to use for final executable + ENV = {'PATH' : os.environ['PATH']}, # Inherit shell path + LIBS = ['gcc', 'libl4'], # libgcc.a - This is required for division routines. + CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE], + LIBPATH = LIBL4_LIBPATH, + CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h') + +src = Glob('*.[cS]') +src += Glob('src/*.[cS]') + +objs = env.Object(src) + +env.Program('main.elf', objs) diff --git a/conts/test/container.c b/conts/test/container.c new file mode 100644 index 0000000..7bcbf9e --- /dev/null +++ b/conts/test/container.c @@ -0,0 +1,21 @@ +/* + * Container entry point for pager + * + * Copyright (C) 2007-2009 B Labs Ltd. + */ + +#include +#include + + +void main(void); + +void __container_init(void) +{ + /* Generic L4 initialisation */ + __l4_init(); + + /* Entry to main */ + main(); +} + diff --git a/conts/test/include/linker.lds b/conts/test/include/linker.lds new file mode 100644 index 0000000..e69de29 diff --git a/conts/test/include/test.h b/conts/test/include/test.h new file mode 100644 index 0000000..e69de29 diff --git a/conts/test/main.c b/conts/test/main.c new file mode 100644 index 0000000..8397a52 --- /dev/null +++ b/conts/test/main.c @@ -0,0 +1,12 @@ +/* + * Main function for this container + */ +#include +#include +#include + +int main(void) +{ + return 0; +} + diff --git a/conts/test/src/test.c b/conts/test/src/test.c new file mode 100644 index 0000000..e69de29 diff --git a/scripts/bare/bare_generator.py b/scripts/bare/bare_generator.py index 8807f7a..bf237d6 100644 --- a/scripts/bare/bare_generator.py +++ b/scripts/bare/bare_generator.py @@ -22,6 +22,11 @@ class BareContGenerator: def __init__(self): self.CONT_SRC_DIR = '' # Set when container is selected self.BARE_SRC_BASEDIR = join(PROJROOT, 'conts') + self.EXAMPLE_PROJ_SRC_DIR = join(PROJROOT, 'conts/test') + + self.main_builder_name = 'build.py' + self.main_configurator_name = 'configure.py' + self.mailing_list_url = 'http://lists.l4dev.org/mailman/listinfo/codezero-devel' self.build_script_in = join(SCRIPTROOT, 'SConstruct.in') self.build_readme_in = join(SCRIPTROOT, 'build.readme.in') @@ -29,20 +34,16 @@ class BareContGenerator: self.build_script_name = 'SConstruct' self.build_readme_name = 'build.readme' - self.build_desc_name = 'container.description' + self.build_desc_name = 'cont.desc' self.build_script_out = None self.build_readme_out = None self.build_desc_out = None - self.main_builder_name = 'build.py' - self.main_configurator_name = 'configure.py' - self.mailing_list_url = 'http://lists.l4dev.org/mailman/listinfo/codezero-devel' + self.src_main_out = None - def create_bare_dirtree(self, config, cont): - # First, create the container directory structure - os.mkdir(self.CONT_SRC_DIR) - os.mkdir(join(self.CONT_SRC_DIR, 'src')) - os.mkdir(join(self.CONT_SRC_DIR, 'include')) + def create_bare_srctree(self, config, cont): + # First, create the base project directory and sources + shutil.copytree(self.EXAMPLE_PROJ_SRC_DIR, self.CONT_SRC_DIR) def copy_bare_build_desc(self, config, cont): with open(self.build_desc_in) as fin: @@ -63,34 +64,21 @@ class BareContGenerator: self.main_configurator_name, \ self.main_configurator_name)) - def copy_bare_build_script(self, config, cont): - with open(self.build_script_in) as fin: - str = fin.read() - with open(self.build_script_out, 'w+') as fout: - # Make any manipulations here - fout.write(str) - def create_bare_sources(self, config, cont): # Determine container directory name. self.CONT_SRC_DIR = join(self.BARE_SRC_BASEDIR, cont.dirname.lower()) - print "container source dir: " + self.CONT_SRC_DIR - self.build_script_out = join(self.CONT_SRC_DIR, self.build_script_name) self.build_readme_out = join(self.CONT_SRC_DIR, self.build_readme_name) self.build_desc_out = join(self.CONT_SRC_DIR, self.build_desc_name) - self.create_bare_dirtree(config, cont) - self.copy_bare_build_script(config, cont) + self.create_bare_srctree(config, cont) self.copy_bare_build_readme(config, cont) self.copy_bare_build_desc(config, cont) - #copy_bare_sources(config, cont) def check_create_bare_sources(self, config): for cont in config.containers: if cont.type == "bare": - print "Cont type: " + cont.type if not os.path.exists(join(self.BARE_SRC_BASEDIR, cont.dirname)): - print "Creating new at " + join(self.BARE_SRC_BASEDIR, cont.dirname) self.create_bare_sources(config, cont) def bare_container_generate(self, config):