summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-06-15 11:14:16 +1000
committerChris Johns <chrisj@rtems.org>2016-06-15 11:14:16 +1000
commitb0afac0fd2d21401e2e41efe66de975cc1e23c58 (patch)
treef0b4a1e421dc87bef69447b6ea938611a37da30a
parent93e554578cdcb2b6c5439b3371dcd558b3218829 (diff)
Add root_filesystem support to create a root file system.
To use add to your wscript file: rtems.root_filesystem(bld, 'rootfs', ['etc/rc.conf'], 'rootfs.tar', 'rootfs-tar.o') to create a rootfs-tar.o which you add to your executable's list of sources. In your main or Init function add: #include <rtems/untar.h> extern int _binary_rootfs_tar_start; extern int _binary_rootfs_tar_size; static void expand_rootfs_tarfile(void) { rtems_status_code sc; rtems_printer printer; rtems_print_printer_printf(&printer); sc = Untar_FromMemory_Print((void *)(&_binary_rootfs_tar_start), (size_t)&_binary_rootfs_tar_size, &printer); if (sc != RTEMS_SUCCESSFUL) fprintf(stderr, "error: untar failed: %s\n", rtems_status_text(sc)); } Note, some arch's may not need the '_' at the start of the tar symbols.
-rw-r--r--rtems.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/rtems.py b/rtems.py
index 8384191..3a9ff60 100644
--- a/rtems.py
+++ b/rtems.py
@@ -221,6 +221,7 @@ def configure(conf, bsp_configure = None):
conf.env.IFLAGS = cflags['includes']
conf.env.LINKFLAGS = cflags['cflags'] + ldflags['ldflags']
conf.env.LIB = flags['LIB']
+ conf.env.LIBPATH = ldflags['libpath']
conf.env.RTRACE_WRAPPER_ST = '-W %s'
@@ -513,6 +514,16 @@ def library_path(library, cc, cflags):
return os.path.dirname(lib)
return None
+def root_filesystem(bld, name, files, tar, obj):
+ bld(name = name + '_tar',
+ target = tar,
+ source = files,
+ rule = 'SDIR=$PWD && cd ../.. && tar --format=ustar -cf $SDIR/${TGT} $(echo "${SRC}" | sed -e "s/\.\.\/\.\.\///\")')
+ bld.objects(name = name,
+ target = obj,
+ source = tar,
+ rule = '${OBJCOPY} -I binary -B ${RTEMS_ARCH} ${OBJCOPY_FLAGS} ${SRC} ${TGT}')
+
def clone_tasks(bld):
if bld.cmd == 'build':
for obj in bld.all_task_gen[:]:
@@ -713,6 +724,7 @@ def _filter_flags(label, flags, arch, rtems_path):
flag_groups = \
[ { 'key': 'warnings', 'path': False, 'flags': { '-W': 1 }, 'cflags': False, 'lflags': False },
{ 'key': 'includes', 'path': True, 'flags': { '-I': 1, '-isystem': 2, '-sysroot': 2 } },
+ { 'key': 'libpath', 'path': True, 'flags': { '-L': 1 } },
{ 'key': 'machines', 'path': True, 'flags': { '-O': 1, '-m': 1, '-f': 1 } },
{ 'key': 'specs', 'path': True, 'flags': { '-q': 1, '-B': 2, '--specs': 2 } } ]