From: Iulia Manda <iulia.manda21@gmail.com>
To: tim.bird@sonymobile.com
Cc: linux-kernel@vger.kernel.org, josh@joshtriplett.org,
pebolle@tiscali.nl, rob@landley.net
Subject: [PATCH v2] kernel: Add a new config option to remove command line parsing
Date: Wed, 20 May 2015 18:15:46 +0300 [thread overview]
Message-ID: <1432134946-20612-1-git-send-email-iulia.manda21@gmail.com> (raw)
In-Reply-To: <1431949832-13606-1-git-send-email-iulia.manda21@gmail.com>
This patch introduces CONFIG_CMDLINE_PARSE option which conditionally
compiles the support for parsing kernel command line arguments. The
corresponding functions that actually do the parsing will be compiled out.
This is used when no parameters will be specified neither at compile time
nor at boot time.
Bloat-o-meter output (compared to the version in which builtin
cmdline is set to 'Y'):
add/remove: 0/8 grow/shrink: 0/6 up/down: 0/-3669 (-3669)
function old new delta
load_module 5571 5563 -8
parse_early_param 54 44 -10
parse_early_options 33 5 -28
initcall_level_names 32 - -32
kernel_init_freeable 413 360 -53
unknown_module_param_cb 60 - -60
setup_arch 3041 2972 -69
set_init_arg 73 - -73
repair_env_string 81 - -81
start_kernel 857 759 -98
do_early_param 117 - -117
unknown_bootoption 366 - -366
parse_args 626 - -626
builtin_cmdline 2048 - -2048
Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Tim Bird <tim.bird@sonymobile.com>
---
Changes since v1:
- make CONFIG_CMDLINE_PARSE arch independent
- make CONFIG_CMDLINE_PARSE depend on EXPERT
arch/x86/Kconfig | 1 +
include/linux/moduleparam.h | 14 ++++++++++++++
init/Kconfig | 14 ++++++++++++++
kernel/params.c | 2 ++
4 files changed, 31 insertions(+)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 226d569..3dd249f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2005,6 +2005,7 @@ config COMPAT_VDSO
config CMDLINE_BOOL
bool "Built-in kernel command line"
+ depends on CMDLINE_PARSE
---help---
Allow for specifying boot arguments to the kernel at
build time. On some systems (e.g. embedded ones), it is
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 1c9effa..570f70e 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -350,6 +350,7 @@ extern bool parameq(const char *name1, const char *name2);
*/
extern bool parameqn(const char *name1, const char *name2, size_t n);
+#ifdef CONFIG_CMDLINE_PARSE
/* Called on module insert or kernel boot */
extern char *parse_args(const char *name,
char *args,
@@ -359,6 +360,19 @@ extern char *parse_args(const char *name,
s16 level_max,
int (*unknown)(char *param, char *val,
const char *doing));
+#else
+static inline char *parse_args(const char *name,
+ char *args,
+ const struct kernel_param *params,
+ unsigned num,
+ s16 level_min,
+ s16 level_max,
+ int (*unknown)(char *param, char *val,
+ const char *doing))
+{
+ return NULL;
+}
+#endif
/* Called by module remove. */
#ifdef CONFIG_SYSFS
diff --git a/init/Kconfig b/init/Kconfig
index dc24dec..6afd154 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1372,6 +1372,20 @@ config MULTIUSER
If unsure, say Y here.
+config CMDLINE_PARSE
+ bool "Enable support for command line parsing" if EXPERT
+ default y
+ ---help---
+ With this option set to 'Y', kernel parameters, both the ones
+ passed at boot time and at compile time are parsed.
+
+ If you say no here, all the kernel parameters' values will be set
+ to their defaults at compile time, in order to make constant
+ folding possible.
+
+ Systems with no space constraints should leave this option set to
+ 'Y'.
+
config SGETMASK_SYSCALL
bool "sgetmask/ssetmask syscalls support" if EXPERT
def_bool PARISC || MN10300 || BLACKFIN || M68K || PPC || MIPS || X86 || SPARC || CRIS || MICROBLAZE || SUPERH
diff --git a/kernel/params.c b/kernel/params.c
index a22d6a7..de8c49a 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -93,6 +93,7 @@ static void param_check_unsafe(const struct kernel_param *kp)
}
}
+#ifdef CONFIG_CMDLINE_PARSE
static int parse_one(char *param,
char *val,
const char *doing,
@@ -239,6 +240,7 @@ char *parse_args(const char *doing,
/* All parsed OK. */
return NULL;
}
+#endif
/* Lazy bastard, eh? */
#define STANDARD_PARAM_DEF(name, type, format, strtolfn) \
--
1.9.1
prev parent reply other threads:[~2015-05-20 15:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 11:50 [PATCH 1/3] " Iulia Manda
2015-05-18 11:50 ` [PATCH 2/3] linux: Add macros that define and declare a core_param variable Iulia Manda
2015-05-18 11:50 ` [PATCH 3/3] init: Set initcall_debug to a default value Iulia Manda
2015-05-19 9:46 ` Paul Bolle
2015-05-20 0:54 ` josh
2015-05-19 9:35 ` [PATCH 1/3] kernel: Add a new config option to remove command line parsing Paul Bolle
2015-05-20 0:54 ` josh
2015-05-20 6:29 ` Rob Landley
2015-05-20 15:15 ` Iulia Manda [this message]
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=1432134946-20612-1-git-send-email-iulia.manda21@gmail.com \
--to=iulia.manda21@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pebolle@tiscali.nl \
--cc=rob@landley.net \
--cc=tim.bird@sonymobile.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome