system/nxinit: add CONFIG_SYSTEM_NXINIT_STDOUT for printf-based log output - #3765
Open
JianyuWang0623 wants to merge 1 commit into
Open
system/nxinit: add CONFIG_SYSTEM_NXINIT_STDOUT for printf-based log output#3765JianyuWang0623 wants to merge 1 commit into
JianyuWang0623 wants to merge 1 commit into
Conversation
…utput Syslog may be output via services such as DFX. When debugging the init component (e.g., service startup failures, including DFX-related exceptions), syslog may not be output properly. Add a debug Kconfig option SYSTEM_NXINIT_STDOUT that redirects all init log macros (init_debug/info/warn/err) to printf instead of syslog. This is useful for early boot debugging when syslog is not yet available or serial console shows no output. Introduce init_log_output() macro as the common log backend, selected at compile time between printf (with appended newline) and syslog. Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
JianyuWang0623
force-pushed
the
nxinit-stdout-log-output
branch
from
September 2, 2026 07:49
6ec234a to
4f7c896
Compare
JianyuWang0623
marked this pull request as ready for review
September 2, 2026 07:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
system/nxinitcurrently logs everything throughsyslog(). Onproducts where
syslogis 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/erroutput is silentlylost and there is no way to see why
initfailed to bring up aservice.
Add a debug-only Kconfig option
SYSTEM_NXINIT_STDOUTthat redirectsall four log macros to
printf()(with an appended newline) insteadof
syslog(), selected at compile time via a newinit_log_output()macro. Default is
n(unchangedsyslogbehavior).Impact
system/nxinit/{Kconfig,init.h}. No behavior changewhen
SYSTEM_NXINIT_STDOUTis left at its default (n).stdio.his already transitively available.Testing
Built with the
sim:nshtarget (host gcc,nxinit-qemu-sim-all-nsh-defconfigsbranch of
nuttxwhich enablesCONFIG_SYSTEM_NXINIT).nxstyleclean on both touched files.
Verified the actual failure mode this fixes: pointed
CONFIG_SYSTEM_NXINIT_RC_FILE_PATHat a nonexistent file soinithits its own
init_err()path on boot, and disabledCONFIG_SYSLOG_DEFAULTsosyslog()has no console channel at all(simulating "syslog not available/not visible"):
With
CONFIG_SYSTEM_NXINIT_STDOUTleft unset (default), behavior isunchanged from before this patch (verified boot log is identical to
apache/master).