You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2026/04/23 13:26:31 UTC

(nuttx) 02/02: sched/docs: Align ETC ROMFS text with tmpfs-first /tmp mount.

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit f51052d78030d00001f71c780efcae9a588bf63b
Author: Arjav Patel <ar...@gmail.com>
AuthorDate: Thu Apr 23 07:33:38 2026 +0530

    sched/docs: Align ETC ROMFS text with tmpfs-first /tmp mount.
    
    Update ETC_ROMFS help text and NSH/ROMFS guides to describe the
    /tmp mount behavior as tmpfs-first with FAT RAMDISK fallback when
    CONFIG_FS_TMPFS is not enabled.
    
    Signed-off-by: Arjav Patel <ar...@gmail.com>
---
 Documentation/applications/nsh/customizing.rst | 18 ++++++++++----
 Documentation/guides/etcromfs.rst              | 11 ++++++---
 sched/Kconfig                                  | 34 ++++++++++++++------------
 3 files changed, 39 insertions(+), 24 deletions(-)

diff --git a/Documentation/applications/nsh/customizing.rst b/Documentation/applications/nsh/customizing.rst
index 2d120373a9a..ca2d305ff8c 100644
--- a/Documentation/applications/nsh/customizing.rst
+++ b/Documentation/applications/nsh/customizing.rst
@@ -57,10 +57,13 @@ The NSH initialization function, ``nsh_initialize()``, be found in
      read-only, ROMFS file system is mounted by ``nsh_romfsetc()``.
 
      The ROMFS image is, itself, just built into the firmware. By default,
-     this ``rc.sysinit`` system init script contains the following logic::
+     this ``rc.sysinit`` system init script contains logic to prefer
+     TMPFS for ``/tmp`` and to fall back to FAT RAMDISK::
 
-        # Create a RAMDISK and mount it at XXXRDMOUNTPOINTXXX
+        # Mount /tmp on TMPFS
+        mount -t tmpfs XXXRDMOUNTPOINTXXX
 
+        # Otherwise create a RAMDISK and mount it at XXXRDMOUNTPOINTXXX
         mkrd -m XXXMKRDMINORXXX -s XXMKRDSECTORSIZEXXX XXMKRDBLOCKSXXX
         mkfatfs /dev/ramXXXMKRDMINORXXX
         mount -t vfat /dev/ramXXXMKRDMINORXXX XXXRDMOUNTPOINTXXX
@@ -79,15 +82,20 @@ The NSH initialization function, ``nsh_initialize()``, be found in
      -  ``XXXRDMOUNTPOINTXXX`` will become the configured mount point.
         Default: ``/etc``
 
-     By default, the substituted values would yield an ``rc.sysinit`` file like::
+     By default, with FAT fallback values substituted, ``rc.sysinit``
+     can look like::
 
-        # Create a RAMDISK and mount it at /tmp
+        # Mount /tmp on TMPFS
+        mount -t tmpfs /tmp
 
+        # Otherwise create a RAMDISK and mount it at /tmp
         mkrd -m 1 -s 512 1024
         mkfatfs /dev/ram1
         mount -t vfat /dev/ram1 /tmp
 
-     This script will, then:
+     This script will:
+
+     -  Mount ``/tmp`` as TMPFS when available, or else:
 
      -  Create a RAMDISK of size 512*1024 bytes at ``/dev/ram1``,
 
diff --git a/Documentation/guides/etcromfs.rst b/Documentation/guides/etcromfs.rst
index aee60257a39..9a579fc2d11 100644
--- a/Documentation/guides/etcromfs.rst
+++ b/Documentation/guides/etcromfs.rst
@@ -58,10 +58,13 @@ behave as follows at Nuttx start-up time:
               `-- rcS
               `-- rc.sysinit
 
-  -  By default, the contents of ``rc.sysinit`` script are::
+  -  By default, the contents of ``rc.sysinit`` script prefer TMPFS for
+     ``/tmp`` and fall back to FAT RAMDISK when TMPFS is not enabled::
 
-      # Create a RAMDISK and mount it at /tmp
+      # Mount /tmp on TMPFS
+      mount -t tmpfs /tmp
 
+      # Otherwise create a RAMDISK and mount it at /tmp
       mkrd -m 1 -s 512 1024
       mkfatfs /dev/ram1
       mount -t vfat /dev/ram1 /tmp
@@ -96,8 +99,8 @@ In most of these cases, the configuration sets up 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.
+default configuration mounts ``/tmp`` as TMPFS when enabled, otherwise
+it creates a RAMDISK and mounts FAT at ``/tmp`` as discussed above.
 
 Customizing Start up Scripts
 ============================
diff --git a/sched/Kconfig b/sched/Kconfig
index 167cd17eb95..a3860afc1b0 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -552,8 +552,9 @@ menuconfig ETC_ROMFS
 	---help---
 		Mount a ROMFS filesystem 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.
+		at /etc/init.d/rcS.  The default system init script mounts
+		/tmp as TMPFS when FS_TMPFS is enabled, otherwise it can
+		fall back to mounting a FAT FS RAMDISK at /tmp.
 
 if ETC_ROMFS
 
@@ -591,37 +592,40 @@ config ETC_FATDEVNO
 	default 1
 	depends on FS_FAT
 	---help---
-		When the default rcS file used when ETC_ROMFS is selected, it
-		will mount a FAT FS under /tmp. This is the minor number of the FAT
-		FS block device.  The default is '1' corresponding to /dev/ram1.
+		When ETC_ROMFS is selected and FS_TMPFS is disabled, the
+		default rc.sysinit script mounts a FAT FS under /tmp. This
+		is the minor number of the FAT FS block device.  The default
+		is '1' corresponding to /dev/ram1.
 
 config ETC_FATSECTSIZE
 	int "FAT sector size"
 	default 512
 	depends on FS_FAT
 	---help---
-		When the default rcS file used when ETC_ROMFS is selected, it
-		will mount a FAT FS under /tmp. This is the sector size use with the
-		FAT FS. Default is 512.
+		When ETC_ROMFS is selected and FS_TMPFS is disabled, the
+		default rc.sysinit script mounts a FAT FS under /tmp. This
+		is the sector size used with the FAT FS. Default is 512.
 
 config ETC_FATNSECTORS
 	int "FAT number of sectors"
 	default 1024
 	depends on FS_FAT
 	---help---
-		When the default rcS file used when ETC_ROMFS is selected, it
-		will mount a FAT FS under /tmp. This is the number of sectors to use
-		with the FAT FS.  Default is 1024.  The amount of memory used by the
-		FAT FS will be ETC_FATSECTSIZE * ETC_FATNSECTORS bytes.
+		When ETC_ROMFS is selected and FS_TMPFS is disabled, the
+		default rc.sysinit script mounts a FAT FS under /tmp. This
+		is the number of sectors to use with the FAT FS.  Default is
+		1024.  The amount of memory used by the FAT FS will be
+		ETC_FATSECTSIZE * ETC_FATNSECTORS bytes.
 
 config ETC_FATMOUNTPT
 	string "FAT mount point"
 	default "/tmp"
 	depends on FS_FAT
 	---help---
-		When the default rcS file used when ETC_ROMFS is selected, it
-		will mount a FAT FS under /tmp. This is the location where the FAT
-		FS will be mounted.  Default is "/tmp".
+		When ETC_ROMFS is selected and FS_TMPFS is disabled, the
+		default rc.sysinit script mounts a FAT FS under /tmp. This
+		is the location where the FAT FS will be mounted.  Default is
+		"/tmp".
 
 endif # ETC_ROMFS