generic: make sure we only try to mangle bootargs we do have
Signed-off-by: Imre Kaloz <kaloz@openwrt.org> SVN-Revision: 45393
This commit is contained in:
		| @@ -1,8 +1,8 @@ | |||||||
| --- a/init/main.c | --- a/init/main.c | ||||||
| +++ b/init/main.c | +++ b/init/main.c | ||||||
| @@ -379,6 +379,26 @@ static void __init setup_command_line(ch | @@ -362,6 +362,29 @@ static inline void setup_nr_cpu_ids(void | ||||||
|  	strcpy(static_command_line, command_line); |  static inline void smp_prepare_cpus(unsigned int maxcpus) { } | ||||||
|  } |  #endif | ||||||
|   |   | ||||||
| +#ifdef CONFIG_MANGLE_BOOTARGS | +#ifdef CONFIG_MANGLE_BOOTARGS | ||||||
| +static void __init mangle_bootargs(char *command_line) | +static void __init mangle_bootargs(char *command_line) | ||||||
| @@ -11,9 +11,13 @@ | |||||||
| +	char *rootfs; | +	char *rootfs; | ||||||
| + | + | ||||||
| +	rootdev = strstr(command_line, "root=/dev/mtdblock"); | +	rootdev = strstr(command_line, "root=/dev/mtdblock"); | ||||||
|  | + | ||||||
|  | +	if (rootdev) | ||||||
| +		strncpy(rootdev, "mangled_rootblock=", 18); | +		strncpy(rootdev, "mangled_rootblock=", 18); | ||||||
| + | + | ||||||
| +	rootfs = strstr(command_line, "rootfstype"); | +	rootfs = strstr(command_line, "rootfstype"); | ||||||
|  | + | ||||||
|  | +	if (rootfs) | ||||||
| +		strncpy(rootfs, "mangled_fs", 10); | +		strncpy(rootfs, "mangled_fs", 10); | ||||||
| + | + | ||||||
| +} | +} | ||||||
| @@ -22,12 +26,11 @@ | |||||||
| +{ | +{ | ||||||
| +} | +} | ||||||
| +#endif | +#endif | ||||||
| + |  | ||||||
| + | + | ||||||
|  /* |  /* | ||||||
|   * We need to finalize in a non-__init function or else race conditions |   * We need to store the untouched command line for future reference. | ||||||
|   * between the root thread and the init thread may cause start_kernel to |   * We also need to store the touched command line since the parameter | ||||||
| @@ -530,6 +550,7 @@ asmlinkage __visible void __init start_k | @@ -530,6 +553,7 @@ asmlinkage __visible void __init start_k | ||||||
|  	pr_notice("%s", linux_banner); |  	pr_notice("%s", linux_banner); | ||||||
|  	setup_arch(&command_line); |  	setup_arch(&command_line); | ||||||
|  	mm_init_cpumask(&init_mm); |  	mm_init_cpumask(&init_mm); | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| --- a/init/main.c | --- a/init/main.c | ||||||
| +++ b/init/main.c | +++ b/init/main.c | ||||||
| @@ -368,6 +368,26 @@ static void __init setup_command_line(ch | @@ -351,6 +351,29 @@ static inline void setup_nr_cpu_ids(void | ||||||
|  	strcpy(static_command_line, command_line); |  static inline void smp_prepare_cpus(unsigned int maxcpus) { } | ||||||
|  } |  #endif | ||||||
|   |   | ||||||
| +#ifdef CONFIG_MANGLE_BOOTARGS | +#ifdef CONFIG_MANGLE_BOOTARGS | ||||||
| +static void __init mangle_bootargs(char *command_line) | +static void __init mangle_bootargs(char *command_line) | ||||||
| @@ -11,9 +11,13 @@ | |||||||
| +	char *rootfs; | +	char *rootfs; | ||||||
| + | + | ||||||
| +	rootdev = strstr(command_line, "root=/dev/mtdblock"); | +	rootdev = strstr(command_line, "root=/dev/mtdblock"); | ||||||
|  | + | ||||||
|  | +	if (rootdev) | ||||||
| +		strncpy(rootdev, "mangled_rootblock=", 18); | +		strncpy(rootdev, "mangled_rootblock=", 18); | ||||||
| + | + | ||||||
| +	rootfs = strstr(command_line, "rootfstype"); | +	rootfs = strstr(command_line, "rootfstype"); | ||||||
|  | + | ||||||
|  | +	if (rootfs) | ||||||
| +		strncpy(rootfs, "mangled_fs", 10); | +		strncpy(rootfs, "mangled_fs", 10); | ||||||
| + | + | ||||||
| +} | +} | ||||||
| @@ -22,12 +26,11 @@ | |||||||
| +{ | +{ | ||||||
| +} | +} | ||||||
| +#endif | +#endif | ||||||
| + |  | ||||||
| + | + | ||||||
|  /* |  /* | ||||||
|   * We need to finalize in a non-__init function or else race conditions |   * We need to store the untouched command line for future reference. | ||||||
|   * between the root thread and the init thread may cause start_kernel to |   * We also need to store the touched command line since the parameter | ||||||
| @@ -519,6 +539,7 @@ asmlinkage __visible void __init start_k | @@ -519,6 +542,7 @@ asmlinkage __visible void __init start_k | ||||||
|  	pr_notice("%s", linux_banner); |  	pr_notice("%s", linux_banner); | ||||||
|  	setup_arch(&command_line); |  	setup_arch(&command_line); | ||||||
|  	mm_init_cpumask(&init_mm); |  	mm_init_cpumask(&init_mm); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Imre Kaloz
					Imre Kaloz