
From: Simon Glass <sjg@chromium.org> Add a new global_data flag GD_FLG_ULIB to indicate that U-Boot is being used as a shared library. This allows suppressing console output that is inappropriate for library usage while preserving normal boot messages for standalone operation. For now the flag must be enabled by the caller and it has no effect. Signed-off-by: Simon Glass <sjg@chromium.org> --- include/asm-generic/global_data.h | 12 ++++++++++++ test/ulib/ulib_test.c | 1 + 2 files changed, 13 insertions(+) diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index fc99411e5fb..8b59df66ec5 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -758,8 +758,20 @@ enum gd_flags { * drivers shall not be called. */ GD_FLG_HAVE_CONSOLE = 0x8000000, + /** + * @GD_FLG_ULIB: U-Boot is running as a library + * + * For now, this just avoids console output on startup + */ + GD_FLG_ULIB = 0x10000000, }; +#if CONFIG_IS_ENABLED(ULIB) +#define gd_ulib() (gd->flags & GD_FLG_ULIB) +#else +#define gd_ulib() 0 +#endif + #endif /* __ASSEMBLY__ */ #endif /* __ASM_GENERIC_GBL_DATA_H */ diff --git a/test/ulib/ulib_test.c b/test/ulib/ulib_test.c index dd9cc0bb978..621bcd49be9 100644 --- a/test/ulib/ulib_test.c +++ b/test/ulib/ulib_test.c @@ -25,6 +25,7 @@ int main(int argc, char *argv[]) /* init global data */ memset(&data, '\0', sizeof(data)); + data.flags = GD_FLG_ULIB; ret = sandbox_init(argc, argv, &data); -- 2.43.0