JianyuWang0623 opened a new pull request, #3765:
URL: https://github.com/apache/nuttx-apps/pull/3765

   ## Summary
   
   `system/nxinit` currently logs everything through `syslog()`. On
   products where `syslog` is routed through a userspace service (e.g.
   DFX), that channel may not be usable yet during early boot, or may
   not be visible at all if the service itself is what's failing (e.g.
   a service start failure, or an exception inside the DFX consumer).
   When that happens, `init_debug/info/warn/err` output is silently
   lost and there is no way to see why `init` failed to bring up a
   service.
   
   Add a debug-only Kconfig option `SYSTEM_NXINIT_STDOUT` that redirects
   all four log macros to `printf()` (with an appended newline) instead
   of `syslog()`, selected at compile time via a new `init_log_output()`
   macro. Default is `n` (unchanged `syslog` behavior).
   
   ## Impact
   
   - Only touches `system/nxinit/{Kconfig,init.h}`. No behavior change
     when `SYSTEM_NXINIT_STDOUT` is left at its default (`n`).
   - No new dependencies; `stdio.h` is already transitively available.
   
   ## Testing
   
   Built with the `sim:nsh` target (host gcc, 
`nxinit-qemu-sim-all-nsh-defconfigs`
   branch of `nuttx` which enables `CONFIG_SYSTEM_NXINIT`). `nxstyle`
   clean on both touched files.
   
   Verified the actual failure mode this fixes: pointed
   `CONFIG_SYSTEM_NXINIT_RC_FILE_PATH` at a nonexistent file so `init`
   hits its own `init_err()` path on boot, and disabled
   `CONFIG_SYSLOG_DEFAULT` so `syslog()` has no console channel at all
   (simulating "syslog not available/not visible"):
   
   ```
   # CONFIG_SYSTEM_NXINIT_STDOUT is not set, CONFIG_SYSLOG_DEFAULT is not set
   $ ./nuttx
   nsh>                     # no init_err output at all - the bug this fixes
   
   # CONFIG_SYSTEM_NXINIT_STDOUT=y, CONFIG_SYSLOG_DEFAULT still not set
   $ ./nuttx
   Error Opening /etc/init.d/init.rc.MISSING 2
   nsh>                     # init_err output now visible via printf
   ```
   
   With `CONFIG_SYSTEM_NXINIT_STDOUT` left unset (default), behavior is
   unchanged from before this patch (verified boot log is identical to
   `apache/master`).
   


-- 
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