From 9bd5bd889f86bd1885df90e218a34b43bbf9257f Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Thu, 12 Nov 2009 11:27:21 +0530 Subject: [PATCH 1/7] Prevent recompilation of libdev --- SConstruct.loader | 5 +++-- SConstruct.userlibs | 3 ++- conts/examples/example1/SConstruct | 2 +- conts/libc/SConscript | 2 +- conts/posix/SConstruct | 4 ++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/SConstruct.loader b/SConstruct.loader index c5a41c3..4182b01 100644 --- a/SConstruct.loader +++ b/SConstruct.loader @@ -41,12 +41,13 @@ env = Environment(CC = config.kernel_toolchain + 'gcc', PROGSUFFIX = '.elf', ENV = {'PATH' : os.environ['PATH']}, LIBS = ['gcc', 'elf', 'libdev-baremetal', 'c-baremetal', 'gcc'], - LIBPATH = [join('build', LIBELF_PATH), join('build', LIBDEV_PATH), join('build', LIBC_PATH)], + LIBPATH = [join(join('build', LIBDEV_PATH), 'sys-' + variant), \ + join('build', LIBELF_PATH), join('build', LIBC_PATH)], CPPPATH = ['#include', LIBDEV_INCPATH, LIBC_INCPATH, LIBELF_INCPATH]) libdev = SConscript('conts/libdev/SConscript', \ exports = { 'env' : env, 'arch' : arch, 'platform' : platform, 'type' : variant}, \ - duplicate = 0, variant_dir = 'build/conts/libdev') + duplicate = 0, variant_dir = 'build/conts/libdev/sys-' + variant) libc = SConscript('loader/libs/c/SConscript', \ exports = { 'env' : env, 'arch' : arch, 'platform' : platform, 'type' : variant}, \ duplicate = 0, variant_dir = 'build/loader/libs/c') diff --git a/SConstruct.userlibs b/SConstruct.userlibs index 13b537e..f671fe4 100644 --- a/SConstruct.userlibs +++ b/SConstruct.userlibs @@ -34,10 +34,11 @@ libl4 = SConscript('conts/libl4/SConscript', \ e = env.Clone() e.Replace(CPPFLAGS = '') +type = 'userspace' libdev = SConscript('conts/libdev/SConscript', \ exports = { 'env' : e, 'arch' : arch, 'platform' : platform, 'type' : 'userspace' }, \ duplicate = 0, variant_dir = \ - join(BUILDDIR, os.path.relpath('conts/libdev', PROJROOT))) + join(join(BUILDDIR, os.path.relpath('conts/libdev', PROJROOT)), 'sys-' + type)) libc = SConscript('conts/libc/SConscript', \ exports = { 'env' : env, 'arch' : arch, 'platform' : platform, 'type' : 'userspace' }, \ diff --git a/conts/examples/example1/SConstruct b/conts/examples/example1/SConstruct index 2130add..d855e61 100644 --- a/conts/examples/example1/SConstruct +++ b/conts/examples/example1/SConstruct @@ -34,7 +34,7 @@ LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \ LIBDEV_RELDIR = 'conts/libdev' LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) -LIBDEV_LIBPATH = join(BUILDDIR, LIBDEV_RELDIR) +LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')] LIBMEM_RELDIR = 'conts/libmem' diff --git a/conts/libc/SConscript b/conts/libc/SConscript index e0136c8..be39cd2 100644 --- a/conts/libc/SConscript +++ b/conts/libc/SConscript @@ -25,7 +25,7 @@ LIBDEV_INCPATH = [LIBDEV_PATH + '/uart/include'] e = env.Clone() e.Append(CPPPATH = ['include', 'include/sys-' + variant + '/arch-' + arch, LIBDEV_INCPATH], - CCFLAGS = ['-nostdinc', '-DVARIANT_' + variant.upper()]) + CCFLAGS = '-nostdinc') source = \ Glob('src/*.c') + \ diff --git a/conts/posix/SConstruct b/conts/posix/SConstruct index 1471be5..675f95e 100644 --- a/conts/posix/SConstruct +++ b/conts/posix/SConstruct @@ -34,8 +34,8 @@ LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \ LIBDEV_RELDIR = 'conts/libdev' LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) -LIBDEV_LIBPATH = join(BUILDDIR, LIBDEV_RELDIR) -LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')] +LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') +LIBDEV_INCLUDE = join(LIBDEV_DIR, 'uart/include') LIBMEM_RELDIR = 'conts/libmem' LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR) From f5faa71e89ee8e4722a4d290f0fd2699b6ba32f8 Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Thu, 19 Nov 2009 21:27:49 +0530 Subject: [PATCH 2/7] Libdev added in example0 --- conts/examples/example0/SConstruct | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/conts/examples/example0/SConstruct b/conts/examples/example0/SConstruct index 23e059c..67600e7 100644 --- a/conts/examples/example0/SConstruct +++ b/conts/examples/example0/SConstruct @@ -32,6 +32,10 @@ LIBC_LIBPATH = join(BUILDDIR, LIBC_RELDIR) LIBC_INCLUDE = [join(LIBC_DIR, 'include'), \ join(LIBC_DIR, 'include/arch' + '/' + arch)] +LIBDEV_RELDIR = 'conts/libdev' +LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) +LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') +LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')] env = Environment(CC = 'arm-none-linux-gnueabi-gcc', # We don't use -nostdinc because sometimes we need standard headers, @@ -42,9 +46,9 @@ env = Environment(CC = 'arm-none-linux-gnueabi-gcc', 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], + LIBS = ['gcc', 'libl4', 'c-userspace', 'libdev-userspace', 'gcc', 'c-userspace'], # libgcc.a - This is required for division routines. + CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, LIBC_INCLUDE], + LIBPATH = [LIBL4_LIBPATH, LIBDEV_LIBPATH, LIBC_LIBPATH], CPPFLAGS = '-include l4/config.h -include l4/macros.h -include l4/types.h') src = Glob('*.[cS]') From 1384701a53ffeab37e3a200a3a876716b8476455 Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Thu, 19 Nov 2009 21:32:16 +0530 Subject: [PATCH 3/7] Corrected value assignment error in stack_used variable --- conts/posix/mm0/mm/task.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conts/posix/mm0/mm/task.c b/conts/posix/mm0/mm/task.c index 2e877f7..df117f0 100644 --- a/conts/posix/mm0/mm/task.c +++ b/conts/posix/mm0/mm/task.c @@ -520,18 +520,18 @@ int task_map_stack(struct vm_file *f, struct exec_file_desc *efd, struct tcb *task, struct args_struct *args, struct args_struct *env) { - unsigned long stack_used; - unsigned long arg_pages = __pfn(page_align_up(stack_used)); - char *args_on_stack; - void *mapped; - /* * Stack contains: args, environment, argc integer, * 2 Null integers as terminators. * * It also needs to be 8-byte aligned. */ - stack_used = align_up(args->size + env->size + sizeof(int) * 3 + 8, 8); + + unsigned long stack_used = align_up(args->size + env->size + sizeof(int) * 3 + 8, 8); + unsigned long arg_pages = __pfn(page_align_up(stack_used)); + char *args_on_stack; + void *mapped; + task->stack_end = __pfn_to_addr(cont_mem_regions.task->end); task->stack_start = __pfn_to_addr(cont_mem_regions.task->end) - DEFAULT_STACK_SIZE; task->args_end = task->stack_end; From 352d75f66c1ac20aa0ff9d19d2190aa31dcf1074 Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Thu, 19 Nov 2009 23:26:00 +0530 Subject: [PATCH 4/7] Name of example container changed to Baremetal --- config/cml/container_ruleset.template | 47 ++++++++--------- config/configuration.py | 10 ++-- configure.py | 8 +-- .../baremetal0}/SConstruct | 0 .../baremetal0}/container.c | 0 .../baremetal0}/include/test.h | 0 .../example0 => baremetal/baremetal0}/main.c | 0 .../baremetal0}/src/test.c | 0 .../baremetal1}/SConstruct | 0 .../baremetal1}/container.c | 0 .../example1 => baremetal/baremetal1}/hello.c | 0 .../baremetal1}/include/test.h | 0 .../example1 => baremetal/baremetal1}/main.c | 0 .../baremetal1}/src/test.c | 0 .../baremetal2}/SConstruct | 0 .../baremetal2}/container.c | 0 .../example2 => baremetal/baremetal2}/main.c | 0 scripts/{examples => baremetal}/__init__.py | 0 .../baremetal_generator.py} | 50 +++++++++---------- .../files/SConstruct.in | 0 .../files/build.readme.in | 0 .../files/container.desc.in | 0 .../files/container.h.in | 0 .../files/linker.lds.in | 0 scripts/conts/containers.py | 2 +- 25 files changed, 59 insertions(+), 58 deletions(-) rename conts/{examples/example0 => baremetal/baremetal0}/SConstruct (100%) rename conts/{examples/example0 => baremetal/baremetal0}/container.c (100%) rename conts/{examples/example0 => baremetal/baremetal0}/include/test.h (100%) rename conts/{examples/example0 => baremetal/baremetal0}/main.c (100%) rename conts/{examples/example0 => baremetal/baremetal0}/src/test.c (100%) rename conts/{examples/example1 => baremetal/baremetal1}/SConstruct (100%) rename conts/{examples/example1 => baremetal/baremetal1}/container.c (100%) rename conts/{examples/example1 => baremetal/baremetal1}/hello.c (100%) rename conts/{examples/example1 => baremetal/baremetal1}/include/test.h (100%) rename conts/{examples/example1 => baremetal/baremetal1}/main.c (100%) rename conts/{examples/example1 => baremetal/baremetal1}/src/test.c (100%) rename conts/{examples/example2 => baremetal/baremetal2}/SConstruct (100%) rename conts/{examples/example2 => baremetal/baremetal2}/container.c (100%) rename conts/{examples/example2 => baremetal/baremetal2}/main.c (100%) rename scripts/{examples => baremetal}/__init__.py (100%) rename scripts/{examples/examples_generator.py => baremetal/baremetal_generator.py} (77%) rename scripts/{examples => baremetal}/files/SConstruct.in (100%) rename scripts/{examples => baremetal}/files/build.readme.in (100%) rename scripts/{examples => baremetal}/files/container.desc.in (100%) rename scripts/{examples => baremetal}/files/container.h.in (100%) rename scripts/{examples => baremetal}/files/linker.lds.in (100%) diff --git a/config/cml/container_ruleset.template b/config/cml/container_ruleset.template index f911d9b..0f49a30 100644 --- a/config/cml/container_ruleset.template +++ b/config/cml/container_ruleset.template @@ -1,9 +1,9 @@ symbols -CONT%(cn)d_TYPE_LINUX 'Linux Container' -CONT%(cn)d_TYPE_EXAMPLES 'Examples Container' -CONT%(cn)d_TYPE_POSIX 'Codezero POSIX Services' -CONT%(cn)d_TYPE_TEST 'Test Container' -CONT%(cn)d_OPT_NAME 'Container Name' +CONT%(cn)d_TYPE_LINUX 'Linux Container' +CONT%(cn)d_TYPE_BAREMETAL 'Barebones Container' +CONT%(cn)d_TYPE_POSIX 'POSIX Container' +CONT%(cn)d_TYPE_TEST 'Test Container' +CONT%(cn)d_OPT_NAME 'Container Name' CONT%(cn)d_PHYSMEM_REGIONS 'Container %(cn)d Number of Physical Regions' CONT%(cn)d_PHYS0_START 'Container %(cn)d Physical Region 0 Start Address' @@ -139,12 +139,13 @@ default CONT%(cn)d_VIRT4_END from 0xe0000000 default CONT%(cn)d_VIRT5_START from 0xe0000000 default CONT%(cn)d_VIRT5_END from 0xf0000000 -default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_EXAMPLES==y) ? "example%(cn)d" : ((CONT%(cn)d_TYPE_TEST==y) ? "test%(cn)d" : "posix%(cn)d")) +default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_BAREMETAL==y) ? "baremetal%(cn)d" : ((CONT%(cn)d_TYPE_TEST==y) ? "test%(cn)d" : "posix%(cn)d")) -when CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_default_pager_params cont%(cn)d_posix_pager_params cont%(cn)d_examples_params -when CONT%(cn)d_TYPE_EXAMPLES==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params -when CONT%(cn)d_TYPE_TEST==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params cont%(cn)d_examples_params -when CONT%(cn)d_TYPE_POSIX==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_examples_params +when CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_default_pager_params cont%(cn)d_posix_pager_params +when CONT%(cn)d_TYPE_BAREMETAL==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params +when CONT%(cn)d_TYPE_TEST==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params +when CONT%(cn)d_TYPE_POSIX==y suppress cont%(cn)d_linux_pager_params +unless CONT%(cn)d_TYPE_BAREMETAL==y suppress cont%(cn)d_baremetal_params symbols cont%(cn)d_menu 'Container %(cn)d Parameters' @@ -157,17 +158,17 @@ cont%(cn)d_linux_pager_params 'Container %(cn)d Linux Pager Parameters' cont%(cn)d_default_pager_params 'Container %(cn)d Default Pager Parameters' cont%(cn)d_posix_pager_params 'Container %(cn)d POSIX Pager Parameters' -cont%(cn)d_examples_params 'Example Applications List' -CONT%(cn)d_EXAMPLE_APP0 'Empty Application' -CONT%(cn)d_EXAMPLE_APP1 'Hello World' -CONT%(cn)d_EXAMPLE_APP2 'Thread Library Demo' +cont%(cn)d_baremetal_params 'Baremetal Applications List' +CONT%(cn)d_BAREMETAL_APP0 'Empty Application' +CONT%(cn)d_BAREMETAL_APP1 'Hello World' +CONT%(cn)d_BAREMETAL_APP2 'Thread Library Demo' -choices cont%(cn)d_examples_params - CONT%(cn)d_EXAMPLE_APP0 - CONT%(cn)d_EXAMPLE_APP1 - CONT%(cn)d_EXAMPLE_APP2 - default CONT%(cn)d_EXAMPLE_APP0 +choices cont%(cn)d_baremetal_params + CONT%(cn)d_BAREMETAL_APP0 + CONT%(cn)d_BAREMETAL_APP1 + CONT%(cn)d_BAREMETAL_APP2 + default CONT%(cn)d_BAREMETAL_APP0 menu cont%(cn)d_default_pager_params CONT%(cn)d_PAGER_LMA@ @@ -637,7 +638,7 @@ menu cont%(cn)d_capability_list menu container%(cn)d_options CONT%(cn)d_OPT_NAME$ - cont%(cn)d_examples_params + cont%(cn)d_baremetal_params cont%(cn)d_linux_pager_params cont%(cn)d_default_pager_params cont%(cn)d_posix_pager_params @@ -646,11 +647,11 @@ menu container%(cn)d_options cont%(cn)d_capability_list choices container%(cn)d_type - CONT%(cn)d_TYPE_EXAMPLES - CONT%(cn)d_TYPE_LINUX + CONT%(cn)d_TYPE_BAREMETAL CONT%(cn)d_TYPE_POSIX + CONT%(cn)d_TYPE_LINUX CONT%(cn)d_TYPE_TEST - default CONT%(cn)d_TYPE_EXAMPLES + default CONT%(cn)d_TYPE_BAREMETAL menu cont%(cn)d_menu container%(cn)d_type diff --git a/config/configuration.py b/config/configuration.py index 6bf498c..1e4b37e 100644 --- a/config/configuration.py +++ b/config/configuration.py @@ -12,7 +12,7 @@ class Container: self.name = None self.type = None self.id = id - self.example_id = 0 + self.baremetal_id = 0 self.pager_lma = 0 self.pager_vma = 0 self.pager_size = 0 @@ -173,9 +173,9 @@ class configuration: dirname = val[1:-1].lower() self.containers[id].dirname = dirname self.containers[id].name = dirname - elif param[:len("EXAMPLE_APP")] == "EXAMPLE_APP": + elif param[:len("BAREMETAL_APP")] == "BAREMETAL_APP": param1 = param.split("_", 1) - self.containers[id].example_id = param1[1][-1:] + self.containers[id].baremetal_id = param1[1][-1:] elif param[:len("CAP_")] == "CAP_": prefix, param_rest = param.split('_', 1) prepare_capability(self.containers[id], param_rest, val) @@ -186,8 +186,8 @@ class configuration: self.containers[id].type = "linux" elif param2 == "POSIX": self.containers[id].type = "posix" - elif param2 == "EXAMPLES": - self.containers[id].type = "examples" + elif param2 == "BAREMETAL": + self.containers[id].type = "baremetal" elif param2 == "TEST": self.containers[id].type = "test" # Extract parameters for containers diff --git a/configure.py b/configure.py index 5ab1410..461b673 100755 --- a/configure.py +++ b/configure.py @@ -4,7 +4,7 @@ import os, sys, shelve, shutil from os.path import join from config.projpaths import * from config.configuration import * -from scripts.examples.examples_generator import * +from scripts.baremetal.baremetal_generator import * from scripts.kernel.generate_kernel_cinfo import * from scripts.cml.generate_container_cml import * from optparse import OptionParser @@ -184,9 +184,9 @@ def configure_system(options, args): configuration_save(config) - # Generate example container files if new ones defined - examples_cont_gen = ExamplesContGenerator() - examples_cont_gen.examples_container_generate(config) + # Generate baremetal container files if new ones defined + baremetal_cont_gen = BaremetalContGenerator() + baremetal_cont_gen.baremetal_container_generate(config) # Print out the configuration if asked if options.print_config: diff --git a/conts/examples/example0/SConstruct b/conts/baremetal/baremetal0/SConstruct similarity index 100% rename from conts/examples/example0/SConstruct rename to conts/baremetal/baremetal0/SConstruct diff --git a/conts/examples/example0/container.c b/conts/baremetal/baremetal0/container.c similarity index 100% rename from conts/examples/example0/container.c rename to conts/baremetal/baremetal0/container.c diff --git a/conts/examples/example0/include/test.h b/conts/baremetal/baremetal0/include/test.h similarity index 100% rename from conts/examples/example0/include/test.h rename to conts/baremetal/baremetal0/include/test.h diff --git a/conts/examples/example0/main.c b/conts/baremetal/baremetal0/main.c similarity index 100% rename from conts/examples/example0/main.c rename to conts/baremetal/baremetal0/main.c diff --git a/conts/examples/example0/src/test.c b/conts/baremetal/baremetal0/src/test.c similarity index 100% rename from conts/examples/example0/src/test.c rename to conts/baremetal/baremetal0/src/test.c diff --git a/conts/examples/example1/SConstruct b/conts/baremetal/baremetal1/SConstruct similarity index 100% rename from conts/examples/example1/SConstruct rename to conts/baremetal/baremetal1/SConstruct diff --git a/conts/examples/example1/container.c b/conts/baremetal/baremetal1/container.c similarity index 100% rename from conts/examples/example1/container.c rename to conts/baremetal/baremetal1/container.c diff --git a/conts/examples/example1/hello.c b/conts/baremetal/baremetal1/hello.c similarity index 100% rename from conts/examples/example1/hello.c rename to conts/baremetal/baremetal1/hello.c diff --git a/conts/examples/example1/include/test.h b/conts/baremetal/baremetal1/include/test.h similarity index 100% rename from conts/examples/example1/include/test.h rename to conts/baremetal/baremetal1/include/test.h diff --git a/conts/examples/example1/main.c b/conts/baremetal/baremetal1/main.c similarity index 100% rename from conts/examples/example1/main.c rename to conts/baremetal/baremetal1/main.c diff --git a/conts/examples/example1/src/test.c b/conts/baremetal/baremetal1/src/test.c similarity index 100% rename from conts/examples/example1/src/test.c rename to conts/baremetal/baremetal1/src/test.c diff --git a/conts/examples/example2/SConstruct b/conts/baremetal/baremetal2/SConstruct similarity index 100% rename from conts/examples/example2/SConstruct rename to conts/baremetal/baremetal2/SConstruct diff --git a/conts/examples/example2/container.c b/conts/baremetal/baremetal2/container.c similarity index 100% rename from conts/examples/example2/container.c rename to conts/baremetal/baremetal2/container.c diff --git a/conts/examples/example2/main.c b/conts/baremetal/baremetal2/main.c similarity index 100% rename from conts/examples/example2/main.c rename to conts/baremetal/baremetal2/main.c diff --git a/scripts/examples/__init__.py b/scripts/baremetal/__init__.py similarity index 100% rename from scripts/examples/__init__.py rename to scripts/baremetal/__init__.py diff --git a/scripts/examples/examples_generator.py b/scripts/baremetal/baremetal_generator.py similarity index 77% rename from scripts/examples/examples_generator.py rename to scripts/baremetal/baremetal_generator.py index 17663d7..2702720 100755 --- a/scripts/examples/examples_generator.py +++ b/scripts/baremetal/baremetal_generator.py @@ -19,11 +19,11 @@ from config.projpaths import * from config.configuration import * from config.lib import * -class ExamplesContGenerator: +class BaremetalContGenerator: def __init__(self): self.CONT_SRC_DIR = '' # Set when container is selected - self.EXAMPLES_SRC_BASEDIR = join(PROJROOT, 'conts') - self.EXAMPLES_PROJ_SRC_DIR = join(PROJROOT, 'conts/examples') + self.BAREMETAL_SRC_BASEDIR = join(PROJROOT, 'conts') + self.BAREMETAL_PROJ_SRC_DIR = join(PROJROOT, 'conts/baremetal') self.main_builder_name = 'build.py' self.main_configurator_name = 'configure.py' @@ -47,12 +47,12 @@ class ExamplesContGenerator: self.build_desc_out = None self.src_main_out = None - def create_examples_srctree(self, config, cont): + def create_baremetal_srctree(self, config, cont): # First, create the base project directory and sources - str = 'example' + cont.example_id - shutil.copytree(join(self.EXAMPLES_PROJ_SRC_DIR, str), self.CONT_SRC_DIR) + str = 'baremetal' + cont.baremetal_id + shutil.copytree(join(self.BAREMETAL_PROJ_SRC_DIR, str), self.CONT_SRC_DIR) - def copy_examples_build_desc(self, config, cont): + def copy_baremetal_build_desc(self, config, cont): id_header = '[Container ID]\n' type_header = '\n[Container Type]\n' name_header = '\n[Container Name]\n' @@ -79,7 +79,7 @@ class ExamplesContGenerator: fout.write(pager_physmem_header % ireg) fout.write('\t' + cont.physmem["START"][ireg] + ' - ' + cont.physmem["END"][ireg] + '\n') - def copy_examples_build_readme(self, config, cont): + def copy_baremetal_build_readme(self, config, cont): with open(self.build_readme_in) as fin: str = fin.read() with open(self.build_readme_out, 'w+') as fout: @@ -91,30 +91,30 @@ class ExamplesContGenerator: self.main_configurator_name, \ self.main_configurator_name)) - def copy_examples_container_h(self, config, cont): + def copy_baremetal_container_h(self, config, cont): with open(self.container_h_in) as fin: str = fin.read() with open(self.container_h_out, 'w+') as fout: # Make any manipulations here fout.write(str % (cont.name, cont.id, cont.id)) - def create_examples_sources(self, config, cont): - self.create_examples_srctree(config, cont) - self.copy_examples_build_readme(config, cont) - self.copy_examples_build_desc(config, cont) + def create_baremetal_sources(self, config, cont): + self.create_baremetal_srctree(config, cont) + self.copy_baremetal_build_readme(config, cont) + self.copy_baremetal_build_desc(config, cont) self.generate_linker_script(config, cont) - self.copy_examples_container_h(config, cont) + self.copy_baremetal_container_h(config, cont) def update_configuration(self, config, cont): - self.copy_examples_build_desc(config, cont) + self.copy_baremetal_build_desc(config, cont) self.generate_linker_script(config, cont) - self.copy_examples_container_h(config, cont) + self.copy_baremetal_container_h(config, cont) - def check_create_examples_sources(self, config): + def check_create_baremetal_sources(self, config): for cont in config.containers: - if cont.type == "examples": + if cont.type == "baremetal": # Determine container directory name. - self.CONT_SRC_DIR = join(self.EXAMPLES_SRC_BASEDIR, cont.dirname.lower()) + self.CONT_SRC_DIR = join(self.BAREMETAL_SRC_BASEDIR, cont.dirname.lower()) 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.linker_lds_out = join(join(self.CONT_SRC_DIR, 'include'), \ @@ -122,8 +122,8 @@ class ExamplesContGenerator: self.container_h_out = join(join(self.CONT_SRC_DIR, 'include'), \ self.container_h_name) - if not os.path.exists(join(self.EXAMPLES_SRC_BASEDIR, cont.dirname)): - self.create_examples_sources(config, cont) + if not os.path.exists(join(self.BAREMETAL_SRC_BASEDIR, cont.dirname)): + self.create_baremetal_sources(config, cont) else: # Don't create new sources but update configuration self.update_configuration(config, cont) @@ -135,12 +135,12 @@ class ExamplesContGenerator: fout.write(str % (conv_hex(cont.pager_vma), \ conv_hex(cont.pager_lma))) - def examples_container_generate(self, config): - self.check_create_examples_sources(config) + def baremetal_container_generate(self, config): + self.check_create_baremetal_sources(config) if __name__ == "__main__": config = configuration_retrieve() config.config_print() - examples_cont = ExamplesContGenerator() - examples_cont.examples_container_generate(config) + baremetal_cont = BaremetalContGenerator() + baremetal_cont.baremetal_container_generate(config) diff --git a/scripts/examples/files/SConstruct.in b/scripts/baremetal/files/SConstruct.in similarity index 100% rename from scripts/examples/files/SConstruct.in rename to scripts/baremetal/files/SConstruct.in diff --git a/scripts/examples/files/build.readme.in b/scripts/baremetal/files/build.readme.in similarity index 100% rename from scripts/examples/files/build.readme.in rename to scripts/baremetal/files/build.readme.in diff --git a/scripts/examples/files/container.desc.in b/scripts/baremetal/files/container.desc.in similarity index 100% rename from scripts/examples/files/container.desc.in rename to scripts/baremetal/files/container.desc.in diff --git a/scripts/examples/files/container.h.in b/scripts/baremetal/files/container.h.in similarity index 100% rename from scripts/examples/files/container.h.in rename to scripts/baremetal/files/container.h.in diff --git a/scripts/examples/files/linker.lds.in b/scripts/baremetal/files/linker.lds.in similarity index 100% rename from scripts/examples/files/linker.lds.in rename to scripts/baremetal/files/linker.lds.in diff --git a/scripts/conts/containers.py b/scripts/conts/containers.py index f42bca9..dc54a65 100755 --- a/scripts/conts/containers.py +++ b/scripts/conts/containers.py @@ -124,7 +124,7 @@ def build_all_containers(): if container.type == 'linux': pass cont_images.append(build_linux_container(config, projpaths, container)) - elif container.type == 'examples': + elif container.type == 'baremetal': cont_images.append(build_default_container(config, projpaths, container)) elif container.type == 'posix': cont_images.append(build_posix_container(config, projpaths, container)) From 8a7b9dbcdf770e030598e4bfbc88093a7d3adc36 Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Fri, 20 Nov 2009 00:06:03 +0530 Subject: [PATCH 5/7] Integrated Test Container inside Baremetal container. --- config/cml/container_ruleset.template | 8 +- config/cml/examples/test/config.cml | 113 ------------------ config/configuration.py | 2 - config/projpaths.py | 2 - conts/baremetal/baremetal3/SConstruct | 59 +++++++++ .../baremetal3}/container.c | 2 +- .../baremetal3}/include/capability.h | 0 .../baremetal3}/include/tests.h | 0 .../baremetal3}/include/thread.h | 0 conts/{test => baremetal/baremetal3}/main.c | 0 conts/{test => baremetal/baremetal3}/src/arch | 0 .../baremetal3}/src/arch-arm/new_thread.S | 0 .../baremetal3}/src/capability.c | 0 .../baremetal3}/src/captest.c | 0 .../baremetal3}/src/example.c | 0 .../baremetal3}/src/thread.c | 0 conts/test/SConscript | 44 ------- conts/test/SConstruct | 56 --------- conts/test/include/container.h.in | 13 -- conts/test/include/linker.lds.in | 29 ----- scripts/conts/containers.py | 23 ---- 21 files changed, 63 insertions(+), 288 deletions(-) delete mode 100644 config/cml/examples/test/config.cml create mode 100644 conts/baremetal/baremetal3/SConstruct rename conts/{test => baremetal/baremetal3}/container.c (91%) rename conts/{test => baremetal/baremetal3}/include/capability.h (100%) rename conts/{test => baremetal/baremetal3}/include/tests.h (100%) rename conts/{test => baremetal/baremetal3}/include/thread.h (100%) rename conts/{test => baremetal/baremetal3}/main.c (100%) rename conts/{test => baremetal/baremetal3}/src/arch (100%) rename conts/{test => baremetal/baremetal3}/src/arch-arm/new_thread.S (100%) rename conts/{test => baremetal/baremetal3}/src/capability.c (100%) rename conts/{test => baremetal/baremetal3}/src/captest.c (100%) rename conts/{test => baremetal/baremetal3}/src/example.c (100%) rename conts/{test => baremetal/baremetal3}/src/thread.c (100%) delete mode 100644 conts/test/SConscript delete mode 100644 conts/test/SConstruct delete mode 100644 conts/test/include/container.h.in delete mode 100644 conts/test/include/linker.lds.in diff --git a/config/cml/container_ruleset.template b/config/cml/container_ruleset.template index 0f49a30..6ade069 100644 --- a/config/cml/container_ruleset.template +++ b/config/cml/container_ruleset.template @@ -2,7 +2,6 @@ symbols CONT%(cn)d_TYPE_LINUX 'Linux Container' CONT%(cn)d_TYPE_BAREMETAL 'Barebones Container' CONT%(cn)d_TYPE_POSIX 'POSIX Container' -CONT%(cn)d_TYPE_TEST 'Test Container' CONT%(cn)d_OPT_NAME 'Container Name' CONT%(cn)d_PHYSMEM_REGIONS 'Container %(cn)d Number of Physical Regions' @@ -139,11 +138,10 @@ default CONT%(cn)d_VIRT4_END from 0xe0000000 default CONT%(cn)d_VIRT5_START from 0xe0000000 default CONT%(cn)d_VIRT5_END from 0xf0000000 -default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_BAREMETAL==y) ? "baremetal%(cn)d" : ((CONT%(cn)d_TYPE_TEST==y) ? "test%(cn)d" : "posix%(cn)d")) +default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_BAREMETAL==y) ? "baremetal%(cn)d" : "posix%(cn)d") when CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_default_pager_params cont%(cn)d_posix_pager_params when CONT%(cn)d_TYPE_BAREMETAL==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params -when CONT%(cn)d_TYPE_TEST==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params when CONT%(cn)d_TYPE_POSIX==y suppress cont%(cn)d_linux_pager_params unless CONT%(cn)d_TYPE_BAREMETAL==y suppress cont%(cn)d_baremetal_params @@ -162,12 +160,13 @@ cont%(cn)d_baremetal_params 'Baremetal Applications List' CONT%(cn)d_BAREMETAL_APP0 'Empty Application' CONT%(cn)d_BAREMETAL_APP1 'Hello World' CONT%(cn)d_BAREMETAL_APP2 'Thread Library Demo' - +CONT%(cn)d_BAREMETAL_APP3 'Test Application' choices cont%(cn)d_baremetal_params CONT%(cn)d_BAREMETAL_APP0 CONT%(cn)d_BAREMETAL_APP1 CONT%(cn)d_BAREMETAL_APP2 + CONT%(cn)d_BAREMETAL_APP3 default CONT%(cn)d_BAREMETAL_APP0 menu cont%(cn)d_default_pager_params @@ -650,7 +649,6 @@ choices container%(cn)d_type CONT%(cn)d_TYPE_BAREMETAL CONT%(cn)d_TYPE_POSIX CONT%(cn)d_TYPE_LINUX - CONT%(cn)d_TYPE_TEST default CONT%(cn)d_TYPE_BAREMETAL menu cont%(cn)d_menu diff --git a/config/cml/examples/test/config.cml b/config/cml/examples/test/config.cml deleted file mode 100644 index 83a7397..0000000 --- a/config/cml/examples/test/config.cml +++ /dev/null @@ -1,113 +0,0 @@ -# -# Automatically generated, don't edit -# -# Generated on: bahadir-laptop -# At: Fri, 23 Oct 2009 09:24:42 +0000 -# Linux version 2.6.24-22-generic (buildd@vernadsky) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #1 SMP Mon Nov 24 18:32:42 UTC 2008 - -# -# Codezero Microkernel Configurator -# - -# -# Main architecture -# -CONFIG_ARCH_ARM=y - - -# -# ARM Architecture Configuration -# - -# -# ARM Architecture Family -# -CONFIG_SUBARCH_V5=y -CONFIG_SUBARCH_V6=n -CONFIG_SUBARCH_V7=n - - -# -# ARM CPU type -# - -# -# ARM Processor Type -# -CONFIG_CPU_ARM926=y - - - -# -# ARM Platform Type -# - -# -# ARM Platform Type -# -CONFIG_PLATFORM_EB=n -CONFIG_PLATFORM_AB926=n -CONFIG_PLATFORM_PB926=y - - - -# -# Platform Drivers -# -CONFIG_DRIVER_UART_PL011=y -CONFIG_DRIVER_TIMER_SP804=y -CONFIG_DRIVER_IRQ_PL190=y - - -CONFIG_CONTAINERS=1 - -# -# Container Setup -# - -# -# Container 0 Parameters -# - -# -# Container 0 Type -# -CONFIG_CONT0_TYPE_LINUX=n -CONFIG_CONT0_TYPE_BARE=n -CONFIG_CONT0_TYPE_POSIX=n -CONFIG_CONT0_TYPE_TEST=y - - -# -# Container 0 Options -# -CONFIG_CONT0_OPT_NAME="caps" - -# -# Container 0 Default Pager Parameters -# -CONFIG_CONT0_PAGER_LMA=0x40000 -CONFIG_CONT0_PAGER_VMA=0x10000000 - - -# -# Container 0 Physical Memory Regions -# -CONFIG_CONT0_PHYSMEM_REGIONS=1 -CONFIG_CONT0_PHYS0_START=0x40000 -CONFIG_CONT0_PHYS0_END=0x200000 - - -# -# Container 0 Virtual Memory Regions -# -CONFIG_CONT0_VIRTMEM_REGIONS=1 -CONFIG_CONT0_VIRT0_START=0x10000000 -CONFIG_CONT0_VIRT0_END=0x20000000 - - - - - -# -# That's all, folks! diff --git a/config/configuration.py b/config/configuration.py index 1e4b37e..f8c2fdc 100644 --- a/config/configuration.py +++ b/config/configuration.py @@ -188,8 +188,6 @@ class configuration: self.containers[id].type = "posix" elif param2 == "BAREMETAL": self.containers[id].type = "baremetal" - elif param2 == "TEST": - self.containers[id].type = "test" # Extract parameters for containers def get_container_parameters(self, name, val): matchobj = re.match(r"(CONFIG_CONT){1}([0-9]){1}(\w+)", name) diff --git a/config/projpaths.py b/config/projpaths.py index d2af30d..60cdd49 100644 --- a/config/projpaths.py +++ b/config/projpaths.py @@ -30,8 +30,6 @@ LINUX_ATAGSDIR = join(LINUXDIR, 'atags') POSIXDIR = join(PROJROOT, 'conts/posix') POSIX_BOOTDESCDIR = join(POSIXDIR, 'bootdesc') -TESTDIR = join(PROJROOT, 'conts/test') - projpaths = { \ 'LINUX_ATAGSDIR' : LINUX_ATAGSDIR, \ 'LINUX_ROOTFSDIR' : LINUX_ROOTFSDIR, \ diff --git a/conts/baremetal/baremetal3/SConstruct b/conts/baremetal/baremetal3/SConstruct new file mode 100644 index 0000000..5e5a317 --- /dev/null +++ b/conts/baremetal/baremetal3/SConstruct @@ -0,0 +1,59 @@ +# -*- 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 * +from config.lib 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)] + +LIBDEV_RELDIR = 'conts/libdev' +LIBDEV_DIR = join(PROJROOT, LIBDEV_RELDIR) +LIBDEV_LIBPATH = join(join(BUILDDIR, LIBDEV_RELDIR), 'sys-userspace') +LIBDEV_INCLUDE = [join(LIBDEV_DIR, 'uart/include')] + +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', 'libdev-userspace', 'gcc', 'c-userspace'], # libgcc.a - This is required for division routines. + CPPPATH = ["#include", KERNEL_INCLUDE, LIBL4_INCLUDE, LIBDEV_INCLUDE, LIBC_INCLUDE], + LIBPATH = [LIBL4_LIBPATH, LIBDEV_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') diff --git a/conts/test/container.c b/conts/baremetal/baremetal3/container.c similarity index 91% rename from conts/test/container.c rename to conts/baremetal/baremetal3/container.c index 7bcbf9e..f570c3d 100644 --- a/conts/test/container.c +++ b/conts/baremetal/baremetal3/container.c @@ -8,7 +8,7 @@ #include -void main(void); +extern void main(void); void __container_init(void) { diff --git a/conts/test/include/capability.h b/conts/baremetal/baremetal3/include/capability.h similarity index 100% rename from conts/test/include/capability.h rename to conts/baremetal/baremetal3/include/capability.h diff --git a/conts/test/include/tests.h b/conts/baremetal/baremetal3/include/tests.h similarity index 100% rename from conts/test/include/tests.h rename to conts/baremetal/baremetal3/include/tests.h diff --git a/conts/test/include/thread.h b/conts/baremetal/baremetal3/include/thread.h similarity index 100% rename from conts/test/include/thread.h rename to conts/baremetal/baremetal3/include/thread.h diff --git a/conts/test/main.c b/conts/baremetal/baremetal3/main.c similarity index 100% rename from conts/test/main.c rename to conts/baremetal/baremetal3/main.c diff --git a/conts/test/src/arch b/conts/baremetal/baremetal3/src/arch similarity index 100% rename from conts/test/src/arch rename to conts/baremetal/baremetal3/src/arch diff --git a/conts/test/src/arch-arm/new_thread.S b/conts/baremetal/baremetal3/src/arch-arm/new_thread.S similarity index 100% rename from conts/test/src/arch-arm/new_thread.S rename to conts/baremetal/baremetal3/src/arch-arm/new_thread.S diff --git a/conts/test/src/capability.c b/conts/baremetal/baremetal3/src/capability.c similarity index 100% rename from conts/test/src/capability.c rename to conts/baremetal/baremetal3/src/capability.c diff --git a/conts/test/src/captest.c b/conts/baremetal/baremetal3/src/captest.c similarity index 100% rename from conts/test/src/captest.c rename to conts/baremetal/baremetal3/src/captest.c diff --git a/conts/test/src/example.c b/conts/baremetal/baremetal3/src/example.c similarity index 100% rename from conts/test/src/example.c rename to conts/baremetal/baremetal3/src/example.c diff --git a/conts/test/src/thread.c b/conts/baremetal/baremetal3/src/thread.c similarity index 100% rename from conts/test/src/thread.c rename to conts/baremetal/baremetal3/src/thread.c diff --git a/conts/test/SConscript b/conts/test/SConscript deleted file mode 100644 index 64c707d..0000000 --- a/conts/test/SConscript +++ /dev/null @@ -1,44 +0,0 @@ - -Import('config', 'env', 'contid') - -import os, sys -from config.projpaths import * - -arch = config.arch - -sys.path.append('../../') -from config.lib import * - -container = next((c for c in config.containers if int(c.id) == int(contid)), None) - -CONTAINER_INCLUDE = join(BUILDDIR, 'cont' + str(contid) + '/test' + '/include') - -def generate_linker_script(target, source, env): - with open(source[0].path, 'r') as lds_in: - linker_script = lds_in.read() - with open(target[0].path, 'w+') as lds_out: - assert container.pager_vma != 0 - assert container.pager_lma != 0 - lds_out.write(linker_script % (conv_hex(container.pager_vma), conv_hex(container.pager_lma))) - -def generate_container_h(target, source, env): - with open(source[0].path, 'r') as fin: - str = fin.read() - with open(target[0].path, 'w+') as fout: - # Make any manipulations here - fout.write(str % (container.name, container.id, container.id)) - -linker_lds = Command('include/linker.lds', 'include/linker.lds.in', generate_linker_script) - -container_h = Command('include/container.h', 'include/container.h.in', generate_container_h) - -src = [Glob('*.[cS]') + Glob('src/*.[cS]') + Glob('src/arch/*.[cS]')] - -env.Append(LINKFLAGS = ['-T' + linker_lds[0].path, '-u_start']) -env.Append(CPPPATH = [CONTAINER_INCLUDE]) - -objs = env.Object(src) -prog = env.Program('main.elf', objs) -Depends(linker_lds, CML2_CONFIG_H) -Depends(prog, linker_lds) - diff --git a/conts/test/SConstruct b/conts/test/SConstruct deleted file mode 100644 index af97623..0000000 --- a/conts/test/SConstruct +++ /dev/null @@ -1,56 +0,0 @@ -# -*- 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 * -from config.lib 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'], - 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') - - -contid = ARGUMENTS.get('cont', '0') - -SConscript('SConscript', \ - exports = { 'config' : config, 'env' : env, 'contid' : contid }, duplicate = 0, \ - variant_dir = join(BUILDDIR, 'cont' + str(contid) + '/test')) - diff --git a/conts/test/include/container.h.in b/conts/test/include/container.h.in deleted file mode 100644 index 5015fd6..0000000 --- a/conts/test/include/container.h.in +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Autogenerated definitions for this container. - */ -#ifndef __CONTAINER_H__ -#define __CONTAINER_H__ - - -#define __CONTAINER_NAME__ "%s" -#define __CONTAINER_ID__ %d -#define __CONTAINER__ "cont%d" - - -#endif /* __CONTAINER_H__ */ diff --git a/conts/test/include/linker.lds.in b/conts/test/include/linker.lds.in deleted file mode 100644 index d9740ab..0000000 --- a/conts/test/include/linker.lds.in +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Example working linker script for this container. - * - * Copyright (C) 2009 B Labs Ltd. - */ - -vma_start = %s; -lma_start = %s; -offset = vma_start - lma_start; - -ENTRY(_start) - -SECTIONS -{ - . = vma_start; - .text : AT (ADDR(.text) - offset) { *(.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 = .; - } -} diff --git a/scripts/conts/containers.py b/scripts/conts/containers.py index dc54a65..ae79ca0 100755 --- a/scripts/conts/containers.py +++ b/scripts/conts/containers.py @@ -77,27 +77,6 @@ def build_posix_container(config, projpaths, container): container_packer = DefaultContainerPacker(container, images) return container_packer.pack_container(config) -# We simply use SCons to figure all this out from container.id -# Builds the test container. -def build_test_container(config, projpaths, container): - images = [] - cwd = os.getcwd() - os.chdir(TESTDIR) - print '\nBuilding the Test Container...' - scons_cmd = 'scons ' + 'cont=' + str(container.id) - print "Issuing scons command: %s" % scons_cmd - os.system(scons_cmd) - builddir = source_to_builddir(TESTDIR, container.id) - os.path.walk(builddir, glob_by_walk, ['*.elf', images]) - - # Calculate and store size of pager - pager_binary = "cont" + str(container.id) + "/test/main.elf" - config.containers[container.id].pager_size = \ - conv_hex(elf_binary_size(join(BUILDDIR, pager_binary))) - - container_packer = DefaultContainerPacker(container, images) - return container_packer.pack_container(config) - # This simply calls SCons on a given container, and collects # all images with .elf extension, instead of using whole classes # for building and packing. @@ -128,8 +107,6 @@ def build_all_containers(): cont_images.append(build_default_container(config, projpaths, container)) elif container.type == 'posix': cont_images.append(build_posix_container(config, projpaths, container)) - elif container.type == 'test': - cont_images.append(build_test_container(config, projpaths, container)) else: print "Error: Don't know how to build " + \ "container of type: %s" % (container.type) From e2c2f1f2b1478436d7ba8e1ae5ca84d1f7b47b06 Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Fri, 20 Nov 2009 00:19:51 +0530 Subject: [PATCH 6/7] Building baremetal containers in build directory --- conts/baremetal/baremetal0/SConstruct | 2 +- conts/baremetal/baremetal1/SConstruct | 2 +- conts/baremetal/baremetal2/SConstruct | 2 +- conts/baremetal/baremetal3/SConstruct | 2 +- scripts/baremetal/baremetal_generator.py | 5 ++--- scripts/conts/containers.py | 7 ++++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/conts/baremetal/baremetal0/SConstruct b/conts/baremetal/baremetal0/SConstruct index 67600e7..d546ae1 100644 --- a/conts/baremetal/baremetal0/SConstruct +++ b/conts/baremetal/baremetal0/SConstruct @@ -7,7 +7,7 @@ import os, shelve, sys from os.path import * -PROJRELROOT = '../..' +PROJRELROOT = '../../..' sys.path.append(PROJRELROOT) diff --git a/conts/baremetal/baremetal1/SConstruct b/conts/baremetal/baremetal1/SConstruct index d855e61..159ed3a 100644 --- a/conts/baremetal/baremetal1/SConstruct +++ b/conts/baremetal/baremetal1/SConstruct @@ -7,7 +7,7 @@ import os, shelve, sys from os.path import * -PROJRELROOT = '../..' +PROJRELROOT = '../../..' sys.path.append(PROJRELROOT) diff --git a/conts/baremetal/baremetal2/SConstruct b/conts/baremetal/baremetal2/SConstruct index 63134bb..48674b4 100644 --- a/conts/baremetal/baremetal2/SConstruct +++ b/conts/baremetal/baremetal2/SConstruct @@ -7,7 +7,7 @@ import os, shelve, sys from os.path import * -PROJRELROOT = '../..' +PROJRELROOT = '../../..' sys.path.append(PROJRELROOT) diff --git a/conts/baremetal/baremetal3/SConstruct b/conts/baremetal/baremetal3/SConstruct index 5e5a317..b695949 100644 --- a/conts/baremetal/baremetal3/SConstruct +++ b/conts/baremetal/baremetal3/SConstruct @@ -7,7 +7,7 @@ import os, shelve, sys from os.path import * -PROJRELROOT = '../..' +PROJRELROOT = '../../..' sys.path.append(PROJRELROOT) diff --git a/scripts/baremetal/baremetal_generator.py b/scripts/baremetal/baremetal_generator.py index 2702720..921aa45 100755 --- a/scripts/baremetal/baremetal_generator.py +++ b/scripts/baremetal/baremetal_generator.py @@ -22,7 +22,6 @@ from config.lib import * class BaremetalContGenerator: def __init__(self): self.CONT_SRC_DIR = '' # Set when container is selected - self.BAREMETAL_SRC_BASEDIR = join(PROJROOT, 'conts') self.BAREMETAL_PROJ_SRC_DIR = join(PROJROOT, 'conts/baremetal') self.main_builder_name = 'build.py' @@ -114,7 +113,7 @@ class BaremetalContGenerator: for cont in config.containers: if cont.type == "baremetal": # Determine container directory name. - self.CONT_SRC_DIR = join(self.BAREMETAL_SRC_BASEDIR, cont.dirname.lower()) + self.CONT_SRC_DIR = join(join(BUILDDIR, 'cont') + str(cont.id), cont.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.linker_lds_out = join(join(self.CONT_SRC_DIR, 'include'), \ @@ -122,7 +121,7 @@ class BaremetalContGenerator: self.container_h_out = join(join(self.CONT_SRC_DIR, 'include'), \ self.container_h_name) - if not os.path.exists(join(self.BAREMETAL_SRC_BASEDIR, cont.dirname)): + if not os.path.exists(self.CONT_SRC_DIR): self.create_baremetal_sources(config, cont) else: # Don't create new sources but update configuration diff --git a/scripts/conts/containers.py b/scripts/conts/containers.py index ae79ca0..95a5f5f 100755 --- a/scripts/conts/containers.py +++ b/scripts/conts/containers.py @@ -83,15 +83,16 @@ def build_posix_container(config, projpaths, container): def build_default_container(config, projpaths, container): images = [] cwd = os.getcwd() - projdir = join(join(PROJROOT, 'conts'), container.name) + projdir = join(join(BUILDDIR, 'cont') + str(container.id), \ + container.name) os.chdir(projdir) os.system("scons") os.path.walk(projdir, glob_by_walk, ['*.elf', images]) # Calculate and store size of pager - pager_binary = "conts/" + container.name + "/main.elf" + pager_binary = join("cont" + str(container.id), container.name) + "/main.elf" config.containers[container.id].pager_size = \ - conv_hex(elf_binary_size(join(PROJROOT, pager_binary))) + conv_hex(elf_binary_size(join(BUILDDIR, pager_binary))) container_packer = DefaultContainerPacker(container, images) return container_packer.pack_container(config) From 2b63cff8000378d9691aa406696be58d15643b47 Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Fri, 20 Nov 2009 00:50:57 +0530 Subject: [PATCH 7/7] Adding option for customized containers --- config/cml/container_ruleset.template | 12 ++- config/configuration.py | 8 +- configure.py | 5 + scripts/conts/containers.py | 2 +- scripts/custom/__init__.py | 0 scripts/custom/custom_generator.py | 143 +++++++++++++++++++++++++ scripts/custom/files/SConstruct.in | 0 scripts/custom/files/build.readme.in | 112 +++++++++++++++++++ scripts/custom/files/container.desc.in | 8 ++ scripts/custom/files/container.h.in | 13 +++ scripts/custom/files/linker.lds.in | 29 +++++ 11 files changed, 328 insertions(+), 4 deletions(-) create mode 100644 scripts/custom/__init__.py create mode 100755 scripts/custom/custom_generator.py create mode 100644 scripts/custom/files/SConstruct.in create mode 100644 scripts/custom/files/build.readme.in create mode 100644 scripts/custom/files/container.desc.in create mode 100644 scripts/custom/files/container.h.in create mode 100644 scripts/custom/files/linker.lds.in diff --git a/config/cml/container_ruleset.template b/config/cml/container_ruleset.template index 6ade069..2051c43 100644 --- a/config/cml/container_ruleset.template +++ b/config/cml/container_ruleset.template @@ -2,7 +2,9 @@ symbols CONT%(cn)d_TYPE_LINUX 'Linux Container' CONT%(cn)d_TYPE_BAREMETAL 'Barebones Container' CONT%(cn)d_TYPE_POSIX 'POSIX Container' +CONT%(cn)d_TYPE_CUSTOM 'Add New Customized Container' CONT%(cn)d_OPT_NAME 'Container Name' +CONT%(cn)d_SOURCE_PATH 'Container Source Path' CONT%(cn)d_PHYSMEM_REGIONS 'Container %(cn)d Number of Physical Regions' CONT%(cn)d_PHYS0_START 'Container %(cn)d Physical Region 0 Start Address' @@ -138,12 +140,16 @@ default CONT%(cn)d_VIRT4_END from 0xe0000000 default CONT%(cn)d_VIRT5_START from 0xe0000000 default CONT%(cn)d_VIRT5_END from 0xf0000000 -default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_BAREMETAL==y) ? "baremetal%(cn)d" : "posix%(cn)d") +default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_BAREMETAL==y) ? "baremetal%(cn)d" : ((CONT%(cn)d_TYPE_CUSTOM==y) ? "custom%(cn)d" :"posix%(cn)d")) + +default CONT%(cn)d_SOURCE_PATH from "conts/timer" when CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_default_pager_params cont%(cn)d_posix_pager_params when CONT%(cn)d_TYPE_BAREMETAL==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params when CONT%(cn)d_TYPE_POSIX==y suppress cont%(cn)d_linux_pager_params +when CONT%(cn)d_TYPE_CUSTOM==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params unless CONT%(cn)d_TYPE_BAREMETAL==y suppress cont%(cn)d_baremetal_params +unless CONT%(cn)d_TYPE_CUSTOM==y suppress CONT%(cn)d_SOURCE_PATH symbols cont%(cn)d_menu 'Container %(cn)d Parameters' @@ -637,6 +643,7 @@ menu cont%(cn)d_capability_list menu container%(cn)d_options CONT%(cn)d_OPT_NAME$ + CONT%(cn)d_SOURCE_PATH$ cont%(cn)d_baremetal_params cont%(cn)d_linux_pager_params cont%(cn)d_default_pager_params @@ -648,7 +655,8 @@ menu container%(cn)d_options choices container%(cn)d_type CONT%(cn)d_TYPE_BAREMETAL CONT%(cn)d_TYPE_POSIX - CONT%(cn)d_TYPE_LINUX + CONT%(cn)d_TYPE_CUSTOM + CONT%(cn)d_TYPE_LINUX default CONT%(cn)d_TYPE_BAREMETAL menu cont%(cn)d_menu diff --git a/config/configuration.py b/config/configuration.py index f8c2fdc..9ee8758 100644 --- a/config/configuration.py +++ b/config/configuration.py @@ -12,6 +12,7 @@ class Container: self.name = None self.type = None self.id = id + self.src_path = None self.baremetal_id = 0 self.pager_lma = 0 self.pager_vma = 0 @@ -131,7 +132,10 @@ class configuration: # TODO: Carry this over to Container() as static method??? def get_container_parameter(self, id, param, val): - if param[:len("PAGER_LMA")] == "PAGER_LMA": + if param[:len("SOURCE_PATH")] == "SOURCE_PATH": + parts = val.split("\"", 3) + self.containers[id].src_path = parts[1] + elif param[:len("PAGER_LMA")] == "PAGER_LMA": self.containers[id].pager_lma = int(val, 0) elif param[:len("PAGER_VMA")] == "PAGER_VMA": self.containers[id].pager_vma = int(val, 0) @@ -188,6 +192,8 @@ class configuration: self.containers[id].type = "posix" elif param2 == "BAREMETAL": self.containers[id].type = "baremetal" + elif param2 == "CUSTOM": + self.containers[id].type = "custom" # Extract parameters for containers def get_container_parameters(self, name, val): matchobj = re.match(r"(CONFIG_CONT){1}([0-9]){1}(\w+)", name) diff --git a/configure.py b/configure.py index 461b673..deec0e4 100755 --- a/configure.py +++ b/configure.py @@ -5,6 +5,7 @@ from os.path import join from config.projpaths import * from config.configuration import * from scripts.baremetal.baremetal_generator import * +from scripts.custom.custom_generator import * from scripts.kernel.generate_kernel_cinfo import * from scripts.cml.generate_container_cml import * from optparse import OptionParser @@ -188,6 +189,10 @@ def configure_system(options, args): baremetal_cont_gen = BaremetalContGenerator() baremetal_cont_gen.baremetal_container_generate(config) + # Generate custom container files if new ones defined + custom_cont_gen = CustomContGenerator() + custom_cont_gen.custom_container_generate(config) + # Print out the configuration if asked if options.print_config: config.config_print() diff --git a/scripts/conts/containers.py b/scripts/conts/containers.py index 95a5f5f..17acada 100755 --- a/scripts/conts/containers.py +++ b/scripts/conts/containers.py @@ -104,7 +104,7 @@ def build_all_containers(): if container.type == 'linux': pass cont_images.append(build_linux_container(config, projpaths, container)) - elif container.type == 'baremetal': + elif container.type == 'baremetal' or container.type == 'custom': cont_images.append(build_default_container(config, projpaths, container)) elif container.type == 'posix': cont_images.append(build_posix_container(config, projpaths, container)) diff --git a/scripts/custom/__init__.py b/scripts/custom/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/custom/custom_generator.py b/scripts/custom/custom_generator.py new file mode 100755 index 0000000..5d377ec --- /dev/null +++ b/scripts/custom/custom_generator.py @@ -0,0 +1,143 @@ +#! /usr/bin/env python2.6 +# -*- mode: python; coding: utf-8; -*- +# +# Codezero -- Virtualization microkernel for embedded systems. +# +# Copyright © 2009 B Labs Ltd +# +import os, sys, shelve, glob +from os.path import join + +PROJRELROOT = '../../' + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), PROJRELROOT))) +sys.path.append(os.path.abspath("../")) + +SCRIPTROOT = os.path.abspath(os.path.dirname(__file__)) + +from config.projpaths import * +from config.configuration import * +from config.lib import * + +class CustomContGenerator: + def __init__(self): + self.CONT_SRC_DIR = '' # Set when container is selected + + 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, 'files/SConstruct.in') + self.build_readme_in = join(SCRIPTROOT, 'files/build.readme.in') + self.build_desc_in = join(SCRIPTROOT, 'files/container.desc.in') + self.linker_lds_in = join(SCRIPTROOT, 'files/linker.lds.in') + self.container_h_in = join(SCRIPTROOT, 'files/container.h.in') + + self.build_script_name = 'SConstruct' + self.build_readme_name = 'build.readme' + self.build_desc_name = '.container' + self.linker_lds_name = 'linker.lds' + self.container_h_name = 'container.h' + + self.container_h_out = None + self.build_script_out = None + self.build_readme_out = None + self.build_desc_out = None + self.src_main_out = None + + def create_custom_srctree(self, config, cont): + # First, create the base project directory and sources + shutil.copytree(join(PROJROOT, cont.src_path), self.CONT_SRC_DIR) + + def copy_custom_build_desc(self, config, cont): + id_header = '[Container ID]\n' + type_header = '\n[Container Type]\n' + name_header = '\n[Container Name]\n' + pager_lma_header = '\n[Container Pager LMA]\n' + pager_vma_header = '\n[Container Pager VMA]\n' + pager_virtmem_header = '\n[Container Virtmem Region %s]\n' + pager_physmem_header = '\n[Container Physmem Region %s]\n' + + with open(self.build_desc_out, 'w+') as fout: + fout.write(id_header) + fout.write('\t' + str(cont.id) + '\n') + fout.write(type_header) + fout.write('\t' + cont.type + '\n') + fout.write(name_header) + fout.write('\t' + cont.name + '\n') + fout.write(pager_lma_header) + fout.write('\t' + conv_hex(cont.pager_lma) + '\n') + fout.write(pager_vma_header) + fout.write('\t' + conv_hex(cont.pager_vma) + '\n') + for ireg in range(cont.virt_regions): + fout.write(pager_virtmem_header % ireg) + fout.write('\t' + cont.virtmem["START"][ireg] + ' - ' + cont.virtmem["END"][ireg] + '\n') + for ireg in range(cont.phys_regions): + fout.write(pager_physmem_header % ireg) + fout.write('\t' + cont.physmem["START"][ireg] + ' - ' + cont.physmem["END"][ireg] + '\n') + + def copy_custom_build_readme(self, config, cont): + with open(self.build_readme_in) as fin: + str = fin.read() + with open(self.build_readme_out, 'w+') as fout: + # Make any manipulations here + fout.write(str % (self.mailing_list_url, \ + cont.name, \ + self.build_desc_name, \ + self.main_builder_name, \ + self.main_configurator_name, \ + self.main_configurator_name)) + + def copy_custom_container_h(self, config, cont): + with open(self.container_h_in) as fin: + str = fin.read() + with open(self.container_h_out, 'w+') as fout: + # Make any manipulations here + fout.write(str % (cont.name, cont.id, cont.id)) + + def create_custom_sources(self, config, cont): + self.create_custom_srctree(config, cont) + self.copy_custom_build_readme(config, cont) + self.copy_custom_build_desc(config, cont) + self.generate_linker_script(config, cont) + self.copy_custom_container_h(config, cont) + + def update_configuration(self, config, cont): + self.copy_custom_build_desc(config, cont) + self.generate_linker_script(config, cont) + self.copy_custom_container_h(config, cont) + + def check_create_custom_sources(self, config): + for cont in config.containers: + if cont.type == "custom": + # Determine container directory name. + self.CONT_SRC_DIR = join(join(BUILDDIR, 'cont') + str(cont.id), cont.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.linker_lds_out = join(join(self.CONT_SRC_DIR, 'include'), \ + self.linker_lds_name) + self.container_h_out = join(join(self.CONT_SRC_DIR, 'include'), \ + self.container_h_name) + + if not os.path.exists(self.CONT_SRC_DIR): + self.create_custom_sources(config, cont) + else: + # Don't create new sources but update configuration + self.update_configuration(config, cont) + + def generate_linker_script(self, config, cont): + with open(self.linker_lds_in) as fin: + str = fin.read() + with open(self.linker_lds_out, 'w+') as fout: + fout.write(str % (conv_hex(cont.pager_vma), \ + conv_hex(cont.pager_lma))) + + def custom_container_generate(self, config): + self.check_create_custom_sources(config) + +if __name__ == "__main__": + config = configuration_retrieve() + config.config_print() + custom_cont = CustomContGenerator() + custom_cont.custom_container_generate(config) + diff --git a/scripts/custom/files/SConstruct.in b/scripts/custom/files/SConstruct.in new file mode 100644 index 0000000..e69de29 diff --git a/scripts/custom/files/build.readme.in b/scripts/custom/files/build.readme.in new file mode 100644 index 0000000..daf5f1d --- /dev/null +++ b/scripts/custom/files/build.readme.in @@ -0,0 +1,112 @@ + Codezero Buildsystem For This Container + + Autogenerated by the Build system + + +This is an autogenerated file that is meant to walk you through the build +process. It is meant to be the most simple to get on with, therefore if +you feel any complications, please reach us on our l4dev.org mailing list +on %s + +You have created a new container called `%s'. + +The parameters you have supplied are described in the "%s" file +placed at the top-level directory. Note, that this is only an informative +file for your reference, and it can be optionally removed. + + + 1. Directory Structure: + +1.1) Directory tree: +. +|-- SConstruct +|-- build.readme +|-- .container +|-- include +| `-- linker.lds.example +|-- main.c +`-- src + |-- test.c + +In the above directory tree: + +1.2) |-- SConstruct + +This is the top-level build file, that will build your project in its current +state. You may freely reorganize directories, but must reflect changes in this +file. For more, please see the SCons build tool at http://www.scons.org/ + +The build system will search for this file, and execute it by the: + +`scons' + +command at the root of the directory. You may issue the same command manually +for building and testing your build. If you choose to use another build tool +such as make, you may freely replace scons, and the build system will search +and call your custom build command. + +1.3) |--include + `--src + +These are the directories that include your header files and sources. You may +freely change and reorganize these, but make sure to have a valid build file +that reflects those changes at the top-level directory. + +1.4) |-- include + | `-- linker.lds.example + +This is an example linker script for your project. Using this as your default +linker script is often useful, since it has been autogenerated to contain all +the parameters you need for the memory regions of your application defined at +configuration time. You may freely replace it, but make sure to edit the +top-level build script accordingly. + + + 2. Build Process + +2.1) Build overview + +The complete Codezero system will be built from a top-level `%s' script by +that resides in the top-level directory of Codezero sources. + +The Codezero system build script will build this container at a certain stage +during the build, by referring to build script file named such as `SConstruct' +or `Makefile' that resides in this container's top-level directory. + +Once the executables are built, it will search for all files with a .elf +extension in any of the subdirectories, and recognize those as loadable +executables. There may be more than one of these files present after the build. + +In the future this behaviour may change such that the loadable executable files +are also specified in the configuration. + +Finally, executables of all containers will be picked up and built into the +final.elf file, which is a self-loading elf executable. + + + 3. Reconfiguring this container + +If you want to reconfigure the container with new parameters, you may do so by +executing the `%s' script at the top-level Codezero directory by: + +'./%s' + +This will populate only brand new container directories with new files. It will +update it's existing internal configuration for existing containers (such as +container memory regions) but it won't touch any files that exist under an +already-defined container. + +If you want to start from scratch, specify a new directory name, if you want +to reconfigure existing container parameters, run this on an existing directory, +and it will only update its internal records for this container, but not touch +the directory. + + + 4. Example source files + +Example source files populated by the configuration contain valid examples +of how the generic libl4 userspace library can be used. Each test contains a +valid example from the available API, and may be modified, changed and removed +freely. + + diff --git a/scripts/custom/files/container.desc.in b/scripts/custom/files/container.desc.in new file mode 100644 index 0000000..61346d9 --- /dev/null +++ b/scripts/custom/files/container.desc.in @@ -0,0 +1,8 @@ +[Container Name] + +[Container LMA] + +[Container VMA] + +[Container Type] + diff --git a/scripts/custom/files/container.h.in b/scripts/custom/files/container.h.in new file mode 100644 index 0000000..5015fd6 --- /dev/null +++ b/scripts/custom/files/container.h.in @@ -0,0 +1,13 @@ +/* + * Autogenerated definitions for this container. + */ +#ifndef __CONTAINER_H__ +#define __CONTAINER_H__ + + +#define __CONTAINER_NAME__ "%s" +#define __CONTAINER_ID__ %d +#define __CONTAINER__ "cont%d" + + +#endif /* __CONTAINER_H__ */ diff --git a/scripts/custom/files/linker.lds.in b/scripts/custom/files/linker.lds.in new file mode 100644 index 0000000..d9740ab --- /dev/null +++ b/scripts/custom/files/linker.lds.in @@ -0,0 +1,29 @@ +/* + * Example working linker script for this container. + * + * Copyright (C) 2009 B Labs Ltd. + */ + +vma_start = %s; +lma_start = %s; +offset = vma_start - lma_start; + +ENTRY(_start) + +SECTIONS +{ + . = vma_start; + .text : AT (ADDR(.text) - offset) { *(.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 = .; + } +}