QFSGen is a cross-platform, command-line utility that generates a ROM-based file system, which can be incorporated in a C source code. Specifically, QFSGen utility generates a C header file that contains a bunch of constant byte arrays representing your files and directories. This generated header file (named fsdata.h
by default) can be subsequently included in the ROM-Based File System implementation.
QFSGen is deployed as natively compiled executable and is located in the sub-directory qtools/bin/. QFSGen is available in portable source code and can be compiled on all desktop platforms (Windows and POSIX – Linux, macOS...).
You use the QFSGen utility from command-prompt. First, change current directory to the directory, where you wish to generate the C header file (named fsdata.h
by default) and type:
qfsgen website -h
where website
is a directory, which contains the files and sub-directories you wish to include into your ROM-based file system. This particular QFSGen invocation will generate the file-system found in the directory website
with HTTP headers (-h
option).
QFSGen takes the following command-line parameters:
PARAMETER | DEFAULT | COMMENT |
---|---|---|
fs-dir | file system directory (relative or absolute) | |
[output-flie] | fsdata.h | output file name (optional) |
OPTIONS | ||
-h | generate HTTP headers |
QFSGen recursively scans the provided directory and recursively encodes any file and sub-directory into an array in the generated header file. For example, here is the content of the website
directory:
+-website/ +-img/ | +-AN_QP_and_lwIP.jpg | +-arrow.gif | +-favicon.ico | +-footer.jpg | +-logo_lwip_qp.jpg | +-logo_ql.jpg | +-logo_sics.gif | +-PSiCC2.gif | +-QP_datasheet.gif +-404.htm +-bg_footer.gif +-cgi_demo.htm +-index.htm +-ssi_demo.shtm +-style.css +-thank_you.htm +-udp_demo.htm
This directory structure is then encoded into the following header file fsdata.h
:
Subsequently, the fsdata.h
header file is included in the ROM file-system implementation file fs.c
, which is included in the qfsgen/source
directory.
Next: Revision History