[openwrt/openwrt] kernel: mtdsplit_minor: accept bootimage filename

LEDE Commits lede-commits at lists.infradead.org
Wed Oct 30 03:15:39 PDT 2024


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/36834ea3403d05b6beab3a2efc3f00f097e58c81

commit 36834ea3403d05b6beab3a2efc3f00f097e58c81
Author: John Thomson <git at johnthomson.fastmail.com.au>
AuthorDate: Wed Oct 16 12:51:22 2024 +1000

    kernel: mtdsplit_minor: accept bootimage filename
    
    RouterBOOT v7 on NOR devices no longer accepts the YAFFS kernel ELF
    method of booting. It will accept an NPK image named bootimage.
    Adjust mtdsplit_minor to accept this second possible boot file name.
    Use the conservative value of 127 for YAFFS max name length (used when
    YAFFS compiled with unicode support) vs 255.
    
    Signed-off-by: John Thomson <git at johnthomson.fastmail.com.au>
    Acked-by: Thibaut VARENE <hacks at slashdirt.org>
    Link: https://github.com/openwrt/openwrt/pull/16780
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_minor.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_minor.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_minor.c
index be69de5798..053cba6272 100644
--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_minor.c
+++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_minor.c
@@ -34,7 +34,9 @@
 #define YAFFS_OBJECT_TYPE_FILE	0x1
 #define YAFFS_OBJECTID_ROOT	0x1
 #define YAFFS_SUM_UNUSED	0xFFFF
-#define YAFFS_NAME		"kernel"
+#define YAFFS_MAX_NAME_LENGTH	127
+#define YAFFS_NAME_KERNEL	"kernel"
+#define YAFFS_NAME_BOOTIMAGE	"bootimage"
 
 #define MINOR_NR_PARTS		2
 
@@ -46,7 +48,7 @@ struct minor_header {
 	int yaffs_type;
 	int yaffs_obj_id;
 	u16 yaffs_sum_unused;
-	char yaffs_name[sizeof(YAFFS_NAME)];
+	char yaffs_name[YAFFS_MAX_NAME_LENGTH];
 };
 
 static int mtdsplit_parse_minor(struct mtd_info *master,
@@ -87,7 +89,8 @@ static int mtdsplit_parse_minor(struct mtd_info *master,
 		return 0;
 	}
 
-	if (memcmp(hdr.yaffs_name, YAFFS_NAME, sizeof(YAFFS_NAME))) {
+	if ((memcmp(hdr.yaffs_name, YAFFS_NAME_KERNEL, sizeof(YAFFS_NAME_KERNEL))) &&
+	    (memcmp(hdr.yaffs_name, YAFFS_NAME_BOOTIMAGE, sizeof(YAFFS_NAME_BOOTIMAGE)))) {
 		pr_info("MiNOR YAFFS first name not matched\n");
 		return 0;
 	}




More information about the lede-commits mailing list