lkml.org 
[lkml]   [2011]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] arch/x86/boot: added support for early builtin command-line
From
So far the builtin command-line was appended to the bootloader
supplied one in arch/x86/kernel/setup.c. Code executed before (e.g.
arch/x86/boot/*) would not access the builtin command-line and
therefore not react to parameters configuring the early setup (e.g.
earlyprintk).

---
arch/x86/boot/boot.h | 30 ++++++++++++++++++++++++++++++
arch/x86/boot/main.c | 1 +
2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index c7093bd..f3c6f9e 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -37,6 +37,7 @@

extern struct setup_header hdr;
extern struct boot_params boot_params;
+extern char builtin_cmd_line[];

#define cpu_relax() asm volatile("rep; nop")

@@ -289,12 +290,41 @@ int __cmdline_find_option(u32 cmdline_ptr, const
char *option, char *buffer, int
int __cmdline_find_option_bool(u32 cmdline_ptr, const char *option);
static inline int cmdline_find_option(const char *option, char
*buffer, int bufsize)
{
+#ifdef CONFIG_CMDLINE_BOOL
+ u32 builtin_cmdline_ptr = (ds() << 4) + (u16)builtin_cmd_line;
+#ifdef CONFIG_CMDLINE_OVERRIDE
+ return __cmdline_find_option(builtin_cmdline_ptr, option,
buffer, bufsize);
+#else // !CONFIG_CMDLINE_OVERRIDE && CONFIG_CMDLINE_BOOL
+ int length_cmdline = __cmdline_find_option(boot_params.hdr.cmd_line_ptr,
+ option, buffer, bufsize);
+ if (length_cmdline == -1) {
+ return __cmdline_find_option(builtin_cmdline_ptr,
option, buffer, bufsize);
+ } else {
+ return length_cmdline;
+ }
+#endif // CONFIG_CMDLINE_OVERRIDE
+#else // !CONFIG_CMDLINE_BOOL
return __cmdline_find_option(boot_params.hdr.cmd_line_ptr,
option, buffer, bufsize);
+#endif
}

static inline int cmdline_find_option_bool(const char *option)
{
+#ifdef CONFIG_CMDLINE_BOOL
+ u32 builtin_cmdline_ptr = (ds() << 4) + (u16)builtin_cmd_line;
+#ifdef CONFIG_CMDLINE_OVERRIDE
+ return __cmdline_find_option_bool(builtin_cmdline_ptr, option);
+#else // !CONFIG_CMDLINE_OVERRIDE && CONFIG_CMDLINE_BOOL
+ int length_cmdline =
__cmdline_find_option_bool(boot_params.hdr.cmd_line_ptr, option);
+ if (length_cmdline == -1) {
+ return __cmdline_find_option_bool(builtin_cmdline_ptr, option);
+ } else {
+ return length_cmdline;
+ }
+#endif // CONFIG_CMDLINE_OVERRIDE
+#else // !CONFIG_CMDLINE_BOOL
return __cmdline_find_option_bool(boot_params.hdr.cmd_line_ptr, option);
+#endif
}


diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c
index 40358c8..9b12007 100644
--- a/arch/x86/boot/main.c
+++ b/arch/x86/boot/main.c
@@ -16,6 +16,7 @@
#include "boot.h"

struct boot_params boot_params __attribute__((aligned(16)));
+char builtin_cmd_line[] __attribute__((aligned(16))) = CONFIG_CMDLINE;

char *HEAP = _end;
char *heap_end = _end; /* Default end of heap = no heap */
--
1.7.0.4

\
 
 \ /
  Last update: 2011-03-18 13:49    [W:0.014 / U:19.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site