[Concept,14/18] ulib: Implement GD_FLG_ULIB for library-usage mode
Commit Message
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(+)
@@ -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 */
@@ -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);