From b0afac0fd2d21401e2e41efe66de975cc1e23c58 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Wed, 15 Jun 2016 11:14:16 +1000 Subject: 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 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. --- rtems.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 } } ] -- cgit v1.2.3