Documentation: update doc for etc romfs
as apache/nuttx#11498, need update documentation for etc romfs, that mount etc romfs from nsh to sched/init.
This commit is contained in:
parent
2ff700de92
commit
5d40882d4c
@ -299,12 +299,6 @@ Configuration Description
|
||||
registered as ``/dev/mmcsd``\ *N* where *N* is the minor number.
|
||||
Default is zero.
|
||||
|
||||
``CONFIG_NSH_ROMFSETC`` Mount a ROMFS file system at ``/etc`` and provide a system init
|
||||
script at ``/etc/init.d.rc.sysinit`` and a startup script at
|
||||
``/etc/init.d/rcS``.
|
||||
The default system init script will mount a FAT FS RAMDISK at
|
||||
``/tmp`` but the logic is `easily extensible <#startupscript>`__.
|
||||
|
||||
``CONFIG_NSH_CONSOLE`` If ``CONFIG_NSH_CONSOLE`` is set to *y*, then a serial console
|
||||
front-end is selected.
|
||||
|
||||
@ -451,44 +445,20 @@ Configuration Description
|
||||
is indicated.
|
||||
============================================== ============================================================
|
||||
|
||||
If ``CONFIG_NSH_ROMFSETC`` is selected, then the following additional
|
||||
If ``CONFIG_ETC_ROMFS`` is selected, then the following additional
|
||||
configuration setting apply:
|
||||
|
||||
============================== ==============================================================
|
||||
Configuration Description
|
||||
============================== ==============================================================
|
||||
``CONFIG_NSH_ARCHROMFS`` May be defined to specify an alternative ROMFS image
|
||||
that can be found at ``boards/<arch>/<chip>/<board>/include/nsh_romfsimg.h``.
|
||||
``CONFIG_NSH_ROMFSMOUNTPT`` The default mountpoint for the ROMFS volume is ``"/etc"``,
|
||||
but that can be changed with this setting. This must be a
|
||||
absolute path beginning with '``/``' and enclosed in quotes.
|
||||
``CONFIG_NSH_SYSINITSCRIPT`` This is the relative path to the system init script within the
|
||||
mountpoint. The default is ``"init.d/rc.sysinit"``. This is a relative
|
||||
path and must not start with '``/``' but must be enclosed in quotes.
|
||||
``CONFIG_NSH_INITSCRIPT`` This is the relative path to the startup script within the
|
||||
mountpoint. The default is ``"init.d/rcS"``. This is a relative
|
||||
path and must not start with '``/``' but must be enclosed in quotes.
|
||||
``CONFIG_NSH_ROMFSDEVNO`` This is the minor number of the ROMFS block device.
|
||||
The default is '``0``' corresponding to ``/dev/ram0``.
|
||||
``CONFIG_NSH_ROMFSSECTSIZE`` This is the sector size to use with the ROMFS volume. Since the
|
||||
default volume is very small, this defaults to 64 but should
|
||||
be increased if the ROMFS volume were to be become large.
|
||||
Any value selected must be a power of 2.
|
||||
============================== ==============================================================
|
||||
|
||||
When the default ``rc.sysinit`` file used when ``CONFIG_NSH_ROMFSETC`` is
|
||||
selected, it will mount a FAT FS under ``/tmp``. The following
|
||||
selections describe that FAT FS.
|
||||
|
||||
============================== =======================================================
|
||||
Configuration Description
|
||||
============================== =======================================================
|
||||
``CONFIG_NSH_FATDEVNO`` This is the minor number of the FAT FS block device.
|
||||
The default is '``1``' corresponding to ``/dev/ram1``.
|
||||
``CONFIG_NSH_FATSECTSIZE`` This is the sector size use with the FAT FS. Default is 512.
|
||||
============================== =======================================================
|
||||
|
||||
|
||||
Common Problems
|
||||
===============
|
||||
|
||||
|
@ -27,177 +27,3 @@ increasing difficulty:
|
||||
create the start-up script. It is sufficiently complex that is
|
||||
deserves its own paragraph
|
||||
|
||||
NuttShell Start up Scripts
|
||||
--------------------------
|
||||
|
||||
First of all you should look at `NSH Start-Up Script <#startupscript>`__
|
||||
paragraph. Most everything you need to know can be found there. That
|
||||
information will be repeated and extended here for completeness.
|
||||
|
||||
**NSH Start-Up Script**. NSH supports options to provide a start up
|
||||
script for NSH. The start-up script contains any command support by NSH
|
||||
(i.e., that you see when you enter 'nsh> help'). In general this
|
||||
capability is enabled with ``CONFIG_NSH_ROMFSETC=y``, but has several
|
||||
other related configuration options as described with the `NSH-specific
|
||||
configuration settings <#nshconfiguration>`__ paragraph. This capability
|
||||
also depends on:
|
||||
|
||||
- ``CONFIG_DISABLE_MOUNTPOINT=n``. If mount point support is disabled,
|
||||
then you cannot mount *any* file systems.
|
||||
|
||||
- ``CONFIG_FS_ROMFS`` enabled. This option enables ROMFS file system
|
||||
support.
|
||||
|
||||
**Default Start-Up Behavior**. The implementation that is provided is
|
||||
intended to provide great flexibility for the use of Start-Up files.
|
||||
This paragraph will discuss the general behavior when all of the
|
||||
configuration options are set to the default values.
|
||||
|
||||
In this default case, enabling ``CONFIG_NSH_ROMFSETC`` will cause NSH to
|
||||
behave as follows at NSH start-up time:
|
||||
|
||||
- NSH will create a read-only RAM disk (a ROM disk), containing a tiny
|
||||
ROMFS file system containing the following::
|
||||
|
||||
`--init.d/
|
||||
`-- rcS
|
||||
`-- rc.sysinit
|
||||
|
||||
Where ``rcS`` is the NSH start-up script.
|
||||
Where ``rc.sysinit`` is the NSH system-init script.
|
||||
|
||||
- NSH will then mount the ROMFS file system at ``/etc``, resulting in::
|
||||
|
||||
|--dev/
|
||||
| `-- ram0
|
||||
`--etc/
|
||||
`--init.d/
|
||||
`-- rcS
|
||||
`-- rc.sysinit
|
||||
|
||||
- By default, the contents of ``rc.sysinit`` script are::
|
||||
|
||||
# Create a RAMDISK and mount it at /tmp
|
||||
|
||||
mkrd -m 1 -s 512 1024
|
||||
mkfatfs /dev/ram1
|
||||
mount -t vfat /dev/ram1 /tmp
|
||||
|
||||
- NSH will execute the script at ``/etc/init.d/rc.sysinit`` at system
|
||||
init (before the first NSH prompt). After execution of the script,
|
||||
the root FS will look like::
|
||||
|
||||
|--dev/
|
||||
| |-- ram0
|
||||
| `-- ram1
|
||||
|--etc/
|
||||
| `--init.d/
|
||||
| `-- rcS
|
||||
| `-- rc.sysinit
|
||||
`--tmp/
|
||||
|
||||
**Example Configurations**. Here are some configurations that have
|
||||
``CONFIG_NSH_ROMFSETC=y`` in the NuttX configuration file. They might
|
||||
provide useful examples:
|
||||
|
||||
- ``boards/arm/stm32/hymini-stm32v/nsh2``
|
||||
- ``boards/arm/dm320/ntosd-dm320/nsh``
|
||||
- ``boards/sim/sim/sim/nsh``
|
||||
- ``boards/sim/sim/sim/nsh2``
|
||||
- ``boards/sim/sim/sim/nx``
|
||||
- ``boards/sim/sim/sim/nx11``
|
||||
- ``boards/sim/sim/sim/touchscreen``
|
||||
|
||||
In most of these cases, the configuration sets up the *default*
|
||||
``/etc/init.d/rc.sysinit`` and ``/etc/init.d/rcS`` script. The default
|
||||
script is here: ``apps/nshlib/rc.sysinit.template`` and
|
||||
``apps/nshlib/rcS.template``. (The funny values in the rc.sysinit.template
|
||||
like ``XXXMKRDMINORXXX`` get replaced via ``sed`` at build time). This
|
||||
default configuration creates a ramdisk and mounts it at ``/tmp`` as
|
||||
discussed above.
|
||||
|
||||
If that default behavior is not what you want, then you can provide your
|
||||
own custom ``rc.sysinit`` and ``rcS`` script by defining
|
||||
``CONFIG_NSH_ARCHROMFS=y`` in the configuration file.
|
||||
|
||||
**Modifying the ROMFS Image**. The contents of the ``/etc`` directory
|
||||
are retained in the file ``apps/nshlib/nsh_romfsimg.h`` OR, if
|
||||
``CONFIG_NSH_ARCHROMFS`` is defined,
|
||||
``include/arch/board/nsh_romfsimg.h``. In order to modify the start-up
|
||||
behavior, there are three things to study:
|
||||
|
||||
#. **Configuration Options.** The additional ``CONFIG_NSH_ROMFSETC``
|
||||
configuration options discussed with the other `NSH-specific
|
||||
configuration settings <#nshconfiguration>`__.
|
||||
|
||||
#. ``tools/mkromfsimg.sh`` **Script**. The script
|
||||
``tools/mkromfsimg.sh`` creates ``nsh_romfsimg.h``. It is not
|
||||
automatically executed. If you want to change the configuration
|
||||
settings associated with creating and mounting the ``/tmp``
|
||||
directory, then it will be necessary to re-generate this header file
|
||||
using the ``tools/mkromfsimg.sh`` script.
|
||||
|
||||
The behavior of this script depends upon several things:
|
||||
|
||||
#. The configuration settings then installed configuration.
|
||||
|
||||
#. The ``genromfs`` tool(available from
|
||||
`http://romfs.sourceforge.net <http://romfs.sourceforge.net/>`__)
|
||||
or included within the NuttX buildroot toolchain. There is also a
|
||||
snapshot available in the NuttX tools repository
|
||||
`here <https://bitbucket.org/nuttx/tools/src/master/genromfs-0.5.2.tar.gz>`__.
|
||||
|
||||
#. The ``xxd`` tool that is used to generate the C header files (xxd
|
||||
is a normal part of a complete Linux or Cygwin installation,
|
||||
usually as part of the ``vi`` package).
|
||||
|
||||
#. The file ``apps/nshlib/rc.sysinit.template`` (OR, if
|
||||
``CONFIG_NSH_ARCHROMFS`` is defined
|
||||
``include/arch/board/rc.sysinit.template``.
|
||||
|
||||
The file ``apps/nshlib/rcS.template`` (OR, if
|
||||
``CONFIG_NSH_ARCHROMFS`` is defined
|
||||
``include/arch/board/rcs.template``.
|
||||
|
||||
#. ``rc.sysinit.template``. The file ``apps/nshlib/rc.sysinit.template``
|
||||
contains the general form of the ``rc.sysinit`` file; configured values
|
||||
are plugged into this template file to produce the final ``rc.sysinit`` file.
|
||||
|
||||
``rcS.template``. The file ``apps/nshlib/rcS.template`` contains the
|
||||
general form of the ``rcS`` file; configured values are plugged into
|
||||
this template file to produce the final ``rcS`` file.
|
||||
|
||||
To generate a custom ``rc.sysinit`` and ``rcS`` file a copy of
|
||||
``rc.sysinit.template`` and ``rcS.template`` needs to
|
||||
be placed at ``tools/`` and changed according to the desired start-up
|
||||
behaviour. Running ``tools/mkromfsimg.h`` creates ``nsh_romfsimg.h``
|
||||
which needs to be copied to ``apps/nshlib`` OR if
|
||||
``CONFIG_NSH_ARCHROMFS`` is defined to
|
||||
``boards/<arch>/<chip>/<board>/include``.
|
||||
|
||||
``rc.sysinit.template``. The default ``rc.sysinit.template``,
|
||||
``apps/nshlib/rc.sysinit.template``, generates the standard, default
|
||||
``apps/nshlib/nsh_romfsimg.h`` file.
|
||||
|
||||
``rcS.template``. The default ``rcS.template``,
|
||||
``apps/nshlib/rcS.template``, generates the standard, default
|
||||
``apps/nshlib/nsh_romfsimg.h`` file.
|
||||
|
||||
If ``CONFIG_NSH_ARCHROMFS`` is defined in the NuttX configuration file,
|
||||
then a custom, board-specific ``nsh_romfsimg.h`` file residing in
|
||||
``boards/<arch>/<chip>/<board>/include``\ will be used. NOTE when the OS
|
||||
is configured, ``include/arch/board`` will be linked to
|
||||
``boards/<arch>/<chip>/<board>/include``.
|
||||
|
||||
All of the startup-behavior is contained in ``rc.sysinit.template`` and
|
||||
``rcS.template``. The role of ``mkromfsimg.sh`` script is to (1) apply
|
||||
the specific configuration settings to ``rc.sysinit.template`` to create
|
||||
the final ``rc.sysinit``, and ``rcS.template`` to create the final ``rcS``,
|
||||
and (2) to generate the header file ``nsh_romfsimg.h`` containing the ROMFS file
|
||||
system image. To do this, ``mkromfsimg.sh`` uses two tools that must be
|
||||
installed in your system:
|
||||
|
||||
#. The ``genromfs`` tool that is used to generate the ROMFS file system
|
||||
image.
|
||||
|
||||
#. The ``xxd`` tool that is used to create the C header file.
|
||||
|
@ -261,123 +261,3 @@ Environment Variables
|
||||
========== ================================================
|
||||
|
||||
|
||||
NSH Start-Up Script
|
||||
===================
|
||||
|
||||
**NSH Start-Up Script**. NSH supports options to provide a start
|
||||
up script for NSH. In general this capability is enabled with
|
||||
``CONFIG_NSH_ROMFSETC``, but has several other related
|
||||
configuration options as described with the
|
||||
:doc:`NSH specific configuration settings <config>`.
|
||||
This capability also depends on:
|
||||
|
||||
- ``CONFIG_DISABLE_MOUNTPOINT`` not set
|
||||
- ``CONFIG_FS_ROMFS`` enabled
|
||||
|
||||
**Default Start-Up Behavior**. The implementation that is provided
|
||||
is intended to provide great flexibility for the use of Start-Up
|
||||
files. This paragraph will discuss the general behavior when all
|
||||
of the configuration options are set to the default values.
|
||||
|
||||
In this default case, enabling ``CONFIG_NSH_ROMFSETC`` will cause
|
||||
NSH to behave as follows at NSH startup time:
|
||||
|
||||
- NSH will create a read-only RAM disk (a ROM disk), containing a
|
||||
tiny ROMFS file system containing the following::
|
||||
|
||||
`--init.d/
|
||||
`-- rcS
|
||||
`-- rc.sysinit
|
||||
|
||||
Where rcS is the NSH start-up script.
|
||||
Where rc.sysinit is the NSH system init script.
|
||||
|
||||
- NSH will then mount the ROMFS file system at ``/etc``,
|
||||
resulting in::
|
||||
|
||||
|--dev/
|
||||
| `-- ram0
|
||||
`--etc/
|
||||
`--init.d/
|
||||
`-- rcS
|
||||
`-- rc.sysinit
|
||||
|
||||
- By default, the contents of rc.sysinit script are::
|
||||
|
||||
# Create a RAMDISK and mount it at XXXRDMOUNTPOINTXXX
|
||||
|
||||
mkrd -m 1 -s 512 1024
|
||||
mkfatfs /dev/ram1
|
||||
mount -t vfat /dev/ram1 /tmp
|
||||
|
||||
- NSH will execute the script at ``/etc/init.d/rc.sysinit`` at
|
||||
system init script(before the first NSH prompt). After
|
||||
execution of the script, the root FS will look like::
|
||||
|
||||
|--dev/
|
||||
| |-- ram0
|
||||
| `-- ram1
|
||||
|--etc/
|
||||
| `--init.d/
|
||||
| `-- rcS
|
||||
| `-- rc.sysinit
|
||||
`--tmp/
|
||||
|
||||
**Modifying the ROMFS Image**. The contents of the ``/etc``
|
||||
directory are retained in the file ``apps/nshlib/nsh_romfsimg.h``
|
||||
OR, if ``CONFIG_NSH_ARCHROMFS`` is defined,
|
||||
``include/arch/board/rcs.template``). In order to modify the
|
||||
start-up behavior, there are three things to study:
|
||||
|
||||
#. **Configuration Options.** The additional
|
||||
``CONFIG_NSH_ROMFSETC`` configuration options discussed with
|
||||
the other :doc:`NSH specific configuration settings <config>`.
|
||||
#. `tools/mkromfsimg.sh`` **Script**. The script
|
||||
``tools/mkromfsimg.sh`` creates ``nsh_romfsimg.h``. It is not
|
||||
automatically executed. If you want to change the configuration
|
||||
settings associated with creating and mounting the ``/tmp``
|
||||
directory, then it will be necessary to re-generate this header
|
||||
file using the ``tools/mkromfsimg.sh`` script.
|
||||
|
||||
The behavior of this script depends upon three things:
|
||||
|
||||
- The configuration settings then installed configuration.
|
||||
- The ``genromfs`` tool (available from
|
||||
http://romfs.sourceforge.net).
|
||||
- The file ``apps/nshlib/rc.sysinit.template`` (OR, if
|
||||
``CONFIG_NSH_ARCHROMFS`` is defined
|
||||
``include/arch/board/rc.sysinit.template``.
|
||||
The file ``apps/nshlib/rcS.template`` (OR, if
|
||||
``CONFIG_NSH_ARCHROMFS`` is defined
|
||||
``include/arch/board/rcs.template``.
|
||||
|
||||
#. ``rc.sysinit.template``: The file ``apps/nshlib/rc.sysinit.template``
|
||||
contains the general form of the ``rc.sysinit`` file; configured
|
||||
values are plugged into this template file to produce the final
|
||||
``rc.sysinit`` file.
|
||||
|
||||
``rcS.template``: The file ``apps/nshlib/rcS.template``
|
||||
contains the general form of the ``rcS`` file; configured
|
||||
values are plugged into this template file to produce the final
|
||||
``rcS`` file.
|
||||
|
||||
.. note::
|
||||
``apps/nshlib/rcS.template`` and ``apps/nshlib/rc.sysinit.template``
|
||||
generates the standard, default ``nsh_romfsimg.h`` file.
|
||||
If ``CONFIG_NSH_ARCHROMFS`` is defined in the NuttX configuration
|
||||
file, then a custom, board-specific ``nsh_romfsimg.h`` file residing
|
||||
in the ``boards/<arch>/<chip>/<board>/include`` directory will be
|
||||
used. NOTE when the OS is configured, ``include/arch/board`` will be
|
||||
linked to ``boards/<arch>/<chip>/<board>/include``.
|
||||
|
||||
All of the startup-behavior is contained in ``rc.sysinit.template``
|
||||
and ``rcS.template``. The role of ``mkromfsimg.sh`` is to (1) apply
|
||||
the specific configuration settings to ``rc.sysinit.template`` to create
|
||||
the final ``rc.sysinit``, and ``rc.sysinit.template`` to create the final
|
||||
``rcS`` and (2) to generate the header file ``nsh_romfsimg.h``
|
||||
containing the ROMFS file system image.
|
||||
|
||||
**Further Information**. See the section on
|
||||
:doc:`Customizing the NuttShell <customizing>` for additional, more detailed
|
||||
information about the NSH start-up script and how to modify it.
|
||||
|
||||
|
177
Documentation/guides/etcromfs.rst
Normal file
177
Documentation/guides/etcromfs.rst
Normal file
@ -0,0 +1,177 @@
|
||||
=========================
|
||||
etc romfs
|
||||
=========================
|
||||
The ROMFS image is the contents of the ``/etc`` directory, including the start-up script
|
||||
contains any command support by Nuttx, and other customized contents needed.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
CONFIG_NSH_ROMFS /* Mount a ROMFS file system at "/etc" and provide a system init script at
|
||||
"/etc/init.d.rc.sysinit" and a startup script at "etc/init.d/rcS". */
|
||||
CONFIG_ETC_ROMFSMOUNTPT /* The default mountpoint for the ROMFS volume is "/etc", but that can be
|
||||
changed with this setting. This must be a absolute path beginning with '/'
|
||||
and enclosed in quotes. */
|
||||
CONFIG_ETC_ROMFSDEVNO /* This is the minor number of the ROMFS block device. The default is '0'
|
||||
corresponding to "/dev/ram0". */
|
||||
CONFIG_ETC_ROMFSSECTSIZE /* This is the sector size to use with the ROMFS volume. Since the default volume
|
||||
is very small, this defaults to 64 but should be increased if the ROMFS volume
|
||||
were to be become large. Any value selected must be a power of 2. */
|
||||
|
||||
This capability also depends on:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
CONFIG_DISABLE_MOUNTPOINT /* If mount point support is disabled, then you cannot mount any file systems. */
|
||||
CONFIG_FS_ROMFS /* This option enables ROMFS file system support. */
|
||||
|
||||
Start up Scripts
|
||||
================
|
||||
|
||||
**Start-Up Script**. The start-up script contains any command support by Nuttx
|
||||
(i.e., that you see when you enter 'nsh> help'). The implementation that is provided is
|
||||
intended to provide great flexibility for the use of Start-Up files.
|
||||
This paragraph will discuss the general behavior when all of the
|
||||
configuration options are set to the default values.
|
||||
|
||||
In this default case, enabling ``CONFIG_ETC_ROMFS`` will cause Nuttx to
|
||||
behave as follows at Nuttx start-up time:
|
||||
|
||||
- Nuttx will create a read-only RAM disk (a ROM disk), containing a tiny
|
||||
ROMFS file system containing the following::
|
||||
|
||||
`--init.d/
|
||||
`-- rcS
|
||||
`-- rc.sysinit
|
||||
|
||||
Where ``rcS`` is the start-up script.
|
||||
Where ``rc.sysinit`` is the system-init script.
|
||||
|
||||
- Nuttx will then mount the ROMFS file system at ``/etc``, resulting in::
|
||||
|
||||
|--dev/
|
||||
| `-- ram0
|
||||
`--etc/
|
||||
`--init.d/
|
||||
`-- rcS
|
||||
`-- rc.sysinit
|
||||
|
||||
- By default, the contents of ``rc.sysinit`` script are::
|
||||
|
||||
# Create a RAMDISK and mount it at /tmp
|
||||
|
||||
mkrd -m 1 -s 512 1024
|
||||
mkfatfs /dev/ram1
|
||||
mount -t vfat /dev/ram1 /tmp
|
||||
|
||||
- NSH will execute the script at ``/etc/init.d/rc.sysinit`` at system
|
||||
init (before the first NSH prompt). After execution of the script,
|
||||
the root FS will look like::
|
||||
|
||||
|--dev/
|
||||
| |-- ram0
|
||||
| `-- ram1
|
||||
|--etc/
|
||||
| `--init.d/
|
||||
| `-- rcS
|
||||
| `-- rc.sysinit
|
||||
`--tmp/
|
||||
|
||||
**Example Configurations**. Here are some configurations that have
|
||||
``CONFIG_ETC_ROMFS=y`` in the NuttX configuration file. They might
|
||||
provide useful examples:
|
||||
|
||||
- ``boards/arm/stm32/hymini-stm32v/nsh2``
|
||||
- ``boards/arm/dm320/ntosd-dm320/nsh``
|
||||
- ``boards/sim/sim/sim/nsh``
|
||||
- ``boards/sim/sim/sim/nsh2``
|
||||
- ``boards/sim/sim/sim/nx``
|
||||
- ``boards/sim/sim/sim/nx11``
|
||||
- ``boards/sim/sim/sim/touchscreen``
|
||||
|
||||
In most of these cases, the configuration sets up the *default*
|
||||
``/etc/init.d/rc.sysinit`` and ``/etc/init.d/rcS`` script. The default
|
||||
script is here: ``apps/nshlib/rc.sysinit.template`` and
|
||||
``apps/nshlib/rcS.template``. (The funny values in the rc.sysinit.template
|
||||
like ``XXXMKRDMINORXXX`` get replaced via ``sed`` at build time). This
|
||||
default configuration creates a ramdisk and mounts it at ``/tmp`` as
|
||||
discussed above.
|
||||
|
||||
Customizing Start up Scripts
|
||||
============================
|
||||
|
||||
In order to modify the start-up behavior, there are three things to study:
|
||||
|
||||
#. **Configuration Options.** The additional ``CONFIG_ETC_ROMFS``
|
||||
configuration options discussed with `Configuration`
|
||||
|
||||
#. ``tools/mkromfsimg.sh`` **Script**. The script
|
||||
``tools/mkromfsimg.sh`` creates ``etc_romfs.c``. It is not
|
||||
automatically executed. If you want to change the configuration
|
||||
settings associated with creating and mounting the ``/tmp``
|
||||
directory, then it will be necessary to re-generate this header file
|
||||
using the ``tools/mkromfsimg.sh`` script.
|
||||
|
||||
The behavior of this script depends upon several things:
|
||||
|
||||
#. The configuration settings then installed configuration.
|
||||
|
||||
#. The ``genromfs`` tool(available from
|
||||
`http://romfs.sourceforge.net <http://romfs.sourceforge.net/>`__)
|
||||
or included within the NuttX buildroot toolchain. There is also a
|
||||
snapshot available in the NuttX tools repository
|
||||
`here <https://bitbucket.org/nuttx/tools/src/master/genromfs-0.5.2.tar.gz>`__.
|
||||
|
||||
#. The ``xxd`` tool that is used to generate the C header files (xxd
|
||||
is a normal part of a complete Linux or Cygwin installation,
|
||||
usually as part of the ``vi`` package).
|
||||
|
||||
#. The file ``include/arch/board/rc.sysinit.template`` and
|
||||
the file ``include/arch/board/rcs.template``
|
||||
|
||||
#. ``rc.sysinit.template``. The file ``apps/nshlib/rc.sysinit.template``
|
||||
contains the general form of the ``rc.sysinit`` file; configured values
|
||||
are plugged into this template file to produce the final ``rc.sysinit`` file.
|
||||
|
||||
``rcS.template``. The file ``apps/nshlib/rcS.template`` contains the
|
||||
general form of the ``rcS`` file; configured values are plugged into
|
||||
this template file to produce the final ``rcS`` file.
|
||||
|
||||
To generate a custom ``rc.sysinit`` and ``rcS`` file a copy of
|
||||
``rc.sysinit.template`` and ``rcS.template`` needs to
|
||||
be placed at ``tools/`` and changed according to the desired start-up
|
||||
behaviour. Running ``tools/mkromfsimg.h`` creates ``etc_romfs.c``
|
||||
which needs to be copied to ``arch/board/src`` and compiled in Makefile
|
||||
|
||||
All of the startup-behavior is contained in ``rc.sysinit.template`` and
|
||||
``rcS.template``. The role of ``mkromfsimg.sh`` script is to (1) apply
|
||||
the specific configuration settings to ``rc.sysinit.template`` to create
|
||||
the final ``rc.sysinit``, and ``rcS.template`` to create the final ``rcS``,
|
||||
and (2) to generate the source file ``etc_romfs.c`` containing the ROMFS file
|
||||
system image. To do this, ``mkromfsimg.sh`` uses two tools that must be
|
||||
installed in your system:
|
||||
|
||||
#. The ``genromfs`` tool that is used to generate the ROMFS file system
|
||||
image.
|
||||
|
||||
#. The ``xxd`` tool that is used to create the C header file.
|
||||
|
||||
Customizing ROMFS Image
|
||||
=======================
|
||||
|
||||
The ROMFS image can be generated from the content in the corresponding
|
||||
``board/arch/board/board/src/etc`` directory, and added by Makefile.
|
||||
|
||||
**Example Configurations**. Here are some configurations that have
|
||||
``CONFIG_ETC_ROMFS=y`` in the NuttX configuration file. They might
|
||||
provide useful examples:
|
||||
|
||||
- ``boards/risc-v/bl808/ox64/src/etc``
|
||||
- ``boards/risc-v/qemu-rv/rv-virt/src/etc``
|
||||
- ``boards/risc-v/esp32c3/esp32c3-devkit/src/etc``
|
||||
- ``boards/risc-v/k230/canmv230/src/etc``
|
||||
- ``boards/risc-v/jh7110/star64/src/etc``
|
||||
- ``boards/arm64/rk3399/nanopi_m4/src/etc``
|
||||
- ``boards/sim/sim/sim/src/etc``
|
@ -30,3 +30,4 @@ Guides
|
||||
stm32nullpointer.rst
|
||||
stm32ccm.rst
|
||||
stackrecord.rst
|
||||
etcromfs.rst
|
||||
|
@ -49,7 +49,7 @@ with NuttX. The list is the following:
|
||||
``CONFIG_ARCH_RAMVECTORS=y`` ``CONFIG_NSH_FILE_APPS=y``
|
||||
``CONFIG_BOARDCTL_APP_SYMTAB=y`` ``CONFIG_NSH_LINELEN=64``
|
||||
``CONFIG_BOARDCTL_OS_SYMTAB=y`` ``CONFIG_NSH_READLINE=y``
|
||||
``CONFIG_BUILTIN=y`` ``CONFIG_NSH_ROMFSETC=y``
|
||||
``CONFIG_BUILTIN=y`` ``CONFIG_ETC_ROMFS=y``
|
||||
``CONFIG_ELF=y`` ``CONFIG_PSEUDOTERM=y``
|
||||
``CONFIG_FS_BINFS=y`` ``CONFIG_PTHREAD_CLEANUP_STACKSIZE=1``
|
||||
``CONFIG_FS_PROCFS=y`` ``CONFIG_PTHREAD_MUTEX_TYPES=y``
|
||||
|
@ -4386,11 +4386,11 @@ Configurations
|
||||
|
||||
Relevant configuration options include:
|
||||
|
||||
CONFIG_NSH_ROMFSETC=y : Enable mounting at of startup file system
|
||||
CONFIG_NSH_ROMFSMOUNTPT="/etc" : Mount at /etc
|
||||
CONFIG_NSH_ROMFSDEVNO=0 : Device is /dev/ram0
|
||||
CONFIG_NSH_ARCHROMFS=y : ROMFS image is at
|
||||
boards/arm/sama5/sama5d4-ek/include/nsh_romfsimg.h
|
||||
CONFIG_ETC_ROMFS=y : Enable mounting at of startup file system
|
||||
ROMFS image is at
|
||||
boards/arm/sama5/sama5d4-ek/src/etc_romfs.c
|
||||
CONFIG_ETC_ROMFSMOUNTPT="/etc" : Mount at /etc
|
||||
CONFIG_ETC_ROMFSDEVNO=0 : Device is /dev/ram0
|
||||
The content of /etc/init.d/rcS can be see in the file rcS.template that
|
||||
can be found at: boards/arm/sama5/sama5d4-ek/include/rcS.template:
|
||||
|
||||
|
@ -5,7 +5,7 @@ README
|
||||
--------
|
||||
This directory contains logic to support a custom ROMFS system-init script
|
||||
and start-up script. These scripts are used by by the NSH when it starts
|
||||
provided that CONFIG_NSH_ARCHROMFS=y. These scripts provide a ROMFS volume
|
||||
provided that CONFIG_ETC_ROMFS=y. These scripts provide a ROMFS volume
|
||||
that will be mounted at /etc and will look like this at run-time:
|
||||
|
||||
NuttShell (NSH) NuttX-8.2
|
||||
|
@ -5,7 +5,7 @@ README
|
||||
--------
|
||||
This directory contains logic to support a custom ROMFS system-init script
|
||||
and start-up script. These scripts are used by by the NSH when it starts
|
||||
provided that CONFIG_NSH_ARCHROMFS=y. These scripts provide a ROMFS volume
|
||||
provided that CONFIG_ETC_ROMFS=y. These scripts provide a ROMFS volume
|
||||
that will be mounted at /etc and will look like this at run-time:
|
||||
|
||||
NuttShell (NSH) NuttX-8.2
|
||||
|
@ -5,7 +5,7 @@ README
|
||||
--------
|
||||
This directory contains logic to support a custom ROMFS system-init script
|
||||
and start-up script. These scripts are used by by the NSH when it starts
|
||||
provided that CONFIG_NSH_ARCHROMFS=y. These scripts provide a ROMFS volume
|
||||
provided that CONFIG_ETC_ROMFS=y. These scripts provide a ROMFS volume
|
||||
that will be mounted at /etc and will look like this at run-time:
|
||||
|
||||
NuttShell (NSH) NuttX-10.1.0-RC1
|
||||
|
@ -5,7 +5,7 @@ README
|
||||
--------
|
||||
This directory contains logic to support a custom ROMFS system-init script
|
||||
and start-up script. These scripts are used by by the NSH when it starts
|
||||
provided that CONFIG_NSH_ARCHROMFS=y. These scripts provide a ROMFS volume
|
||||
provided that CONFIG_ETC_ROMFS=y. These scripts provide a ROMFS volume
|
||||
that will be mounted at /etc and will look like this at run-time:
|
||||
|
||||
NuttShell (NSH) NuttX-7.31
|
||||
|
@ -1043,7 +1043,7 @@ NOTES
|
||||
@@ -117,7 +117,8 @@
|
||||
/* Execute the startup script */
|
||||
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
#ifdef CONFIG_ETC_ROMFS
|
||||
- nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH);
|
||||
+// REMOVE ME
|
||||
+// nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH);
|
||||
|
Loading…
Reference in New Issue
Block a user