Skip to content

Add documentation for NxInit (apps/system/nxinit) - #17215

Closed
JianyuWang0623 wants to merge 1 commit into
apache:masterfrom
JianyuWang0623:system_init_doc_config
Closed

JianyuWang0623 wants to merge 1 commit into
apache:masterfrom
JianyuWang0623:system_init_doc_config

Conversation

@JianyuWang0623

@JianyuWang0623 JianyuWang0623 commented Oct 20, 2025 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds documentation for the Init component and updates the configuration for qemu-armv8a:fastboot.

  • Included syntax explanations for key Init APIs
  • Provided simple usage examples to illustrate practical implementation

Depends-on: apache/nuttx-apps#3192

Impact

  • documentation for newly introduced Android System Init subsystem.

Testing

image

@simbit18

Copy link
Copy Markdown
Contributor

The Pull Request Labeler workflow error:
https://github.com/apache/nuttx/actions/runs/18647234788/job/53157042267?pr=17214#logs

is related to this issue on
Docker Hub
https://www.dockerstatus.com/

@simbit18

simbit18 commented Oct 20, 2025 •

Copy link
Copy Markdown
Contributor

@JianyuWang0623 This error on MSYS2 is because genromfs is missing!

I'll run some tests and then open a PR.

====================================================================================
Configuration/Tool: qemu-armv8a/nsh_smp
2025-10-20 09:27:14
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Building NuttX...
/usr/bin/bash: line 1: genromfs: command not found
make[2]: *** [/d/a/nuttx/nuttx/sources/nuttx/boards/Board.mk:35: etctmp.c] Error 127
make[2]: Target 'depend' not remade because of errors.
make[1]: *** [Makefile:233: .depend] Error 2
make[1]: Target 'depend' not remade because of errors.
make: *** [tools/Unix.mk:660: pass2dep] Error 2
make: Target 'all' not remade because of errors.
/d/a/nuttx/nuttx/sources/nuttx/tools/testbuild.sh: line 385: /d/a/nuttx/nuttx/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize qemu-armv8a/nsh_smp
====================================================================================

@JianyuWang0623 JianyuWang0623 changed the title System init doc config Add doc for Init Oct 20, 2025

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @JianyuWang0623 :-)

  1. Just as in apache/nuttx-apps#3192 I would advise using "Android System Init" naming convention as there are several different init types out there and the name / variables would be self-explanatory and maybe one day add other init types.
  2. This PR is about adding documentation but also changes code. Shouldn't code changes go to the PR where code is changed?

@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Size: M The size of the change in this PR is medium labels Oct 20, 2025
@JianyuWang0623

Copy link
Copy Markdown
Contributor Author
  1. This PR is about adding documentation but also changes code. Shouldn't code changes go to the PR where code is changed?

@cederom Both of these commits are related to the Init process. The code changes can serve as detailed examples for the documentation. If this is not appropriate, I have split them. Could you help review the pull request? #17216

@cederom

cederom commented Oct 20, 2025

Copy link
Copy Markdown
Contributor

Big thank you @JianyuWang0623 !! :-) I would like to discuss the naming convention please, I will start thread on the mailing list :-) The change is very useful but naming like "Android System Init" would make it more clear for the users :-) Thank you :-)


1. Actions and Commands
-----------------------
::

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout the NuttX documentation the
.. code-block:: console or .. code-block:: bash block is used, rather than literal blocks ::
I suggest using the same approach here for anything "output"/commands related.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tinnedkarma what happens when uses :: without the code-block pattern? Will it try to autodetect the type of the block?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not at all. It will do nothing.
The simple :: is part of reStructuredText specs, built in. It just creates a block of text.
The ..code-block:: [language] is a Sphinx directive. This directive adds syntax highlighting based on language specified

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tinnedkarma Useful syntax. I've specified the diff format for the defconfig in the Example. Thank you.

@acassis acassis left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JianyuWang0623 your Documentation is very good! Kudos.

As @cederom suggested the naming "System Init" could confuse some users. Because now there are many ways to initialize the system or an application on NuttX:

  1. The INIT_ENTRYPOINT is in some way a system init (if the "system" of the user is just his application)
  2. NSH Init Script is also a way to initialize the system
  3. Android System Init.

So I suggest you starting the Documentation explaining about these differences before explaining about this new system init. This way the user will get a better understanding of the options and when and why they will select the Android System Init option.

Also please include some information about the footprint and limitation of each usage case.

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a feedback after dev@ mailing list discussion, thank you for understanding / considering @JianyuWang0623 :

  1. We clearly need to use "Android System Init" naming here and update all kconfig/global variables names to clearly distinguish from current NuttX Init, Android System Init, and SystemV Init (there is sill a change it will show up here one day), maybe others. "system_system" or "system_init" or "init_main" is really confusing and not self-explanatory, does not even point to "android_system_init". I know this is a bit longer but will provide important context and clear separation between completely different functionalities / implementations.
  2. We need better documentation for this "Android System Init" as well as "Fastboot". These functionalities are welcome, people want to use it, but users / developers ask questions like: Why do we need another init system? What should happen with the previous ones? What does this new init system solve? How this relates to Fastboot? When, why, and how can I use it? What are best use cases with some examples? Please consider approach like explaining and convincing someone who wants to use it but has zero knowledge about the solution.

sleep 1 /* Block for 1 second */
exec_start mkdir_tmp /* Start the "mkdir_tmp" service and wait for exit */

on property:ro.boot.resetcause=cpu_soft_reset(bootloader) /* Trigger after rebooting to bootloader */

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cant find in the code where properties are supported. maybe it's my fault, or it's not there yet?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@7rx8 Sorry, this part is still in the internal repository and hasn’t been upstreamed yet. For now, let’s treat it as a feature preview. Alternatively, if it’s causing confusion, I can remove this part first.

@7rx8 7rx8 Oct 23, 2025 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, that means you have more pull requests with property support coming :)

Did you make sure to keep this optional? Because the system is already useful without properties.

My suggestion regarding this is: update the doc so it matches the current code pull request, then update the doc later so it matches the future functions. I understand this is more work for you, so you're free to refuse.

OR: just add a note that this is not implemented yet.

Looking forward to see this integrated in nuttx, good job, thank you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@7rx8 Yes, there will be a new pull request to support properties. It will be independent and optional, and may be more suitable/needed in certain scenarios that require action triggering.

Regarding the documentation, I fully agree with your point of view. I have already removed the descriptions of features that haven't been submitted yet, as this might cause confusion for users. Thank you.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen the new doc, it is probably enough for now. We should update it when users ask questions about topics that were not documented yet.

Add documentation for the Init component, including syntax explanations and
simple examples.

Signed-off-by: wangjianyu3 <[email protected]>
@JianyuWang0623 JianyuWang0623 changed the title Add doc for Init Add documentation for NxInit (apps/system/nxinit) Oct 27, 2025
@7rx8

7rx8 commented Oct 28, 2025

Copy link
Copy Markdown

Hello

I do not agree with this closure. This is a great addition to nuttx that was worked on for a long time and is almost ready. Why are you closing this?

@JianyuWang0623 has worked a lot of time to reply to community requests there is no point in closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants