kernel: update kernel 3.18 to version 3.18.23
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-3.18 / 995-mangle_bootargs.patch
1 --- a/init/main.c
2 +++ b/init/main.c
3 @@ -362,6 +362,29 @@ static inline void setup_nr_cpu_ids(void
4 static inline void smp_prepare_cpus(unsigned int maxcpus) { }
5 #endif
6
7 +#ifdef CONFIG_MANGLE_BOOTARGS
8 +static void __init mangle_bootargs(char *command_line)
9 +{
10 + char *rootdev;
11 + char *rootfs;
12 +
13 + rootdev = strstr(command_line, "root=/dev/mtdblock");
14 +
15 + if (rootdev)
16 + strncpy(rootdev, "mangled_rootblock=", 18);
17 +
18 + rootfs = strstr(command_line, "rootfstype");
19 +
20 + if (rootfs)
21 + strncpy(rootfs, "mangled_fs", 10);
22 +
23 +}
24 +#else
25 +static void __init mangle_bootargs(char *command_line)
26 +{
27 +}
28 +#endif
29 +
30 /*
31 * We need to store the untouched command line for future reference.
32 * We also need to store the touched command line since the parameter
33 @@ -530,6 +553,7 @@ asmlinkage __visible void __init start_k
34 pr_notice("%s", linux_banner);
35 setup_arch(&command_line);
36 mm_init_cpumask(&init_mm);
37 + mangle_bootargs(command_line);
38 setup_command_line(command_line);
39 setup_nr_cpu_ids();
40 setup_per_cpu_areas();
41 --- a/init/Kconfig
42 +++ b/init/Kconfig
43 @@ -1597,6 +1597,15 @@ config EMBEDDED
44 an embedded system so certain expert options are available
45 for configuration.
46
47 +config MANGLE_BOOTARGS
48 + bool "Rename offending bootargs"
49 + depends on EXPERT
50 + help
51 + Sometimes the bootloader passed bogus root= and rootfstype=
52 + parameters to the kernel, and while you want to ignore them,
53 + you need to know the values f.e. to support dual firmware
54 + layouts on the flash.
55 +
56 config HAVE_PERF_EVENTS
57 bool
58 help