Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions system/nxinit/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,12 @@ config SYSTEM_NXINIT_DEBUG
bool "Enable debug log"
depends on SYSTEM_NXINIT_INFO

config SYSTEM_NXINIT_STDOUT
bool "Output log to stdout (printf)"
default n
---help---
Debug option: redirect all init logs to stdout via printf
instead of syslog. Useful when syslog is not available or
serial console has no output during early boot.

endif
15 changes: 11 additions & 4 deletions system/nxinit/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
****************************************************************************/

#include <poll.h>
#include <stdio.h>
#include <syslog.h>

/****************************************************************************
Expand All @@ -36,8 +37,14 @@

#define TIMESPEC2MS(t) (((t).tv_sec * 1000) + (t).tv_nsec / 1000000)

#ifdef CONFIG_SYSTEM_NXINIT_STDOUT
#define init_log_output(level, fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
#else
#define init_log_output(level, ...) syslog(level, ##__VA_ARGS__)
#endif

#ifdef CONFIG_SYSTEM_NXINIT_DEBUG
#define init_debug(...) syslog(LOG_USER, ##__VA_ARGS__)
#define init_debug(...) init_log_output(LOG_USER, ##__VA_ARGS__)
#define init_dump_args(argc, argv) \
{ \
int _i; \
Expand All @@ -52,19 +59,19 @@
#endif

#ifdef CONFIG_SYSTEM_NXINIT_INFO
#define init_info(...) syslog(LOG_INFO, ##__VA_ARGS__)
#define init_info(...) init_log_output(LOG_INFO, ##__VA_ARGS__)
#else
#define init_info(...)
#endif

#ifdef CONFIG_SYSTEM_NXINIT_WARN
#define init_warn(...) syslog(LOG_WARNING, ##__VA_ARGS__)
#define init_warn(...) init_log_output(LOG_WARNING, ##__VA_ARGS__)
#else
#define init_warn(...)
#endif

#ifdef CONFIG_SYSTEM_NXINIT_ERR
#define init_err(f, ...) syslog(LOG_ERR, "Error " f, ##__VA_ARGS__)
#define init_err(f, ...) init_log_output(LOG_ERR, "Error " f, ##__VA_ARGS__)
#else
#define init_err(...)
#endif
Expand Down
Loading