mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-03 20:44:18 +00:00
9e86e0b33b
Changelogs: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.67 https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.68 https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.69 Upstreamed patches: target/linux/generic/backport-6.1/740-v6.9-01-netfilter-flowtable-validate-pppoe-header.patch [1] target/linux/generic/backport-6.1/740-v6.9-02-netfilter-flowtable-incorrect-pppoe-tuple.patch [2] target/linux/generic/backport-6.1/790-48-STABLE-net-dsa-mt7530-trap-link-local-frames-regardless-of-.patch [3] target/linux/generic/backport-6.1/790-50-v6.10-net-dsa-mt7530-fix-mirroring-frames-received-on-loca.patch [4] target/linux/generic/backport-6.1/790-16-v6.4-net-dsa-mt7530-set-all-CPU-ports-in-MT7531_CPU_PMAP.patch [5] target/linux/generic/backport-6.1/790-46-v6.9-net-dsa-mt7530-fix-improper-frames-on-all-25MHz-and-.patch [6] target/linux/generic/backport-6.1/790-47-v6.10-net-dsa-mt7530-fix-enabling-EEE-on-MT7531-switch-on-.patch [7] target/linux/mediatek/patches-6.1/220-v6.3-clk-mediatek-clk-gate-Propagate-struct-device-with-m.patch [8] target/linux/mediatek/patches-6.1/222-v6.3-clk-mediatek-clk-mtk-Propagate-struct-device-for-com.patch [9] target/linux/mediatek/patches-6.1/223-v6.3-clk-mediatek-clk-mux-Propagate-struct-device-for-mtk.patch [10] target/linux/mediatek/patches-6.1/226-v6.3-clk-mediatek-clk-mtk-Extend-mtk_clk_simple_probe.patch [11] Symbol changes: MITIGATION_SPECTRE_BHI (new) [12] SPECTRE_BHI_{ON,OFF} (deprecated) [12] References: [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=8bf7c76a2a207ca2b4cfda0a279192adf27678d7 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=f1c3c61701a0b12f4906152c1626a5de580ea3d2 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=19643bf8c9b5bb5eea5163bf2f6a3eee6fb5b99b [4] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=e86c9db58eba290e858e2bb80efcde9e3973a5ef [5] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=013c787d231188a6408e2991150d3c9bf9a2aa0b [6] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=41a004ffba9b1fd8a5a7128ebd0dfa3ed39c3316 [7] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=7d51db455ca03e5270cc585a75a674abd063fa6c [8] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=082b831488a41257b7ac7ffa1d80a0b60d98394d [9] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=6f5f72a684a2823f21efbfd20c7e4b528c44a781 [10] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=a4fe8813a7868ba5867e42e60de7a2b8baac30ff [11] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=c1d87d56af063c87961511ee25f6b07a5676d27d [12] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=d844df110084ef8bd950a52194865f3f63b561ca Signed-off-by: Shiji Yang <yangshiji66@qq.com>
280 lines
7.9 KiB
Diff
280 lines
7.9 KiB
Diff
From 71270226b14733a4b1f2cde58ea9265caa50b38d Mon Sep 17 00:00:00 2001
|
|
From: Adrian Panella <ianchi74@outlook.com>
|
|
Date: Thu, 9 Mar 2017 09:37:17 +0100
|
|
Subject: [PATCH 67/69] generic: Mangle bootloader's kernel arguments
|
|
|
|
The command-line arguments provided by the boot loader will be
|
|
appended to a new device tree property: bootloader-args.
|
|
If there is a property "append-rootblock" in DT under /chosen
|
|
and a root= option in bootloaders command line it will be parsed
|
|
and added to DT bootargs with the form: <append-rootblock>XX.
|
|
Only command line ATAG will be processed, the rest of the ATAGs
|
|
sent by bootloader will be ignored.
|
|
This is usefull in dual boot systems, to get the current root partition
|
|
without afecting the rest of the system.
|
|
|
|
Signed-off-by: Adrian Panella <ianchi74@outlook.com>
|
|
|
|
This patch has been modified to be mvebu specific. The original patch
|
|
did not pass the bootloader cmdline on if no append-rootblock stanza
|
|
was found, resulting in blank cmdline and failure to boot.
|
|
|
|
Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
|
|
---
|
|
arch/arm/Kconfig | 11 ++++
|
|
arch/arm/boot/compressed/atags_to_fdt.c | 85 ++++++++++++++++++++++++-
|
|
init/main.c | 16 +++++
|
|
3 files changed, 111 insertions(+), 1 deletion(-)
|
|
|
|
--- a/arch/arm/Kconfig
|
|
+++ b/arch/arm/Kconfig
|
|
@@ -1587,6 +1587,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.
|
|
|
|
+config ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE
|
|
+ bool "Append rootblock parsing bootloader's kernel arguments"
|
|
+ help
|
|
+ The command-line arguments provided by the boot loader will be
|
|
+ appended to a new device tree property: bootloader-args.
|
|
+ If there is a property "append-rootblock" in DT under /chosen
|
|
+ and a root= option in bootloaders command line it will be parsed
|
|
+ and added to DT bootargs with the form: <append-rootblock>XX.
|
|
+ Only command line ATAG will be processed, the rest of the ATAGs
|
|
+ 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
|
|
@@ -5,6 +5,8 @@
|
|
|
|
#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND)
|
|
#define do_extend_cmdline 1
|
|
+#elif defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
|
|
+#define do_extend_cmdline 1
|
|
#else
|
|
#define do_extend_cmdline 0
|
|
#endif
|
|
@@ -20,6 +22,7 @@ static int node_offset(void *fdt, const
|
|
return offset;
|
|
}
|
|
|
|
+#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE
|
|
static int setprop(void *fdt, const char *node_path, const char *property,
|
|
void *val_array, int size)
|
|
{
|
|
@@ -28,6 +31,7 @@ static int setprop(void *fdt, const char
|
|
return offset;
|
|
return fdt_setprop(fdt, offset, property, val_array, size);
|
|
}
|
|
+#endif
|
|
|
|
static int setprop_string(void *fdt, const char *node_path,
|
|
const char *property, const char *string)
|
|
@@ -38,6 +42,7 @@ static int setprop_string(void *fdt, con
|
|
return fdt_setprop_string(fdt, offset, property, string);
|
|
}
|
|
|
|
+#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE
|
|
static int setprop_cell(void *fdt, const char *node_path,
|
|
const char *property, uint32_t val)
|
|
{
|
|
@@ -46,6 +51,7 @@ static int setprop_cell(void *fdt, const
|
|
return offset;
|
|
return fdt_setprop_cell(fdt, offset, property, val);
|
|
}
|
|
+#endif
|
|
|
|
static const void *getprop(const void *fdt, const char *node_path,
|
|
const char *property, int *len)
|
|
@@ -58,6 +64,7 @@ static const void *getprop(const void *f
|
|
return fdt_getprop(fdt, offset, property, len);
|
|
}
|
|
|
|
+#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE
|
|
static uint32_t get_cell_size(const void *fdt)
|
|
{
|
|
int len;
|
|
@@ -69,6 +76,74 @@ static uint32_t get_cell_size(const void
|
|
return cell_size;
|
|
}
|
|
|
|
+#endif
|
|
+
|
|
+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
|
|
+
|
|
+static char *append_rootblock(char *dest, const char *str, int len, void *fdt)
|
|
+{
|
|
+ const char *ptr, *end;
|
|
+ const char *root="root=";
|
|
+ int i, l;
|
|
+ const char *rootblock;
|
|
+
|
|
+ //ARM doesn't have __HAVE_ARCH_STRSTR, so search manually
|
|
+ ptr = str - 1;
|
|
+
|
|
+ do {
|
|
+ //first find an 'r' at the begining or after a space
|
|
+ do {
|
|
+ ptr++;
|
|
+ ptr = strchr(ptr, 'r');
|
|
+ if (!ptr)
|
|
+ goto no_append;
|
|
+
|
|
+ } while (ptr != str && *(ptr-1) != ' ');
|
|
+
|
|
+ //then check for the rest
|
|
+ for(i = 1; i <= 4; i++)
|
|
+ if(*(ptr+i) != *(root+i)) break;
|
|
+
|
|
+ } while (i != 5);
|
|
+
|
|
+ end = strchr(ptr, ' ');
|
|
+ end = end ? (end - 1) : (strchr(ptr, 0) - 1);
|
|
+
|
|
+ //find partition number (assumes format root=/dev/mtdXX | /dev/mtdblockXX | yy:XX )
|
|
+ for( i = 0; end >= ptr && *end >= '0' && *end <= '9'; end--, i++);
|
|
+ ptr = end + 1;
|
|
+
|
|
+ /* if append-rootblock property is set use it to append to command line */
|
|
+ rootblock = getprop(fdt, "/chosen", "append-rootblock", &l);
|
|
+ if (rootblock == NULL)
|
|
+ goto no_append;
|
|
+
|
|
+ if (*dest != ' ') {
|
|
+ *dest = ' ';
|
|
+ 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;
|
|
+}
|
|
+#endif
|
|
+
|
|
static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
|
|
{
|
|
char cmdline[COMMAND_LINE_SIZE];
|
|
@@ -88,18 +163,28 @@ static void merge_fdt_bootargs(void *fdt
|
|
|
|
/* and append the ATAG_CMDLINE */
|
|
if (fdt_cmdline) {
|
|
+
|
|
+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
|
|
+ //save original bootloader args
|
|
+ //and append ubi.mtd with root partition number to current cmdline
|
|
+ setprop_string(fdt, "/chosen", "bootloader-args", fdt_cmdline);
|
|
+ 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;
|
|
}
|
|
+#endif
|
|
}
|
|
*ptr = '\0';
|
|
|
|
setprop_string(fdt, "/chosen", "bootargs", cmdline);
|
|
}
|
|
|
|
+#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE
|
|
static void hex_str(char *out, uint32_t value)
|
|
{
|
|
uint32_t digit;
|
|
@@ -117,6 +202,7 @@ static void hex_str(char *out, uint32_t
|
|
}
|
|
*out = '\0';
|
|
}
|
|
+#endif
|
|
|
|
/*
|
|
* Convert and fold provided ATAGs into the provided FDT.
|
|
@@ -131,9 +217,11 @@ int atags_to_fdt(void *atag_list, void *
|
|
struct tag *atag = atag_list;
|
|
/* In the case of 64 bits memory size, need to reserve 2 cells for
|
|
* address and size for each bank */
|
|
+#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE
|
|
__be32 mem_reg_property[2 * 2 * NR_BANKS];
|
|
- int memcount = 0;
|
|
- int ret, memsize;
|
|
+ int memsize, memcount = 0;
|
|
+#endif
|
|
+ int ret;
|
|
|
|
/* make sure we've got an aligned pointer */
|
|
if ((u32)atag_list & 0x3)
|
|
@@ -168,7 +256,9 @@ int atags_to_fdt(void *atag_list, void *
|
|
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)
|
|
@@ -212,6 +302,10 @@ int atags_to_fdt(void *atag_list, void *
|
|
setprop(fdt, "/memory", "reg", mem_reg_property,
|
|
4 * memcount * memsize);
|
|
}
|
|
+#else
|
|
+
|
|
+ }
|
|
+#endif
|
|
|
|
return fdt_pack(fdt);
|
|
}
|
|
--- a/init/main.c
|
|
+++ b/init/main.c
|
|
@@ -113,6 +113,10 @@
|
|
|
|
#include <kunit/test.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);
|
|
@@ -996,6 +1000,18 @@ asmlinkage __visible void __init __no_sa
|
|
page_alloc_init();
|
|
|
|
pr_notice("Kernel command line: %s\n", saved_command_line);
|
|
+
|
|
+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
|
|
+ //Show bootloader's original command line for reference
|
|
+ if(of_chosen) {
|
|
+ const char *prop = of_get_property(of_chosen, "bootloader-args", NULL);
|
|
+ if(prop)
|
|
+ pr_notice("Bootloader command line (ignored): %s\n", prop);
|
|
+ else
|
|
+ pr_notice("Bootloader command line not present\n");
|
|
+ }
|
|
+#endif
|
|
+
|
|
/* parameters may set static keys */
|
|
jump_label_init();
|
|
parse_early_param();
|