A few changes to allow development on conts/test directory.

Now, bare containers get their files from conts/bare_src instead of conts/test.
test directory will be used for the next generation test programs.
Also bare_src is tracked by git now with a minor mod to .gitignore.
This commit is contained in:
Bora Sahin
2009-10-01 15:43:46 +03:00
parent 4db35ff350
commit afaa1d03a8
9 changed files with 141 additions and 2 deletions

2
.gitignore vendored
View File

@@ -9,7 +9,7 @@ cscope*out
loader/images.S
loader/ksyms.S
tags
conts/bare*
conts/bare[0-9]
conts/linux
src/generic/cinfo.c
.gdbinit

55
conts/bare_src/SConstruct Normal file
View File

@@ -0,0 +1,55 @@
# -*- 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 *
config = configuration_retrieve()
arch = config.arch
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)
# Locally important paths are here
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)]
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", "-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', 'gcc', 'c-userspace'], # libgcc.a - This is required for division routines.
CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBC_INCLUDE],
LIBPATH = [LIBL4_LIBPATH, LIBC_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)
prog = env.Program('main.elf', objs)
Depends(prog, 'include/linker.lds')

View 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();
}

13
conts/bare_src/hello.c Normal file
View File

@@ -0,0 +1,13 @@
/*
* Autogenerated hello world print function
*/
#include <stdio.h>
#include <container.h>
int print_hello_world(void)
{
printf("%s: Hello world from %s!\n", __CONTAINER__, __CONTAINER_NAME__);
return 0;
}

View File

@@ -0,0 +1,34 @@
/*
* Example working linker script for this container.
*
* Copyright (C) 2009 B Labs Ltd.
*/
vma_start = 0x0;
lma_start = 0x1000000;
offset = vma_start - lma_start;
ENTRY(_start)
SECTIONS
{
. = vma_start;
.text : AT (ADDR(.text) - offset) {
/*
* NOTE:
* crt0.S must be in .text.head. This is necessary because
* the kernel does not know any _start address, it assumes
* the start address of pager region as the start address.
*/
*(.text.head) *(.text)
}
.rodata : AT (ADDR(.rodata) - offset) { *(.rodata) }
.rodata1 : AT (ADDR(.rodata1) - offset) { *(.rodata1) }
. = ALIGN(4K);
.data : AT (ADDR(.data) - offset) { *(.data) }
.bss : AT (ADDR(.bss) - offset) { *(.bss) }
. += 0x1000;
. = ALIGN(8);
__stack = .;
}

View File

16
conts/bare_src/main.c Normal file
View File

@@ -0,0 +1,16 @@
/*
* Main function for this container
*/
#include <l4lib/arch/syslib.h>
#include <l4lib/arch/syscalls.h>
#include <l4/api/space.h>
extern int print_hello_world(void);
int main(void)
{
print_hello_world();
return 0;
}

View File

View File

@@ -23,7 +23,7 @@ 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.EXAMPLE_PROJ_SRC_DIR = join(PROJROOT, 'conts/bare_src')
self.main_builder_name = 'build.py'
self.main_configurator_name = 'configure.py'