[U-Boot] [PATCH 06/11] MIPS: bootm: make initialisation of Linux environment optional

Daniel Schwierzeck daniel.schwierzeck at gmail.com
Sun Jun 9 00:42:45 CEST 2013


Recent linux kernels do not use that special environment variables
anymore. Add an option to disable compilation of that code but
keep it for compatibilty with older kernels.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
---
 README                | 6 ++++++
 arch/mips/lib/bootm.c | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/README b/README
index 33bda8c..1623616 100644
--- a/README
+++ b/README
@@ -522,6 +522,12 @@ The following options need to be configured:
 		expect it to be in bytes, others in MB.
 		Define CONFIG_MEMSIZE_IN_BYTES to make it in bytes.
 
+		CONFIG_DISABLE_ENV_INIT		[relevant for MIPS only]
+
+		Disable initialization of traditional environment variables
+		passed to Linux. Modern kernels only use variables from command
+		line.
+
 		CONFIG_OF_LIBFDT
 
 		New kernel versions are expecting firmware settings to be
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 304ee53..e13e0d5 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -33,6 +33,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #define	LINUX_MAX_ENVS		256
 #define	LINUX_MAX_ARGS		256
 
+#if defined(CONFIG_DISABLE_ENV_INIT)
+#define need_linux_env		0
+#else
+#define need_linux_env		1
+#endif
+
 static int linux_argc;
 static char **linux_argv;
 static char *linux_argp;
@@ -201,7 +207,8 @@ static void boot_prep_linux_legacy(bootm_headers_t *images)
 
 static void boot_prep_linux(bootm_headers_t *images)
 {
-	boot_prep_linux_legacy(images);
+	if (need_linux_env)
+		boot_prep_linux_legacy(images);
 }
 
 static void boot_jump_linux(bootm_headers_t *images)
-- 
1.8.1.2



More information about the U-Boot mailing list