mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Bare container correctly autogenerates from `test' sources and builds.
new file: conts/test/SConstruct new file: conts/test/container.c new file: conts/test/include/linker.lds new file: conts/test/include/test.h new file: conts/test/main.c new file: conts/test/src/test.c modified: scripts/bare/bare_generator.py
This commit is contained in:
46
conts/test/SConstruct
Normal file
46
conts/test/SConstruct
Normal file
@@ -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)
|
||||
21
conts/test/container.c
Normal file
21
conts/test/container.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Container entry point for pager
|
||||
*
|
||||
* Copyright (C) 2007-2009 B Labs Ltd.
|
||||
*/
|
||||
|
||||
#include <l4lib/init.h>
|
||||
#include <l4lib/utcb.h>
|
||||
|
||||
|
||||
void main(void);
|
||||
|
||||
void __container_init(void)
|
||||
{
|
||||
/* Generic L4 initialisation */
|
||||
__l4_init();
|
||||
|
||||
/* Entry to main */
|
||||
main();
|
||||
}
|
||||
|
||||
0
conts/test/include/linker.lds
Normal file
0
conts/test/include/linker.lds
Normal file
0
conts/test/include/test.h
Normal file
0
conts/test/include/test.h
Normal file
12
conts/test/main.c
Normal file
12
conts/test/main.c
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Main function for this container
|
||||
*/
|
||||
#include <l4lib/arch/syslib.h>
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
#include <l4/api/space.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
0
conts/test/src/test.c
Normal file
0
conts/test/src/test.c
Normal file
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user