[LEDE-DEV] [PATCH 2/4] kernel/4.4: mtdsplit: add kernel cmdline to disable split parsers for rootfs and firmware partitions

hackpascal hackpascal at gmail.com
Sat Sep 2 21:45:20 PDT 2017


Some firmware have already defined rootfs/rootfs_data partitions and do not need extra split operations.

This patch adds two kernel cmdline parameters to disable firmware and rootfs parsers separately:
  nofwsplit
  norootfssplit

Signed-off-by: hackpascal <hackpascal at gmail.com>
---
 ...d-kernel-cmdline-to-disable-split-parsers.patch | 56 ++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 target/linux/generic/pending-4.4/405-mtd-add-kernel-cmdline-to-disable-split-parsers.patch

diff --git a/target/linux/generic/pending-4.4/405-mtd-add-kernel-cmdline-to-disable-split-parsers.patch b/target/linux/generic/pending-4.4/405-mtd-add-kernel-cmdline-to-disable-split-parsers.patch
new file mode 100644
index 0000000000..b0a666a401
--- /dev/null
+++ b/target/linux/generic/pending-4.4/405-mtd-add-kernel-cmdline-to-disable-split-parsers.patch
@@ -0,0 +1,56 @@
+--- a/drivers/mtd/mtdpart.c
++++ b/drivers/mtd/mtdpart.c
+@@ -39,6 +39,10 @@
+ 
+ #define MTD_ERASE_PARTIAL	0x8000 /* partition only covers parts of an erase block */
+ 
++/* Do not split firmware/rootfs partition */
++static bool no_fw_split_flag = 0;
++static bool no_rootfs_split_flag = 0;
++
+ /* Our partition linked list */
+ static LIST_HEAD(mtd_partitions);
+ static DEFINE_MUTEX(mtd_partitions_mutex);
+@@ -774,6 +778,9 @@ mtd_pad_erasesize(struct mtd_info *mtd,
+ 
+ static void split_firmware(struct mtd_info *master, struct mtd_part *part)
+ {
++	if (no_fw_split_flag)
++		return;
++
+ 	run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE);
+ }
+ 
+@@ -790,7 +797,8 @@ static void mtd_partition_split(struct m
+ 		return;
+ 
+ 	if (!strcmp(part->mtd.name, "rootfs")) {
+-		run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS);
++		if (!no_rootfs_split_flag)
++			run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS);
+ 
+ 		rootfs_found = 1;
+ 	}
+@@ -1092,3 +1100,22 @@ uint64_t mtd_get_device_size(const struc
+ 	return PART(mtd)->master->size;
+ }
+ EXPORT_SYMBOL_GPL(mtd_get_device_size);
++
++
++static int __init no_fw_split(char *str)
++{
++	no_fw_split_flag = 1;
++
++	return 0;
++}
++
++early_param("nofwsplit", no_fw_split);
++
++static int __init no_rootfs_split(char *str)
++{
++	no_rootfs_split_flag = 1;
++
++	return 0;
++}
++
++early_param("norootfssplit", no_rootfs_split);
-- 
2.11.0




More information about the Lede-dev mailing list