kernel: generic: add kernel 4.3
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-4.3 / 995-mangle_bootargs.patch
1 --- a/init/main.c
2 +++ b/init/main.c
3 @@ -355,6 +355,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 @@ -527,6 +550,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 @@ -1638,6 +1638,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