[U-Boot] [PATCH v2 27/31] sandbox: Deal with conflicting getenv() for SDL

Simon Glass sjg at chromium.org
Thu Feb 27 21:26:21 CET 2014


Unfortunately SDL requires getenv() to operate, since it wants to figure out
the display type. U-Boot has its own getenv() and they conflict. As a
work-around use #define to resolve the conflict.

A better but more complex solution might be to rename some U-Boot symbols
at link time. SDL audio is not functional at present, likely due to a related
issue.

Note: Vic Yank wrote a script for this, filed in crbug.com/271125.

Reviewed-by: Simon Glass <sjg at chromium.org>
Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2: None

 include/common.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/common.h b/include/common.h
index 033b5d9..bbcfd97 100644
--- a/include/common.h
+++ b/include/common.h
@@ -359,6 +359,11 @@ int do_ext2load(cmd_tbl_t *, int, int, char * const []);
 int	env_init     (void);
 void	env_relocate (void);
 int	envmatch     (uchar *, int);
+
+/* Avoid unfortunate conflict with libc's getenv() */
+#ifdef CONFIG_SANDBOX
+#define getenv uboot_getenv
+#endif
 char	*getenv	     (const char *);
 int	getenv_f     (const char *name, char *buf, unsigned len);
 ulong getenv_ulong(const char *name, int base, ulong default_val);
-- 
1.9.0.279.gdc9e3eb



More information about the U-Boot mailing list