tinnedkarma commented on code in PR #17215:
URL: https://github.com/apache/nuttx/pull/17215#discussion_r2445036508


##########
Documentation/applications/system/init/index.rst:
##########
@@ -0,0 +1,118 @@
+======================
+``init`` Init
+======================
+
+Init.rc Syntax
+==============
+
+Init.rc consists of five categories of statements, all line-oriented with
+parameters separated by spaces. The content is processed by a preprocessor,
+following C language specifications for escape rules and comment formats.
+File path: /etc/init.d/init.rc.
+
+1. Actions and Commands
+-----------------------
+::
+
+    on <trigger> [&& <trigger>]*
+       <command>
+       <command>
+       <command>
+
+- An Action (command sequence) contains trigger conditions. When satisfied,
+  it is added to the execution queue. Multiple triggers can be combined (e.g.,
+  boot && property:true=true). Two types of triggers are supported: event
+  triggers (e.g., boot) and property triggers (e.g., property:a=b).
+- Commands are the specific execution content of actions, such as setprop
+  (set system properties), start (start services), and mount (mount file
+  systems).
+
+2. Services and Options
+-----------------------
+::
+
+    service <name> <pathname> [ <argument> ]*
+       <option>
+       <option>
+       ...
+
+- A Service is a program started by Init, with a unique name (can be overridden
+  via the override option).
+- Options are modifiers for services, affecting their running mode and timing.
+  Examples include class (specify service category for batch start/stop),
+  override (override previously defined services), restart_period (interval
+  for restarting exited services), and reboot_on_failure (critical services
+  trigger device reboot on startup failure or abnormal exit).
+
+3. Imports
+----------
+Used to import other configuration files, supporting single files or all files
+in a directory (non-recursive).
+
+Triggers
+========
+
+1. Types and Formats
+--------------------
+Divided into event triggers (e.g., boot) and property triggers (e.g.,
+property:a=b). Actions can include multiple triggers but only one event
+trigger. Triggers can be combined with && for "AND" conditions.
+
+2. Check Timing
+---------------
+- All action triggers are automatically checked once at startup.
+- Property triggers are checked when the property is created or its value
+  is updated (e.g., property:a=b is checked when a's value changes).
+
+3. Trigger Execution Order
+--------------------------
+1. boot: The first event after Init starts.
+2. init: After BOARDIOC_INIT completes.
+3. netinit: Optional, after netinit_bringup() returns.
+4. finalinit: After BOARDIOC_FINALINIT completes.
+
+Commands
+========
+- System Operations: mount/umount (mount/unmount file systems), setprop
+  (set system properties), chmod/chown (modify file permissions/owner).
+- Service Management: start/stop/restart (start/stop/restart services),
+  class_start/class_stop (batch start/stop service categories).
+- File Operations: mkdir (create directories with configurable permissions,
+  owner, and encryption settings), copy/write (copy files/write file content).
+- Others: trigger (trigger events), wait (wait for file existence or timeout),
+  loglevel (set Init log level).
+
+Examples
+========
+defconfig::

Review Comment:
   Ditto



##########
Documentation/applications/system/init/index.rst:
##########
@@ -0,0 +1,118 @@
+======================
+``init`` Init
+======================
+
+Init.rc Syntax
+==============
+
+Init.rc consists of five categories of statements, all line-oriented with
+parameters separated by spaces. The content is processed by a preprocessor,
+following C language specifications for escape rules and comment formats.
+File path: /etc/init.d/init.rc.
+
+1. Actions and Commands
+-----------------------
+::
+
+    on <trigger> [&& <trigger>]*
+       <command>
+       <command>
+       <command>
+
+- An Action (command sequence) contains trigger conditions. When satisfied,
+  it is added to the execution queue. Multiple triggers can be combined (e.g.,
+  boot && property:true=true). Two types of triggers are supported: event
+  triggers (e.g., boot) and property triggers (e.g., property:a=b).
+- Commands are the specific execution content of actions, such as setprop
+  (set system properties), start (start services), and mount (mount file
+  systems).
+
+2. Services and Options
+-----------------------
+::
+
+    service <name> <pathname> [ <argument> ]*
+       <option>
+       <option>
+       ...
+
+- A Service is a program started by Init, with a unique name (can be overridden
+  via the override option).
+- Options are modifiers for services, affecting their running mode and timing.
+  Examples include class (specify service category for batch start/stop),
+  override (override previously defined services), restart_period (interval
+  for restarting exited services), and reboot_on_failure (critical services
+  trigger device reboot on startup failure or abnormal exit).
+
+3. Imports
+----------
+Used to import other configuration files, supporting single files or all files
+in a directory (non-recursive).
+
+Triggers
+========
+
+1. Types and Formats
+--------------------
+Divided into event triggers (e.g., boot) and property triggers (e.g.,
+property:a=b). Actions can include multiple triggers but only one event
+trigger. Triggers can be combined with && for "AND" conditions.
+
+2. Check Timing
+---------------
+- All action triggers are automatically checked once at startup.
+- Property triggers are checked when the property is created or its value
+  is updated (e.g., property:a=b is checked when a's value changes).
+
+3. Trigger Execution Order
+--------------------------
+1. boot: The first event after Init starts.
+2. init: After BOARDIOC_INIT completes.
+3. netinit: Optional, after netinit_bringup() returns.
+4. finalinit: After BOARDIOC_FINALINIT completes.
+
+Commands
+========
+- System Operations: mount/umount (mount/unmount file systems), setprop
+  (set system properties), chmod/chown (modify file permissions/owner).
+- Service Management: start/stop/restart (start/stop/restart services),
+  class_start/class_stop (batch start/stop service categories).
+- File Operations: mkdir (create directories with configurable permissions,
+  owner, and encryption settings), copy/write (copy files/write file content).
+- Others: trigger (trigger events), wait (wait for file existence or timeout),
+  loglevel (set Init log level).
+
+Examples
+========
+defconfig::
+
+    CONFIG_INIT_ENTRYPOINT="init_main"
+    CONFIG_SYSTEM_INIT=y
+    CONFIG_SYSTEM_INIT_DEBUG=y
+    CONFIG_SYSTEM_INIT_INFO=y
+    CONFIG_SYSTEM_INIT_WARN=y
+
+init.rc::

Review Comment:
   Ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to