mvebu: fix bootloader kernel commandline mangling
Currently I'm unable to boot initramfs image with `console=ttyS0,115200` kernel commandline as the kernel commandline mangling resets kernel commandline if there is no `root=` option provided, efectively clearing whatever I pass to the kernel, making the `root=` option mandatory. So if the kernel commandline mangling is not appropriate just leave the kernel commandline as it is. Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
parent
c4037a5b9e
commit
014c101e0b
1 changed files with 34 additions and 27 deletions
|
@ -21,10 +21,10 @@ was found, resulting in blank cmdline and failure to boot.
|
||||||
|
|
||||||
Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
|
Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
|
||||||
---
|
---
|
||||||
arch/arm/Kconfig | 11 +++++
|
arch/arm/Kconfig | 11 ++++
|
||||||
arch/arm/boot/compressed/atags_to_fdt.c | 72 ++++++++++++++++++++++++++++++++-
|
arch/arm/boot/compressed/atags_to_fdt.c | 85 ++++++++++++++++++++++++-
|
||||||
init/main.c | 16 ++++++++
|
init/main.c | 16 +++++
|
||||||
3 files changed, 98 insertions(+), 1 deletion(-)
|
3 files changed, 111 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
--- a/arch/arm/Kconfig
|
--- a/arch/arm/Kconfig
|
||||||
+++ b/arch/arm/Kconfig
|
+++ b/arch/arm/Kconfig
|
||||||
|
@ -57,7 +57,7 @@ Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
|
||||||
#else
|
#else
|
||||||
#define do_extend_cmdline 0
|
#define do_extend_cmdline 0
|
||||||
#endif
|
#endif
|
||||||
@@ -67,6 +69,65 @@ static uint32_t get_cell_size(const void
|
@@ -67,6 +69,72 @@ static uint32_t get_cell_size(const void
|
||||||
return cell_size;
|
return cell_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,8 @@ Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
|
||||||
+ do {
|
+ do {
|
||||||
+ ptr++;
|
+ ptr++;
|
||||||
+ ptr = strchr(ptr, 'r');
|
+ ptr = strchr(ptr, 'r');
|
||||||
+ if(!ptr) return dest;
|
+ if (!ptr)
|
||||||
|
+ goto no_append;
|
||||||
+
|
+
|
||||||
+ } while (ptr != str && *(ptr-1) != ' ');
|
+ } while (ptr != str && *(ptr-1) != ' ');
|
||||||
+
|
+
|
||||||
|
@ -97,25 +98,31 @@ Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
|
||||||
+
|
+
|
||||||
+ /* if append-rootblock property is set use it to append to command line */
|
+ /* if append-rootblock property is set use it to append to command line */
|
||||||
+ rootblock = getprop(fdt, "/chosen", "append-rootblock", &l);
|
+ rootblock = getprop(fdt, "/chosen", "append-rootblock", &l);
|
||||||
+ if(rootblock != NULL) {
|
+ if (rootblock == NULL)
|
||||||
+ if(*dest != ' ') {
|
+ goto no_append;
|
||||||
+ *dest = ' ';
|
+
|
||||||
+ dest++;
|
+ if (*dest != ' ') {
|
||||||
+ len++;
|
+ *dest = ' ';
|
||||||
+ }
|
+ dest++;
|
||||||
+ if (len + l + i <= COMMAND_LINE_SIZE) {
|
+ len++;
|
||||||
+ memcpy(dest, rootblock, l);
|
|
||||||
+ dest += l - 1;
|
|
||||||
+ memcpy(dest, ptr, i);
|
|
||||||
+ dest += i;
|
|
||||||
+ }
|
|
||||||
+ } else {
|
|
||||||
+ len = strlen(str);
|
|
||||||
+ if (len + 1 < COMMAND_LINE_SIZE) {
|
|
||||||
+ memcpy(dest, str, len);
|
|
||||||
+ dest += len;
|
|
||||||
+ }
|
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ if (len + l + i <= COMMAND_LINE_SIZE) {
|
||||||
|
+ memcpy(dest, rootblock, l);
|
||||||
|
+ dest += l - 1;
|
||||||
|
+ memcpy(dest, ptr, i);
|
||||||
|
+ dest += i;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return dest;
|
||||||
|
+
|
||||||
|
+no_append:
|
||||||
|
+ len = strlen(str);
|
||||||
|
+ if (len + 1 < COMMAND_LINE_SIZE) {
|
||||||
|
+ memcpy(dest, str, len);
|
||||||
|
+ dest += len;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ return dest;
|
+ return dest;
|
||||||
+}
|
+}
|
||||||
+#endif
|
+#endif
|
||||||
|
@ -123,7 +130,7 @@ Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
|
||||||
static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
|
static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
|
||||||
{
|
{
|
||||||
char cmdline[COMMAND_LINE_SIZE];
|
char cmdline[COMMAND_LINE_SIZE];
|
||||||
@@ -86,12 +147,21 @@ static void merge_fdt_bootargs(void *fdt
|
@@ -86,12 +154,21 @@ static void merge_fdt_bootargs(void *fdt
|
||||||
|
|
||||||
/* and append the ATAG_CMDLINE */
|
/* and append the ATAG_CMDLINE */
|
||||||
if (fdt_cmdline) {
|
if (fdt_cmdline) {
|
||||||
|
@ -145,7 +152,7 @@ Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
|
||||||
}
|
}
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
|
||||||
@@ -166,7 +236,9 @@ int atags_to_fdt(void *atag_list, void *
|
@@ -166,7 +243,9 @@ int atags_to_fdt(void *atag_list, void *
|
||||||
else
|
else
|
||||||
setprop_string(fdt, "/chosen", "bootargs",
|
setprop_string(fdt, "/chosen", "bootargs",
|
||||||
atag->u.cmdline.cmdline);
|
atag->u.cmdline.cmdline);
|
||||||
|
@ -156,7 +163,7 @@ Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
|
||||||
if (memcount >= sizeof(mem_reg_property)/4)
|
if (memcount >= sizeof(mem_reg_property)/4)
|
||||||
continue;
|
continue;
|
||||||
if (!atag->u.mem.size)
|
if (!atag->u.mem.size)
|
||||||
@@ -210,6 +282,10 @@ int atags_to_fdt(void *atag_list, void *
|
@@ -210,6 +289,10 @@ int atags_to_fdt(void *atag_list, void *
|
||||||
setprop(fdt, "/memory", "reg", mem_reg_property,
|
setprop(fdt, "/memory", "reg", mem_reg_property,
|
||||||
4 * memcount * memsize);
|
4 * memcount * memsize);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue