diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-09-11 22:59:45 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-09-11 22:59:45 +0000 |
commit | 616b655dea1a96593abea5ff590dacbaedfa52ed (patch) | |
tree | 7cb7878b1e71d310a8a41049299d98ef09c8a2de /nuttx/examples/nsh/README.txt | |
parent | 97d11b18c99ba683fbe91fc3ad5d9b897de27c81 (diff) | |
download | px4-nuttx-616b655dea1a96593abea5ff590dacbaedfa52ed.tar.gz px4-nuttx-616b655dea1a96593abea5ff590dacbaedfa52ed.tar.bz2 px4-nuttx-616b655dea1a96593abea5ff590dacbaedfa52ed.zip |
Add /etc via ROMFS and /tmp via FAT FS to NSH
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@911 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nsh/README.txt')
-rw-r--r-- | nuttx/examples/nsh/README.txt | 96 |
1 files changed, 95 insertions, 1 deletions
diff --git a/nuttx/examples/nsh/README.txt b/nuttx/examples/nsh/README.txt index 7a904ecce..c2182e91d 100644 --- a/nuttx/examples/nsh/README.txt +++ b/nuttx/examples/nsh/README.txt @@ -9,7 +9,8 @@ examples/nsh - Conditional Command Execution - Built-In Variables - Current Working Directory - Environment Variables: + Environment Variables + - NSH Start-Up Script - Simple Commands - NSH Configuration Settings Command Dependencies on Configuration Settings @@ -94,6 +95,99 @@ Current Working Directory PWD - The current working directory OLDPWD - The previous working directory +NSH Start-Up Script +^^^^^^^^^^^^^^^^^^^ + +NSH supports options to provide a start up script for NSH. In general +this capability is enabled with CONFIG_EXAMPLES_NSH_ROMFSETC, but has +several other related configuration options as described in the final +section of this README. This capability also depends on: + + - CONFIG_DISABLE_MOUNTPOINT not set + - CONFIG_NFILE_DESCRIPTORS < 4 + - CONFIG_FS_ROMFS + +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_EXAMPLES_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 filesystem containing the following: + + |--init.d/ + `-- rcS + + Where rcS is the NSH start-up script + +- NSH will then mount the ROMFS filesystem at /etc, resulting in: + + |--dev/ + | `-- ram0 + `--etc/ + `--init.d/ + `-- rcS + +- By default, the contents of rcS script are: + + # Create a RAMDISK and mount it at XXXRDMOUNTPOUNTXXX + + mkrd -m 1 -s 512 1024 + mkfatfs /dev/ram1 + mount -t vfat /dev/ram1 /tmp + +- NSH will execute the script at /etc/init.d/rcS at start-up (before the + first NSH prompt. After execution of the script, the root FS will look + like: + + |--dev/ + | |-- ram0 + | `-- ram1 + |--etc/ + | `--init.d/ + | `-- rcS + `--tmp/ + +Modifying the ROMFS Image +------------------------- + +The contents of the /etc directory are retained in the file +examples/nsh/nsh_romfsimg.h. In order to modify the start-up +behavior, there are three things to study: + +1. Configuration Options. + The additional CONFIG_EXAMPLES_NSH_ROMFSETC configuration options + discussed in the final section of this README. + +2. mkromfsimg.sh Script. + The script examples/nsh/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 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 examples/nsh/rcS.template. + +3. rcS.template. + The file examples/nsh/rcS.template contains the general form + of the rcS file; configurated values are plugged into this + template file to produce the final rcS file. + +All of the startup-behavior is contained in rcS.template. The +role of mkromfsimg.sh is to (1) apply the specific configuration +settings to rcS.template to create the final rcS, and (2) to +generate the header file nsh_romfsimg.h containg the ROMFS +file system image. Simple Commands ^^^^^^^^^^^^^^^ |