summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorImre Kaloz <kaloz@openwrt.org>2015-03-31 19:27:59 +0000
committerImre Kaloz <kaloz@openwrt.org>2015-03-31 19:27:59 +0000
commitf079ad97ce40b50478af6d8abf8c1a5d7bdca210 (patch)
treebda833821d7206a843944c2a73567d60f407c1c1 /target
parent77f322e0d78ff5abaea559e77681455cfb6c19bb (diff)
downloadmtk-20170518-f079ad97ce40b50478af6d8abf8c1a5d7bdca210.zip
mtk-20170518-f079ad97ce40b50478af6d8abf8c1a5d7bdca210.tar.gz
mtk-20170518-f079ad97ce40b50478af6d8abf8c1a5d7bdca210.tar.bz2
mvebu: use CONFIG_MANGLE_BOOTARGS
Signed-off-by: Imre Kaloz <kaloz@openwrt.org> SVN-Revision: 45200
Diffstat (limited to 'target')
-rw-r--r--target/linux/mvebu/config-3.181
-rw-r--r--target/linux/mvebu/config-4.01
-rw-r--r--target/linux/mvebu/patches-3.18/100-find_active_root.patch104
-rw-r--r--target/linux/mvebu/patches-4.0/100-find_active_root.patch104
4 files changed, 14 insertions, 196 deletions
diff --git a/target/linux/mvebu/config-3.18 b/target/linux/mvebu/config-3.18
index 3a9dd33..2c9302a 100644
--- a/target/linux/mvebu/config-3.18
+++ b/target/linux/mvebu/config-3.18
@@ -218,6 +218,7 @@ CONFIG_MACH_ARMADA_XP=y
CONFIG_MACH_MVEBU_ANY=y
CONFIG_MACH_MVEBU_V7=y
CONFIG_MAGIC_SYSRQ=y
+CONFIG_MANGLE_BOOTARGS=y
CONFIG_MARVELL_PHY=y
CONFIG_MDIO_BOARDINFO=y
CONFIG_MEMORY=y
diff --git a/target/linux/mvebu/config-4.0 b/target/linux/mvebu/config-4.0
index eb2f95b..cdec3cd 100644
--- a/target/linux/mvebu/config-4.0
+++ b/target/linux/mvebu/config-4.0
@@ -220,6 +220,7 @@ CONFIG_MACH_ARMADA_XP=y
CONFIG_MACH_MVEBU_ANY=y
CONFIG_MACH_MVEBU_V7=y
CONFIG_MAGIC_SYSRQ=y
+CONFIG_MANGLE_BOOTARGS=y
CONFIG_MARVELL_PHY=y
CONFIG_MDIO_BOARDINFO=y
CONFIG_MEMORY=y
diff --git a/target/linux/mvebu/patches-3.18/100-find_active_root.patch b/target/linux/mvebu/patches-3.18/100-find_active_root.patch
index 68826fc..e32b608 100644
--- a/target/linux/mvebu/patches-3.18/100-find_active_root.patch
+++ b/target/linux/mvebu/patches-3.18/100-find_active_root.patch
@@ -1,107 +1,15 @@
The WRT1900AC among other Linksys routers uses a dual-firmware layout.
-The bootloader passes the active rootfs in bootargs and also sets the
-rootfstype to jffs2 - which is clearly something we don't want.
-
-Rename both root= and rootfstype= variables to avoid issues and also
-use the former to dynamically rename the active partition to "ubi".
-
+Dynamically rename the active partition to "ubi".
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
---- a/arch/arm/boot/compressed/atags_to_fdt.c
-+++ b/arch/arm/boot/compressed/atags_to_fdt.c
-@@ -66,6 +66,18 @@ static uint32_t get_cell_size(const void
- return cell_size;
- }
-
-+static void mangle_bootargs(void *fdt, const char *fdt_cmdline)
-+{
-+ char *rootdev;
-+ char *rootfs;
-+
-+ rootdev = strstr(fdt_cmdline, "root=/dev/mtdblock");
-+ strncpy(rootdev, "uboot_active_root=", 18);
-+
-+ rootfs = strstr(fdt_cmdline, "rootfstype");
-+ strncpy(rootfs, "origfstype", 10);
-+}
-+
- static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
- {
- char cmdline[COMMAND_LINE_SIZE];
-@@ -135,6 +147,9 @@ int atags_to_fdt(void *atag_list, void *
-
- for_each_tag(atag, atag_list) {
- if (atag->hdr.tag == ATAG_CMDLINE) {
-+ /* Rename the original root= and rootfstype= options */
-+ mangle_bootargs(fdt,
-+ atag->u.cmdline.cmdline);
- /* Append the ATAGS command line to the device tree
- * command line.
- * NB: This means that if the same parameter is set in
---- a/arch/arm/boot/compressed/string.c
-+++ b/arch/arm/boot/compressed/string.c
-@@ -111,6 +111,53 @@ char *strchr(const char *s, int c)
- return (char *)s;
- }
-
-+/**
-+ * strncpy - Copy a length-limited, %NUL-terminated string
-+ * @dest: Where to copy the string to
-+ * @src: Where to copy the string from
-+ * @count: The maximum number of bytes to copy
-+ *
-+ * The result is not %NUL-terminated if the source exceeds
-+ * @count bytes.
-+ *
-+ * In the case where the length of @src is less than that of
-+ * count, the remainder of @dest will be padded with %NUL.
-+ *
-+ */
-+char *strncpy(char *dest, const char *src, size_t count)
-+{
-+ char *tmp = dest;
-+
-+ while (count) {
-+ if ((*tmp = *src) != 0)
-+ src++;
-+ tmp++;
-+ count--;
-+ }
-+ return dest;
-+}
-+
-+/**
-+ * strstr - Find the first substring in a %NUL terminated string
-+ * @s1: The string to be searched
-+ * @s2: The string to search for
-+ */
-+char *strstr(const char *s1, const char *s2)
-+{
-+ size_t l1, l2;
-+
-+ l2 = strlen(s2);
-+ if (!l2)
-+ return (char *)s1;
-+ l1 = strlen(s1);
-+ while (l1 >= l2) {
-+ l1--;
-+ if (!memcmp(s1, s2, l2))
-+ return (char *)s1;
-+ s1++;
-+ }
-+ return NULL;
-+}
- #undef memset
-
- void *memset(void *s, int c, size_t count)
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -25,12 +25,15 @@ static bool node_has_compatible(struct d
return of_get_property(pp, "compatible", NULL);
}
-+static int uboot_active_root;
++static int mangled_rootblock;
+
static int parse_ofpart_partitions(struct mtd_info *master,
struct mtd_partition **pparts,
@@ -120,7 +28,7 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
- partname = of_get_property(pp, "label", &len);
- if (!partname)
- partname = of_get_property(pp, "name", &len);
-+ if (uboot_active_root && (i == uboot_active_root)) {
++ if (mangled_rootblock && (i == mangled_rootblock)) {
+ partname = owrtpart;
+ } else {
+ partname = of_get_property(pp, "label", &len);
@@ -138,15 +46,15 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
+static int __init active_root(char *str)
+{
-+ get_option(&str, &uboot_active_root);
++ get_option(&str, &mangled_rootblock);
+
-+ if (!uboot_active_root)
++ if (!mangled_rootblock)
+ return 1;
+
+ return 1;
+}
+
-+__setup("uboot_active_root=", active_root);
++__setup("mangled_rootblock=", active_root);
+
static void __exit ofpart_parser_exit(void)
{
diff --git a/target/linux/mvebu/patches-4.0/100-find_active_root.patch b/target/linux/mvebu/patches-4.0/100-find_active_root.patch
index 68826fc..e32b608 100644
--- a/target/linux/mvebu/patches-4.0/100-find_active_root.patch
+++ b/target/linux/mvebu/patches-4.0/100-find_active_root.patch
@@ -1,107 +1,15 @@
The WRT1900AC among other Linksys routers uses a dual-firmware layout.
-The bootloader passes the active rootfs in bootargs and also sets the
-rootfstype to jffs2 - which is clearly something we don't want.
-
-Rename both root= and rootfstype= variables to avoid issues and also
-use the former to dynamically rename the active partition to "ubi".
-
+Dynamically rename the active partition to "ubi".
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
---- a/arch/arm/boot/compressed/atags_to_fdt.c
-+++ b/arch/arm/boot/compressed/atags_to_fdt.c
-@@ -66,6 +66,18 @@ static uint32_t get_cell_size(const void
- return cell_size;
- }
-
-+static void mangle_bootargs(void *fdt, const char *fdt_cmdline)
-+{
-+ char *rootdev;
-+ char *rootfs;
-+
-+ rootdev = strstr(fdt_cmdline, "root=/dev/mtdblock");
-+ strncpy(rootdev, "uboot_active_root=", 18);
-+
-+ rootfs = strstr(fdt_cmdline, "rootfstype");
-+ strncpy(rootfs, "origfstype", 10);
-+}
-+
- static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
- {
- char cmdline[COMMAND_LINE_SIZE];
-@@ -135,6 +147,9 @@ int atags_to_fdt(void *atag_list, void *
-
- for_each_tag(atag, atag_list) {
- if (atag->hdr.tag == ATAG_CMDLINE) {
-+ /* Rename the original root= and rootfstype= options */
-+ mangle_bootargs(fdt,
-+ atag->u.cmdline.cmdline);
- /* Append the ATAGS command line to the device tree
- * command line.
- * NB: This means that if the same parameter is set in
---- a/arch/arm/boot/compressed/string.c
-+++ b/arch/arm/boot/compressed/string.c
-@@ -111,6 +111,53 @@ char *strchr(const char *s, int c)
- return (char *)s;
- }
-
-+/**
-+ * strncpy - Copy a length-limited, %NUL-terminated string
-+ * @dest: Where to copy the string to
-+ * @src: Where to copy the string from
-+ * @count: The maximum number of bytes to copy
-+ *
-+ * The result is not %NUL-terminated if the source exceeds
-+ * @count bytes.
-+ *
-+ * In the case where the length of @src is less than that of
-+ * count, the remainder of @dest will be padded with %NUL.
-+ *
-+ */
-+char *strncpy(char *dest, const char *src, size_t count)
-+{
-+ char *tmp = dest;
-+
-+ while (count) {
-+ if ((*tmp = *src) != 0)
-+ src++;
-+ tmp++;
-+ count--;
-+ }
-+ return dest;
-+}
-+
-+/**
-+ * strstr - Find the first substring in a %NUL terminated string
-+ * @s1: The string to be searched
-+ * @s2: The string to search for
-+ */
-+char *strstr(const char *s1, const char *s2)
-+{
-+ size_t l1, l2;
-+
-+ l2 = strlen(s2);
-+ if (!l2)
-+ return (char *)s1;
-+ l1 = strlen(s1);
-+ while (l1 >= l2) {
-+ l1--;
-+ if (!memcmp(s1, s2, l2))
-+ return (char *)s1;
-+ s1++;
-+ }
-+ return NULL;
-+}
- #undef memset
-
- void *memset(void *s, int c, size_t count)
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -25,12 +25,15 @@ static bool node_has_compatible(struct d
return of_get_property(pp, "compatible", NULL);
}
-+static int uboot_active_root;
++static int mangled_rootblock;
+
static int parse_ofpart_partitions(struct mtd_info *master,
struct mtd_partition **pparts,
@@ -120,7 +28,7 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
- partname = of_get_property(pp, "label", &len);
- if (!partname)
- partname = of_get_property(pp, "name", &len);
-+ if (uboot_active_root && (i == uboot_active_root)) {
++ if (mangled_rootblock && (i == mangled_rootblock)) {
+ partname = owrtpart;
+ } else {
+ partname = of_get_property(pp, "label", &len);
@@ -138,15 +46,15 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
+static int __init active_root(char *str)
+{
-+ get_option(&str, &uboot_active_root);
++ get_option(&str, &mangled_rootblock);
+
-+ if (!uboot_active_root)
++ if (!mangled_rootblock)
+ return 1;
+
+ return 1;
+}
+
-+__setup("uboot_active_root=", active_root);
++__setup("mangled_rootblock=", active_root);
+
static void __exit ofpart_parser_exit(void)
{