kernel: bump 4.14 to 4.14.48 for 18.06
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.14 / 0067-generic-Mangle-bootloader-s-kernel-arguments.patch
index 98c2ba1faadec69dbb599e9541e8abef87ef8e3f..c7123eac52c8fa87e5d24f48e6ccb4e51402ec5b 100644 (file)
@@ -23,9 +23,9 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
 --- a/arch/arm/Kconfig
 +++ b/arch/arm/Kconfig
 @@ -1938,6 +1938,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN
-         The command-line arguments provided by the boot loader will be
-         appended to the the device tree bootargs property.
-
+         The command-line arguments provided by the boot loader will be
+         appended to the the device tree bootargs property.
 +config ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE
 +      bool "Append rootblock parsing bootloader's kernel arguments"
 +      help
@@ -38,12 +38,12 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
 +        sent by bootloader will be ignored.
 +
  endchoice
-
  config CMDLINE
 --- a/arch/arm/boot/compressed/atags_to_fdt.c
 +++ b/arch/arm/boot/compressed/atags_to_fdt.c
 @@ -4,6 +4,8 @@
-
  #if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND)
  #define do_extend_cmdline 1
 +#elif defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
@@ -52,9 +52,9 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
  #define do_extend_cmdline 0
  #endif
 @@ -67,6 +69,59 @@ static uint32_t get_cell_size(const void
-       return cell_size;
+       return cell_size;
  }
-
 +#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
 +
 +static char *append_rootblock(char *dest, const char *str, int len, void *fdt)
@@ -110,11 +110,11 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
 +
  static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
  {
-       char cmdline[COMMAND_LINE_SIZE];
+       char cmdline[COMMAND_LINE_SIZE];
 @@ -86,12 +141,21 @@ static void merge_fdt_bootargs(void *fdt
-
-       /* and append the ATAG_CMDLINE */
-       if (fdt_cmdline) {
+       /* and append the ATAG_CMDLINE */
+       if (fdt_cmdline) {
 +
 +#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
 +              //save original bootloader args
@@ -123,55 +123,55 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
 +              ptr = append_rootblock(ptr, fdt_cmdline, len, fdt);
 +
 +#else
-               len = strlen(fdt_cmdline);
-               if (ptr - cmdline + len + 2 < COMMAND_LINE_SIZE) {
-                       *ptr++ = ' ';
-                       memcpy(ptr, fdt_cmdline, len);
-                       ptr += len;
-               }
+               len = strlen(fdt_cmdline);
+               if (ptr - cmdline + len + 2 < COMMAND_LINE_SIZE) {
+                       *ptr++ = ' ';
+                       memcpy(ptr, fdt_cmdline, len);
+                       ptr += len;
+               }
 +#endif
-       }
-       *ptr = '\0';
-
+       }
+       *ptr = '\0';
 @@ -148,7 +212,9 @@ int atags_to_fdt(void *atag_list, void *
-                       else
-                               setprop_string(fdt, "/chosen", "bootargs",
-                                              atag->u.cmdline.cmdline);
+                       else
+                               setprop_string(fdt, "/chosen", "bootargs",
+                                              atag->u.cmdline.cmdline);
 -              } else if (atag->hdr.tag == ATAG_MEM) {
 +              }
 +#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE
 +              else if (atag->hdr.tag == ATAG_MEM) {
-                       if (memcount >= sizeof(mem_reg_property)/4)
-                               continue;
-                       if (!atag->u.mem.size)
+                       if (memcount >= sizeof(mem_reg_property)/4)
+                               continue;
+                       if (!atag->u.mem.size)
 @@ -187,6 +253,10 @@ int atags_to_fdt(void *atag_list, void *
-               setprop(fdt, "/memory", "reg", mem_reg_property,
-                       4 * memcount * memsize);
-       }
+               setprop(fdt, "/memory", "reg", mem_reg_property,
+                       4 * memcount * memsize);
+       }
 +#else
 +
 +      }
 +#endif
-
-       return fdt_pack(fdt);
+       return fdt_pack(fdt);
  }
 --- a/init/main.c
 +++ b/init/main.c
 @@ -95,6 +95,10 @@
  #include <asm/sections.h>
  #include <asm/cacheflush.h>
-
 +#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
 +#include <linux/of.h>
 +#endif
 +
  static int kernel_init(void *);
-
  extern void init_IRQ(void);
 @@ -574,6 +578,18 @@ asmlinkage __visible void __init start_k
-       page_alloc_init();
-
-       pr_notice("Kernel command line: %s\n", boot_command_line);
+       page_alloc_init();
+       pr_notice("Kernel command line: %s\n", boot_command_line);
 +
 +#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
 +      //Show bootloader's original command line for reference
@@ -184,6 +184,6 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
 +      }
 +#endif
 +
-       parse_early_param();
-       after_dashes = parse_args("Booting kernel",
-                                 static_command_line, __start___param,
+       parse_early_param();
+       after_dashes = parse_args("Booting kernel",
+                                 static_command_line, __start___param,