Skip to content

Commit

Permalink
kernel: mtdsplit_minor: accept bootimage filename
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
john-tho committed Oct 29, 2024
1 parent d12a9ba commit 73f3af3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_minor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
Expand Down Expand Up @@ -87,7 +89,10 @@ 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;
}
Expand Down

0 comments on commit 73f3af3

Please sign in to comment.