LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bernhard Walle <bwalle@suse.de>
To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Cc: Alon Bar-Lev <alon.barlev@gmail.com>
Subject: [patch 01/26] Dynamic kernel command-line - common
Date: Thu, 18 Jan 2007 13:58:50 +0100 [thread overview]
Message-ID: <20070118130028.268691000@strauss.suse.de> (raw)
In-Reply-To: <20070118125849.441998000@strauss.suse.de>
[-- Attachment #1: dynamic-kernel-command-line-common.diff --]
[-- Type: text/plain, Size: 4166 bytes --]
1. Rename saved_command_line into boot_command_line, mark
as init disposable.
2. Add dynamic allocated saved_command_line.
3. Add dynamic allocated static_command_line.
4. During startup copy:
boot_command_line into saved_command_line.
arch command_line into static_command_line.
5. Parse static_command_line and not
arch command_line, so arch command_line may
be freed.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
include/linux/init.h | 5 +++--
init/main.c | 29 ++++++++++++++++++++++++-----
2 files changed, 27 insertions(+), 7 deletions(-)
Index: linux-2.6.20-rc4-mm1/include/linux/init.h
===================================================================
--- linux-2.6.20-rc4-mm1.orig/include/linux/init.h
+++ linux-2.6.20-rc4-mm1/include/linux/init.h
@@ -67,7 +67,8 @@ extern initcall_t __con_initcall_start[]
extern initcall_t __security_initcall_start[], __security_initcall_end[];
/* Defined in init/main.c */
-extern char saved_command_line[];
+extern char __initdata boot_command_line[];
+extern char *saved_command_line;
extern unsigned int reset_devices;
/* used by init/main.c */
@@ -164,7 +165,7 @@ struct obs_kernel_param {
#define early_param(str, fn) \
__setup_param(str, fn, fn, 1)
-/* Relies on saved_command_line being set */
+/* Relies on boot_command_line being set */
void __init parse_early_param(void);
#endif /* __ASSEMBLY__ */
Index: linux-2.6.20-rc4-mm1/init/main.c
===================================================================
--- linux-2.6.20-rc4-mm1.orig/init/main.c
+++ linux-2.6.20-rc4-mm1/init/main.c
@@ -122,8 +122,12 @@ extern void time_init(void);
void (*late_time_init)(void);
extern void softirq_init(void);
-/* Untouched command line (eg. for /proc) saved by arch-specific code. */
-char saved_command_line[COMMAND_LINE_SIZE];
+/* Untouched command line saved by arch-specific code. */
+char __initdata boot_command_line[COMMAND_LINE_SIZE];
+/* Untouched saved command line (eg. for /proc) */
+char *saved_command_line;
+/* Command line for parameter parsing */
+static char *static_command_line;
static char *execute_command;
static char *ramdisk_execute_command;
@@ -406,6 +410,20 @@ static void __init smp_init(void)
#endif
/*
+ * We need to store the untouched command line for future reference.
+ * We also need to store the touched command line since the parameter
+ * parsing is performed in place, and we should allow a component to
+ * store reference of name/value for future reference.
+ */
+static void __init setup_command_line(char *command_line)
+{
+ saved_command_line = alloc_bootmem(strlen (boot_command_line)+1);
+ static_command_line = alloc_bootmem(strlen (command_line)+1);
+ strcpy (saved_command_line, boot_command_line);
+ strcpy (static_command_line, command_line);
+}
+
+/*
* We need to finalize in a non-__init function or else race conditions
* between the root thread and the init thread may cause start_kernel to
* be reaped by free_initmem before the root thread has proceeded to
@@ -459,7 +477,7 @@ void __init parse_early_param(void)
return;
/* All fall through to do_early_param. */
- strlcpy(tmp_cmdline, saved_command_line, COMMAND_LINE_SIZE);
+ strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
parse_args("early options", tmp_cmdline, NULL, 0, do_early_param);
done = 1;
}
@@ -509,6 +527,7 @@ asmlinkage void __init start_kernel(void
printk(KERN_NOTICE);
printk(linux_banner);
setup_arch(&command_line);
+ setup_command_line(command_line);
unwind_setup();
setup_per_cpu_areas();
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
@@ -526,9 +545,9 @@ asmlinkage void __init start_kernel(void
preempt_disable();
build_all_zonelists();
page_alloc_init();
- printk(KERN_NOTICE "Kernel command line: %s\n", saved_command_line);
+ printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
parse_early_param();
- parse_args("Booting kernel", command_line, __start___param,
+ parse_args("Booting kernel", static_command_line, __start___param,
__stop___param - __start___param,
&unknown_bootoption);
if (!irqs_disabled()) {
--
next prev parent reply other threads:[~2007-01-18 13:04 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-18 12:58 [patch 00/26] Dynamic kernel command-line Bernhard Walle
2007-01-18 12:58 ` Bernhard Walle [this message]
2007-01-18 12:58 ` [patch 02/26] Dynamic kernel command-line - alpha Bernhard Walle
2007-01-18 12:58 ` [patch 03/26] Dynamic kernel command-line - arm Bernhard Walle
2007-01-18 14:14 ` Russell King
2007-01-18 14:48 ` Alon Bar-Lev
2007-01-18 15:31 ` Tomas Carnecky
2007-01-18 15:23 ` Russell King
2007-01-18 15:31 ` Alon Bar-Lev
2007-01-19 12:38 ` Bernhard Walle
2007-01-22 19:56 ` Andrew Morton
2007-01-22 20:00 ` Russell King
2007-01-22 20:31 ` Alon Bar-Lev
2007-01-22 20:44 ` Andrew Morton
2007-01-22 20:58 ` Bernhard Walle
2007-01-22 21:02 ` Alon Bar-Lev
2007-01-22 22:14 ` Bernhard Walle
2007-01-22 22:27 ` Russell King
2007-01-22 22:42 ` Bernhard Walle
2007-01-23 10:37 ` Alon Bar-Lev
2007-01-23 10:41 ` Russell King
2007-01-23 10:50 ` Alon Bar-Lev
2007-01-23 10:53 ` Russell King
2007-01-23 10:59 ` Alon Bar-Lev
2007-01-23 11:31 ` Alon Bar-Lev
2007-01-23 11:54 ` Russell King
2007-01-23 11:59 ` Alon Bar-Lev
2007-01-23 12:43 ` Russell King
2007-01-18 12:58 ` [patch 04/26] Dynamic kernel command-line - arm26 Bernhard Walle
2007-01-18 12:58 ` [patch 05/26] Dynamic kernel command-line - avr32 Bernhard Walle
2007-01-18 12:58 ` [patch 06/26] Dynamic kernel command-line - cris Bernhard Walle
2007-01-18 12:58 ` [patch 07/26] Dynamic kernel command-line - frv Bernhard Walle
2007-01-18 12:58 ` [patch 08/26] Dynamic kernel command-line - h8300 Bernhard Walle
2007-01-18 12:58 ` [patch 09/26] Dynamic kernel command-line - i386 Bernhard Walle
2007-01-18 12:58 ` [patch 10/26] Dynamic kernel command-line - ia64 Bernhard Walle
2007-01-18 12:59 ` [patch 11/26] Dynamic kernel command-line - m32r Bernhard Walle
2007-01-18 12:59 ` [patch 12/26] Dynamic kernel command-line - m68k Bernhard Walle
2007-01-18 12:59 ` [patch 13/26] Dynamic kernel command-line - m68knommu Bernhard Walle
2007-01-18 12:59 ` [patch 14/26] Dynamic kernel command-line - mips Bernhard Walle
2007-01-18 12:59 ` [patch 15/26] Dynamic kernel command-line - parisc Bernhard Walle
2007-01-18 12:59 ` [patch 16/26] Dynamic kernel command-line - powerpc Bernhard Walle
2007-01-18 12:59 ` [patch 17/26] Dynamic kernel command-line - ppc Bernhard Walle
2007-01-18 12:59 ` [patch 18/26] Dynamic kernel command-line - s390 Bernhard Walle
2007-01-18 12:59 ` [patch 19/26] Dynamic kernel command-line - sh Bernhard Walle
2007-01-18 12:59 ` [patch 20/26] Dynamic kernel command-line - sh64 Bernhard Walle
2007-01-18 12:59 ` [patch 21/26] Dynamic kernel command-line - sparc Bernhard Walle
2007-01-18 12:59 ` [patch 22/26] Dynamic kernel command-line - sparc64 Bernhard Walle
2007-01-18 12:59 ` [patch 23/26] Dynamic kernel command-line - um Bernhard Walle
2007-01-18 12:59 ` [patch 24/26] Dynamic kernel command-line - v850 Bernhard Walle
2007-01-18 12:59 ` [patch 25/26] Dynamic kernel command-line - x86_64 Bernhard Walle
2007-01-18 12:59 ` [patch 26/26] Dynamic kernel command-line - xtensa Bernhard Walle
-- strict thread matches above, loose matches on Subject: below --
2006-12-02 10:47 [PATCH 00/26] Dynamic kernel command-line Alon Bar-Lev
2006-12-02 10:48 ` [PATCH 01/26] Dynamic kernel command-line - common Alon Bar-Lev
2006-09-03 22:15 [PATCH 00/26] Dynamic kernel command-line - Resend please ignore last Alon Bar-Lev
2006-09-03 22:16 ` [PATCH 01/26] Dynamic kernel command-line - common Alon Bar-Lev
2006-09-03 21:50 [PATCH 00/26] Dynamic kernel command-line Alon Bar-Lev
2006-09-03 21:52 ` [PATCH 01/26] Dynamic kernel command-line - common Alon Bar-Lev
2006-09-03 22:10 ` Matthew Wilcox
2006-09-03 22:12 ` Alon Bar-Lev
2006-09-05 23:52 ` Bill Davidsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070118130028.268691000@strauss.suse.de \
--to=bwalle@suse.de \
--cc=alon.barlev@gmail.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--subject='Re: [patch 01/26] Dynamic kernel command-line - common' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).