This commit adds tools/gencromfs.c, a tool that can be used to generate CROMFS file system images.

Squashed commit of the following:

    tools/gencromfs.c:  Seems basically functional but has not has not yet been integrated with CROMFS.
    tools/gencromfs.c:  Revist previous commit.  Let's make no assumptions about the compatibility of the host system and NuttX.
    tools/gencromfs.c:  I think access mode bits are sufficiently standard that we can just copy them from the host.  This is don't mostly to pick up the executable bits and other conbinations of bits without doing a bit-for-bit decode.
    tools/gencromfs.c:  Code complete but only partially functional.
    tools/gencromfs.c:  type definitions must precede data definitions
    tools/gencromfs.c:  Adds a little more logic to gencromfs tools.  Still not complete but can traverse directories and generate directory and hard-link nodes.
    tools/gencromfs.c: Beginning of a genromfs tool that will eventually be used for generation of CROMFS file system images.
This commit is contained in:
Gregory Nutt 2018-03-20 07:31:13 -06:00
parent 87c8b116ca
commit eec44d1f01
5 changed files with 1275 additions and 6 deletions

View File

@ -1,7 +1,7 @@
############################################################################
# fs/cromfs/Make.defs
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

View File

@ -115,8 +115,8 @@ struct cromfs_node_s
size_t cn_name; /* Offset from the beginning of the volume header to the
* node name string. NUL-terminated. */
size_t cn_size; /* Size of the uncompressed data (in bytes) */
size_t cn_peer; /* Offset to next node in this directory (for readdir())*/
union /* Must be last */
size_t cn_peer; /* Offset to next node in this directory (for readdir()) */
union
{
size_t cn_child; /* Offset to first node in sub-directory (directories only) */
size_t cn_link; /* Offset to an arbitrary node (for hard link) */
@ -124,4 +124,4 @@ struct cromfs_node_s
} u;
};
#endif /* __FS_CROMFS_CROMFS_H */
#endif /* __FS_CROMFS_CROMFS_H */

View File

@ -72,14 +72,14 @@ all: b16$(HOSTEXEEXT) bdf-converter$(HOSTEXEEXT) cmpconfig$(HOSTEXEEXT) \
configure$(HOSTEXEEXT) mkconfig$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) \
mksymtab$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkversion$(HOSTEXEEXT) \
cnvwindeps$(HOSTEXEEXT) nxstyle$(HOSTEXEEXT) initialconfig$(HOSTEXEEXT) \
logparser$(HOSTEXEEXT)
logparser$(HOSTEXEEXT) gencromfs$(HOSTEXEEXT)
default: mkconfig$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) \
cnvwindeps$(HOSTEXEEXT)
ifdef HOSTEXEEXT
.PHONY: b16 bdf-converter cmpconfig clean configure kconfig2html mkconfig \
mkdeps mksymtab mksyscall mkversion cnvwindeps nxstyle initialconfig \
logparser
logparser gencromfs
else
.PHONY: clean
endif
@ -194,6 +194,15 @@ ifdef HOSTEXEEXT
logparser: logparser$(HOSTEXEEXT)
endif
# gencromfs - Generate a CROMFS file system
gencromfs$(HOSTEXEEXT): gencromfs.c
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o gencromfs$(HOSTEXEEXT) gencromfs.c
ifdef HOSTEXEEXT
gencromfs: gencromfs$(HOSTEXEEXT)
endif
# cnvwindeps - Convert dependences generated by a Windows native toolchain
# for use in a Cygwin/POSIX build environment

View File

@ -61,6 +61,22 @@ discover.py
Example script for discovering devices in the local network.
It is the counter part to apps/netutils/discover
gencromfs.c
-----------
This is a C program that is used to generate CROMFS file system images.
Usage is simple:
gencromfs <dir-path> <out-file>
Where:
<dir-path> is the path to the directory will be at the root of the
new CROMFS file system image.
<out-file> the name of the generated, output C file. This file must
be compiled in order to generate the binary CROMFS file system
image.
mkconfig.c, cfgdefine.c, and cfgdefine.h
----------------------------------------

1244
tools/gencromfs.c Normal file

File diff suppressed because it is too large Load Diff