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

login
register
mail settings
Submitter Daniel Schwierzeck
Date June 8, 2013, 10:42 p.m.
Message ID <1370731370-32767-7-git-send-email-daniel.schwierzeck@gmail.com>
Download mbox | patch
Permalink /patch/249990/
State Superseded
Delegated to: Daniel Schwierzeck
Headers show

Comments

Daniel Schwierzeck - June 8, 2013, 10:42 p.m.
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@gmail.com>
---
 README                | 6 ++++++
 arch/mips/lib/bootm.c | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

Patch

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)